Path: blob/main/test/test_tree_1d_eulermulti.jl
5582 views
module TestExamples1DEulerMulti12using Test3using Trixi45include("test_trixi.jl")67EXAMPLES_DIR = joinpath(examples_dir(), "tree_1d_dgsem")89@testset "Compressible Euler Multicomponent" begin10@trixi_testset "Testing entropy2cons and cons2entropy" begin11using ForwardDiff12using Trixi: Trixi, CompressibleEulerMulticomponentEquations1D, cons2entropy,13entropy2cons, SVector14gammas = (1.3272378792562836, 1.5269959187969864, 1.8362285750521512,151.0409061360276926, 1.4652015053812224, 1.3626493264184423)16gas_constants = (1.817636851910076, 6.760820475922636, 5.588953939749113,176.31574782981543, 3.362932038038397, 3.212779569399733)18equations = CompressibleEulerMulticomponentEquations1D(gammas = SVector{length(gammas)}(gammas...),19gas_constants = SVector{length(gas_constants)}(gas_constants...))20u = [-1.4632513788889214, 0.9908786980927811, 0.2909066990257628,210.6256623915420473, 0.4905882754313441, 0.14481800501749112,221.0333532872771651, 0.6805599818745411]23w = cons2entropy(u, equations)24# test that the entropy variables match the gradients of the total entropy25@test w ≈ ForwardDiff.gradient(u -> Trixi.total_entropy(u, equations), u)26# test that `entropy2cons` is the inverse of `cons2entropy`27@test entropy2cons(w, equations) ≈ u28end2930@trixi_testset "elixir_eulermulti_ec.jl" begin31@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_eulermulti_ec.jl"),32l2=[0.15330089521538684, 0.4417674632047301,330.016888510510282385, 0.03377702102056477,340.06755404204112954],35linf=[0.29130548795961864, 0.8847009003152357,360.034686525099975274, 0.06937305019995055,370.1387461003999011])38# Ensure that we do not have excessive memory allocations39# (e.g., from type instabilities)40@test_allocations(Trixi.rhs!, semi, sol, 1000)41end4243@trixi_testset "elixir_eulermulti_es.jl" begin44@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_eulermulti_es.jl"),45l2=[460.1522380497572071,470.43830846465313206,480.03907262116499431,490.0781452423299886250],51linf=[520.24939193075537294,530.7139395740052739,540.06324208768391237,550.1264841753678247556])57# Ensure that we do not have excessive memory allocations58# (e.g., from type instabilities)59@test_allocations(Trixi.rhs!, semi, sol, 1000)60end6162@trixi_testset "elixir_eulermulti_convergence_ec.jl" begin63@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_eulermulti_convergence_ec.jl"),64l2=[658.575236038539227e-5,660.00016387804318585358,671.9412699303977585e-5,683.882539860795517e-569],70linf=[710.00030593277277124464,720.0006244803933350696,737.253121435135679e-5,740.0001450624287027135875])76# Ensure that we do not have excessive memory allocations77# (e.g., from type instabilities)78@test_allocations(Trixi.rhs!, semi, sol, 1000)79end8081@trixi_testset "elixir_eulermulti_convergence_es.jl" begin82@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_eulermulti_convergence_es.jl"),83l2=[1.8983933794407234e-5, 6.207744299844731e-5,841.5466205761868047e-6, 3.0932411523736094e-6,856.186482304747219e-6, 1.2372964609494437e-5],86linf=[0.00012014372605895218, 0.0003313207215800418,876.50836791016296e-6, 1.301673582032592e-5,882.603347164065184e-5, 5.206694328130368e-5])89# Ensure that we do not have excessive memory allocations90# (e.g., from type instabilities)91@test_allocations(Trixi.rhs!, semi, sol, 1000)92end9394@trixi_testset "elixir_eulermulti_convergence_es.jl with flux_chandrashekar" begin95@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_eulermulti_convergence_es.jl"),96l2=[1.888450477353845e-5, 5.4910600482795386e-5,979.426737161533622e-7, 1.8853474323067245e-6,983.770694864613449e-6, 7.541389729226898e-6],99linf=[0.00011622351152063004, 0.0003079221967086099,1003.2177423254231563e-6, 6.435484650846313e-6,1011.2870969301692625e-5, 2.574193860338525e-5],102volume_flux=flux_chandrashekar)103# Ensure that we do not have excessive memory allocations104# (e.g., from type instabilities)105@test_allocations(Trixi.rhs!, semi, sol, 1000)106end107108@trixi_testset "elixir_eulermulti_two_interacting_blast_waves.jl" begin109@test_trixi_include(joinpath(EXAMPLES_DIR,110"elixir_eulermulti_two_interacting_blast_waves.jl"),111l2=[1.288867611915533, 82.71335258388848, 0.00350680272313187,1120.013698784353152794,1130.019179518517518084],114linf=[29.6413044707026, 1322.5844802186496, 0.09191919374782143,1150.31092970966717925,1160.4417989757182038],117tspan=(0.0, 0.0001))118# Ensure that we do not have excessive memory allocations119# (e.g., from type instabilities)120@test_allocations(Trixi.rhs!, semi, sol, 1000)121end122end123124end # module125126127