Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
trixi-framework
GitHub Repository: trixi-framework/Trixi.jl
Path: blob/main/test/test_p4est_3d_mhdmultiion.jl
2055 views
1
module TestExamples3DIdealGlmMhdMultiIon
2
3
using Test
4
using Trixi
5
6
include("test_trixi.jl")
7
8
# pathof(Trixi) returns /path/to/Trixi/src/Trixi.jl, dirname gives the parent directory
9
EXAMPLES_DIR = joinpath(examples_dir(), "p4est_3d_dgsem")
10
11
@testset "MHD Multi-ion" begin
12
#! format: noindent
13
14
@trixi_testset "elixir_mhdmultiion_ec.jl" begin
15
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_mhdmultiion_ec.jl"),
16
l2=[
17
0.003734820532985263,
18
0.0038615619955546204,
19
0.003833638703487458,
20
0.0028263125135739955,
21
0.0023618139630058143,
22
0.002384129259605738,
23
0.0023828293292904833,
24
0.038089526935383124,
25
0.0038194562843790105,
26
0.003439479296467246,
27
0.003526498173885533,
28
0.0034956719160693537,
29
0.02143679204123428,
30
3.3199722425501164e-6
31
],
32
linf=[
33
0.2016143602393723,
34
0.1707562492816741,
35
0.19671841540041113,
36
0.092481456884773,
37
0.09928141143714853,
38
0.10613515319792097,
39
0.11127460598498372,
40
1.2130363801029604,
41
0.12582249707043758,
42
0.1698494562737311,
43
0.16751667624425207,
44
0.1687325700572586,
45
0.7019146966991214,
46
0.0007812116161561696
47
], tspan=(0.0, 0.05))
48
# Ensure that we do not have excessive memory allocations
49
# (e.g., from type instabilities)
50
let
51
t = sol.t[end]
52
u_ode = sol.u[end]
53
du_ode = similar(u_ode)
54
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
55
end
56
end
57
58
# Up to version 0.13.0, `max_abs_speed_naive` was used as the default wave speed estimate of
59
# `const flux_lax_friedrichs = FluxLaxFriedrichs(), i.e., `FluxLaxFriedrichs(max_abs_speed = max_abs_speed_naive)`.
60
# In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`.
61
# Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`.
62
# To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`.
63
# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the
64
# `StepsizeCallback` (CFL-Condition) and less diffusion.
65
@trixi_testset "Provably entropy-stable LLF-type fluxes for multi-ion GLM-MHD" begin
66
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_mhdmultiion_ec.jl"),
67
l2=[
68
0.0028955650582195335,
69
0.0029749524273695624,
70
0.0029533907732692344,
71
0.0024285755843305988,
72
0.0023749924019966094,
73
0.0024114801452486206,
74
0.0023991164504279404,
75
0.03150571433653016,
76
0.003874135295085382,
77
0.0032206538891184646,
78
0.0033289635387358306,
79
0.0032922608966505377,
80
0.019053919178522397,
81
1.2888164218472409e-5
82
],
83
linf=[
84
0.10031944778984792,
85
0.09835765892858706,
86
0.09915484563347321,
87
0.0643535254948433,
88
0.09957773301344566,
89
0.09607387748333969,
90
0.09698728400727108,
91
0.8341002490873852,
92
0.12157560398831846,
93
0.14778536942358805,
94
0.1464940331696904,
95
0.1449618481727096,
96
0.5487673957733081,
97
0.0014540668676888365
98
],
99
surface_flux=(FluxPlusDissipation(flux_ruedaramirez_etal,
100
DissipationLaxFriedrichsEntropyVariables(max_abs_speed_naive)),
101
flux_nonconservative_ruedaramirez_etal),
102
tspan=(0.0, 0.05))
103
# Ensure that we do not have excessive memory allocations
104
# (e.g., from type instabilities)
105
let
106
t = sol.t[end]
107
u_ode = sol.u[end]
108
du_ode = similar(u_ode)
109
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
110
end
111
end
112
end
113
end # module
114
115