Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
trixi-framework
GitHub Repository: trixi-framework/Trixi.jl
Path: blob/main/test/test_p4est_3d.jl
2055 views
1
module TestExamplesP4estMesh3D
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
# Start with a clean environment: remove Trixi.jl output directory if it exists
11
outdir = "out"
12
isdir(outdir) && rm(outdir, recursive = true)
13
14
@testset "P4estMesh3D" begin
15
#! format: noindent
16
17
@trixi_testset "elixir_advection_basic.jl" begin
18
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_advection_basic.jl"),
19
# Expected errors are exactly the same as with TreeMesh!
20
l2=[0.00016263963870641478],
21
linf=[0.0014537194925779984])
22
# Ensure that we do not have excessive memory allocations
23
# (e.g., from type instabilities)
24
let
25
t = sol.t[end]
26
u_ode = sol.u[end]
27
du_ode = similar(u_ode)
28
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
29
end
30
end
31
32
@trixi_testset "elixir_advection_unstructured_curved.jl" begin
33
@test_trixi_include(joinpath(EXAMPLES_DIR,
34
"elixir_advection_unstructured_curved.jl"),
35
l2=[0.0004750004258546538],
36
linf=[0.026527551737137167])
37
# Ensure that we do not have excessive memory allocations
38
# (e.g., from type instabilities)
39
let
40
t = sol.t[end]
41
u_ode = sol.u[end]
42
du_ode = similar(u_ode)
43
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
44
end
45
end
46
47
@trixi_testset "elixir_advection_nonconforming.jl" begin
48
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_advection_nonconforming.jl"),
49
l2=[0.00253595715323843],
50
linf=[0.016486952252155795])
51
# Ensure that we do not have excessive memory allocations
52
# (e.g., from type instabilities)
53
let
54
t = sol.t[end]
55
u_ode = sol.u[end]
56
du_ode = similar(u_ode)
57
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
58
end
59
end
60
61
@trixi_testset "elixir_advection_amr.jl" begin
62
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_advection_amr.jl"),
63
# Expected errors are exactly the same as with TreeMesh!
64
l2=[9.773852895157622e-6],
65
linf=[0.0005853874124926162])
66
# Ensure that we do not have excessive memory allocations
67
# (e.g., from type instabilities)
68
let
69
t = sol.t[end]
70
u_ode = sol.u[end]
71
du_ode = similar(u_ode)
72
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
73
end
74
end
75
76
@trixi_testset "elixir_advection_amr_unstructured_curved.jl" begin
77
@test_trixi_include(joinpath(EXAMPLES_DIR,
78
"elixir_advection_amr_unstructured_curved.jl"),
79
l2=[1.6163120948209677e-5],
80
linf=[0.0010572201890564834],
81
tspan=(0.0, 1.0),)
82
# Ensure that we do not have excessive memory allocations
83
# (e.g., from type instabilities)
84
let
85
t = sol.t[end]
86
u_ode = sol.u[end]
87
du_ode = similar(u_ode)
88
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
89
end
90
end
91
92
@trixi_testset "elixir_advection_cubed_sphere.jl" begin
93
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_advection_cubed_sphere.jl"),
94
l2=[0.002006918015656413],
95
linf=[0.027655117058380085])
96
# Ensure that we do not have excessive memory allocations
97
# (e.g., from type instabilities)
98
let
99
t = sol.t[end]
100
u_ode = sol.u[end]
101
du_ode = similar(u_ode)
102
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
103
end
104
end
105
106
@trixi_testset "elixir_advection_restart.jl" begin
107
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_advection_restart.jl"),
108
l2=[0.002590388934758452],
109
linf=[0.01840757696885409])
110
# Ensure that we do not have excessive memory allocations
111
# (e.g., from type instabilities)
112
let
113
t = sol.t[end]
114
u_ode = sol.u[end]
115
du_ode = similar(u_ode)
116
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
117
end
118
end
119
120
@trixi_testset "elixir_euler_source_terms_nonconforming_unstructured_curved.jl" begin
121
@test_trixi_include(joinpath(EXAMPLES_DIR,
122
"elixir_euler_source_terms_nonconforming_unstructured_curved.jl"),
123
l2=[
124
4.070355207909268e-5,
125
4.4993257426833716e-5,
126
5.10588457841744e-5,
127
5.102840924036687e-5,
128
0.00019986264001630542
129
],
130
linf=[
131
0.0016987332417202072,
132
0.003622956808262634,
133
0.002029576258317789,
134
0.0024206977281964193,
135
0.008526972236273522
136
],
137
tspan=(0.0, 0.01))
138
139
@test_trixi_include(joinpath(EXAMPLES_DIR,
140
"elixir_euler_source_terms_nonconforming_unstructured_curved.jl"),
141
surface_flux=FluxPlusDissipation(flux_ranocha,
142
DissipationMatrixWintersEtal()),
143
l2=[
144
4.068002997087932e-5,
145
4.4742882348806466e-5,
146
5.101817697733163e-5,
147
5.100410876233901e-5,
148
0.000199848133462063
149
],
150
linf=[
151
0.0013080357114820806,
152
0.0028524316301083985,
153
0.0019100643150573582,
154
0.0024800222220195955,
155
0.00830424488849335
156
],
157
tspan=(0.0, 0.01),)
158
# Ensure that we do not have excessive memory allocations
159
# (e.g., from type instabilities)
160
let
161
t = sol.t[end]
162
u_ode = sol.u[end]
163
du_ode = similar(u_ode)
164
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
165
end
166
end
167
168
@trixi_testset "elixir_euler_source_terms_nonperiodic.jl" begin
169
@test_trixi_include(joinpath(EXAMPLES_DIR,
170
"elixir_euler_source_terms_nonperiodic.jl"),
171
l2=[
172
0.0015106060984283647,
173
0.0014733349038567685,
174
0.00147333490385685,
175
0.001473334903856929,
176
0.0028149479453087093
177
],
178
linf=[
179
0.008070806335238156,
180
0.009007245083113125,
181
0.009007245083121784,
182
0.009007245083102688,
183
0.01562861968368434
184
],
185
tspan=(0.0, 1.0))
186
# Ensure that we do not have excessive memory allocations
187
# (e.g., from type instabilities)
188
let
189
t = sol.t[end]
190
u_ode = sol.u[end]
191
du_ode = similar(u_ode)
192
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
193
end
194
end
195
196
@trixi_testset "elixir_euler_free_stream.jl" begin
197
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_free_stream.jl"),
198
l2=[
199
5.162664597942288e-15,
200
1.941857343642486e-14,
201
2.0232366394187278e-14,
202
2.3381518645408552e-14,
203
7.083114561232324e-14
204
],
205
linf=[
206
7.269740365245525e-13,
207
3.289868377720495e-12,
208
4.440087186807773e-12,
209
3.8686831516088205e-12,
210
9.412914891981927e-12
211
],
212
tspan=(0.0, 0.03))
213
# Ensure that we do not have excessive memory allocations
214
# (e.g., from type instabilities)
215
let
216
t = sol.t[end]
217
u_ode = sol.u[end]
218
du_ode = similar(u_ode)
219
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
220
end
221
end
222
223
@trixi_testset "elixir_euler_free_stream_extruded.jl" begin
224
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_free_stream_extruded.jl"),
225
l2=[
226
8.444868392439035e-16,
227
4.889826056731442e-15,
228
2.2921260987087585e-15,
229
4.268460455702414e-15,
230
1.1356712092620279e-14
231
],
232
linf=[
233
7.749356711883593e-14,
234
2.8792246364872653e-13,
235
1.1121659149182506e-13,
236
3.3228975127030935e-13,
237
9.592326932761353e-13
238
],
239
tspan=(0.0, 0.1))
240
# Ensure that we do not have excessive memory allocations
241
# (e.g., from type instabilities)
242
let
243
t = sol.t[end]
244
u_ode = sol.u[end]
245
du_ode = similar(u_ode)
246
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
247
end
248
end
249
250
@trixi_testset "elixir_euler_free_stream_boundaries.jl" begin
251
@test_trixi_include(joinpath(EXAMPLES_DIR,
252
"elixir_euler_free_stream_boundaries.jl"),
253
l2=[
254
6.530157034651212e-16, 1.6057829680004379e-15,
255
3.31107455378537e-15, 3.908829498281281e-15,
256
5.048390610424672e-15
257
],
258
linf=[
259
4.884981308350689e-15, 1.1921019726912618e-14,
260
1.5432100042289676e-14, 2.298161660974074e-14,
261
6.039613253960852e-14
262
])
263
# Ensure that we do not have excessive memory allocations
264
# (e.g., from type instabilities)
265
let
266
t = sol.t[end]
267
u_ode = sol.u[end]
268
du_ode = similar(u_ode)
269
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
270
end
271
end
272
273
@trixi_testset "elixir_euler_free_stream_boundaries_float32.jl" begin
274
# Expected errors are taken from elixir_euler_free_stream_boundaries.jl
275
@test_trixi_include(joinpath(EXAMPLES_DIR,
276
"elixir_euler_free_stream_boundaries_float32.jl"),
277
l2=[
278
Float32(6.530157034651212e-16),
279
Float32(1.6057829680004379e-15),
280
Float32(3.31107455378537e-15),
281
Float32(3.908829498281281e-15),
282
Float32(5.048390610424672e-15)
283
],
284
linf=[
285
Float32(4.884981308350689e-15),
286
Float32(1.1921019726912618e-14),
287
Float32(1.5432100042289676e-14),
288
Float32(2.298161660974074e-14),
289
Float32(6.039613253960852e-14)
290
],
291
RealT=Float32)
292
# Ensure that we do not have excessive memory allocations
293
# (e.g., from type instabilities)
294
let
295
t = sol.t[end]
296
u_ode = sol.u[end]
297
du_ode = similar(u_ode)
298
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
299
end
300
end
301
302
@trixi_testset "elixir_euler_free_stream_extruded.jl with HLLC FLux" begin
303
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_free_stream_extruded.jl"),
304
l2=[
305
8.444868392439035e-16,
306
4.889826056731442e-15,
307
2.2921260987087585e-15,
308
4.268460455702414e-15,
309
1.1356712092620279e-14
310
],
311
linf=[
312
7.749356711883593e-14,
313
4.513472928735496e-13,
314
2.9790059308254513e-13,
315
1.057154364048074e-12,
316
1.6271428648906294e-12
317
],
318
tspan=(0.0, 0.1),
319
surface_flux=flux_hllc)
320
# Ensure that we do not have excessive memory allocations
321
# (e.g., from type instabilities)
322
let
323
t = sol.t[end]
324
u_ode = sol.u[end]
325
du_ode = similar(u_ode)
326
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
327
end
328
end
329
330
@trixi_testset "elixir_euler_ec.jl" begin
331
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_ec.jl"),
332
l2=[
333
0.010380390326164493,
334
0.006192950051354618,
335
0.005970674274073704,
336
0.005965831290564327,
337
0.02628875593094754
338
],
339
linf=[
340
0.3326911600075694,
341
0.2824952141320467,
342
0.41401037398065543,
343
0.45574161423218573,
344
0.8099577682187109
345
],
346
tspan=(0.0, 0.2),)
347
# Ensure that we do not have excessive memory allocations
348
# (e.g., from type instabilities)
349
let
350
t = sol.t[end]
351
u_ode = sol.u[end]
352
du_ode = similar(u_ode)
353
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
354
end
355
end
356
357
@trixi_testset "elixir_euler_ec.jl (flux_chandrashekar)" begin
358
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_ec.jl"),
359
l2=[
360
0.010368548525287055,
361
0.006216054794583285,
362
0.006020401857347216,
363
0.006019175682769779,
364
0.026228080232814154
365
],
366
linf=[
367
0.3169376449662026,
368
0.28950510175646726,
369
0.4402523227566396,
370
0.4869168122387365,
371
0.7999141641954051
372
],
373
tspan=(0.0, 0.2),
374
volume_flux=flux_chandrashekar,)
375
# Ensure that we do not have excessive memory allocations
376
# (e.g., from type instabilities)
377
let
378
t = sol.t[end]
379
u_ode = sol.u[end]
380
du_ode = similar(u_ode)
381
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
382
end
383
end
384
385
@trixi_testset "elixir_euler_sedov.jl" begin
386
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_sedov.jl"),
387
l2=[
388
7.82070951e-02,
389
4.33260474e-02,
390
4.33260474e-02,
391
4.33260474e-02,
392
3.75260911e-01
393
],
394
linf=[
395
7.45329845e-01,
396
3.21754792e-01,
397
3.21754792e-01,
398
3.21754792e-01,
399
4.76151527e+00
400
],
401
tspan=(0.0, 0.3),)
402
# Ensure that we do not have excessive memory allocations
403
# (e.g., from type instabilities)
404
let
405
t = sol.t[end]
406
u_ode = sol.u[end]
407
du_ode = similar(u_ode)
408
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
409
end
410
end
411
412
@trixi_testset "elixir_euler_sedov.jl (HLLE)" begin
413
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_sedov.jl"),
414
l2=[
415
0.09946224487902565,
416
0.04863386374672001,
417
0.048633863746720116,
418
0.04863386374672032,
419
0.3751015774232693
420
],
421
linf=[
422
0.789241521871487,
423
0.42046970270100276,
424
0.42046970270100276,
425
0.4204697027010028,
426
4.730877375538398
427
],
428
tspan=(0.0, 0.3),
429
surface_flux=flux_hlle)
430
# Ensure that we do not have excessive memory allocations
431
# (e.g., from type instabilities)
432
let
433
t = sol.t[end]
434
u_ode = sol.u[end]
435
du_ode = similar(u_ode)
436
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
437
end
438
end
439
440
@trixi_testset "elixir_euler_source_terms_nonconforming_earth.jl" begin
441
@test_trixi_include(joinpath(EXAMPLES_DIR,
442
"elixir_euler_source_terms_nonconforming_earth.jl"),
443
l2=[
444
6.040180337738628e-6,
445
5.4254175153621895e-6,
446
5.677698851333843e-6,
447
5.8017136892469794e-6,
448
1.3637854615117974e-5
449
],
450
linf=[
451
0.00013996924184311865,
452
0.00013681539559939893,
453
0.00013681539539733834,
454
0.00013681539541021692,
455
0.00016833038543762058
456
],
457
# Decrease tolerance of adaptive time stepping to get similar results across different systems
458
abstol=1.0e-11, reltol=1.0e-11,)
459
# Ensure that we do not have excessive memory allocations
460
# (e.g., from type instabilities)
461
let
462
t = sol.t[end]
463
u_ode = sol.u[end]
464
du_ode = similar(u_ode)
465
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
466
end
467
end
468
469
@trixi_testset "elixir_euler_circular_wind_nonconforming.jl" begin
470
@test_trixi_include(joinpath(EXAMPLES_DIR,
471
"elixir_euler_circular_wind_nonconforming.jl"),
472
l2=[
473
1.5737711609657832e-7,
474
3.8630261900166194e-5,
475
3.8672287531936816e-5,
476
3.6865116098660796e-5,
477
0.05508620970403884
478
],
479
linf=[
480
2.268845333053271e-6,
481
0.000531462302113539,
482
0.0005314624461298934,
483
0.0005129931254772464,
484
0.7942778058932163
485
],
486
tspan=(0.0, 2e2),)
487
# Ensure that we do not have excessive memory allocations
488
# (e.g., from type instabilities)
489
let
490
t = sol.t[end]
491
u_ode = sol.u[end]
492
du_ode = similar(u_ode)
493
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
494
end
495
end
496
497
@trixi_testset "elixir_euler_baroclinic_instability.jl" begin
498
@test_trixi_include(joinpath(EXAMPLES_DIR,
499
"elixir_euler_baroclinic_instability.jl"),
500
l2=[
501
6.725093801700048e-7,
502
0.00021710076010951073,
503
0.0004386796338203878,
504
0.00020836270267103122,
505
0.07601887903440395
506
],
507
linf=[
508
1.9107530539574924e-5,
509
0.02980358831035801,
510
0.048476331898047564,
511
0.02200137344113612,
512
4.848310144356219
513
],
514
tspan=(0.0, 1e2),
515
# Decrease tolerance of adaptive time stepping to get similar results across different systems
516
abstol=1.0e-9, reltol=1.0e-9,)
517
# Ensure that we do not have excessive memory allocations
518
# (e.g., from type instabilities)
519
let
520
t = sol.t[end]
521
u_ode = sol.u[end]
522
du_ode = similar(u_ode)
523
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
524
end
525
end
526
527
@trixi_testset "elixir_euler_source_terms_nonperiodic_hohqmesh.jl" begin
528
@test_trixi_include(joinpath(EXAMPLES_DIR,
529
"elixir_euler_source_terms_nonperiodic_hohqmesh.jl"),
530
l2=[
531
0.0042023406458005464,
532
0.004122532789279737,
533
0.0042448149597303616,
534
0.0036361316700401765,
535
0.007389845952982495
536
],
537
linf=[
538
0.04530610539892499,
539
0.02765695110527666,
540
0.05670295599308606,
541
0.048396544302230504,
542
0.1154589758186293
543
])
544
# Ensure that we do not have excessive memory allocations
545
# (e.g., from type instabilities)
546
let
547
t = sol.t[end]
548
u_ode = sol.u[end]
549
du_ode = similar(u_ode)
550
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
551
end
552
end
553
554
@trixi_testset "elixir_mhd_alfven_wave_er.jl" begin
555
@test_trixi_include(joinpath(EXAMPLES_DIR,
556
"elixir_mhd_alfven_wave_er.jl"),
557
l2=[
558
0.0052864046546744065,
559
0.009963357787771665,
560
0.006635699953141596,
561
0.01295540589311982,
562
0.013939326496053958,
563
0.010192741315114568,
564
0.004631666336074305,
565
0.012267586777052244,
566
0.0018063823439272181
567
],
568
linf=[
569
0.021741826900806394,
570
0.0470226920658848,
571
0.025036937229995254,
572
0.05043002191230382,
573
0.06018360063552164,
574
0.04338351710391075,
575
0.023607975939848536,
576
0.050740527490335,
577
0.006909064342577296
578
])
579
# Larger values for allowed allocations due to usage of custom
580
# integrator which are not *recorded* for the methods from
581
# OrdinaryDiffEq.jl
582
# Corresponding issue: https://github.com/trixi-framework/Trixi.jl/issues/1877
583
let
584
t = sol.t[end]
585
u_ode = sol.u[end]
586
du_ode = similar(u_ode)
587
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 15_000
588
end
589
end
590
591
@trixi_testset "elixir_mhd_alfven_wave_nonconforming.jl" begin
592
@test_trixi_include(joinpath(EXAMPLES_DIR,
593
"elixir_mhd_alfven_wave_nonconforming.jl"),
594
l2=[
595
0.0001788543743594658,
596
0.000624334205581902,
597
0.00022892869974368887,
598
0.0007223464581156573,
599
0.0006651366626523314,
600
0.0006287275014743352,
601
0.000344484339916008,
602
0.0007179788287557142,
603
8.632896980651243e-7
604
],
605
linf=[
606
0.0010730565632763867,
607
0.004596749809344033,
608
0.0013235269262853733,
609
0.00468874234888117,
610
0.004719267084104306,
611
0.004228339352211896,
612
0.0037503625505571625,
613
0.005104176909383168,
614
9.738081186490818e-6
615
],
616
tspan=(0.0, 0.25),)
617
# Ensure that we do not have excessive memory allocations
618
# (e.g., from type instabilities)
619
let
620
t = sol.t[end]
621
u_ode = sol.u[end]
622
du_ode = similar(u_ode)
623
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
624
end
625
end
626
627
@trixi_testset "elixir_mhd_alfven_wave_nonperiodic.jl" begin
628
@test_trixi_include(joinpath(EXAMPLES_DIR,
629
"elixir_mhd_alfven_wave_nonperiodic.jl"),
630
l2=[
631
0.00017912812934894293,
632
0.000630910737693146,
633
0.0002256138768371346,
634
0.0007301686017397987,
635
0.0006647296256552257,
636
0.0006409790941359089,
637
0.00033986873316986315,
638
0.0007277161123570452,
639
1.3184121257198033e-5
640
],
641
linf=[
642
0.0012248374096375247,
643
0.004857541490859554,
644
0.001813452620706816,
645
0.004803571938364726,
646
0.005271403957646026,
647
0.004571200760744465,
648
0.002618188297242474,
649
0.005010126350015381,
650
6.309149507784953e-5
651
],
652
tspan=(0.0, 0.25),)
653
# Ensure that we do not have excessive memory allocations
654
# (e.g., from type instabilities)
655
let
656
t = sol.t[end]
657
u_ode = sol.u[end]
658
du_ode = similar(u_ode)
659
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
660
end
661
end
662
663
@trixi_testset "elixir_mhd_shockcapturing_amr.jl" begin
664
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_mhd_shockcapturing_amr.jl"),
665
l2=[
666
0.0062973565893792004,
667
0.006436273914579104,
668
0.007112703307027178,
669
0.006529650167358523,
670
0.020607452343745017,
671
0.005560993001492338,
672
0.007576418168749763,
673
0.0055721349394598635,
674
3.8269125984310296e-6
675
],
676
linf=[
677
0.2090718196650192,
678
0.1863884052971854,
679
0.23475479927204168,
680
0.19460789763442982,
681
0.6859816363887359,
682
0.15171474186273914,
683
0.22404690260234983,
684
0.16808957604979002,
685
0.0005083795485317637
686
],
687
tspan=(0.0, 0.04),)
688
# Ensure that we do not have excessive memory allocations
689
# (e.g., from type instabilities)
690
let
691
t = sol.t[end]
692
u_ode = sol.u[end]
693
du_ode = similar(u_ode)
694
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
695
end
696
end
697
698
@trixi_testset "elixir_mhd_amr_entropy_bounded.jl" begin
699
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_mhd_amr_entropy_bounded.jl"),
700
l2=[
701
0.005430006338127661,
702
0.006186402899876596,
703
0.012171513410597289,
704
0.006181479343504159,
705
0.035068817354117605,
706
0.004967715666538709,
707
0.006592173316509503,
708
0.0050151140388451105,
709
5.146547644807638e-6
710
],
711
linf=[
712
0.18655204102670386,
713
0.20397573777286138,
714
0.3700839435299759,
715
0.23329319876321034,
716
1.0348619438460904,
717
0.18462694496595722,
718
0.20648634653698617,
719
0.18947822281424997,
720
0.0005083794158781671
721
],
722
tspan=(0.0, 0.04),)
723
# Ensure that we do not have excessive memory allocations
724
# (e.g., from type instabilities)
725
let
726
t = sol.t[end]
727
u_ode = sol.u[end]
728
du_ode = similar(u_ode)
729
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
730
end
731
end
732
733
@trixi_testset "elixir_linearizedeuler_convergence.jl" begin
734
@test_trixi_include(joinpath(EXAMPLES_DIR,
735
"elixir_linearizedeuler_convergence.jl"),
736
l2=[
737
0.04452389418193219, 0.03688186699434862,
738
0.03688186699434861, 0.03688186699434858,
739
0.044523894181932186
740
],
741
linf=[
742
0.2295447498696467, 0.058369658071546704,
743
0.05836965807154648, 0.05836965807154648, 0.2295447498696468
744
])
745
# Ensure that we do not have excessive memory allocations
746
# (e.g., from type instabilities)
747
let
748
t = sol.t[end]
749
u_ode = sol.u[end]
750
du_ode = similar(u_ode)
751
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
752
end
753
end
754
755
@trixi_testset "elixir_euler_weak_blast_wave_amr.jl" begin
756
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_weak_blast_wave_amr.jl"),
757
l2=[
758
0.01374649869395016,
759
0.01993458602992416,
760
0.020403214655756098,
761
0.020408263790073853,
762
0.14975849029503904
763
],
764
linf=[
765
0.4411601724293266,
766
0.668308654218055,
767
0.7351134068050753,
768
0.5955002383710662,
769
3.1811162616598985
770
],
771
tspan=(0.0, 0.025),)
772
# Ensure that we do not have excessive memory allocations
773
# (e.g., from type instabilities)
774
let
775
t = sol.t[end]
776
u_ode = sol.u[end]
777
du_ode = similar(u_ode)
778
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
779
end
780
# Check for conservation
781
state_integrals = Trixi.integrate(sol.u[2], semi)
782
initial_state_integrals = analysis_callback.affect!.initial_state_integrals
783
784
@test isapprox(state_integrals[1], initial_state_integrals[1], atol = 1e-13)
785
@test isapprox(state_integrals[2], initial_state_integrals[2], atol = 1e-13)
786
@test isapprox(state_integrals[3], initial_state_integrals[3], atol = 1e-13)
787
@test isapprox(state_integrals[4], initial_state_integrals[4], atol = 1e-13)
788
@test isapprox(state_integrals[5], initial_state_integrals[5], atol = 1e-13)
789
end
790
791
@trixi_testset "elixir_euler_ONERA_M6_wing.jl" begin
792
@test_trixi_include(joinpath(EXAMPLES_DIR,
793
"elixir_euler_ONERA_M6_wing.jl"),
794
l2=[
795
1.3302852203314697e-7,
796
7.016342225152883e-8,
797
1.0954098970860626e-7,
798
6.834890433113107e-8,
799
3.796737956937651e-7
800
],
801
linf=[
802
0.08856648749331164,
803
0.07431651477033197,
804
0.08791247483932041,
805
0.012973811024139751,
806
0.25575828277482016
807
],
808
tspan=(0.0, 5e-8))
809
# Ensure that we do not have excessive memory allocations
810
# (e.g., from type instabilities)
811
let
812
t = sol.t[end]
813
u_ode = sol.u[end]
814
du_ode = similar(u_ode)
815
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
816
end
817
end
818
819
# Multi-ion MHD tests
820
include("test_p4est_3d_mhdmultiion.jl")
821
end
822
823
# Clean up afterwards: delete Trixi.jl output directory
824
@test_nowarn rm(outdir, recursive = true)
825
826
end # module
827
828