From bb5bceb2cbc8f90b61e5c0653b0d4ea1995e0415 Mon Sep 17 00:00:00 2001 From: bennibolm Date: Tue, 15 Oct 2024 14:00:44 +0200 Subject: [PATCH] Fix parameter in `x_trans_periodic_3d` --- examples/t8code_2d_fv/elixir_advection_gauss.jl | 4 ++-- examples/t8code_2d_fv/elixir_advection_nonperiodic.jl | 2 +- examples/t8code_3d_fv/elixir_advection_gauss.jl | 4 +++- src/equations/linear_scalar_advection_3d.jl | 2 +- test/test_t8code_fv_3d.jl | 8 ++++---- 5 files changed, 11 insertions(+), 9 deletions(-) diff --git a/examples/t8code_2d_fv/elixir_advection_gauss.jl b/examples/t8code_2d_fv/elixir_advection_gauss.jl index 177fce928c6..d4394451df6 100644 --- a/examples/t8code_2d_fv/elixir_advection_gauss.jl +++ b/examples/t8code_2d_fv/elixir_advection_gauss.jl @@ -11,9 +11,9 @@ initial_condition = initial_condition_gauss solver = FV(order = 2, surface_flux = flux_lax_friedrichs) initial_refinement_level = 4 +# Note: The initial_condition is set up for a domain [-5,5]^2. +# This becomes important when using a non-periodic mesh. cmesh = Trixi.cmesh_new_periodic_hybrid() -# Note: A non-periodic run with the tri mesh is unstable. Same as in `elixir_advection_nonperiodic.jl` -# cmesh = Trixi.cmesh_new_tri(periodicity = (false, false)) mesh = T8codeMesh(cmesh, solver, initial_refinement_level = initial_refinement_level) diff --git a/examples/t8code_2d_fv/elixir_advection_nonperiodic.jl b/examples/t8code_2d_fv/elixir_advection_nonperiodic.jl index 7e956fe1754..fbe7940617d 100644 --- a/examples/t8code_2d_fv/elixir_advection_nonperiodic.jl +++ b/examples/t8code_2d_fv/elixir_advection_nonperiodic.jl @@ -23,7 +23,7 @@ solver = FV(order = 2, surface_flux = flux_lax_friedrichs) initial_refinement_level = 5 cmesh = Trixi.cmesh_new_quad(periodicity = (false, false)) -# **Note**: A non-periodic run with the tri mesh is unstable. (Same happens for a non-periodic run with `elixir_advection_gauss.jl`) +# **Note**: A non-periodic run with the tri mesh is unstable. # - This only happens with **2nd order** # - When increasing refinement_level to 6 and lower CFL to 0.4, it seems like the simulation is stable again (except of some smaller noises at the corners) # - With a lower resolution (5) I cannot get the simulation stable. Even with a cfl of 0.01 etc. diff --git a/examples/t8code_3d_fv/elixir_advection_gauss.jl b/examples/t8code_3d_fv/elixir_advection_gauss.jl index 1f9c051f63d..71e6d82eca6 100644 --- a/examples/t8code_3d_fv/elixir_advection_gauss.jl +++ b/examples/t8code_3d_fv/elixir_advection_gauss.jl @@ -13,7 +13,9 @@ solver = FV(order = 2, surface_flux = flux_lax_friedrichs) initial_refinement_level = 4 # TODO: There are no other cmesh functions implemented yet in 3d. -cmesh = Trixi.cmesh_new_quad_3d(periodicity = (true, true, true)) +cmesh = Trixi.cmesh_new_quad_3d(coordinates_min = (-5.0, -5.0, -5.0), + coordinates_max = (5.0, 5.0, 5.0), + periodicity = (true, true, true)) mesh = T8codeMesh(cmesh, solver, initial_refinement_level = initial_refinement_level) semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) diff --git a/src/equations/linear_scalar_advection_3d.jl b/src/equations/linear_scalar_advection_3d.jl index 006179c1fc9..9c68ce6cd47 100644 --- a/src/equations/linear_scalar_advection_3d.jl +++ b/src/equations/linear_scalar_advection_3d.jl @@ -65,7 +65,7 @@ function initial_condition_convergence_test(x, t, end # Calculates translated coordinates `x` for a periodic domain -function x_trans_periodic_3d(x, domain_length = SVector(2, 2, 2), +function x_trans_periodic_3d(x, domain_length = SVector(10, 10, 10), center = SVector(0, 0, 0)) x_normalized = x .- center x_shifted = x_normalized .% domain_length diff --git a/test/test_t8code_fv_3d.jl b/test/test_t8code_fv_3d.jl index e2e1225abde..b29c09c99b7 100644 --- a/test/test_t8code_fv_3d.jl +++ b/test/test_t8code_fv_3d.jl @@ -97,8 +97,8 @@ end @test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_advection_gauss.jl"), order=1, - l2=[0.1515258539168874], - linf=[0.43164936150417055]) + l2=[0.03422041780251932], + linf=[0.7655163504661142]) # Ensure that we do not have excessive memory allocations # (e.g., from type instabilities) let @@ -111,8 +111,8 @@ end @trixi_testset "second-order FV" begin @test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_advection_gauss.jl"), - l2=[0.04076672839289378], - linf=[0.122537463101035582]) + l2=[0.02129708543319383], + linf=[0.5679262915623222]) # Ensure that we do not have excessive memory allocations # (e.g., from type instabilities) let