From b1ef499074cfdd6e28bdef8ae01ee409acc56c26 Mon Sep 17 00:00:00 2001 From: Hendrik Ranocha Date: Mon, 21 Jul 2025 13:36:16 +0200 Subject: [PATCH 01/19] update to Trixi.jl v0.13 --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index f0ff7495..6b684d05 100644 --- a/Project.toml +++ b/Project.toml @@ -33,5 +33,5 @@ Static = "0.8, 1" StaticArrayInterface = "1.5.1" StaticArrays = "1" StrideArrays = "0.1.28" -Trixi = "0.9.9, 0.10, 0.11, 0.12" +Trixi = "0.13" julia = "1.9" From 49d3180fdddde9ec29ff83c5172ea4ec7cf15cba Mon Sep 17 00:00:00 2001 From: Benedict <135045760+benegee@users.noreply.github.com> Date: Mon, 21 Jul 2025 16:52:40 +0200 Subject: [PATCH 02/19] Update Project.toml --- Project.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Project.toml b/Project.toml index 6b684d05..6544a6a8 100644 --- a/Project.toml +++ b/Project.toml @@ -20,7 +20,7 @@ StrideArrays = "d1fa6d79-ef01-42a6-86c9-f7c551f8593b" Trixi = "a7f1ee26-1774-49b1-8366-f1abc58fbfcb" [compat] -ForwardDiff = "0.10.36" +ForwardDiff = "0.10.36, 1" HDF5 = "0.16.10, 0.17" LinearAlgebra = "1" LoopVectorization = "0.12.118" @@ -33,5 +33,5 @@ Static = "0.8, 1" StaticArrayInterface = "1.5.1" StaticArrays = "1" StrideArrays = "0.1.28" -Trixi = "0.13" +Trixi = ""0.9.9, 0.10, 0.11, 0.12, 0.13" julia = "1.9" From 747f68fb4f67a77941d107ebf4077dc6a727bf25 Mon Sep 17 00:00:00 2001 From: Benedict <135045760+benegee@users.noreply.github.com> Date: Mon, 21 Jul 2025 16:52:58 +0200 Subject: [PATCH 03/19] Update Project.toml --- test/Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Project.toml b/test/Project.toml index 08efd123..4604ecce 100644 --- a/test/Project.toml +++ b/test/Project.toml @@ -15,5 +15,5 @@ OrdinaryDiffEq = "6.91" OrdinaryDiffEqLowStorageRK = "1.2" OrdinaryDiffEqSSPRK = "1.2" Test = "1" -Trixi = "0.9.9, 0.10, 0.11, 0.12" +Trixi = "0.9.9, 0.10, 0.11, 0.12, 0.13" TrixiTest = "0.1" From 97632b588b373934cb2207f3ed3f4bd886cc3ce4 Mon Sep 17 00:00:00 2001 From: Benedict <135045760+benegee@users.noreply.github.com> Date: Mon, 21 Jul 2025 16:53:51 +0200 Subject: [PATCH 04/19] Update Project.toml --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 6544a6a8..64093c37 100644 --- a/Project.toml +++ b/Project.toml @@ -33,5 +33,5 @@ Static = "0.8, 1" StaticArrayInterface = "1.5.1" StaticArrays = "1" StrideArrays = "0.1.28" -Trixi = ""0.9.9, 0.10, 0.11, 0.12, 0.13" +Trixi = "0.9.9, 0.10, 0.11, 0.12, 0.13" julia = "1.9" From dd1c9b5fd3d8289a18998258484fb32098eb6e26 Mon Sep 17 00:00:00 2001 From: Benedict Geihe Date: Mon, 21 Jul 2025 17:54:34 +0200 Subject: [PATCH 05/19] adapt to Trixi v0.12.7 performance_counter has to be given as additional argument in constructor --- ...retization_hyperbolic_2d_manifold_in_3d.jl | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/semidiscretization/semidiscretization_hyperbolic_2d_manifold_in_3d.jl b/src/semidiscretization/semidiscretization_hyperbolic_2d_manifold_in_3d.jl index 2a9a1bcb..885e5a3b 100644 --- a/src/semidiscretization/semidiscretization_hyperbolic_2d_manifold_in_3d.jl +++ b/src/semidiscretization/semidiscretization_hyperbolic_2d_manifold_in_3d.jl @@ -16,16 +16,19 @@ function Trixi.SemidiscretizationHyperbolic(mesh::P4estMesh{2}, # `RealT` is used as real type for node locations etc. # while `uEltype` is used as element type of solutions etc. RealT = real(solver), uEltype = RealT, - initial_cache = NamedTuple(), metric_terms = MetricTermsCrossProduct(), auxiliary_field = nothing) cache = (; Trixi.create_cache(mesh, equations, solver, RealT, metric_terms, - auxiliary_field, uEltype)..., initial_cache...) + auxiliary_field, uEltype)...) _boundary_conditions = Trixi.digest_boundary_conditions(boundary_conditions, mesh, solver, cache) + Trixi.check_periodicity_mesh_boundary_conditions(mesh, _boundary_conditions) + + performance_counter = Trixi.PerformanceCounter() + SemidiscretizationHyperbolic{typeof(mesh), typeof(equations), typeof(initial_condition), typeof(_boundary_conditions), typeof(source_terms), @@ -33,7 +36,8 @@ function Trixi.SemidiscretizationHyperbolic(mesh::P4estMesh{2}, initial_condition, _boundary_conditions, source_terms, solver, - cache) + cache, + performance_counter) end # Constructor for SemidiscretizationHyperbolic for the covariant form. Requires @@ -49,17 +53,20 @@ function Trixi.SemidiscretizationHyperbolic(mesh::P4estMesh{NDIMS, NDIMS_AMBIENT # `RealT` is used as real type for node locations etc. # while `uEltype` is used as element type of solutions etc. RealT = real(solver), uEltype = RealT, - initial_cache = NamedTuple(), metric_terms = MetricTermsCovariantSphere(), auxiliary_field = nothing) where {NDIMS, NDIMS_AMBIENT} cache = (; Trixi.create_cache(mesh, equations, solver, RealT, metric_terms, - auxiliary_field, uEltype)..., initial_cache...) + auxiliary_field, uEltype)...) _boundary_conditions = Trixi.digest_boundary_conditions(boundary_conditions, mesh, solver, cache) + Trixi.check_periodicity_mesh_boundary_conditions(mesh, _boundary_conditions) + + performance_counter = Trixi.PerformanceCounter() + SemidiscretizationHyperbolic{typeof(mesh), typeof(equations), typeof(initial_condition), typeof(_boundary_conditions), typeof(source_terms), @@ -67,5 +74,6 @@ function Trixi.SemidiscretizationHyperbolic(mesh::P4estMesh{NDIMS, NDIMS_AMBIENT initial_condition, _boundary_conditions, source_terms, solver, - cache) + cache, + performance_counter) end From 30597f9560eeb7b3d6c2051a2559e94ccd8390cc Mon Sep 17 00:00:00 2001 From: Benedict Geihe Date: Mon, 21 Jul 2025 22:37:22 +0200 Subject: [PATCH 06/19] add backend for compute_coefficients --- src/solvers/dgsem_p4est/dg_2d_manifold_in_3d_covariant.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/solvers/dgsem_p4est/dg_2d_manifold_in_3d_covariant.jl b/src/solvers/dgsem_p4est/dg_2d_manifold_in_3d_covariant.jl index 131840b7..f9b03b9c 100644 --- a/src/solvers/dgsem_p4est/dg_2d_manifold_in_3d_covariant.jl +++ b/src/solvers/dgsem_p4est/dg_2d_manifold_in_3d_covariant.jl @@ -66,7 +66,7 @@ function Trixi.rhs!(du, u, t, end # Compute coefficients for an initial condition that uses auxiliary variables -function Trixi.compute_coefficients!(u, func, t, mesh::P4estMesh{2}, +function Trixi.compute_coefficients!(backend::Nothing, u, func, t, mesh::P4estMesh{2}, equations::AbstractCovariantEquations{2}, dg::DG, cache) (; aux_node_vars) = cache.auxiliary_variables From 3a5cc9235c147a1de05de8340d38666e27f0fa4a Mon Sep 17 00:00:00 2001 From: Benedict Geihe Date: Mon, 21 Jul 2025 22:37:43 +0200 Subject: [PATCH 07/19] add opt-in for automatic search in external sources --- docs/make.jl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/make.jl b/docs/make.jl index 7800d66f..cfaf51f9 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -12,6 +12,9 @@ end links = InterLinks("Trixi" => ("https://trixi-framework.github.io/TrixiDocumentation/stable/", "https://trixi-framework.github.io/TrixiDocumentation/stable/objects.inv")) +# Search for any unresolvable `@ref` reference in external sources +fallbacks = ExternalFallbacks(; automatic=true) + # Define module-wide setups such that the respective modules are available in doctests DocMeta.setdocmeta!(TrixiAtmo, :DocTestSetup, :(using TrixiAtmo); recursive = true) @@ -95,7 +98,7 @@ makedocs(; "Contributing" => "contributing.md", "Code of Conduct" => "code_of_conduct.md", "License" => "license.md"], - plugins = [links],) + plugins = [links, fallbacks],) deploydocs(; repo = "github.com/trixi-framework/TrixiAtmo.jl", From f18239b17f3131826eee19f761a8ccff2de75e55 Mon Sep 17 00:00:00 2001 From: Benedict Geihe Date: Mon, 21 Jul 2025 22:46:13 +0200 Subject: [PATCH 08/19] fmt --- docs/make.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/make.jl b/docs/make.jl index cfaf51f9..93c1fc33 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -13,7 +13,7 @@ links = InterLinks("Trixi" => ("https://trixi-framework.github.io/TrixiDocumenta "https://trixi-framework.github.io/TrixiDocumentation/stable/objects.inv")) # Search for any unresolvable `@ref` reference in external sources -fallbacks = ExternalFallbacks(; automatic=true) +fallbacks = ExternalFallbacks(; automatic = true) # Define module-wide setups such that the respective modules are available in doctests DocMeta.setdocmeta!(TrixiAtmo, :DocTestSetup, :(using TrixiAtmo); From 72e5823522505e64f2536b85ba0bbd564032cbe7 Mon Sep 17 00:00:00 2001 From: Benedict Geihe Date: Mon, 21 Jul 2025 23:21:46 +0200 Subject: [PATCH 09/19] switch max_speed_native for max_speed --- src/equations/covariant_advection.jl | 6 +++--- src/equations/covariant_shallow_water.jl | 6 +++--- src/equations/shallow_water_3d.jl | 22 ++++++++++++++++++++++ 3 files changed, 28 insertions(+), 6 deletions(-) diff --git a/src/equations/covariant_advection.jl b/src/equations/covariant_advection.jl index c14fefb6..081b0135 100644 --- a/src/equations/covariant_advection.jl +++ b/src/equations/covariant_advection.jl @@ -110,9 +110,9 @@ end end # Maximum contravariant wave speed with respect to specific basis vector -@inline function Trixi.max_abs_speed_naive(u_ll, u_rr, aux_vars_ll, aux_vars_rr, - orientation::Integer, - equations::CovariantLinearAdvectionEquation2D) +@inline function Trixi.max_abs_speed(u_ll, u_rr, aux_vars_ll, aux_vars_rr, + orientation::Integer, + equations::CovariantLinearAdvectionEquation2D) vcon_ll = velocity_contravariant(u_ll, equations) # Contravariant components on left side vcon_rr = velocity_contravariant(u_rr, equations) # Contravariant components on right side return max(abs(vcon_ll[orientation]), abs(vcon_rr[orientation])) diff --git a/src/equations/covariant_shallow_water.jl b/src/equations/covariant_shallow_water.jl index c1a8daf2..beac8762 100644 --- a/src/equations/covariant_shallow_water.jl +++ b/src/equations/covariant_shallow_water.jl @@ -217,9 +217,9 @@ end end # Maximum wave speed along the normal direction in reference space -@inline function Trixi.max_abs_speed_naive(u_ll, u_rr, aux_vars_ll, aux_vars_rr, - orientation, - equations::AbstractCovariantShallowWaterEquations2D) +@inline function Trixi.max_abs_speed(u_ll, u_rr, aux_vars_ll, aux_vars_rr, + orientation, + equations::AbstractCovariantShallowWaterEquations2D) # Geometric variables Gcon_ll = metric_contravariant(aux_vars_ll, equations) Gcon_rr = metric_contravariant(aux_vars_rr, equations) diff --git a/src/equations/shallow_water_3d.jl b/src/equations/shallow_water_3d.jl index 3a8fd89a..e75c99e8 100644 --- a/src/equations/shallow_water_3d.jl +++ b/src/equations/shallow_water_3d.jl @@ -407,6 +407,28 @@ end return max(abs(v_ll), abs(v_rr)) + max(c_ll, c_rr) * norm(normal_direction) end +@inline function Trixi.max_abs_speed(u_ll, u_rr, normal_direction::AbstractVector, + equations::ShallowWaterEquations3D) + # Extract and compute the velocities in the normal direction + v1_ll, v2_ll, v3_ll = velocity(u_ll, equations) + v1_rr, v2_rr, v3_rr = velocity(u_rr, equations) + v_ll = v1_ll * normal_direction[1] + v2_ll * normal_direction[2] + + v3_ll * normal_direction[3] + v_rr = v1_rr * normal_direction[1] + v2_rr * normal_direction[2] + + v3_rr * normal_direction[3] + + # Compute the wave celerity on the left and right + h_ll = waterheight(u_ll, equations) + h_rr = waterheight(u_rr, equations) + + c_ll = sqrt(max(equations.gravity * h_ll, 0.0f0)) + c_rr = sqrt(max(equations.gravity * h_rr, 0.0f0)) + + # The normal velocities are already scaled by the norm + return max(abs(v_ll) + c_ll * norm_, abs(v_rr) + c_rr * norm_) * + norm(normal_direction) +end + # Specialized `DissipationLocalLaxFriedrichs` to avoid spurious dissipation in the bottom topography @inline function (dissipation::DissipationLocalLaxFriedrichs)(u_ll, u_rr, orientation_or_normal_direction, From f1bb61e2fae3c3df0e5de6068a9e9d756a436cfd Mon Sep 17 00:00:00 2001 From: Benedict Geihe Date: Tue, 22 Jul 2025 00:50:48 +0200 Subject: [PATCH 10/19] fixup --- src/equations/shallow_water_3d.jl | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/equations/shallow_water_3d.jl b/src/equations/shallow_water_3d.jl index e75c99e8..764a6cdf 100644 --- a/src/equations/shallow_water_3d.jl +++ b/src/equations/shallow_water_3d.jl @@ -425,8 +425,7 @@ end c_rr = sqrt(max(equations.gravity * h_rr, 0.0f0)) # The normal velocities are already scaled by the norm - return max(abs(v_ll) + c_ll * norm_, abs(v_rr) + c_rr * norm_) * - norm(normal_direction) + return max(abs(v_ll) + c_ll, abs(v_rr) + c_rr) * norm(normal_direction) end # Specialized `DissipationLocalLaxFriedrichs` to avoid spurious dissipation in the bottom topography From ee8e9186a013010a1cf67453b6304463c7fa6dbc Mon Sep 17 00:00:00 2001 From: Benedict Geihe Date: Tue, 22 Jul 2025 01:15:57 +0200 Subject: [PATCH 11/19] fixup --- src/equations/shallow_water_3d.jl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/equations/shallow_water_3d.jl b/src/equations/shallow_water_3d.jl index 764a6cdf..42ea04bd 100644 --- a/src/equations/shallow_water_3d.jl +++ b/src/equations/shallow_water_3d.jl @@ -425,7 +425,8 @@ end c_rr = sqrt(max(equations.gravity * h_rr, 0.0f0)) # The normal velocities are already scaled by the norm - return max(abs(v_ll) + c_ll, abs(v_rr) + c_rr) * norm(normal_direction) + norm_ = norm(normal_direction) + return max(abs(v_ll) + c_ll * norm_, abs(v_rr) + c_rr * norm_) end # Specialized `DissipationLocalLaxFriedrichs` to avoid spurious dissipation in the bottom topography From 7eb51a22a445c51661d08a902e559d4667a3bde3 Mon Sep 17 00:00:00 2001 From: Benedict <135045760+benegee@users.noreply.github.com> Date: Tue, 22 Jul 2025 08:29:58 +0200 Subject: [PATCH 12/19] Apply suggestions from code review Co-authored-by: Hendrik Ranocha --- Project.toml | 2 +- test/Project.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Project.toml b/Project.toml index 64093c37..dbcff694 100644 --- a/Project.toml +++ b/Project.toml @@ -33,5 +33,5 @@ Static = "0.8, 1" StaticArrayInterface = "1.5.1" StaticArrays = "1" StrideArrays = "0.1.28" -Trixi = "0.9.9, 0.10, 0.11, 0.12, 0.13" +Trixi = "0.13" julia = "1.9" diff --git a/test/Project.toml b/test/Project.toml index 4604ecce..b4189076 100644 --- a/test/Project.toml +++ b/test/Project.toml @@ -15,5 +15,5 @@ OrdinaryDiffEq = "6.91" OrdinaryDiffEqLowStorageRK = "1.2" OrdinaryDiffEqSSPRK = "1.2" Test = "1" -Trixi = "0.9.9, 0.10, 0.11, 0.12, 0.13" +Trixi = "0.13" TrixiTest = "0.1" From 7186278d097b7093320af58ae0c624e64d9cf76f Mon Sep 17 00:00:00 2001 From: Benedict Geihe Date: Tue, 22 Jul 2025 17:59:15 +0200 Subject: [PATCH 13/19] revert, max_abs_speed_naive will be used as fallback --- src/equations/covariant_advection.jl | 6 +++--- src/equations/covariant_shallow_water.jl | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/equations/covariant_advection.jl b/src/equations/covariant_advection.jl index 081b0135..c14fefb6 100644 --- a/src/equations/covariant_advection.jl +++ b/src/equations/covariant_advection.jl @@ -110,9 +110,9 @@ end end # Maximum contravariant wave speed with respect to specific basis vector -@inline function Trixi.max_abs_speed(u_ll, u_rr, aux_vars_ll, aux_vars_rr, - orientation::Integer, - equations::CovariantLinearAdvectionEquation2D) +@inline function Trixi.max_abs_speed_naive(u_ll, u_rr, aux_vars_ll, aux_vars_rr, + orientation::Integer, + equations::CovariantLinearAdvectionEquation2D) vcon_ll = velocity_contravariant(u_ll, equations) # Contravariant components on left side vcon_rr = velocity_contravariant(u_rr, equations) # Contravariant components on right side return max(abs(vcon_ll[orientation]), abs(vcon_rr[orientation])) diff --git a/src/equations/covariant_shallow_water.jl b/src/equations/covariant_shallow_water.jl index beac8762..c1a8daf2 100644 --- a/src/equations/covariant_shallow_water.jl +++ b/src/equations/covariant_shallow_water.jl @@ -217,9 +217,9 @@ end end # Maximum wave speed along the normal direction in reference space -@inline function Trixi.max_abs_speed(u_ll, u_rr, aux_vars_ll, aux_vars_rr, - orientation, - equations::AbstractCovariantShallowWaterEquations2D) +@inline function Trixi.max_abs_speed_naive(u_ll, u_rr, aux_vars_ll, aux_vars_rr, + orientation, + equations::AbstractCovariantShallowWaterEquations2D) # Geometric variables Gcon_ll = metric_contravariant(aux_vars_ll, equations) Gcon_rr = metric_contravariant(aux_vars_rr, equations) From 6ed8908193d64a8f1d11f4acc8a78bb120b68286 Mon Sep 17 00:00:00 2001 From: Benedict Geihe Date: Tue, 22 Jul 2025 17:59:43 +0200 Subject: [PATCH 14/19] get new reference values --- test/test_3d_shallow_water.jl | 78 ++++++++++++++++---------------- test/test_spherical_advection.jl | 46 +++++++++---------- 2 files changed, 62 insertions(+), 62 deletions(-) diff --git a/test/test_3d_shallow_water.jl b/test/test_3d_shallow_water.jl index 03a0d79e..7da5e7c7 100644 --- a/test/test_3d_shallow_water.jl +++ b/test/test_3d_shallow_water.jl @@ -11,17 +11,17 @@ EXAMPLES_DIR = TrixiAtmo.examples_dir() @test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_shallowwater_cartesian_unsteady_solid_body_rotation_EC_correction.jl"), l2=[ - 1.1385840313143962, - 464.82837506217066, - 469.1401783834081, - 311.3170683216476, + 0.1385840313143962, + 0.82837506217066, + 0.1401783834081, + 0.3170683216476, 0.0 ], linf=[ - 5.159323444366919, - 3303.7491913049016, - 3420.553600463765, - 3730.0452131916827, + 0.159323444366919, + 0.7491913049016, + 0.553600463765, + 0.0452131916827, 0.0 ], polydeg=3, @@ -41,17 +41,17 @@ end @test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_shallowwater_cartesian_unsteady_solid_body_rotation_EC_projection.jl"), l2=[ - 1.2715065248576713, - 598.683530367431, - 605.759403715426, - 460.96437160416355, + 0.2715065248576713, + 0.683530367431, + 0.759403715426, + 0.96437160416355, 0.0 ], linf=[ - 4.238740469409095, - 5466.431268687156, - 5083.837234735748, - 3502.6899531778763, + 0.238740469409095, + 0.431268687156, + 0.837234735748, + 0.6899531778763, 0.0 ], polydeg=3, @@ -72,16 +72,16 @@ end "elixir_shallowwater_cartesian_unsteady_solid_body_rotation_EC_projection.jl"), l2=[ 0.2744086984644598, - 280.22833657858405, - 294.07258247717635, - 187.92205847355822, + 0.22833657858405, + 0.07258247717635, + 0.92205847355822, 0.0 ], linf=[ - 1.4332199421835412, - 1255.449038614228, - 1470.6155024602194, - 1249.3580783745856, + 0.4332199421835412, + 0.449038614228, + 0.6155024602194, + 0.3580783745856, 0.0 ], surface_flux=(FluxPlusDissipation(flux_wintermeyer_etal, @@ -120,17 +120,17 @@ end @test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_shallowwater_cartesian_geostrophic_balance.jl"), l2=[ - 0.27676841776660416, - 103.39838614468358, - 103.39838614468256, - 47.517273183733906, + 0.0, + 0.39838614468358, + 0.39838614468256, + 0.517273183733906, 0.0 ], linf=[ - 1.2383681144717684, - 610.2955303677882, - 610.2955303680574, - 276.4494926100049, + 0.2383681144717684, + 0.2955303677882, + 0.2955303680574, + 0.4494926100049, 0.0 ], polydeg=3, @@ -150,17 +150,17 @@ end @test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_shallowwater_cartesian_isolated_mountain.jl"), l2=[ - 13.189867835225384, - 4656.890929855556, - 4027.784683604144, - 6275.998709859527, + 0.189867835225384, + 0.890929855556, + 0.784683604144, + 0.998709859527, 0.0 ], linf=[ - 115.53215616900434, - 37970.28060001574, - 42646.814315962474, - 65362.28474927765, + 0.53215616900434, + 0.28060001574, + 0.814315962474, + 0.28474927765, 0.0 ], polydeg=3, diff --git a/test/test_spherical_advection.jl b/test/test_spherical_advection.jl index 3610d188..766f9a30 100644 --- a/test/test_spherical_advection.jl +++ b/test/test_spherical_advection.jl @@ -11,17 +11,17 @@ EXAMPLES_DIR = TrixiAtmo.examples_dir() @test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_shallowwater_cartesian_advection_cubed_sphere.jl"), l2=[ - 0.796321633853675, - 20.317829852384286, - 8.810001095524816, - 20.317829852393054, + 0.0, + 0.317829852384286, + 0.810001095524816, + 0.317829852393054, 0.0 ], linf=[ - 10.872101731709677, - 289.6515963524798, - 95.1288712006542, - 289.65159635247255, + 0.872101731709677, + 0.6515963524798, + 0.1288712006542, + 0.65159635247255, 0.0 ]) # and small reference values @@ -39,17 +39,17 @@ end @test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_shallowwater_cartesian_advection_quad_icosahedron.jl"), l2=[ - 0.45702277148735726, - 11.807355540175404, - 4.311881740745649, - 11.807355540181993, + 0.0, + 0.807355540175404, + 0.311881740745649, + 0.807355540181993, 0.0 ], linf=[ - 13.591965583200476, - 364.76418895396273, - 93.69731833993228, - 364.76418895397, + 0.591965583200476, + 0.76418895396273, + 0.69731833993228, + 0.76418895397, 0.0 ]) # and small reference values @@ -68,16 +68,16 @@ end "elixir_shallowwater_cartesian_advection_cubed_sphere.jl"), l2=[ 0.8933429672952714, - 22.84887991902509, - 9.758850586757735, - 22.84887991902542, + 0.84887991902509, + 0.758850586757735, + 0.84887991902542, 0.0 ], linf=[ - 14.289456304624764, - 380.6958334067349, - 120.59259301602742, - 380.69583340674217, + 0.289456304624764, + 0.6958334067349, + 0.59259301602742, + 0.69583340674217, 0.0 ], element_local_mapping=true) # and small reference values From aeaae41800bd1f14aedd12c78321f13446a236cd Mon Sep 17 00:00:00 2001 From: Benedict Geihe Date: Tue, 22 Jul 2025 18:02:18 +0200 Subject: [PATCH 15/19] remove max_abs_speed_naive --- src/equations/shallow_water_3d.jl | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/src/equations/shallow_water_3d.jl b/src/equations/shallow_water_3d.jl index 42ea04bd..477bcff2 100644 --- a/src/equations/shallow_water_3d.jl +++ b/src/equations/shallow_water_3d.jl @@ -386,27 +386,6 @@ function clean_solution_lagrange_multiplier!(u, equations::ShallowWaterEquations u[4] -= normal_direction[3] * x_dot_div_f end -@inline function Trixi.max_abs_speed_naive(u_ll, u_rr, normal_direction::AbstractVector, - equations::ShallowWaterEquations3D) - # Extract and compute the velocities in the normal direction - v1_ll, v2_ll, v3_ll = velocity(u_ll, equations) - v1_rr, v2_rr, v3_rr = velocity(u_rr, equations) - v_ll = v1_ll * normal_direction[1] + v2_ll * normal_direction[2] + - v3_ll * normal_direction[3] - v_rr = v1_rr * normal_direction[1] + v2_rr * normal_direction[2] + - v3_rr * normal_direction[3] - - # Compute the wave celerity on the left and right - h_ll = waterheight(u_ll, equations) - h_rr = waterheight(u_rr, equations) - - c_ll = sqrt(max(equations.gravity * h_ll, 0.0f0)) - c_rr = sqrt(max(equations.gravity * h_rr, 0.0f0)) - - # The normal velocities are already scaled by the norm - return max(abs(v_ll), abs(v_rr)) + max(c_ll, c_rr) * norm(normal_direction) -end - @inline function Trixi.max_abs_speed(u_ll, u_rr, normal_direction::AbstractVector, equations::ShallowWaterEquations3D) # Extract and compute the velocities in the normal direction From fbfc60bae929a4a912f7983da5cff5aa96fd7229 Mon Sep 17 00:00:00 2001 From: Benedict Geihe Date: Tue, 22 Jul 2025 20:19:44 +0200 Subject: [PATCH 16/19] re-add naive version --- src/equations/covariant_advection.jl | 6 +++--- src/equations/covariant_shallow_water.jl | 6 +++--- src/equations/shallow_water_3d.jl | 21 +++++++++++++++++++++ 3 files changed, 27 insertions(+), 6 deletions(-) diff --git a/src/equations/covariant_advection.jl b/src/equations/covariant_advection.jl index c14fefb6..081b0135 100644 --- a/src/equations/covariant_advection.jl +++ b/src/equations/covariant_advection.jl @@ -110,9 +110,9 @@ end end # Maximum contravariant wave speed with respect to specific basis vector -@inline function Trixi.max_abs_speed_naive(u_ll, u_rr, aux_vars_ll, aux_vars_rr, - orientation::Integer, - equations::CovariantLinearAdvectionEquation2D) +@inline function Trixi.max_abs_speed(u_ll, u_rr, aux_vars_ll, aux_vars_rr, + orientation::Integer, + equations::CovariantLinearAdvectionEquation2D) vcon_ll = velocity_contravariant(u_ll, equations) # Contravariant components on left side vcon_rr = velocity_contravariant(u_rr, equations) # Contravariant components on right side return max(abs(vcon_ll[orientation]), abs(vcon_rr[orientation])) diff --git a/src/equations/covariant_shallow_water.jl b/src/equations/covariant_shallow_water.jl index c1a8daf2..beac8762 100644 --- a/src/equations/covariant_shallow_water.jl +++ b/src/equations/covariant_shallow_water.jl @@ -217,9 +217,9 @@ end end # Maximum wave speed along the normal direction in reference space -@inline function Trixi.max_abs_speed_naive(u_ll, u_rr, aux_vars_ll, aux_vars_rr, - orientation, - equations::AbstractCovariantShallowWaterEquations2D) +@inline function Trixi.max_abs_speed(u_ll, u_rr, aux_vars_ll, aux_vars_rr, + orientation, + equations::AbstractCovariantShallowWaterEquations2D) # Geometric variables Gcon_ll = metric_contravariant(aux_vars_ll, equations) Gcon_rr = metric_contravariant(aux_vars_rr, equations) diff --git a/src/equations/shallow_water_3d.jl b/src/equations/shallow_water_3d.jl index 477bcff2..42ea04bd 100644 --- a/src/equations/shallow_water_3d.jl +++ b/src/equations/shallow_water_3d.jl @@ -386,6 +386,27 @@ function clean_solution_lagrange_multiplier!(u, equations::ShallowWaterEquations u[4] -= normal_direction[3] * x_dot_div_f end +@inline function Trixi.max_abs_speed_naive(u_ll, u_rr, normal_direction::AbstractVector, + equations::ShallowWaterEquations3D) + # Extract and compute the velocities in the normal direction + v1_ll, v2_ll, v3_ll = velocity(u_ll, equations) + v1_rr, v2_rr, v3_rr = velocity(u_rr, equations) + v_ll = v1_ll * normal_direction[1] + v2_ll * normal_direction[2] + + v3_ll * normal_direction[3] + v_rr = v1_rr * normal_direction[1] + v2_rr * normal_direction[2] + + v3_rr * normal_direction[3] + + # Compute the wave celerity on the left and right + h_ll = waterheight(u_ll, equations) + h_rr = waterheight(u_rr, equations) + + c_ll = sqrt(max(equations.gravity * h_ll, 0.0f0)) + c_rr = sqrt(max(equations.gravity * h_rr, 0.0f0)) + + # The normal velocities are already scaled by the norm + return max(abs(v_ll), abs(v_rr)) + max(c_ll, c_rr) * norm(normal_direction) +end + @inline function Trixi.max_abs_speed(u_ll, u_rr, normal_direction::AbstractVector, equations::ShallowWaterEquations3D) # Extract and compute the velocities in the normal direction From 87355024e944bb64f30ef3357c8bb6bbb843071a Mon Sep 17 00:00:00 2001 From: Benedict Geihe Date: Tue, 22 Jul 2025 20:58:36 +0200 Subject: [PATCH 17/19] no reference values --- test/test_3d_shallow_water.jl | 16 +++++------ test/test_spherical_advection.jl | 48 ++++++++++++++++---------------- test/test_trixiatmo.jl | 31 ++------------------- 3 files changed, 34 insertions(+), 61 deletions(-) diff --git a/test/test_3d_shallow_water.jl b/test/test_3d_shallow_water.jl index 7da5e7c7..c293123f 100644 --- a/test/test_3d_shallow_water.jl +++ b/test/test_3d_shallow_water.jl @@ -11,17 +11,17 @@ EXAMPLES_DIR = TrixiAtmo.examples_dir() @test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_shallowwater_cartesian_unsteady_solid_body_rotation_EC_correction.jl"), l2=[ - 0.1385840313143962, - 0.82837506217066, - 0.1401783834081, - 0.3170683216476, + 0.0274954994, + 9.65117289, + 8.20257340, + 18.5292301, 0.0 ], linf=[ - 0.159323444366919, - 0.7491913049016, - 0.553600463765, - 0.0452131916827, + 0.157738035, + 59.4123680, + 51.9233503, + 8.36833383, 0.0 ], polydeg=3, diff --git a/test/test_spherical_advection.jl b/test/test_spherical_advection.jl index 766f9a30..a4eaa772 100644 --- a/test/test_spherical_advection.jl +++ b/test/test_spherical_advection.jl @@ -11,17 +11,17 @@ EXAMPLES_DIR = TrixiAtmo.examples_dir() @test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_shallowwater_cartesian_advection_cubed_sphere.jl"), l2=[ - 0.0, - 0.317829852384286, - 0.810001095524816, - 0.317829852393054, + 0.183524336, + 5.64470440, + 2.80467667, + 5.64470440, 0.0 ], linf=[ - 0.872101731709677, - 0.6515963524798, - 0.1288712006542, - 0.65159635247255, + 2.79650356, + 91.6208734, + 24.9330974, + 91.6208734, 0.0 ]) # and small reference values @@ -39,17 +39,17 @@ end @test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_shallowwater_cartesian_advection_quad_icosahedron.jl"), l2=[ - 0.0, - 0.807355540175404, - 0.311881740745649, - 0.807355540181993, + 0.0771325788, + 2.24899209, + 1.45355192, + 2.24899209, 0.0 ], linf=[ - 0.591965583200476, - 0.76418895396273, - 0.69731833993228, - 0.76418895397, + 1.18929523, + 34.1427583, + 17.9760460, + 34.1427583, 0.0 ]) # and small reference values @@ -67,17 +67,17 @@ end @test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_shallowwater_cartesian_advection_cubed_sphere.jl"), l2=[ - 0.8933429672952714, - 0.84887991902509, - 0.758850586757735, - 0.84887991902542, + 0.222179190, + 6.74419737, + 3.36551000, + 6.74419737, 0.0 ], linf=[ - 0.289456304624764, - 0.6958334067349, - 0.59259301602742, - 0.69583340674217, + 3.60436608, + 113.572183, + 30.1250336, + 113.572183, 0.0 ], element_local_mapping=true) # and small reference values diff --git a/test/test_trixiatmo.jl b/test/test_trixiatmo.jl index bba76399..c1ff984b 100644 --- a/test/test_trixiatmo.jl +++ b/test/test_trixiatmo.jl @@ -21,43 +21,16 @@ macro test_trixi_include(elixir, args...) local linf = get_kwarg(args, :linf, nothing) local atol = get_kwarg(args, :atol, 500 * eps()) local rtol = get_kwarg(args, :rtol, sqrt(eps())) - local skip_coverage = get_kwarg(args, :skip_coverage, false) - local coverage_override = expr_to_named_tuple(get_kwarg(args, :coverage_override, :())) - if !(:maxiters in keys(coverage_override)) - # maxiters in coverage_override defaults to 1 - coverage_override = (; coverage_override..., maxiters = 1) - end - local cmd = string(Base.julia_cmd()) - local coverage = occursin("--code-coverage", cmd) && - !occursin("--code-coverage=none", cmd) local kwargs = Pair{Symbol, Any}[] for arg in args if (arg.head == :(=) && - !(arg.args[1] in (:l2, :linf, :atol, :rtol, :coverage_override, :skip_coverage)) - && !(coverage && arg.args[1] in keys(coverage_override))) + !(arg.args[1] in (:l2, :linf, :atol, :rtol))) push!(kwargs, Pair(arg.args...)) end end - if coverage - for key in keys(coverage_override) - push!(kwargs, Pair(key, coverage_override[key])) - end - end - - if coverage && skip_coverage - return quote - if TrixiAtmo.Trixi.mpi_isroot() - println("═"^100) - println("Skipping coverage test of ", $elixir) - println("═"^100) - println("\n\n") - end - end - end - quote TrixiAtmo.Trixi.mpi_isroot() && println("═"^100) TrixiAtmo.Trixi.mpi_isroot() && println($elixir) @@ -76,7 +49,7 @@ macro test_trixi_include(elixir, args...) @test_nowarn_mod TrixiAtmo.Trixi.trixi_include(@__MODULE__, $elixir; $kwargs...) additional_ignore_content # if present, compare l2 and linf errors against reference values - if !$coverage && (!isnothing($l2) || !isnothing($linf)) + if !isnothing($l2) || !isnothing($linf) l2_measured, linf_measured = analysis_callback(sol) if TrixiAtmo.Trixi.mpi_isroot() && !isnothing($l2) From 41fbf01d624482e5b07a91f69767057e8b14277d Mon Sep 17 00:00:00 2001 From: Benedict Geihe Date: Tue, 22 Jul 2025 22:42:13 +0200 Subject: [PATCH 18/19] reference error values --- test/test_3d_shallow_water.jl | 80 ++++++++++++++++---------------- test/test_spherical_advection.jl | 48 +++++++++---------- 2 files changed, 64 insertions(+), 64 deletions(-) diff --git a/test/test_3d_shallow_water.jl b/test/test_3d_shallow_water.jl index c293123f..2b7b676f 100644 --- a/test/test_3d_shallow_water.jl +++ b/test/test_3d_shallow_water.jl @@ -11,17 +11,17 @@ EXAMPLES_DIR = TrixiAtmo.examples_dir() @test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_shallowwater_cartesian_unsteady_solid_body_rotation_EC_correction.jl"), l2=[ - 0.0274954994, - 9.65117289, - 8.20257340, - 18.5292301, + 1.1385840313142226, + 464.8283750621118, + 469.14017838339083, + 311.31706832161564, 0.0 ], linf=[ - 0.157738035, - 59.4123680, - 51.9233503, - 8.36833383, + 5.159323444358506, + 3303.749191315932, + 3420.5536004616565, + 3730.0452131952625, 0.0 ], polydeg=3, @@ -41,17 +41,17 @@ end @test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_shallowwater_cartesian_unsteady_solid_body_rotation_EC_projection.jl"), l2=[ - 0.2715065248576713, - 0.683530367431, - 0.759403715426, - 0.96437160416355, + 1.271506524857498, + 598.6835303675092, + 605.7594037155094, + 460.9643716042415, 0.0 ], linf=[ - 0.238740469409095, - 0.431268687156, - 0.837234735748, - 0.6899531778763, + 4.23874046947094, + 5466.431268695043, + 5083.837234738506, + 3502.6899531773233, 0.0 ], polydeg=3, @@ -71,17 +71,17 @@ end @test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_shallowwater_cartesian_unsteady_solid_body_rotation_EC_projection.jl"), l2=[ - 0.2744086984644598, - 0.22833657858405, - 0.07258247717635, - 0.92205847355822, + 0.27440876588211627, + 280.22773491124406, + 294.071829622588, + 187.92193710627467, 0.0 ], linf=[ - 0.4332199421835412, - 0.449038614228, - 0.6155024602194, - 0.3580783745856, + 1.4332269086135057, + 1255.4454482832807, + 1470.615003655199, + 1249.359787903988, 0.0 ], surface_flux=(FluxPlusDissipation(flux_wintermeyer_etal, @@ -120,17 +120,17 @@ end @test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_shallowwater_cartesian_geostrophic_balance.jl"), l2=[ - 0.0, - 0.39838614468358, - 0.39838614468256, - 0.517273183733906, + 0.27676870881275684, + 103.39794108387852, + 103.39794108387564, + 47.5171515443239, 0.0 ], linf=[ - 0.2383681144717684, - 0.2955303677882, - 0.2955303680574, - 0.4494926100049, + 1.238372542072966, + 610.2929744255816, + 610.2929744259309, + 276.44878503463497, 0.0 ], polydeg=3, @@ -150,17 +150,17 @@ end @test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_shallowwater_cartesian_isolated_mountain.jl"), l2=[ - 0.189867835225384, - 0.890929855556, - 0.784683604144, - 0.998709859527, + 13.189868962884406, + 4656.890871865292, + 4027.7846474475473, + 6275.998570998393, 0.0 ], linf=[ - 0.53215616900434, - 0.28060001574, - 0.814315962474, - 0.28474927765, + 115.53214502067749, + 37970.29034857702, + 42646.8517588789, + 65362.34875198507, 0.0 ], polydeg=3, diff --git a/test/test_spherical_advection.jl b/test/test_spherical_advection.jl index a4eaa772..d23c91dc 100644 --- a/test/test_spherical_advection.jl +++ b/test/test_spherical_advection.jl @@ -11,17 +11,17 @@ EXAMPLES_DIR = TrixiAtmo.examples_dir() @test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_shallowwater_cartesian_advection_cubed_sphere.jl"), l2=[ - 0.183524336, - 5.64470440, - 2.80467667, - 5.64470440, + 0.796321633847963, + 20.317829852214242, + 8.810001095522356, + 20.317829852220424, 0.0 ], linf=[ - 2.79650356, - 91.6208734, - 24.9330974, - 91.6208734, + 10.872101732112924, + 289.6515963627462, + 95.1288711914458, + 289.65159636274984, 0.0 ]) # and small reference values @@ -39,17 +39,17 @@ end @test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_shallowwater_cartesian_advection_quad_icosahedron.jl"), l2=[ - 0.0771325788, - 2.24899209, - 1.45355192, - 2.24899209, + 0.45702277148770143, + 11.807355540181147, + 4.311881740807178, + 11.807355540181314, 0.0 ], linf=[ - 1.18929523, - 34.1427583, - 17.9760460, - 34.1427583, + 13.591965583195247, + 364.76418895378083, + 93.69731833987953, + 364.7641889537881, 0.0 ]) # and small reference values @@ -67,17 +67,17 @@ end @test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_shallowwater_cartesian_advection_cubed_sphere.jl"), l2=[ - 0.222179190, - 6.74419737, - 3.36551000, - 6.74419737, + 0.893342967293854, + 22.848879918993113, + 9.758850586740538, + 22.848879918993124, 0.0 ], linf=[ - 3.60436608, - 113.572183, - 30.1250336, - 113.572183, + 14.289456304585201, + 380.6958334056544, + 120.59259301568181, + 380.69583340557074, 0.0 ], element_local_mapping=true) # and small reference values From b188a609e06af29a250ae09be368d5db2d08ecbc Mon Sep 17 00:00:00 2001 From: Tristan Montoya Date: Tue, 22 Jul 2025 23:33:43 -0400 Subject: [PATCH 19/19] coverage for max_abs_speed_naive --- test/test_3d_shallow_water.jl | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/test/test_3d_shallow_water.jl b/test/test_3d_shallow_water.jl index 2b7b676f..b2cfa30f 100644 --- a/test/test_3d_shallow_water.jl +++ b/test/test_3d_shallow_water.jl @@ -116,26 +116,24 @@ end end end -@trixiatmo_testset "elixir_shallowwater_cartesian_geostrophic_balance" begin +@trixiatmo_testset "elixir_shallowwater_cartesian_geostrophic_balance (naive)" begin @test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_shallowwater_cartesian_geostrophic_balance.jl"), - l2=[ - 0.27676870881275684, - 103.39794108387852, - 103.39794108387564, - 47.5171515443239, - 0.0 - ], - linf=[ - 1.238372542072966, - 610.2929744255816, - 610.2929744259309, - 276.44878503463497, - 0.0 - ], + l2=[0.27676841776660904, + 103.39838614468599, + 103.39838614468121, + 47.51727318373426, 0.0], + linf=[1.238368114471541, + 610.2955303677882, + 610.2955303679337, + 276.44949261002847, + 0.0], polydeg=3, cells_per_dimension=(5, 5), - tspan=(0.0, 1.0 * SECONDS_PER_DAY)) + tspan=(0.0, 1.0 * SECONDS_PER_DAY), + surface_flux=(FluxPlusDissipation(flux_wintermeyer_etal, + DissipationLocalLaxFriedrichs(max_abs_speed_naive)), + flux_nonconservative_wintermeyer_etal)) # use "naive" wave speed estimate for coverage # Ensure that we do not have excessive memory allocations # (e.g., from type instabilities) let