-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add interpolation * basic working * support periodic * allow to define different smoothing_length * more precisely identify system regions * to improve accuracy calc shepard * add support for multiple points * add line interpolation * add doc * format * add test * small change to doc * revert accidental change * fix * another fix * format * format * also interpolate pressure and velocity * lower tolerance * add example plot * missing dependency * format * add func * add doc * add test * add another test * comment out example * remove pyplot again * fix * format * small update improve accuracy * update * up * fix * format * add JSON library * postprocess_callback * add rect_3d example * fix * format * impl * fixes * fix setting the interval * impl other functions * fix plots * fix plots.jl plot * cleanup * fix tests * cleanup * cleanup * fix docs * fix doc * remove unused func * remove unused code * fix * write missing values * replace incorrect nomenclature * calc von mises stress * rm comment * format * change docs to F * add test * format * fix merge * move files * include exclude bnd * add version info to meta data * fix * add filename and overwrite * write initial values * format * add helper function to obtain latest file * improve func * format * fix plots * rename * add doc * add exports * cleanup * cleanup * format * working example * add plot * also save the cauchy stress components * format * fix dt * fix * fix * fix viscosity * working 3d example for plane interpolation * add 2d plot as well for 3d case * add docs * fix tests * fix * fix plot * fix comments * fix comment * update * format * add Plots * fix * adjust plot * reduce time * add reference * add better digitized curves and error calc * performance optimization and some slight adjustment to improve error * format * update * format * add reference files * add CSV * add csv output * format * up * fixes * update * fix paths * fixes * review * review * change git * change type * remove mutable * add new example * change to plots.jl * increase the resolution * include into CI * move condition * add more output to summary box * update * remove DataEntry * update file structure * fix setup * fix plot * update * fix * update * format * review update * fix test * nvalue->n_values * fix * fixfix * add check for anonymous functions * fix test * remove unused 'using' * add simple test * fix using statements * ignore * format * fix ignore string * fix json reading in example * update * update based on review comments * format * change funcs to keyword args * fix docs * format * review comments * format * fix tests * fix test * format * review * format * fix plot * fix test * remove include * fix test * rm * move * add reference curves * fix plot * fix * add files * update * cleanup * format * update * cleanup plot * simplify plot * switch to makie * implement check * format * update to new reference * update * format * rename * remove the dependencies * remove dependencies * add 5 resolution back * format * use include * format * renaming * fix readme * fix test [skip ci] * [skip ci] remove save for compare * [skip ci] add tspan back * review comments * small fixes [skip ci] * update [skip ci] * rename [skip ci] * update [skip ci] * fix * exchange interpolation function * rename * exchange common time range find code * update reference file * update [skip ci] * format [skip ci] * update --------- Co-authored-by: Erik Faulhaber <[email protected]>
- Loading branch information
1 parent
f205ea4
commit 60d4d67
Showing
18 changed files
with
18,376 additions
and
43 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
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
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
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
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
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
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
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
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
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,9 @@ | ||
The following files are provided here: | ||
|
||
1) Validation simulation: validation_oscillating_beam_2d.jl | ||
2) Comparison with reference: compare_reference_oscillating_beam_results.jl | ||
3) Comparison with TrixiParticles.jl and literature reference: plot_oscillating_beam_results.jl | ||
4) TrixiParticles.jl reference files: validation_reference_[5, 9, 21, 35].j (5 is the default CI resolution, note that resolution 21 takes about 30-50 minutes while 35 takes about 4-6 hours) | ||
5) Reference file reference_turek.csv extracted from the file csm3_l4_t0p005.point here: | ||
https://wwwold.mathematik.tu-dortmund.de/~featflow/en/benchmarks/cfdbenchmarking/fsi_benchmark/fsi_tests/fsi_csm_tests.html | ||
|
80 changes: 80 additions & 0 deletions
80
validation/oscillating_beam_2d/plot_oscillating_beam_results.jl
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,80 @@ | ||
include("../validation_util.jl") | ||
|
||
# Activate for interactive plot | ||
# using GLMakie | ||
using CairoMakie | ||
using CSV | ||
using DataFrames | ||
using JSON | ||
using Glob | ||
using Printf | ||
using TrixiParticles | ||
|
||
elastic_plate = (length=0.35, thickness=0.02) | ||
|
||
# Load the reference simulation data | ||
ref = CSV.read(joinpath(validation_dir(), "oscillating_beam_2d/reference_turek.csv"), | ||
DataFrame) | ||
|
||
# Get the list of JSON files | ||
reference_files = glob("validation_reference_*.json", | ||
joinpath(validation_dir(), "oscillating_beam_2d")) | ||
simulation_files = glob("validation_run_oscillating_beam_2d_*.json", | ||
joinpath(pkgdir(TrixiParticles), "out")) | ||
merged_files = vcat(reference_files, simulation_files) | ||
input_files = sort(merged_files, by=extract_number) | ||
|
||
# Regular expressions for matching keys | ||
key_pattern_x = r"deflection_x_solid_\d+" | ||
key_pattern_y = r"deflection_y_solid_\d+" | ||
|
||
# Setup for Makie plotting | ||
fig = Figure(size=(1200, 800)) | ||
ax1 = Axis(fig, title="X-Axis Displacement", xlabel="Time [s]", ylabel="X Displacement") | ||
ax2 = Axis(fig, title="Y-Axis Displacement", xlabel="Time [s]", ylabel="Y Displacement") | ||
fig[1, 1] = ax1 | ||
fig[2, 1] = ax2 | ||
|
||
for file_name in input_files | ||
println("Loading the input file: $file_name") | ||
json_data = JSON.parsefile(file_name) | ||
|
||
resolution = parse(Int, split(split(file_name, "_")[end], ".")[1]) | ||
particle_spacing = elastic_plate.thickness / (resolution - 1) | ||
|
||
matching_keys_x = sort(collect(filter(key -> occursin(key_pattern_x, key), | ||
keys(json_data)))) | ||
matching_keys_y = sort(collect(filter(key -> occursin(key_pattern_y, key), | ||
keys(json_data)))) | ||
|
||
if isempty(matching_keys_x) | ||
error("No matching keys found in: $file_name") | ||
end | ||
|
||
label_prefix = occursin("reference", file_name) ? "Reference" : "" | ||
|
||
for (matching_keys, ax) in ((matching_keys_x, ax1), (matching_keys_y, ax2)) | ||
for key in matching_keys | ||
data = json_data[key] | ||
times = Float64.(data["time"]) | ||
displacements = Float64.(data["values"]) | ||
|
||
mse_results = occursin(key_pattern_x, key) ? | ||
interpolated_mse(ref.time, ref.Ux, data["time"], displacements) : | ||
interpolated_mse(ref.time, ref.Uy, data["time"], displacements) | ||
|
||
label = "$label_prefix dp = $(@sprintf("%.8f", particle_spacing)) mse=$(@sprintf("%.8f", mse_results))" | ||
lines!(ax, times, displacements, label=label) | ||
end | ||
end | ||
end | ||
|
||
# Plot reference data | ||
lines!(ax1, ref.time, ref.Ux, color=:black, linestyle=:dash, | ||
label="Turek and Hron 2006") | ||
lines!(ax2, ref.time, ref.Uy, color=:black, linestyle=:dash, | ||
label="Turek and Hron 2006") | ||
|
||
legend_ax1 = Legend(fig[1, 2], ax1) | ||
legend_ax2 = Legend(fig[2, 2], ax2) | ||
fig |
Oops, something went wrong.