Skip to content

Commit

Permalink
add tests for spherical advection in Cartesian coords
Browse files Browse the repository at this point in the history
  • Loading branch information
tristanmontoya committed Aug 17, 2024
1 parent fa11728 commit ae53831
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 0 deletions.
2 changes: 2 additions & 0 deletions examples/elixir_euler_spherical_advection_cartesian.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ using TrixiAtmo
###############################################################################
# semidiscretization of the linear advection equation

# We use the Euler equations structure but modify the rhs! function to convert it to a
# variable-coefficient advection equation
equations = CompressibleEulerEquations3D(1.4)

# Create DG solver with polynomial degree = 3 and (local) Lax-Friedrichs/Rusanov flux as surface flux
Expand Down
1 change: 1 addition & 0 deletions examples/elixir_moist_euler_moist_bubble.jl
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@ analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
alive_callback = AliveCallback(analysis_interval = analysis_interval)

save_solution = SaveSolutionCallback(interval = 1000,
output_directory = "moist_bubble",
save_initial_solution = true,
save_final_solution = true,
solution_variables = solution_variables)
Expand Down
4 changes: 4 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,8 @@ const TRIXIATMO_NTHREADS = clamp(Sys.CPU_THREADS, 2, 3)
@time if TRIXIATMO_TEST == "all" || TRIXIATMO_TEST == "moist_euler"
include("test_2d_moist_euler.jl")
end

@time if TRIXIATMO_TEST == "all" || TRIXIATMO_TEST == "spherical_advection"
include("test_spherical_advection.jl")
end
end
37 changes: 37 additions & 0 deletions test/test_spherical_advection.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
module TestSphericalAdvection

using Test
using TrixiAtmo

include("test_trixiatmo.jl")

EXAMPLES_DIR = pkgdir(TrixiAtmo, "examples")

@trixiatmo_testset "elixir_euler_spherical_advection_cartesian" begin
@test_trixi_include(joinpath(EXAMPLES_DIR,
"elixir_euler_spherical_advection_cartesian.jl"),
l2=[
8.44505073e-03,
8.23414117e-03,
1.84210648e-03,
0.00000000e+00,
6.44302430e-02,
],
linf=[
9.48950488e-02,
9.64811952e-02,
1.37453400e-02,
0.00000000e+00,
4.09322999e-01,
])
# Ensure that we do not have excessive memory allocations
# (e.g., from type instabilities)
let
t = sol.t[end]
u_ode = sol.u[end]
du_ode = similar(u_ode)
@test (@allocated TrixiAtmo.Trixi.rhs!(du_ode, u_ode, semi, t)) < 100
end
end

end # module

0 comments on commit ae53831

Please sign in to comment.