Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
trixi-framework
GitHub Repository: trixi-framework/Trixi.jl
Path: blob/main/test/test_tree_1d_mhdmulti.jl
2055 views
1
module TestExamples1DMHD
2
3
using Test
4
using Trixi
5
6
include("test_trixi.jl")
7
8
EXAMPLES_DIR = joinpath(examples_dir(), "tree_1d_dgsem")
9
10
@testset "MHD Multicomponent" begin
11
#! format: noindent
12
13
@trixi_testset "elixir_mhdmulti_ec.jl" begin
14
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_mhdmulti_ec.jl"),
15
l2=[0.08166807325620999, 0.054659228513541616,
16
0.054659228513541616, 0.15578125987042812,
17
4.130462730494e-17, 0.054652588871500665,
18
0.054652588871500665, 0.008307405499637766,
19
0.01661481099927553, 0.03322962199855106],
20
linf=[0.19019207422649645, 0.10059813883022888,
21
0.10059813883022888, 0.4407925743107146,
22
1.1102230246251565e-16, 0.10528911365809623,
23
0.10528911365809623, 0.01737901809766182,
24
0.03475803619532364, 0.06951607239064728])
25
# Ensure that we do not have excessive memory allocations
26
# (e.g., from type instabilities)
27
let
28
t = sol.t[end]
29
u_ode = sol.u[end]
30
du_ode = similar(u_ode)
31
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
32
end
33
end
34
35
@trixi_testset "elixir_mhdmulti_ec.jl with flux_derigs_etal" begin
36
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_mhdmulti_ec.jl"),
37
l2=[0.08151404166186461, 0.054640238302693274,
38
0.054640238302693274, 0.15536125426328573,
39
4.130462730494e-17, 0.054665489963920275,
40
0.054665489963920275, 0.008308349501359825,
41
0.01661669900271965, 0.0332333980054393],
42
linf=[0.1824424257860952, 0.09734687137001484,
43
0.09734687137001484, 0.4243089502087325,
44
1.1102230246251565e-16, 0.09558639591092555,
45
0.09558639591092555, 0.017364773041550624,
46
0.03472954608310125, 0.0694590921662025],
47
volume_flux=flux_derigs_etal)
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
@trixi_testset "elixir_mhdmulti_es.jl" begin
59
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_mhdmulti_es.jl"),
60
l2=[0.07994082660130175, 0.053940174914031976,
61
0.053940174914031976, 0.15165513559250643,
62
4.130462730494e-17, 0.05363207135290325,
63
0.05363207135290325, 0.008258265884659555,
64
0.01651653176931911, 0.03303306353863822],
65
linf=[0.14101014428198477, 0.07762441749521025,
66
0.07762441749521025, 0.3381334453289866,
67
1.1102230246251565e-16, 0.07003646400675223,
68
0.07003646400675223, 0.014962483760600165,
69
0.02992496752120033, 0.05984993504240066])
70
# Ensure that we do not have excessive memory allocations
71
# (e.g., from type instabilities)
72
let
73
t = sol.t[end]
74
u_ode = sol.u[end]
75
du_ode = similar(u_ode)
76
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
77
end
78
end
79
80
@trixi_testset "elixir_mhdmulti_convergence.jl" begin
81
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_mhdmulti_convergence.jl"),
82
l2=[1.7337265267786785e-5, 0.00032976971029271364,
83
0.0003297697102926479, 6.194071694759044e-5,
84
4.130462730494001e-17, 0.00032596825025664136,
85
0.0003259682502567132, 2.5467510126885455e-5,
86
5.093502025377091e-5, 0.00010187004050754182],
87
linf=[3.877554303711845e-5, 0.0012437848638874956,
88
0.0012437848638876898, 0.00016431262020277781,
89
1.1102230246251565e-16, 0.0012443734922607112,
90
0.001244373492260704, 5.691007974162332e-5,
91
0.00011382015948324664, 0.00022764031896649328])
92
# Ensure that we do not have excessive memory allocations
93
# (e.g., from type instabilities)
94
let
95
t = sol.t[end]
96
u_ode = sol.u[end]
97
du_ode = similar(u_ode)
98
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
99
end
100
end
101
102
@trixi_testset "elixir_mhdmulti_briowu_shock_tube.jl" begin
103
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_mhdmulti_briowu_shock_tube.jl"),
104
l2=[0.1877830835572639, 0.3455841730726793, 0.0,
105
0.35413123388836687,
106
8.745556626531982e-16, 0.3629920109231055, 0.0,
107
0.05329005553971236,
108
0.10658011107942472],
109
linf=[0.4288187627971754, 1.0386547815614993, 0.0,
110
0.9541678878162702,
111
5.773159728050814e-15, 1.4595119339458051, 0.0,
112
0.18201910908829552,
113
0.36403821817659104])
114
# Ensure that we do not have excessive memory allocations
115
# (e.g., from type instabilities)
116
let
117
t = sol.t[end]
118
u_ode = sol.u[end]
119
du_ode = similar(u_ode)
120
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
121
end
122
end
123
end
124
125
end # module
126
127