-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
75 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,7 @@ Manifest.toml | |
*.json | ||
*.out | ||
*.sbatch | ||
*.png | ||
!**/Reference/*.e* | ||
LocalPreferences.toml | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# SPDX-FileCopyrightText: 2023 Christian Willberg <[email protected]>, Jan-Timo Hesse <[email protected]> | ||
# | ||
# SPDX-License-Identifier: BSD-3-Clause | ||
|
||
using Exodus | ||
using Plots, Polynomials | ||
using CSV, DataFrame | ||
|
||
function main() | ||
if length(ARGS) < 1 | ||
println("Usage: julia script.jl <filename>") | ||
return | ||
end | ||
|
||
# Extract filename from command-line arguments | ||
file_name = ARGS[1] | ||
|
||
exo = ExodusDatabase(file_name, "r") | ||
|
||
coords = read_coordinates(exo) | ||
times = read_times(exo) | ||
damage = read_values(exo, NodalVariable, length(times), "Damage") | ||
|
||
# Find indices of damaged coordinates | ||
damaged_indices = findall(x -> x > 0.2, damage) | ||
|
||
# Extract damaged coordinates | ||
damaged_coords = coords[:, damaged_indices] | ||
|
||
# Extract x and y values | ||
x_values = damaged_coords[1, :] | ||
y_values = damaged_coords[2, :] | ||
|
||
f1 = fit(x_values, y_values, 2; weights=damage[damaged_indices]) | ||
f2 = fit(x_values, y_values, 4; weights=damage[damaged_indices]) | ||
f3 = fit(x_values, y_values, 8; weights=damage[damaged_indices]) | ||
f4 = fit(x_values, y_values, 12; weights=damage[damaged_indices]) | ||
|
||
scatter(x_values, y_values, zcolor=damage[damaged_indices], label="Damage") | ||
|
||
plot!(f1, extrema(x_values)..., label="2") | ||
plot!(f2, extrema(x_values)..., label="4") | ||
plot!(f3, extrema(x_values)..., label="8") | ||
plot!(f4, extrema(x_values)..., label="12") | ||
savefig("plot.png") | ||
|
||
# Create a DataFrame to store the information | ||
range = vcat(minimum(x_values):1:maximum(x_values)) | ||
df = DataFrame( | ||
x=range, | ||
f1=f1.(range), | ||
) | ||
CSV.write("plot.csv", df) | ||
end | ||
|
||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# SPDX-FileCopyrightText: 2023 Christian Willberg <[email protected]>, Jan-Timo Hesse <[email protected]> | ||
# | ||
# SPDX-License-Identifier: BSD-3-Clause | ||
|
||
using Exodus | ||
|
||
function main() | ||
if length(ARGS) < 1 | ||
println("Usage: julia script.jl <filename>") | ||
return | ||
end | ||
|
||
file_name = ARGS[1] | ||
|
||
epu(file_name) | ||
end | ||
|
||
main() |