Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
trixi-framework
GitHub Repository: trixi-framework/Trixi.jl
Path: blob/main/test/test_mpi_p4est_3d.jl
5582 views
1
module TestExamplesMPIP4estMesh3D
2
3
using Test
4
using Trixi
5
6
include("test_trixi.jl")
7
8
EXAMPLES_DIR = joinpath(examples_dir(), "p4est_3d_dgsem")
9
10
@testset "P4estMesh 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
@test_allocations(Trixi.rhs!, semi, sol, 1000)
43
end
44
45
@trixi_testset "elixir_advection_amr.jl" begin
46
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_advection_amr.jl"),
47
# Expected errors are exactly the same as with TreeMesh!
48
l2=[9.773852895157622e-6],
49
linf=[0.0005853874124926162])
50
51
# Ensure that we do not have excessive memory allocations
52
# (e.g., from type instabilities)
53
@test_allocations(Trixi.rhs!, semi, sol, 1000)
54
end
55
56
# There is an issue with the LoopVectorization.jl ecosystem for this setup
57
# (not caused by MPI), see
58
# https://github.com/JuliaSIMD/LoopVectorization.jl/issues/543
59
# Thus, we do not run this test on macOS with ARM processors.
60
@trixi_testset "elixir_advection_amr_unstructured_curved.jl" begin
61
if Sys.isapple() && (Sys.ARCH === :aarch64)
62
# Show a hint in the test summary that there is a broken test
63
@test_skip false
64
else
65
@test_trixi_include(joinpath(EXAMPLES_DIR,
66
"elixir_advection_amr_unstructured_curved.jl"),
67
l2=[1.6163120948209677e-5],
68
linf=[0.0010572201890564834],
69
tspan=(0.0, 1.0))
70
71
# Ensure that we do not have excessive memory allocations
72
# (e.g., from type instabilities)
73
@test_allocations(Trixi.rhs!, semi, sol, 1000)
74
end
75
end
76
77
@trixi_testset "elixir_advection_restart.jl" begin
78
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_advection_restart.jl"),
79
l2=[0.002590388934758452],
80
linf=[0.01840757696885409])
81
82
# Ensure that we do not have excessive memory allocations
83
# (e.g., from type instabilities)
84
@test_allocations(Trixi.rhs!, semi, sol, 1000)
85
end
86
87
@trixi_testset "elixir_advection_cubed_sphere.jl" begin
88
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_advection_cubed_sphere.jl"),
89
l2=[0.002006918015656413],
90
linf=[0.027655117058380085])
91
92
# Ensure that we do not have excessive memory allocations
93
# (e.g., from type instabilities)
94
@test_allocations(Trixi.rhs!, semi, sol, 1000)
95
end
96
97
# Compressible Euler
98
@trixi_testset "elixir_euler_source_terms_nonconforming_unstructured_curved.jl" begin
99
@test_trixi_include(joinpath(EXAMPLES_DIR,
100
"elixir_euler_source_terms_nonconforming_unstructured_curved.jl"),
101
l2=[
102
4.070355207909268e-5,
103
4.4993257426833716e-5,
104
5.10588457841744e-5,
105
5.102840924036687e-5,
106
0.00019986264001630542
107
],
108
linf=[
109
0.0016987332417202072,
110
0.003622956808262634,
111
0.002029576258317789,
112
0.0024206977281964193,
113
0.008526972236273522
114
],
115
tspan=(0.0, 0.01))
116
117
# Ensure that we do not have excessive memory allocations
118
# (e.g., from type instabilities)
119
@test_allocations(Trixi.rhs!, semi, sol, 1000)
120
end
121
122
@trixi_testset "elixir_euler_source_terms_nonperiodic.jl" begin
123
@test_trixi_include(joinpath(EXAMPLES_DIR,
124
"elixir_euler_source_terms_nonperiodic.jl"),
125
l2=[
126
0.0015106060984283647,
127
0.0014733349038567685,
128
0.00147333490385685,
129
0.001473334903856929,
130
0.0028149479453087093
131
],
132
linf=[
133
0.008070806335238156,
134
0.009007245083113125,
135
0.009007245083121784,
136
0.009007245083102688,
137
0.01562861968368434
138
],
139
tspan=(0.0, 1.0))
140
141
# Ensure that we do not have excessive memory allocations
142
# (e.g., from type instabilities)
143
@test_allocations(Trixi.rhs!, semi, sol, 1000)
144
end
145
146
@trixi_testset "elixir_euler_ec.jl" begin
147
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_ec.jl"),
148
l2=[
149
0.010380390326164493,
150
0.006192950051354618,
151
0.005970674274073704,
152
0.005965831290564327,
153
0.02628875593094754
154
],
155
linf=[
156
0.3326911600075694,
157
0.2824952141320467,
158
0.41401037398065543,
159
0.45574161423218573,
160
0.8099577682187109
161
],
162
tspan=(0.0, 0.2))
163
164
# Ensure that we do not have excessive memory allocations
165
# (e.g., from type instabilities)
166
@test_allocations(Trixi.rhs!, semi, sol, 1000)
167
end
168
169
@trixi_testset "elixir_euler_source_terms_nonperiodic_hohqmesh.jl" begin
170
@test_trixi_include(joinpath(EXAMPLES_DIR,
171
"elixir_euler_source_terms_nonperiodic_hohqmesh.jl"),
172
l2=[
173
0.0042023406458005464,
174
0.004122532789279737,
175
0.0042448149597303616,
176
0.0036361316700401765,
177
0.007389845952982495
178
],
179
linf=[
180
0.04530610539892499,
181
0.02765695110527666,
182
0.05670295599308606,
183
0.048396544302230504,
184
0.1154589758186293
185
])
186
187
# Ensure that we do not have excessive memory allocations
188
# (e.g., from type instabilities)
189
@test_allocations(Trixi.rhs!, semi, sol, 1000)
190
end
191
192
@trixi_testset "elixir_mhd_alfven_wave_nonconforming.jl" begin
193
@test_trixi_include(joinpath(EXAMPLES_DIR,
194
"elixir_mhd_alfven_wave_nonconforming.jl"),
195
l2=[
196
0.0001788543743594658,
197
0.000624334205581902,
198
0.00022892869974368887,
199
0.0007223464581156573,
200
0.0006651366626523314,
201
0.0006287275014743352,
202
0.000344484339916008,
203
0.0007179788287557142,
204
8.632896980651243e-7
205
],
206
linf=[
207
0.0010730565632763867,
208
0.004596749809344033,
209
0.0013235269262853733,
210
0.00468874234888117,
211
0.004719267084104306,
212
0.004228339352211896,
213
0.0037503625505571625,
214
0.005104176909383168,
215
9.738081186490818e-6
216
],
217
tspan=(0.0, 0.25))
218
# Ensure that we do not have excessive memory allocations
219
# (e.g., from type instabilities)
220
@test_allocations(Trixi.rhs!, semi, sol, 1000)
221
end
222
223
# Same test as above but with only one tree in the mesh
224
# We use it to test meshes with elements of different size in each partition
225
@test_trixi_include(joinpath(EXAMPLES_DIR,
226
"elixir_mhd_alfven_wave_nonconforming.jl"),
227
l2=[
228
0.0019054118500017054,
229
0.006957977226608083,
230
0.003429930594167365,
231
0.009051598556176287,
232
0.0077261662742688425,
233
0.008210851821439208,
234
0.003763030674412298,
235
0.009175470744760567,
236
2.881690753923244e-5
237
],
238
linf=[
239
0.010983704624623503,
240
0.04584128974425262,
241
0.02022630484954286,
242
0.04851342295826149,
243
0.040710154751363525,
244
0.044722299260292586,
245
0.036591209423654236,
246
0.05701669133068068,
247
0.00024182906501186622
248
],
249
tspan=(0.0, 0.25), trees_per_dimension=(1, 1, 1))
250
# Ensure that we do not have excessive memory allocations
251
# (e.g., from type instabilities)
252
@test_allocations(Trixi.rhs!, semi, sol, 1000)
253
end
254
end # P4estMesh MPI
255
256
end # module
257
258