Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
trixi-framework
GitHub Repository: trixi-framework/Trixi.jl
Path: blob/main/test/test_tree_2d_euler.jl
2055 views
1
module TestExamples2DEuler
2
3
using Test
4
using Trixi
5
6
include("test_trixi.jl")
7
8
EXAMPLES_DIR = joinpath(examples_dir(), "tree_2d_dgsem")
9
10
@testset "Compressible Euler" begin
11
#! format: noindent
12
13
@trixi_testset "elixir_euler_source_terms.jl" begin
14
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_source_terms.jl"),
15
l2=[
16
9.321181253186009e-7,
17
1.4181210743438511e-6,
18
1.4181210743487851e-6,
19
4.824553091276693e-6
20
],
21
linf=[
22
9.577246529612893e-6,
23
1.1707525976012434e-5,
24
1.1707525976456523e-5,
25
4.8869615580926506e-5
26
])
27
# Ensure that we do not have excessive memory allocations
28
# (e.g., from type instabilities)
29
let
30
t = sol.t[end]
31
u_ode = sol.u[end]
32
du_ode = similar(u_ode)
33
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
34
end
35
end
36
37
@trixi_testset "elixir_euler_convergence_pure_fv.jl" begin
38
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_convergence_pure_fv.jl"),
39
l2=[
40
0.026440292358506527,
41
0.013245905852168414,
42
0.013245905852168479,
43
0.03912520302609374
44
],
45
linf=[
46
0.042130817806361964,
47
0.022685499230187034,
48
0.022685499230187922,
49
0.06999771202145322
50
])
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_euler_density_wave.jl" begin
62
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_density_wave.jl"),
63
l2=[
64
0.0010600778457964775,
65
0.00010600778457634275,
66
0.00021201556915872665,
67
2.650194614399671e-5
68
],
69
linf=[
70
0.006614198043413566,
71
0.0006614198043973507,
72
0.001322839608837334,
73
0.000165354951256802
74
],
75
tspan=(0.0, 0.5))
76
# Ensure that we do not have excessive memory allocations
77
# (e.g., from type instabilities)
78
let
79
t = sol.t[end]
80
u_ode = sol.u[end]
81
du_ode = similar(u_ode)
82
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
83
end
84
end
85
86
@trixi_testset "elixir_euler_source_terms_nonperiodic.jl" begin
87
@test_trixi_include(joinpath(EXAMPLES_DIR,
88
"elixir_euler_source_terms_nonperiodic.jl"),
89
l2=[
90
2.259440511766445e-6,
91
2.318888155713922e-6,
92
2.3188881557894307e-6,
93
6.3327863238858925e-6
94
],
95
linf=[
96
1.498738264560373e-5,
97
1.9182011928187137e-5,
98
1.918201192685487e-5,
99
6.0526717141407005e-5
100
])
101
# Ensure that we do not have excessive memory allocations
102
# (e.g., from type instabilities)
103
let
104
t = sol.t[end]
105
u_ode = sol.u[end]
106
du_ode = similar(u_ode)
107
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
108
end
109
end
110
111
@trixi_testset "elixir_euler_ec.jl" begin
112
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_ec.jl"),
113
l2=[
114
0.061751715597716854,
115
0.05018223615408711,
116
0.05018989446443463,
117
0.225871559730513
118
],
119
linf=[
120
0.29347582879608825,
121
0.31081249232844693,
122
0.3107380389947736,
123
1.0540358049885143
124
])
125
# Ensure that we do not have excessive memory allocations
126
# (e.g., from type instabilities)
127
let
128
t = sol.t[end]
129
u_ode = sol.u[end]
130
du_ode = similar(u_ode)
131
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
132
end
133
end
134
135
@trixi_testset "elixir_euler_ec.jl with flux_kennedy_gruber" begin
136
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_ec.jl"),
137
l2=[
138
0.03481471610306124,
139
0.027694280613944234,
140
0.027697905866996532,
141
0.12932052501462554
142
],
143
linf=[
144
0.31052098400669004,
145
0.3481295959664616,
146
0.34807152194137336,
147
1.1044947556170719
148
],
149
maxiters=10,
150
surface_flux=flux_kennedy_gruber,
151
volume_flux=flux_kennedy_gruber)
152
# Ensure that we do not have excessive memory allocations
153
# (e.g., from type instabilities)
154
let
155
t = sol.t[end]
156
u_ode = sol.u[end]
157
du_ode = similar(u_ode)
158
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
159
end
160
end
161
162
@trixi_testset "elixir_euler_ec.jl with flux_chandrashekar" begin
163
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_ec.jl"),
164
l2=[
165
0.03481122603050542,
166
0.027662840593087695,
167
0.027665658732350273,
168
0.12927455860656786
169
],
170
linf=[
171
0.3110089578739834,
172
0.34888111987218107,
173
0.3488278669826813,
174
1.1056349046774305
175
],
176
maxiters=10,
177
surface_flux=flux_chandrashekar,
178
volume_flux=flux_chandrashekar)
179
# Ensure that we do not have excessive memory allocations
180
# (e.g., from type instabilities)
181
let
182
t = sol.t[end]
183
u_ode = sol.u[end]
184
du_ode = similar(u_ode)
185
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
186
end
187
end
188
189
@trixi_testset "elixir_euler_shockcapturing.jl" begin
190
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_shockcapturing.jl"),
191
l2=[
192
0.05380629130119074,
193
0.04696798008325309,
194
0.04697067787841479,
195
0.19687382235494968
196
],
197
linf=[
198
0.18527440131928286,
199
0.2404798030563736,
200
0.23269573860381076,
201
0.6874012187446894
202
])
203
# Ensure that we do not have excessive memory allocations
204
# (e.g., from type instabilities)
205
let
206
t = sol.t[end]
207
u_ode = sol.u[end]
208
du_ode = similar(u_ode)
209
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
210
end
211
end
212
213
@trixi_testset "elixir_euler_shockcapturing_subcell.jl" begin
214
@test_trixi_include(joinpath(EXAMPLES_DIR,
215
"elixir_euler_shockcapturing_subcell.jl"),
216
l2=[
217
0.08508152653623638,
218
0.04510301725066843,
219
0.04510304668512745,
220
0.6930705064715306
221
],
222
linf=[
223
0.31136518019691406,
224
0.5617651935473419,
225
0.5621200790240503,
226
2.8866869108596056
227
])
228
# Ensure that we do not have excessive memory allocations
229
# (e.g., from type instabilities)
230
let
231
t = sol.t[end]
232
u_ode = sol.u[end]
233
du_ode = similar(u_ode)
234
# Larger values for allowed allocations due to usage of custom
235
# integrator which are not *recorded* for the methods from
236
# OrdinaryDiffEq.jl
237
# Corresponding issue: https://github.com/trixi-framework/Trixi.jl/issues/1877
238
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 15000
239
end
240
end
241
242
@trixi_testset "elixir_euler_shockcapturing_subcell.jl (fixed time step)" begin
243
# Testing local SSP method without stepsize callback
244
# Additionally, tests combination with SaveSolutionCallback using time interval
245
@test_trixi_include(joinpath(EXAMPLES_DIR,
246
"elixir_euler_shockcapturing_subcell.jl"),
247
dt=2.0e-3,
248
tspan=(0.0, 0.25),
249
save_solution=SaveSolutionCallback(dt = 0.1 + 1.0e-8),
250
callbacks=CallbackSet(summary_callback, save_solution,
251
analysis_callback, alive_callback),
252
l2=[
253
0.05624855363458103,
254
0.06931288786158463,
255
0.06931283188960778,
256
0.6200535829842072
257
],
258
linf=[
259
0.29029967648805566,
260
0.6494728865862608,
261
0.6494729363533714,
262
3.0949621505674787
263
])
264
# Ensure that we do not have excessive memory allocations
265
# (e.g., from type instabilities)
266
let
267
t = sol.t[end]
268
u_ode = sol.u[end]
269
du_ode = similar(u_ode)
270
# Larger values for allowed allocations due to usage of custom
271
# integrator which are not *recorded* for the methods from
272
# OrdinaryDiffEq.jl
273
# Corresponding issue: https://github.com/trixi-framework/Trixi.jl/issues/1877
274
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 15000
275
end
276
end
277
278
@trixi_testset "elixir_euler_blast_wave.jl" begin
279
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_blast_wave.jl"),
280
l2=[
281
0.14170569763947993,
282
0.11647068900798814,
283
0.11647072556898294,
284
0.3391989213659599
285
],
286
linf=[
287
1.6544204510794196,
288
1.35194638484646,
289
1.3519463848472744,
290
1.831228461662809
291
],
292
maxiters=30)
293
294
# Ensure that we do not have excessive memory allocations
295
# (e.g., from type instabilities)
296
let
297
t = sol.t[end]
298
u_ode = sol.u[end]
299
du_ode = similar(u_ode)
300
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
301
end
302
end
303
304
@trixi_testset "elixir_euler_blast_wave.jl with DissipationMatrixWintersEtal" begin
305
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_blast_wave.jl"),
306
surface_flux=FluxPlusDissipation(flux_ranocha,
307
DissipationMatrixWintersEtal()),
308
cfl=0.5, tspan=(0.0, 0.01),
309
l2=[
310
0.0240344741630761,
311
0.026530873906038414,
312
0.026530644332116007,
313
0.08614440613707544
314
],
315
linf=[
316
1.9656605818508415,
317
1.217300641837901,
318
1.217300641837901,
319
2.9173277369453516
320
])
321
322
# Ensure that we do not have excessive memory allocations
323
# (e.g., from type instabilities)
324
let
325
t = sol.t[end]
326
u_ode = sol.u[end]
327
du_ode = similar(u_ode)
328
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
329
end
330
end
331
332
@trixi_testset "elixir_euler_blast_wave_pure_fv.jl" begin
333
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_blast_wave_pure_fv.jl"),
334
l2=[
335
0.39957047631960346,
336
0.21006912294983154,
337
0.21006903549932,
338
0.6280328163981136
339
],
340
linf=[
341
2.20417889887697,
342
1.5487238480003327,
343
1.5486788679247812,
344
2.4656795949035857
345
],
346
tspan=(0.0, 0.5),)
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_blast_wave_amr.jl" begin
358
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_blast_wave_amr.jl"),
359
l2=[
360
0.6835576416907511,
361
0.2839963955262972,
362
0.28399565983676,
363
0.7229447806293277
364
],
365
linf=[
366
3.0969614882801393,
367
1.7967947300740248,
368
1.7967508302506658,
369
3.040149575567518
370
],
371
tspan=(0.0, 1.0),)
372
# Ensure that we do not have excessive memory allocations
373
# (e.g., from type instabilities)
374
let
375
t = sol.t[end]
376
u_ode = sol.u[end]
377
du_ode = similar(u_ode)
378
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
379
end
380
end
381
382
@trixi_testset "elixir_euler_blast_wave_sc_subcell_nonperiodic.jl" begin
383
@test_trixi_include(joinpath(EXAMPLES_DIR,
384
"elixir_euler_blast_wave_sc_subcell_nonperiodic.jl"),
385
l2=[
386
0.3221078812528291,
387
0.17985175694043076,
388
0.17983453493705628,
389
0.6136916718599121
390
],
391
linf=[
392
1.343237509126809,
393
1.1747101056222315,
394
1.174585608472406,
395
2.4216027326405487
396
],
397
tspan=(0.0, 0.5),
398
initial_refinement_level=4,)
399
# Ensure that we do not have excessive memory allocations
400
# (e.g., from type instabilities)
401
let
402
t = sol.t[end]
403
u_ode = sol.u[end]
404
du_ode = similar(u_ode)
405
# Larger values for allowed allocations due to usage of custom
406
# integrator which are not *recorded* for the methods from
407
# OrdinaryDiffEq.jl
408
# Corresponding issue: https://github.com/trixi-framework/Trixi.jl/issues/1877
409
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 15000
410
end
411
end
412
413
@trixi_testset "elixir_euler_sedov_blast_wave.jl" begin
414
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_sedov_blast_wave.jl"),
415
l2=[
416
0.4866953770742574,
417
0.1673477470091984,
418
0.16734774700934,
419
0.6184367248923149
420
],
421
linf=[
422
2.6724832723962053,
423
1.2916089288910635,
424
1.2916089289001427,
425
6.474699399394252
426
],
427
tspan=(0.0, 1.0),)
428
# Ensure that we do not have excessive memory allocations
429
# (e.g., from type instabilities)
430
let
431
t = sol.t[end]
432
u_ode = sol.u[end]
433
du_ode = similar(u_ode)
434
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
435
end
436
end
437
438
@trixi_testset "elixir_euler_sedov_blast_wave_sc_subcell.jl" begin
439
rm(joinpath("out", "deviations.txt"), force = true)
440
@test_trixi_include(joinpath(EXAMPLES_DIR,
441
"elixir_euler_sedov_blast_wave_sc_subcell.jl"),
442
l2=[
443
0.4227549115123529,
444
0.14825759222652649,
445
0.14825759222682933,
446
0.6164668313131949
447
],
448
linf=[
449
1.6391908143728386,
450
0.8344433355906021,
451
0.8344433355966195,
452
6.450305752671201
453
],
454
tspan=(0.0, 1.0),
455
initial_refinement_level=4,
456
save_errors=true)
457
lines = readlines(joinpath("out", "deviations.txt"))
458
@test lines[1] ==
459
"# iter, simu_time, rho_min, rho_max, entropy_guermond_etal_min, pressure_min"
460
@test startswith(lines[end], "138")
461
# Ensure that we do not have excessive memory allocations
462
# (e.g., from type instabilities)
463
let
464
t = sol.t[end]
465
u_ode = sol.u[end]
466
du_ode = similar(u_ode)
467
# Larger values for allowed allocations due to usage of custom
468
# integrator which are not *recorded* for the methods from
469
# OrdinaryDiffEq.jl
470
# Corresponding issue: https://github.com/trixi-framework/Trixi.jl/issues/1877
471
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 15000
472
end
473
end
474
475
@trixi_testset "elixir_euler_sedov_blast_wave.jl (HLLE)" begin
476
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_sedov_blast_wave.jl"),
477
l2=[
478
0.352405949321075,
479
0.17207721487429464,
480
0.17207721487433883,
481
0.6263024434020885
482
],
483
linf=[
484
2.760997358628186,
485
1.8279186132509326,
486
1.8279186132502805,
487
6.251573757093399
488
],
489
tspan=(0.0, 0.5),
490
callbacks=CallbackSet(summary_callback,
491
analysis_callback, alive_callback,
492
stepsize_callback),
493
surface_flux=flux_hlle),
494
# Ensure that we do not have excessive memory allocations
495
# (e.g., from type instabilities)
496
let
497
t = sol.t[end]
498
u_ode = sol.u[end]
499
du_ode = similar(u_ode)
500
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
501
end
502
end
503
504
@trixi_testset "elixir_euler_positivity.jl" begin
505
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_positivity.jl"),
506
l2=[
507
0.48862067511841695,
508
0.16787541578869494,
509
0.16787541578869422,
510
0.6184319933114926
511
],
512
linf=[
513
2.6766520821013002,
514
1.2910938760258996,
515
1.2910938760258899,
516
6.473385481404865
517
],
518
tspan=(0.0, 1.0),)
519
# Ensure that we do not have excessive memory allocations
520
# (e.g., from type instabilities)
521
let
522
t = sol.t[end]
523
u_ode = sol.u[end]
524
du_ode = similar(u_ode)
525
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
526
end
527
end
528
529
@trixi_testset "elixir_euler_blob_mortar.jl" begin
530
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_blob_mortar.jl"),
531
l2=[
532
0.22271619518391986,
533
0.6284824759323494,
534
0.24864213447943648,
535
2.9591811489995474
536
],
537
linf=[
538
9.15245400430106,
539
24.96562810334389,
540
10.388109127032374,
541
101.20581544156934
542
],
543
tspan=(0.0, 0.5))
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_euler_blob_amr.jl" begin
555
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_blob_amr.jl"),
556
l2=[
557
0.2086261501910662,
558
1.2118352377894666,
559
0.10255333189606497,
560
5.296238138639236
561
],
562
linf=[
563
14.829071984498198,
564
74.12967742435727,
565
6.863554388300223,
566
303.58813147491134
567
],
568
tspan=(0.0, 0.12),)
569
# Ensure that we do not have excessive memory allocations
570
# (e.g., from type instabilities)
571
let
572
t = sol.t[end]
573
u_ode = sol.u[end]
574
du_ode = similar(u_ode)
575
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
576
end
577
end
578
579
@trixi_testset "elixir_euler_kelvin_helmholtz_instability_fjordholm_etal.jl" begin
580
@test_trixi_include(joinpath(EXAMPLES_DIR,
581
"elixir_euler_kelvin_helmholtz_instability_fjordholm_etal.jl"),
582
l2=[
583
0.1057230211245312,
584
0.10621112311257341,
585
0.07260957505339989,
586
0.11178239111065721
587
],
588
linf=[
589
2.998719417992662,
590
2.1400285015556166,
591
1.1569648700415078,
592
1.8922492268110913
593
],
594
tspan=(0.0, 0.1))
595
# Ensure that we do not have excessive memory allocations
596
# (e.g., from type instabilities)
597
let
598
t = sol.t[end]
599
u_ode = sol.u[end]
600
du_ode = similar(u_ode)
601
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
602
end
603
end
604
605
@trixi_testset "elixir_euler_kelvin_helmholtz_instability.jl" begin
606
@test_trixi_include(joinpath(EXAMPLES_DIR,
607
"elixir_euler_kelvin_helmholtz_instability.jl"),
608
l2=[
609
0.055691508271624536,
610
0.032986009333751655,
611
0.05224390923711999,
612
0.08009536362771563
613
],
614
linf=[
615
0.24043622527087494,
616
0.1660878796929941,
617
0.12355946691711608,
618
0.2694290787257758
619
],
620
tspan=(0.0, 0.2))
621
# Ensure that we do not have excessive memory allocations
622
# (e.g., from type instabilities)
623
let
624
t = sol.t[end]
625
u_ode = sol.u[end]
626
du_ode = similar(u_ode)
627
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
628
end
629
end
630
631
@trixi_testset "elixir_euler_kelvin_helmholtz_instability_amr.jl" begin
632
@test_trixi_include(joinpath(EXAMPLES_DIR,
633
"elixir_euler_kelvin_helmholtz_instability_amr.jl"),
634
l2=[
635
0.05569452733654995,
636
0.033107109983417926,
637
0.05223609622852158,
638
0.08007777597488817
639
],
640
linf=[
641
0.2535807803900303,
642
0.17397028249895308,
643
0.12321616095649354,
644
0.269046666668995
645
],
646
tspan=(0.0, 0.2),)
647
# Ensure that we do not have excessive memory allocations
648
# (e.g., from type instabilities)
649
let
650
t = sol.t[end]
651
u_ode = sol.u[end]
652
du_ode = similar(u_ode)
653
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
654
end
655
end
656
657
@trixi_testset "elixir_euler_kelvin_helmholtz_instability_sc_subcell.jl" begin
658
rm(joinpath("out", "deviations.txt"), force = true)
659
@test_trixi_include(joinpath(EXAMPLES_DIR,
660
"elixir_euler_kelvin_helmholtz_instability_sc_subcell.jl"),
661
l2=[
662
0.42185634563805724,
663
0.1686471269704017,
664
0.18240674916968103,
665
0.17858250604280654
666
],
667
linf=[
668
1.7012978064377158,
669
0.7149714986746726,
670
0.5822547982757897,
671
0.7300051017382696
672
],
673
tspan=(0.0, 2.0),
674
save_errors=true)
675
lines = readlines(joinpath("out", "deviations.txt"))
676
@test lines[1] == "# iter, simu_time, rho_min, pressure_min"
677
# Run takes 745 time steps
678
@test startswith(lines[end], "745")
679
# Ensure that we do not have excessive memory allocations
680
# (e.g., from type instabilities)
681
let
682
t = sol.t[end]
683
u_ode = sol.u[end]
684
du_ode = similar(u_ode)
685
# Larger values for allowed allocations due to usage of custom
686
# integrator which are not *recorded* for the methods from
687
# OrdinaryDiffEq.jl
688
# Corresponding issue: https://github.com/trixi-framework/Trixi.jl/issues/1877
689
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 15000
690
end
691
end
692
693
@trixi_testset "elixir_euler_colliding_flow.jl" begin
694
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_colliding_flow.jl"),
695
l2=[
696
0.007237139090503349,
697
0.044887582765386916,
698
1.0453570959003603e-6,
699
0.6627307840935432
700
],
701
linf=[
702
0.19437260992446315,
703
0.5554343646648533,
704
5.943891455255412e-5,
705
15.188919846360125
706
],
707
tspan=(0.0, 0.1))
708
# Ensure that we do not have excessive memory allocations
709
# (e.g., from type instabilities)
710
let
711
t = sol.t[end]
712
u_ode = sol.u[end]
713
du_ode = similar(u_ode)
714
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
715
end
716
end
717
718
@trixi_testset "elixir_euler_colliding_flow_amr.jl" begin
719
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_colliding_flow_amr.jl"),
720
l2=[
721
0.006768801432802192,
722
0.032184992228603666,
723
6.923887797276484e-7,
724
0.6784222932398366
725
],
726
linf=[
727
0.2508663007713608,
728
0.4097017076529792,
729
0.0003528986458217968,
730
22.435474993016918
731
],
732
tspan=(0.0, 0.1),)
733
# Ensure that we do not have excessive memory allocations
734
# (e.g., from type instabilities)
735
let
736
t = sol.t[end]
737
u_ode = sol.u[end]
738
du_ode = similar(u_ode)
739
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
740
end
741
end
742
743
@trixi_testset "elixir_euler_colliding_flow_amr_entropy_bounded.jl" begin
744
@test_trixi_include(joinpath(EXAMPLES_DIR,
745
"elixir_euler_colliding_flow_amr_entropy_bounded.jl"),
746
l2=[
747
0.04120588220419942,
748
0.09868046588789257,
749
7.446553779796626e-7,
750
5.5746513268066105
751
],
752
linf=[
753
0.3478655090378702,
754
0.864011305195807,
755
5.419432288048388e-5,
756
47.284459667934684
757
],
758
tspan=(0.0, 1.0),
759
dt=2.5e-2, adaptive=false,)
760
# Ensure that we do not have excessive memory allocations
761
# (e.g., from type instabilities)
762
let
763
t = sol.t[end]
764
u_ode = sol.u[end]
765
du_ode = similar(u_ode)
766
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
767
end
768
end
769
770
@trixi_testset "elixir_euler_astro_jet_amr.jl" begin
771
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_astro_jet_amr.jl"),
772
l2=[
773
0.011338365293662804,
774
10.09743543555765,
775
0.00392429463200361,
776
4031.7811487690506
777
],
778
linf=[
779
3.3178633141984193,
780
2993.6445033486402,
781
8.031723414357423,
782
1.1918867260293828e6
783
],
784
tspan=(0.0, 1.0e-7),)
785
# Ensure that we do not have excessive memory allocations
786
# (e.g., from type instabilities)
787
let
788
t = sol.t[end]
789
u_ode = sol.u[end]
790
du_ode = similar(u_ode)
791
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
792
end
793
end
794
795
@trixi_testset "elixir_euler_vortex.jl" begin
796
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_vortex.jl"),
797
l2=[
798
0.00013492249515826863,
799
0.006615696236378061,
800
0.006782108219800376,
801
0.016393831451740604
802
],
803
linf=[
804
0.0020782600954247776,
805
0.08150078921935999,
806
0.08663621974991986,
807
0.2829930622010579
808
])
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
@trixi_testset "elixir_euler_vortex_mortar.jl" begin
820
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_vortex_mortar.jl"),
821
# Expected errors are exactly the same as in the parallel test!
822
l2=[
823
0.0017208369388227673,
824
0.09628684992237334,
825
0.09620157717330868,
826
0.1758809552387432
827
],
828
linf=[
829
0.021869936355319086,
830
0.9956698009442038,
831
1.0002507727219028,
832
2.223249697515648
833
])
834
# Ensure that we do not have excessive memory allocations
835
# (e.g., from type instabilities)
836
let
837
t = sol.t[end]
838
u_ode = sol.u[end]
839
du_ode = similar(u_ode)
840
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
841
end
842
end
843
844
@trixi_testset "elixir_euler_vortex_mortar_split.jl" begin
845
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_vortex_mortar_split.jl"),
846
l2=[
847
0.0017203323613648241,
848
0.09628962878682261,
849
0.09621241164155782,
850
0.17585995600340926
851
],
852
linf=[
853
0.021740570456931674,
854
0.9938841665880938,
855
1.004140123355135,
856
2.224108857746245
857
])
858
# Ensure that we do not have excessive memory allocations
859
# (e.g., from type instabilities)
860
let
861
t = sol.t[end]
862
u_ode = sol.u[end]
863
du_ode = similar(u_ode)
864
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
865
end
866
end
867
868
@trixi_testset "elixir_euler_vortex_shockcapturing.jl" begin
869
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_vortex_shockcapturing.jl"),
870
l2=[
871
0.0017158367642679273,
872
0.09619888722871434,
873
0.09616432767924141,
874
0.17553381166255197
875
],
876
linf=[
877
0.021853862449723982,
878
0.9878047229255944,
879
0.9880191167111795,
880
2.2154030488035588
881
])
882
# Ensure that we do not have excessive memory allocations
883
# (e.g., from type instabilities)
884
let
885
t = sol.t[end]
886
u_ode = sol.u[end]
887
du_ode = similar(u_ode)
888
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
889
end
890
end
891
892
@trixi_testset "elixir_euler_vortex_mortar_shockcapturing.jl" begin
893
@test_trixi_include(joinpath(EXAMPLES_DIR,
894
"elixir_euler_vortex_mortar_shockcapturing.jl"),
895
l2=[
896
0.0017203324051381415,
897
0.09628962899999398,
898
0.0962124115572114,
899
0.1758599596626405
900
],
901
linf=[
902
0.021740568112562086,
903
0.9938841624655501,
904
1.0041401179009877,
905
2.2241087041100798
906
])
907
# Ensure that we do not have excessive memory allocations
908
# (e.g., from type instabilities)
909
let
910
t = sol.t[end]
911
u_ode = sol.u[end]
912
du_ode = similar(u_ode)
913
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
914
end
915
end
916
917
@trixi_testset "elixir_euler_vortex_amr.jl" begin
918
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_vortex_amr.jl"),
919
# Expected errors are exactly the same as in the parallel test!
920
l2=[
921
5.051719943432265e-5,
922
0.0022574259317084747,
923
0.0021755998463189713,
924
0.004346492398617521
925
],
926
linf=[
927
0.0012880114865917447,
928
0.03857193149447702,
929
0.031090457959835893,
930
0.12125130332971423
931
])
932
# Ensure that we do not have excessive memory allocations
933
# (e.g., from type instabilities)
934
let
935
t = sol.t[end]
936
u_ode = sol.u[end]
937
du_ode = similar(u_ode)
938
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
939
end
940
end
941
942
@trixi_testset "elixir_euler_vortex_er.jl" begin
943
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_vortex_er.jl"),
944
l2=[
945
0.02611497083247329,
946
0.1381802635983644,
947
0.11459980510262816,
948
0.43782810743830725
949
],
950
linf=[
951
0.2918576464635866,
952
1.1190399715083816,
953
0.7978297797951908,
954
3.8946074718596115
955
])
956
# Larger values for allowed allocations due to usage of custom
957
# integrator which are not *recorded* for the methods from
958
# OrdinaryDiffEq.jl
959
# Corresponding issue: https://github.com/trixi-framework/Trixi.jl/issues/1877
960
let
961
t = sol.t[end]
962
u_ode = sol.u[end]
963
du_ode = similar(u_ode)
964
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 15_000
965
end
966
967
# test both short and long printing formats
968
@test_nowarn show(relaxation_solver)
969
println()
970
@test_nowarn println(relaxation_solver)
971
println()
972
@test_nowarn display(relaxation_solver)
973
# Test `:compact` printing
974
show(IOContext(IOBuffer(), :compact => true), MIME"text/plain"(), relaxation_solver)
975
end
976
977
@trixi_testset "elixir_euler_ec.jl with boundary_condition_slip_wall" begin
978
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_ec.jl"),
979
l2=[
980
0.03341239373099515,
981
0.026673245711492915,
982
0.026678871434568822,
983
0.12397486476145089
984
],
985
linf=[
986
0.3290981764688339,
987
0.3812055782309788,
988
0.3812041851225023,
989
1.168251216556933
990
],
991
periodicity=false,
992
boundary_conditions=boundary_condition_slip_wall,
993
cfl=0.3, tspan=(0.0, 0.1)) # this test is sensitive to the CFL factor
994
# Ensure that we do not have excessive memory allocations
995
# (e.g., from type instabilities)
996
let
997
t = sol.t[end]
998
u_ode = sol.u[end]
999
du_ode = similar(u_ode)
1000
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
1001
end
1002
end
1003
1004
@trixi_testset "elixir_euler_warm_bubble.jl" begin
1005
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_warm_bubble.jl"),
1006
l2=[
1007
0.0001379946769624388,
1008
0.02078779689715382,
1009
0.033237241571263176,
1010
31.36068872331705
1011
],
1012
linf=[
1013
0.0016286690573188434,
1014
0.15623770697198225,
1015
0.3341371832270615,
1016
334.5373488726036
1017
],
1018
tspan=(0.0, 10.0),
1019
initial_refinement_level=4)
1020
# Ensure that we do not have excessive memory allocations
1021
# (e.g., from type instabilities)
1022
let
1023
t = sol.t[end]
1024
u_ode = sol.u[end]
1025
du_ode = similar(u_ode)
1026
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 100
1027
end
1028
end
1029
1030
# Coverage test for all initial conditions
1031
@testset "Compressible Euler: Tests for initial conditions" begin
1032
@trixi_testset "elixir_euler_vortex.jl one step with initial_condition_constant" begin
1033
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_vortex.jl"),
1034
l2=[
1035
1.1790213022362371e-16,
1036
8.580657423476384e-17,
1037
1.3082387431804115e-16,
1038
1.6182739965672862e-15
1039
],
1040
linf=[
1041
3.3306690738754696e-16,
1042
2.220446049250313e-16,
1043
5.273559366969494e-16,
1044
3.552713678800501e-15
1045
],
1046
maxiters=1,
1047
initial_condition=initial_condition_constant)
1048
# Ensure that we do not have excessive memory allocations
1049
# (e.g., from type instabilities)
1050
let
1051
t = sol.t[end]
1052
u_ode = sol.u[end]
1053
du_ode = similar(u_ode)
1054
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
1055
end
1056
end
1057
1058
@trixi_testset "elixir_euler_sedov_blast_wave.jl one step" begin
1059
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_sedov_blast_wave.jl"),
1060
l2=[
1061
0.0021196114178949396,
1062
0.010703549234544042,
1063
0.01070354923454404,
1064
0.10719124037195142
1065
],
1066
linf=[
1067
0.11987270645890724,
1068
0.7468615461136827,
1069
0.7468615461136827,
1070
3.910689155287799
1071
],
1072
maxiters=1)
1073
1074
# Ensure that we do not have excessive memory allocations
1075
# (e.g., from type instabilities)
1076
let
1077
t = sol.t[end]
1078
u_ode = sol.u[end]
1079
du_ode = similar(u_ode)
1080
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
1081
end
1082
end
1083
end
1084
1085
# Constant subsonic flow test
1086
@trixi_testset "elixir_euler_subsonic_constant.jl" begin
1087
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_subsonic_constant.jl"),
1088
l2=[
1089
9.135564506684991e-14, 1.9441147665983966e-14,
1090
1.94425866451226e-14, 1.7503189225604875e-13
1091
],
1092
linf=[
1093
1.0769163338864018e-13, 8.487407677783974e-14,
1094
8.515583343047957e-14, 2.0472512574087887e-13
1095
],
1096
initial_refinement_level=7,
1097
tspan=(0.0, 0.1))
1098
# Ensure that we do not have excessive memory allocations
1099
# (e.g., from type instabilities)
1100
let
1101
t = sol.t[end]
1102
u_ode = sol.u[end]
1103
du_ode = similar(u_ode)
1104
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
1105
end
1106
end
1107
1108
@trixi_testset "elixir_euler_riemannproblem_quadrants_amr.jl" begin
1109
@test_trixi_include(joinpath(EXAMPLES_DIR,
1110
"elixir_euler_riemannproblem_quadrants_amr.jl"),
1111
tspan=(0.0, 0.05),
1112
l2=[
1113
0.12802172216950314,
1114
0.1333199240875145,
1115
0.13331992408751456,
1116
0.48888051192644405
1117
],
1118
linf=[
1119
0.853710403180942,
1120
0.9151148367639803,
1121
0.9151148367639808,
1122
3.4300525777582864
1123
])
1124
# Ensure that we do not have excessive memory allocations
1125
# (e.g., from type instabilities)
1126
let
1127
t = sol.t[end]
1128
u_ode = sol.u[end]
1129
du_ode = similar(u_ode)
1130
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
1131
end
1132
end
1133
end
1134
1135
end # module
1136
1137