diff --git a/test/examples/examples.jl b/test/examples/examples.jl index c18f2ae0b..7376b516f 100644 --- a/test/examples/examples.jl +++ b/test/examples/examples.jl @@ -2,117 +2,117 @@ # but without checking the correctness of the solution. @testset verbose=true "Examples" begin @testset verbose=true "Fluid" begin - # @trixi_testset "fluid/hydrostatic_water_column_2d.jl" begin - # hydrostatic_water_column_tests = Dict( - # "default" => (), - # "with source term damping" => (source_terms=SourceTermDamping(damping_coefficient=1e-4),), - # "with SummationDensity" => (fluid_density_calculator=SummationDensity(), - # clip_negative_pressure=true), - # "with ViscosityAdami" => ( - # # from 0.02*10.0*1.2*0.05/8 - # viscosity=ViscosityAdami(nu=0.0015),), - # "with ViscosityMorris" => ( - # # from 0.02*10.0*1.2*0.05/8 - # viscosity=ViscosityMorris(nu=0.0015),), - # "with ViscosityAdami and SummationDensity" => ( - # # from 0.02*10.0*1.2*0.05/8 - # viscosity=ViscosityAdami(nu=0.0015), - # fluid_density_calculator=SummationDensity(), - # clip_negative_pressure=true), - # "with ViscosityMorris and SummationDensity" => ( - # # from 0.02*10.0*1.2*0.05/8 - # viscosity=ViscosityMorris(nu=0.0015), - # fluid_density_calculator=SummationDensity(), - # clip_negative_pressure=true), - # "with smoothing_length=1.3" => (smoothing_length=1.3,), - # "with SchoenbergQuarticSplineKernel" => (smoothing_length=1.1, - # smoothing_kernel=SchoenbergQuarticSplineKernel{2}()), - # "with SchoenbergQuinticSplineKernel" => (smoothing_length=1.1, - # smoothing_kernel=SchoenbergQuinticSplineKernel{2}()), - # "with WendlandC2Kernel" => (smoothing_length=3.0, - # smoothing_kernel=WendlandC2Kernel{2}()), - # "with WendlandC4Kernel" => (smoothing_length=3.5, - # smoothing_kernel=WendlandC4Kernel{2}()), - # "with WendlandC6Kernel" => (smoothing_length=4.0, - # smoothing_kernel=WendlandC6Kernel{2}()), - # ) - - # for (test_description, kwargs) in hydrostatic_water_column_tests - # @testset "$test_description" begin - # println("═"^100) - # println("$test_description") - - # @test_nowarn_mod trixi_include(@__MODULE__, - # joinpath(examples_dir(), "fluid", - # "hydrostatic_water_column_2d.jl"); - # kwargs...) - - # @test sol.retcode == ReturnCode.Success - # @test count_rhs_allocations(sol, semi) == 0 - # end - # end - # end - - # @trixi_testset "fluid/hydrostatic_water_column_2d.jl with EDAC" begin - # # import variables into scope - # trixi_include(@__MODULE__, - # joinpath(examples_dir(), "fluid", - # "hydrostatic_water_column_2d.jl"), - # fluid_system=nothing, sol=nothing, semi=nothing, ode=nothing) - - # viscosity = ViscosityAdami(nu=alpha * smoothing_length * sound_speed / 8) - # fluid_system = EntropicallyDampedSPHSystem(tank.fluid, smoothing_kernel, - # smoothing_length, sound_speed, - # viscosity=viscosity, - # density_calculator=ContinuityDensity(), - # acceleration=(0.0, -gravity)) - - # @test_nowarn_mod trixi_include(@__MODULE__, - # joinpath(examples_dir(), "fluid", - # "hydrostatic_water_column_2d.jl"); - # fluid_system=fluid_system) - - # @test sol.retcode == ReturnCode.Success - # @test count_rhs_allocations(sol, semi) == 0 - # end - - # @trixi_testset "fluid/oscillating_drop_2d.jl" begin - # @test_nowarn_mod trixi_include(@__MODULE__, - # joinpath(examples_dir(), "fluid", - # "oscillating_drop_2d.jl")) - # @test sol.retcode == ReturnCode.Success - # # This error varies between serial and multithreaded runs - # @test isapprox(error_A, 0.0, atol=1.73e-4) - # @test count_rhs_allocations(sol, semi) == 0 - # end - - # @trixi_testset "fluid/hydrostatic_water_column_3d.jl" begin - # @test_nowarn_mod trixi_include(@__MODULE__, - # joinpath(examples_dir(), "fluid", - # "hydrostatic_water_column_3d.jl"), - # tspan=(0.0, 0.1)) - # @test sol.retcode == ReturnCode.Success - # @test count_rhs_allocations(sol, semi) == 0 - # end - - # @trixi_testset "fluid/hydrostatic_water_column_3d.jl with SummationDensity" begin - # @test_nowarn_mod trixi_include(@__MODULE__, - # joinpath(examples_dir(), "fluid", - # "hydrostatic_water_column_3d.jl"), - # tspan=(0.0, 0.1), - # fluid_density_calculator=SummationDensity(), - # clip_negative_pressure=true) - # @test sol.retcode == ReturnCode.Success - # @test count_rhs_allocations(sol, semi) == 0 - # end - - # @trixi_testset "fluid/accelerated_tank_2d.jl" begin - # @test_nowarn_mod trixi_include(@__MODULE__, tspan=(0.0, 0.5), - # joinpath(examples_dir(), "fluid", - # "accelerated_tank_2d.jl")) - # @test sol.retcode == ReturnCode.Success - # @test count_rhs_allocations(sol, semi) == 0 - # end + @trixi_testset "fluid/hydrostatic_water_column_2d.jl" begin + hydrostatic_water_column_tests = Dict( + "default" => (), + "with source term damping" => (source_terms=SourceTermDamping(damping_coefficient=1e-4),), + "with SummationDensity" => (fluid_density_calculator=SummationDensity(), + clip_negative_pressure=true), + "with ViscosityAdami" => ( + # from 0.02*10.0*1.2*0.05/8 + viscosity=ViscosityAdami(nu=0.0015),), + "with ViscosityMorris" => ( + # from 0.02*10.0*1.2*0.05/8 + viscosity=ViscosityMorris(nu=0.0015),), + "with ViscosityAdami and SummationDensity" => ( + # from 0.02*10.0*1.2*0.05/8 + viscosity=ViscosityAdami(nu=0.0015), + fluid_density_calculator=SummationDensity(), + clip_negative_pressure=true), + "with ViscosityMorris and SummationDensity" => ( + # from 0.02*10.0*1.2*0.05/8 + viscosity=ViscosityMorris(nu=0.0015), + fluid_density_calculator=SummationDensity(), + clip_negative_pressure=true), + "with smoothing_length=1.3" => (smoothing_length=1.3,), + "with SchoenbergQuarticSplineKernel" => (smoothing_length=1.1, + smoothing_kernel=SchoenbergQuarticSplineKernel{2}()), + "with SchoenbergQuinticSplineKernel" => (smoothing_length=1.1, + smoothing_kernel=SchoenbergQuinticSplineKernel{2}()), + "with WendlandC2Kernel" => (smoothing_length=3.0, + smoothing_kernel=WendlandC2Kernel{2}()), + "with WendlandC4Kernel" => (smoothing_length=3.5, + smoothing_kernel=WendlandC4Kernel{2}()), + "with WendlandC6Kernel" => (smoothing_length=4.0, + smoothing_kernel=WendlandC6Kernel{2}()), + ) + + for (test_description, kwargs) in hydrostatic_water_column_tests + @testset "$test_description" begin + println("═"^100) + println("$test_description") + + @test_nowarn_mod trixi_include(@__MODULE__, + joinpath(examples_dir(), "fluid", + "hydrostatic_water_column_2d.jl"); + kwargs...) + + @test sol.retcode == ReturnCode.Success + @test count_rhs_allocations(sol, semi) == 0 + end + end + end + + @trixi_testset "fluid/hydrostatic_water_column_2d.jl with EDAC" begin + # import variables into scope + trixi_include(@__MODULE__, + joinpath(examples_dir(), "fluid", + "hydrostatic_water_column_2d.jl"), + fluid_system=nothing, sol=nothing, semi=nothing, ode=nothing) + + viscosity = ViscosityAdami(nu=alpha * smoothing_length * sound_speed / 8) + fluid_system = EntropicallyDampedSPHSystem(tank.fluid, smoothing_kernel, + smoothing_length, sound_speed, + viscosity=viscosity, + density_calculator=ContinuityDensity(), + acceleration=(0.0, -gravity)) + + @test_nowarn_mod trixi_include(@__MODULE__, + joinpath(examples_dir(), "fluid", + "hydrostatic_water_column_2d.jl"); + fluid_system=fluid_system) + + @test sol.retcode == ReturnCode.Success + @test count_rhs_allocations(sol, semi) == 0 + end + + @trixi_testset "fluid/oscillating_drop_2d.jl" begin + @test_nowarn_mod trixi_include(@__MODULE__, + joinpath(examples_dir(), "fluid", + "oscillating_drop_2d.jl")) + @test sol.retcode == ReturnCode.Success + # This error varies between serial and multithreaded runs + @test isapprox(error_A, 0.0, atol=1.73e-4) + @test count_rhs_allocations(sol, semi) == 0 + end + + @trixi_testset "fluid/hydrostatic_water_column_3d.jl" begin + @test_nowarn_mod trixi_include(@__MODULE__, + joinpath(examples_dir(), "fluid", + "hydrostatic_water_column_3d.jl"), + tspan=(0.0, 0.1)) + @test sol.retcode == ReturnCode.Success + @test count_rhs_allocations(sol, semi) == 0 + end + + @trixi_testset "fluid/hydrostatic_water_column_3d.jl with SummationDensity" begin + @test_nowarn_mod trixi_include(@__MODULE__, + joinpath(examples_dir(), "fluid", + "hydrostatic_water_column_3d.jl"), + tspan=(0.0, 0.1), + fluid_density_calculator=SummationDensity(), + clip_negative_pressure=true) + @test sol.retcode == ReturnCode.Success + @test count_rhs_allocations(sol, semi) == 0 + end + + @trixi_testset "fluid/accelerated_tank_2d.jl" begin + @test_nowarn_mod trixi_include(@__MODULE__, tspan=(0.0, 0.5), + joinpath(examples_dir(), "fluid", + "accelerated_tank_2d.jl")) + @test sol.retcode == ReturnCode.Success + @test count_rhs_allocations(sol, semi) == 0 + end @trixi_testset "fluid/dam_break_2d.jl" begin dam_break_tests = Dict( @@ -120,7 +120,7 @@ "with SummationDensity" => (fluid_density_calculator=SummationDensity(), clip_negative_pressure=true), "with DensityDiffusionMolteniColagrossi" => (density_diffusion=DensityDiffusionMolteniColagrossi(delta=0.1),), - "no denisty diffusion" => (density_diffusion=nothing,), + "no density diffusion" => (density_diffusion=nothing,), "with KernelAbstractions" => (data_type=Array,), )