From d3531245df2e3f715359bf5a2a0c86b92c7acae8 Mon Sep 17 00:00:00 2001 From: marcelschurer Date: Mon, 9 Dec 2024 13:51:46 +0100 Subject: [PATCH 1/6] tesset begin --- examples/fluid/hydrostatic_water_column_3d.jl | 6 +---- test/preprocessing/preprocessing.jl | 1 + test/preprocessing/readvtk/vtk2trixi.jl | 25 +++++++++++++++++++ 3 files changed, 27 insertions(+), 5 deletions(-) create mode 100644 test/preprocessing/readvtk/vtk2trixi.jl diff --git a/examples/fluid/hydrostatic_water_column_3d.jl b/examples/fluid/hydrostatic_water_column_3d.jl index 7168b0557..7fddfebc5 100644 --- a/examples/fluid/hydrostatic_water_column_3d.jl +++ b/examples/fluid/hydrostatic_water_column_3d.jl @@ -2,8 +2,4 @@ using TrixiParticles trixi_include(@__MODULE__, joinpath(examples_dir(), "fluid", "hydrostatic_water_column_2d.jl"), - fluid_particle_spacing=0.05, initial_fluid_size=(1.0, 1.0, 0.9), - tank_size=(1.0, 1.0, 1.2), acceleration=(0.0, 0.0, -9.81), - smoothing_kernel=SchoenbergCubicSplineKernel{3}(), tspan=(0.0, 1.0), - maxiters=10^5, fluid_density_calculator=ContinuityDensity(), - clip_negative_pressure=false) + tspan=(0.0, 0.1)) diff --git a/test/preprocessing/preprocessing.jl b/test/preprocessing/preprocessing.jl index d2a994f93..223044b74 100644 --- a/test/preprocessing/preprocessing.jl +++ b/test/preprocessing/preprocessing.jl @@ -1 +1,2 @@ include("geometries/geometries.jl") +include("readvtk/readvtk.jl") diff --git a/test/preprocessing/readvtk/vtk2trixi.jl b/test/preprocessing/readvtk/vtk2trixi.jl new file mode 100644 index 000000000..9b1919e08 --- /dev/null +++ b/test/preprocessing/readvtk/vtk2trixi.jl @@ -0,0 +1,25 @@ +@testset verbose=true "vtk2trixi" begin + @testset verbose=true "Basic Functionality - Inital File" begin + min_coordinates = [(0, 0), (0, 0, 0)] + n_particles_per_dimension = [(10, 20), (10, 20, 30)] + velocity = [(1.0, 2.0), (1.0, 2.0, 3.0)] + + for i in 1:2 # 2d and 3d case + saved_ic = RectangularShape(0.1, n_particles_per_dimension[i], + min_coordinates[i], density=1.5, + velocity=velocity[i], pressure=1000.0) + filename = "is_write_out" + file = trixi2vtk(saved_ic; filename=filename) + + loaded_ic = vtk2trixi(joinpath("out", filename * ".vtu")) + + @test saved_ic.coordinates == loaded_ic.coordinates + @test saved_ic.velocity == loaded_ic.velocity + @test saved_ic.density == loaded_ic.density + @test saved_ic.pressure == loaded_ic.pressure + #@test saved_ic.mass == loaded_ic.mass + end + end + + @testset verbose=true "Basic Functionality - Simulation File" begin end +end \ No newline at end of file From 61e88fe67fdaed3d46f79e7bbb84f88db6903ca9 Mon Sep 17 00:00:00 2001 From: Marcel Schurer <153067321+marcelschurer@users.noreply.github.com> Date: Mon, 16 Dec 2024 11:03:51 +0100 Subject: [PATCH 2/6] Update hydrostatic_water_column_3d.jl --- examples/fluid/hydrostatic_water_column_3d.jl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/examples/fluid/hydrostatic_water_column_3d.jl b/examples/fluid/hydrostatic_water_column_3d.jl index 7fddfebc5..de918b563 100644 --- a/examples/fluid/hydrostatic_water_column_3d.jl +++ b/examples/fluid/hydrostatic_water_column_3d.jl @@ -1,5 +1,9 @@ using TrixiParticles trixi_include(@__MODULE__, - joinpath(examples_dir(), "fluid", "hydrostatic_water_column_2d.jl"), + joinpath(examples_dir(), "fluid", "hydrostatic_water_column_2d.jl"), fluid_particle_spacing=0.05, initial_fluid_size=(1.0, 1.0, 0.9), + tank_size=(1.0, 1.0, 1.2), acceleration=(0.0, 0.0, -9.81), + smoothing_kernel=SchoenbergCubicSplineKernel{3}(), tspan=(0.0, 1.0), + maxiters=10^5, fluid_density_calculator=ContinuityDensity(), + clip_negative_pressure=false) tspan=(0.0, 0.1)) From e1a59725d7b262a98d2c87107a5a4d9396b7312c Mon Sep 17 00:00:00 2001 From: marcelschurer Date: Mon, 16 Dec 2024 11:05:27 +0100 Subject: [PATCH 3/6] changes --- test/preprocessing/readvtk/vtk2trixi.jl | 44 ++++++++++++++----------- 1 file changed, 25 insertions(+), 19 deletions(-) diff --git a/test/preprocessing/readvtk/vtk2trixi.jl b/test/preprocessing/readvtk/vtk2trixi.jl index 9b1919e08..8552e2762 100644 --- a/test/preprocessing/readvtk/vtk2trixi.jl +++ b/test/preprocessing/readvtk/vtk2trixi.jl @@ -1,25 +1,31 @@ @testset verbose=true "vtk2trixi" begin - @testset verbose=true "Basic Functionality - Inital File" begin - min_coordinates = [(0, 0), (0, 0, 0)] - n_particles_per_dimension = [(10, 20), (10, 20, 30)] - velocity = [(1.0, 2.0), (1.0, 2.0, 3.0)] + @testset verbose=true "Functionality Check - 2D" begin - for i in 1:2 # 2d and 3d case - saved_ic = RectangularShape(0.1, n_particles_per_dimension[i], - min_coordinates[i], density=1.5, - velocity=velocity[i], pressure=1000.0) - filename = "is_write_out" - file = trixi2vtk(saved_ic; filename=filename) + # 'InitialCondition'-Files + saved_ic = RectangularShape(0.1, (10, 20), + (0, 0), density=1.5, + velocity=(1.0, 2.0), pressure=1000.0) + filename = "is_write_out" + file = trixi2vtk(saved_ic; filename=filename) - loaded_ic = vtk2trixi(joinpath("out", filename * ".vtu")) + loaded_ic = vtk2trixi(joinpath("out", filename * ".vtu")) - @test saved_ic.coordinates == loaded_ic.coordinates - @test saved_ic.velocity == loaded_ic.velocity - @test saved_ic.density == loaded_ic.density - @test saved_ic.pressure == loaded_ic.pressure - #@test saved_ic.mass == loaded_ic.mass - end - end + @test saved_ic.coordinates == loaded_ic.coordinates + @test saved_ic.velocity == loaded_ic.velocity + @test saved_ic.density == loaded_ic.density + @test saved_ic.pressure == loaded_ic.pressure + @test saved_ic.mass == loaded_ic.mass + + # 'Fluidsystem'-Files + state_equation = StateEquationCole(; sound_speed=1.0, reference_density=1.0, + exponent=1, clip_negative_pressure=false) + fluid_system = WeaklyCompressibleSPHSystem(saved_ic, + ContinuityDensity(), state_equation, + WendlandC2Kernel{2}(), 0.2) - @testset verbose=true "Basic Functionality - Simulation File" begin end + trixi2vtk(zeros(), zeros(), 0.0, fluid_system, nothing;) + # trixi2vtk(sol.u[end], semi, 0.0, iter=1, output_directory="output", + # prefix="solution") + + end end \ No newline at end of file From a51cf2ffad59faef70448c24fdafb40484f6a228 Mon Sep 17 00:00:00 2001 From: marcelschurer Date: Mon, 16 Dec 2024 11:07:54 +0100 Subject: [PATCH 4/6] repair --- examples/fluid/hydrostatic_water_column_3d.jl | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/examples/fluid/hydrostatic_water_column_3d.jl b/examples/fluid/hydrostatic_water_column_3d.jl index de918b563..d8b53494f 100644 --- a/examples/fluid/hydrostatic_water_column_3d.jl +++ b/examples/fluid/hydrostatic_water_column_3d.jl @@ -1,9 +1,10 @@ using TrixiParticles trixi_include(@__MODULE__, - joinpath(examples_dir(), "fluid", "hydrostatic_water_column_2d.jl"), fluid_particle_spacing=0.05, initial_fluid_size=(1.0, 1.0, 0.9), + joinpath(examples_dir(), "fluid", "hydrostatic_water_column_2d.jl"), + fluid_particle_spacing=0.05, initial_fluid_size=(1.0, 1.0, 0.9), tank_size=(1.0, 1.0, 1.2), acceleration=(0.0, 0.0, -9.81), smoothing_kernel=SchoenbergCubicSplineKernel{3}(), tspan=(0.0, 1.0), maxiters=10^5, fluid_density_calculator=ContinuityDensity(), - clip_negative_pressure=false) - tspan=(0.0, 0.1)) + clip_negative_pressure=false, + tspan=(0.0, 0.1)) \ No newline at end of file From 3ba15d8a0f9d9bb18fd8571eb65cfd7f4be9ceb8 Mon Sep 17 00:00:00 2001 From: marcelschurer Date: Mon, 16 Dec 2024 11:12:07 +0100 Subject: [PATCH 5/6] tests --- test/preprocessing/readvtk/vtk2trixi.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/preprocessing/readvtk/vtk2trixi.jl b/test/preprocessing/readvtk/vtk2trixi.jl index 8552e2762..7dc1d922b 100644 --- a/test/preprocessing/readvtk/vtk2trixi.jl +++ b/test/preprocessing/readvtk/vtk2trixi.jl @@ -2,7 +2,7 @@ @testset verbose=true "Functionality Check - 2D" begin # 'InitialCondition'-Files - saved_ic = RectangularShape(0.1, (10, 20), + saved_ic = RectangularShape(0.1, (2, 2), (0, 0), density=1.5, velocity=(1.0, 2.0), pressure=1000.0) filename = "is_write_out" @@ -23,7 +23,7 @@ ContinuityDensity(), state_equation, WendlandC2Kernel{2}(), 0.2) - trixi2vtk(zeros(), zeros(), 0.0, fluid_system, nothing;) + trixi2vtk(saved_ic.velocity, saved_ic.coordinates, 0.0, fluid_system, nothing;) # trixi2vtk(sol.u[end], semi, 0.0, iter=1, output_directory="output", # prefix="solution") From 85792cda77d0e83ef408f79f3391909e44cdcf59 Mon Sep 17 00:00:00 2001 From: marcelschurer Date: Mon, 16 Dec 2024 11:16:14 +0100 Subject: [PATCH 6/6] tests --- examples/fluid/hydrostatic_water_column_3d.jl | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/examples/fluid/hydrostatic_water_column_3d.jl b/examples/fluid/hydrostatic_water_column_3d.jl index d8b53494f..7168b0557 100644 --- a/examples/fluid/hydrostatic_water_column_3d.jl +++ b/examples/fluid/hydrostatic_water_column_3d.jl @@ -6,5 +6,4 @@ trixi_include(@__MODULE__, tank_size=(1.0, 1.0, 1.2), acceleration=(0.0, 0.0, -9.81), smoothing_kernel=SchoenbergCubicSplineKernel{3}(), tspan=(0.0, 1.0), maxiters=10^5, fluid_density_calculator=ContinuityDensity(), - clip_negative_pressure=false, - tspan=(0.0, 0.1)) \ No newline at end of file + clip_negative_pressure=false)