Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
trixi-framework
GitHub Repository: trixi-framework/Trixi.jl
Path: blob/main/test/test_mpi_t8code_3d.jl
2055 views
1
module TestExamplesMPIT8codeMesh3D
2
3
using Test
4
using Trixi
5
6
include("test_trixi.jl")
7
8
EXAMPLES_DIR = joinpath(examples_dir(), "t8code_3d_dgsem")
9
10
@testset "T8codeMesh MPI 3D" begin
11
#! format: noindent
12
13
# Run basic tests
14
@testset "Examples 3D" begin
15
# Linear scalar advection
16
@trixi_testset "elixir_advection_basic.jl" begin
17
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_advection_basic.jl"),
18
# Expected errors are exactly the same as with TreeMesh!
19
l2=[0.00016263963870641478],
20
linf=[0.0014537194925779984])
21
22
@testset "error-based step size control" begin
23
mpi_isroot() && println("-"^100)
24
mpi_isroot() &&
25
println("elixir_advection_basic.jl with error-based step size control")
26
27
# Use callbacks without stepsize_callback to test error-based step size control
28
callbacks = CallbackSet(summary_callback, analysis_callback, save_restart,
29
save_solution)
30
sol = solve(ode, RDPK3SpFSAL35(); abstol = 1.0e-4, reltol = 1.0e-4,
31
ode_default_options()..., callback = callbacks)
32
summary_callback()
33
errors = analysis_callback(sol)
34
if mpi_isroot()
35
@test errors.l2≈[0.00016800412839949264] rtol=1.0e-4
36
@test errors.linf≈[0.0014548839020096516] rtol=1.0e-4
37
end
38
end
39
40
# Ensure that we do not have excessive memory allocations
41
# (e.g., from type instabilities)
42
let
43
t = sol.t[end]
44
u_ode = sol.u[end]
45
du_ode = similar(u_ode)
46
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
47
end
48
end
49
50
@trixi_testset "elixir_advection_amr.jl" begin
51
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_advection_amr.jl"),
52
# Expected errors are exactly the same as with TreeMesh!
53
l2=[1.1302812803902801e-5],
54
linf=[0.0007889950196294793])
55
56
# Ensure that we do not have excessive memory allocations
57
# (e.g., from type instabilities)
58
let
59
t = sol.t[end]
60
u_ode = sol.u[end]
61
du_ode = similar(u_ode)
62
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
63
end
64
end
65
66
@trixi_testset "elixir_advection_amr_unstructured_curved.jl" begin
67
@test_trixi_include(joinpath(EXAMPLES_DIR,
68
"elixir_advection_amr_unstructured_curved.jl"),
69
l2=[2.0535121347526814e-5],
70
linf=[0.0010586603797777504],
71
tspan=(0.0, 1.0),)
72
73
# Ensure that we do not have excessive memory allocations
74
# (e.g., from type instabilities)
75
let
76
t = sol.t[end]
77
u_ode = sol.u[end]
78
du_ode = similar(u_ode)
79
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
80
end
81
end
82
83
@trixi_testset "elixir_advection_restart.jl" begin
84
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_advection_restart.jl"),
85
l2=[0.002590388934758452],
86
linf=[0.01840757696885409])
87
88
# Ensure that we do not have excessive memory allocations
89
# (e.g., from type instabilities)
90
let
91
t = sol.t[end]
92
u_ode = sol.u[end]
93
du_ode = similar(u_ode)
94
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
95
end
96
end
97
98
# Compressible Euler
99
@trixi_testset "elixir_euler_source_terms_nonconforming_unstructured_curved.jl" begin
100
@test_trixi_include(joinpath(EXAMPLES_DIR,
101
"elixir_euler_source_terms_nonconforming_unstructured_curved.jl"),
102
l2=[
103
4.070355207909268e-5,
104
4.4993257426833716e-5,
105
5.10588457841744e-5,
106
5.102840924036687e-5,
107
0.00019986264001630542
108
],
109
linf=[
110
0.0016987332417202072,
111
0.003622956808262634,
112
0.002029576258317789,
113
0.0024206977281964193,
114
0.008526972236273522
115
],
116
tspan=(0.0, 0.01))
117
118
# Ensure that we do not have excessive memory allocations
119
# (e.g., from type instabilities)
120
let
121
t = sol.t[end]
122
u_ode = sol.u[end]
123
du_ode = similar(u_ode)
124
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
125
end
126
end
127
128
@trixi_testset "elixir_euler_source_terms_nonperiodic.jl" begin
129
@test_trixi_include(joinpath(EXAMPLES_DIR,
130
"elixir_euler_source_terms_nonperiodic.jl"),
131
l2=[
132
0.0015106060984283647,
133
0.0014733349038567685,
134
0.00147333490385685,
135
0.001473334903856929,
136
0.0028149479453087093
137
],
138
linf=[
139
0.008070806335238156,
140
0.009007245083113125,
141
0.009007245083121784,
142
0.009007245083102688,
143
0.01562861968368434
144
],
145
tspan=(0.0, 1.0))
146
147
# Ensure that we do not have excessive memory allocations
148
# (e.g., from type instabilities)
149
let
150
t = sol.t[end]
151
u_ode = sol.u[end]
152
du_ode = similar(u_ode)
153
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
154
end
155
end
156
157
@trixi_testset "elixir_euler_ec.jl" begin
158
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_ec.jl"),
159
l2=[
160
0.010380390326164493,
161
0.006192950051354618,
162
0.005970674274073704,
163
0.005965831290564327,
164
0.02628875593094754
165
],
166
linf=[
167
0.3326911600075694,
168
0.2824952141320467,
169
0.41401037398065543,
170
0.45574161423218573,
171
0.8099577682187109
172
],
173
tspan=(0.0, 0.2),)
174
175
# Ensure that we do not have excessive memory allocations
176
# (e.g., from type instabilities)
177
let
178
t = sol.t[end]
179
u_ode = sol.u[end]
180
du_ode = similar(u_ode)
181
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
182
end
183
end
184
end
185
end # T8codeMesh MPI
186
187
end # module
188
189