diff --git a/Project.toml b/Project.toml index 19aeb0e1..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" +Trixi = "0.13" julia = "1.9" diff --git a/docs/make.jl b/docs/make.jl index 7800d66f..93c1fc33 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", 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..42ea04bd 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 + 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 @inline function (dissipation::DissipationLocalLaxFriedrichs)(u_ll, u_rr, orientation_or_normal_direction, 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 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 diff --git a/test/Project.toml b/test/Project.toml index 08efd123..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" +Trixi = "0.13" TrixiTest = "0.1" diff --git a/test/test_3d_shallow_water.jl b/test/test_3d_shallow_water.jl index 03a0d79e..b2cfa30f 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, + 1.1385840313142226, + 464.8283750621118, + 469.14017838339083, + 311.31706832161564, 0.0 ], linf=[ - 5.159323444366919, - 3303.7491913049016, - 3420.553600463765, - 3730.0452131916827, + 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=[ - 1.2715065248576713, - 598.683530367431, - 605.759403715426, - 460.96437160416355, + 1.271506524857498, + 598.6835303675092, + 605.7594037155094, + 460.9643716042415, 0.0 ], linf=[ - 4.238740469409095, - 5466.431268687156, - 5083.837234735748, - 3502.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, - 280.22833657858405, - 294.07258247717635, - 187.92205847355822, + 0.27440876588211627, + 280.22773491124406, + 294.071829622588, + 187.92193710627467, 0.0 ], linf=[ - 1.4332199421835412, - 1255.449038614228, - 1470.6155024602194, - 1249.3580783745856, + 1.4332269086135057, + 1255.4454482832807, + 1470.615003655199, + 1249.359787903988, 0.0 ], surface_flux=(FluxPlusDissipation(flux_wintermeyer_etal, @@ -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.27676841776660416, - 103.39838614468358, - 103.39838614468256, - 47.517273183733906, - 0.0 - ], - linf=[ - 1.2383681144717684, + l2=[0.27676841776660904, + 103.39838614468599, + 103.39838614468121, + 47.51727318373426, 0.0], + linf=[1.238368114471541, 610.2955303677882, - 610.2955303680574, - 276.4494926100049, - 0.0 - ], + 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 @@ -150,17 +148,17 @@ end @test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_shallowwater_cartesian_isolated_mountain.jl"), l2=[ - 13.189867835225384, - 4656.890929855556, - 4027.784683604144, - 6275.998709859527, + 13.189868962884406, + 4656.890871865292, + 4027.7846474475473, + 6275.998570998393, 0.0 ], linf=[ - 115.53215616900434, - 37970.28060001574, - 42646.814315962474, - 65362.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 3610d188..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.796321633853675, - 20.317829852384286, - 8.810001095524816, - 20.317829852393054, + 0.796321633847963, + 20.317829852214242, + 8.810001095522356, + 20.317829852220424, 0.0 ], linf=[ - 10.872101731709677, - 289.6515963524798, - 95.1288712006542, - 289.65159635247255, + 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.45702277148735726, - 11.807355540175404, - 4.311881740745649, - 11.807355540181993, + 0.45702277148770143, + 11.807355540181147, + 4.311881740807178, + 11.807355540181314, 0.0 ], linf=[ - 13.591965583200476, - 364.76418895396273, - 93.69731833993228, - 364.76418895397, + 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.8933429672952714, - 22.84887991902509, - 9.758850586757735, - 22.84887991902542, + 0.893342967293854, + 22.848879918993113, + 9.758850586740538, + 22.848879918993124, 0.0 ], linf=[ - 14.289456304624764, - 380.6958334067349, - 120.59259301602742, - 380.69583340674217, + 14.289456304585201, + 380.6958334056544, + 120.59259301568181, + 380.69583340557074, 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)