From 17de344809e1db3bf73baa582cac0fc390670160 Mon Sep 17 00:00:00 2001 From: SimonCan Date: Wed, 6 Dec 2023 13:22:14 +0000 Subject: [PATCH] Removed MHD dynamo test due to long run time. Added memory allocation chck for the visco-resistive MHD test (Alfven waves). --- test/test_tree_3d_mhd.jl | 68 +++++++++++++++++++++++++++++++++------- 1 file changed, 57 insertions(+), 11 deletions(-) diff --git a/test/test_tree_3d_mhd.jl b/test/test_tree_3d_mhd.jl index 38b8dbef8d7..724ba80a009 100644 --- a/test/test_tree_3d_mhd.jl +++ b/test/test_tree_3d_mhd.jl @@ -292,19 +292,65 @@ end end end - @trixi_testset "elixir_mhd_diffusive_alfven_wave.jl" begin +@trixi_testset "elixir_mhd_diffusive_alfven_wave.jl" begin @test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_mhd_diffusive_alfven_wave.jl"), - l2 = [3.470701487566952e-5, 0.00037320266655784104, 0.0001814791326953306, 0.0004187613798734842, 0.00011587163989250743, 0.00037032036399761947, 0.00018270779781144185, 0.00041229458967006154, 2.7753210639128732e-5], - linf = [0.0001348833811495309, 0.000892691474205648, 0.00043846917904940587, 0.0010014206836504308, 0.000443288547495424, 0.0008149498186467707, 0.00042111533550182045, 0.000918156282098577, 0.00010109055017304109]) - end - - @trixi_testset "elixir_mhd_dynamo.jl" begin - @test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_mhd_dynamo.jl"), - l2 = [5.136817044406367e-9, 1.0728023104350635e-6, 1.0741472192876857e-6, 1.1384862784905957e-6, 8.505678187506508e-8, 1.2404355188990195e-8, 1.2260968462092833e-8, 1.2453935882908254e-8, 5.406090684284657e-9], - linf = [6.223255566428776e-8, 3.476280403710667e-6, 3.2024943277794614e-6, 3.2985189119007034e-6, 1.0206843477078564e-6, 7.224815773523103e-8, 9.16975614740533e-8, 7.92452544029745e-8, 1.201338384265285e-7], - tspan = (0.0, 0.001)) - end + l2=[ + 2.9261773702833585e-5, + 4.2317742087810785e-5, + 0.002386297778187223, + 6.14533560433796e-17, + 0.00011871260974613841, + 9.966314200394032e-17, + 0.0023862676185018978, + 1.3752543133402248e-17, + 4.755196029273029e-17, + ], + linf=[ + 6.607356972443412e-5, + 5.286926606104682e-5, + 0.0033837332345763374, + 3.491675860507981e-16, + 0.00017080879140696226, + 4.440892098500626e-16, + 0.0033837125993758897, + 6.398201738523501e-17, + 2.383451411922216e-16, + ]) +end +@testset "analysis_callback(sol) for AnalysisCallbackCoupled" begin + errors = analysis_callback(sol) + @test errors.l2≈[ + 2.9261773702833585e-5, + 4.2317742087810785e-5, + 0.002386297778187223, + 6.14533560433796e-17, + 0.00011871260974613841, + 9.966314200394032e-17, + 0.0023862676185018978, + 1.3752543133402248e-17, + 4.755196029273029e-17, + ] rtol=1.0e-4 + @test errors.linf≈[ + 6.607356972443412e-5, + 5.286926606104682e-5, + 0.0033837332345763374, + 3.491675860507981e-16, + 0.00017080879140696226, + 4.440892098500626e-16, + 0.0033837125993758897, + 6.398201738523501e-17, + 2.383451411922216e-16, + ] rtol=1.0e-4 + # 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 Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000 + end +end end end # module