Path: blob/main/test/test_tree_1d_advection.jl
5582 views
module TestExamples1DAdvection12using Test3using Trixi45include("test_trixi.jl")67EXAMPLES_DIR = joinpath(examples_dir(), "tree_1d_dgsem")89@testset "Linear scalar advection" begin10#! format: noindent1112@trixi_testset "elixir_advection_basic.jl" begin13@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_advection_basic.jl"),14l2=[6.0388296447998465e-6],15linf=[3.217887726258972e-5])16# Ensure that we do not have excessive memory allocations17# (e.g., from type instabilities)18@test_allocations(Trixi.rhs!, semi, sol, 1000)19end2021@trixi_testset "elixir_advection_gauss_legendre.jl" begin22@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_advection_gauss_legendre.jl"),23l2=[2.515203865524688e-6], linf=[8.660338936650191e-6])24# Ensure that we do not have excessive memory allocations25# (e.g., from type instabilities)26@test_allocations(Trixi.rhs!, semi, sol, 1000)27end2829@trixi_testset "elixir_advection_basic.jl (max_abs_speed)" begin30@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_advection_basic.jl"),31surface_flux=FluxLaxFriedrichs(max_abs_speed),32l2=[6.0388296447998465e-6],33linf=[3.217887726258972e-5])34# Ensure that we do not have excessive memory allocations35# (e.g., from type instabilities)36@test_allocations(Trixi.rhs!, semi, sol, 1000)37end3839@trixi_testset "elixir_advection_amr.jl" begin40@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_advection_amr.jl"),41l2=[0.3540206249507417],42linf=[0.9999896603382347])43# Ensure that we do not have excessive memory allocations44# (e.g., from type instabilities)45@test_allocations(Trixi.rhs!, semi, sol, 1000)46end4748@trixi_testset "elixir_advection_amr_nonperiodic.jl" begin49@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_advection_amr_nonperiodic.jl"),50l2=[4.283508859843524e-6],51linf=[3.235356127918171e-5])52# Ensure that we do not have excessive memory allocations53# (e.g., from type instabilities)54@test_allocations(Trixi.rhs!, semi, sol, 1000)55end5657@trixi_testset "elixir_advection_basic.jl (No errors)" begin58@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_advection_basic.jl"),59analysis_callback=AnalysisCallback(semi, interval = 42,60analysis_errors = Symbol[]))61# Ensure that we do not have excessive memory allocations62# (e.g., from type instabilities)63@test_allocations(Trixi.rhs!, semi, sol, 1000)64end6566@trixi_testset "elixir_advection_convergence_fvO2.jl" begin67@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_advection_convergence_fvO2.jl"),68l2=[0.0024544920169555706], linf=[0.007837347144210138])69# Ensure that we do not have excessive memory allocations70# (e.g., from type instabilities)71@test_allocations(Trixi.rhs!, semi, sol, 1000)72end7374@trixi_testset "elixir_advection_finite_volume.jl" begin75@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_advection_finite_volume.jl"),76l2=[0.011662300515980219],77linf=[0.01647256923710194])78# Ensure that we do not have excessive memory allocations79# (e.g., from type instabilities)80@test_allocations(Trixi.rhs!, semi, sol, 1000)81end8283@trixi_testset "elixir_advection_perk2.jl" begin84@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_advection_perk2.jl"),85l2=[0.011288030389423475],86linf=[0.01596735472556976])87# Ensure that we do not have excessive memory allocations88# (e.g., from type instabilities)89# Larger values for allowed allocations due to usage of custom90# integrator which are not *recorded* for the methods from91# OrdinaryDiffEq.jl92# Corresponding issue: https://github.com/trixi-framework/Trixi.jl/issues/187793@test_allocations(Trixi.rhs!, semi, sol, 8000)94end9596# Testing the second-order paired explicit Runge-Kutta (PERK) method without stepsize callback97@trixi_testset "elixir_advection_perk2.jl(fixed time step)" begin98@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_advection_perk2.jl"),99dt=2.0e-3,100tspan=(0.0, 20.0),101save_solution=SaveSolutionCallback(dt = 0.1 + 1.0e-8),102callbacks=CallbackSet(summary_callback, save_solution,103analysis_callback, alive_callback),104l2=[9.886271430207691e-6],105linf=[3.729460413781638e-5])106# Ensure that we do not have excessive memory allocations107# (e.g., from type instabilities)108# Larger values for allowed allocations due to usage of custom109# integrator which are not *recorded* for the methods from110# OrdinaryDiffEq.jl111# Corresponding issue: https://github.com/trixi-framework/Trixi.jl/issues/1877112@test_allocations(Trixi.rhs!, semi, sol, 8000)113end114115# Testing the second-order paired explicit Runge-Kutta (PERK) method with the optimal CFL number116@trixi_testset "elixir_advection_perk2_optimal_cfl.jl" begin117@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_advection_perk2_optimal_cfl.jl"),118l2=[0.0009700887119146429],119linf=[0.00137209242077041])120# Ensure that we do not have excessive memory allocations121# (e.g., from type instabilities)122# Larger values for allowed allocations due to usage of custom123# integrator which are not *recorded* for the methods from124# OrdinaryDiffEq.jl125# Corresponding issue: https://github.com/trixi-framework/Trixi.jl/issues/1877126@test_allocations(Trixi.rhs!, semi, sol, 8000)127end128129@trixi_testset "elixir_advection_doublefloat.jl" begin130using DoubleFloats: Double64131@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_advection_doublefloat.jl"),132l2=Double64[6.80895929885700039832943251427357703e-11],133linf=Double64[5.82834770064525291688100323411704252e-10])134# Ensure that we do not have excessive memory allocations135# (e.g., from type instabilities)136@test_allocations(Trixi.rhs!, semi, sol, 1000)137end138end139140end # module141142143