Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
trixi-framework
GitHub Repository: trixi-framework/Trixi.jl
Path: blob/main/test/test_tree_1d_euler.jl
5582 views
1
module TestExamples1DEuler
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 "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
2.2527950196212703e-8,
17
1.8187357193835156e-8,
18
7.705669939973104e-8],
19
linf=[
20
1.6205433861493646e-7,
21
1.465427772462391e-7,
22
5.372255111879554e-7
23
])
24
# Ensure that we do not have excessive memory allocations
25
# (e.g., from type instabilities)
26
@test_allocations(Trixi.rhs!, semi, sol, 1000)
27
# Extra test to make sure the "TimeSeriesCallback" made correct data.
28
# Extracts data at all points from the first step of the time series and compares it to the
29
# exact solution and an interpolated reference solution
30
point_data = [getindex(time_series.affect!.point_data[i], 1:3) for i in 1:3]
31
exact_data = [initial_condition_convergence_test(time_series.affect!.point_coordinates[i],
32
time_series.affect!.time[1],
33
equations) for i in 1:3]
34
ref_data = [[1.968279088772251, 1.9682791565395945, 3.874122958278797],
35
[2.0654816955822017, 2.0654817326611883, 4.26621471136323],
36
[2.0317209235018936, 2.0317209516429506, 4.127889808862571]]
37
@test point_data≈exact_data atol=1e-6
38
@test point_data ref_data
39
end
40
41
@trixi_testset "elixir_euler_convergence_pure_fv.jl" begin
42
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_convergence_pure_fv.jl"),
43
l2=[
44
0.019355699748523896,
45
0.022326984561234497,
46
0.02523665947241734
47
],
48
linf=[
49
0.02895961127645519,
50
0.03293442484199227,
51
0.04246098278632804
52
])
53
# Ensure that we do not have excessive memory allocations
54
# (e.g., from type instabilities)
55
@test_allocations(Trixi.rhs!, semi, sol, 1000)
56
end
57
58
@trixi_testset "elixir_euler_convergence_pure_fv.jl (O2, constant reconstruction)" begin
59
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_convergence_pure_fv.jl"),
60
volume_integral=VolumeIntegralPureLGLFiniteVolumeO2(LobattoLegendreBasis(3),
61
volume_flux_fv = flux_hllc,
62
reconstruction_mode = reconstruction_constant,
63
slope_limiter = central_slope),
64
l2=[
65
0.019355699748523896,
66
0.022326984561234497,
67
0.02523665947241734
68
],
69
linf=[
70
0.02895961127645519,
71
0.03293442484199227,
72
0.04246098278632804
73
])
74
# Ensure that we do not have excessive memory allocations
75
# (e.g., from type instabilities)
76
@test_allocations(Trixi.rhs!, semi, sol, 1000)
77
end
78
79
@trixi_testset "elixir_euler_density_wave.jl" begin
80
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_density_wave.jl"),
81
l2=[
82
0.0011482554820217855,
83
0.00011482554830323462,
84
5.741277429325267e-6
85
],
86
linf=[
87
0.004090978306812376,
88
0.0004090978313582294,
89
2.045489210189544e-5
90
])
91
# Ensure that we do not have excessive memory allocations
92
# (e.g., from type instabilities)
93
@test_allocations(Trixi.rhs!, semi, sol, 1000)
94
end
95
96
@trixi_testset "elixir_euler_density_wave.jl with initial_condition_constant" begin
97
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_density_wave.jl"),
98
l2=[
99
7.71293052584723e-16,
100
1.9712947511091717e-14,
101
7.50672833504266e-15
102
],
103
linf=[
104
3.774758283725532e-15,
105
6.733502644351574e-14,
106
2.4868995751603507e-14
107
],
108
initial_condition=initial_condition_constant)
109
# Ensure that we do not have excessive memory allocations
110
# (e.g., from type instabilities)
111
@test_allocations(Trixi.rhs!, semi, sol, 1000)
112
end
113
114
@trixi_testset "elixir_euler_density_wave_adaptive_vol_int.jl" begin
115
@test_trixi_include(joinpath(EXAMPLES_DIR,
116
"elixir_euler_density_wave_adaptive_vol_int.jl"),
117
l2=[
118
0.07468001770571216,
119
0.007468001770606171,
120
0.000373400088537588
121
],
122
linf=[
123
0.2796538165732152,
124
0.02796538165747514,
125
0.0013982690828555633
126
])
127
# Ensure that we do not have excessive memory allocations
128
# (e.g., from type instabilities)
129
@test_allocations(Trixi.rhs!, semi, sol, 1000)
130
end
131
132
@trixi_testset "elixir_euler_source_terms_nonperiodic.jl" begin
133
@test_trixi_include(joinpath(EXAMPLES_DIR,
134
"elixir_euler_source_terms_nonperiodic.jl"),
135
l2=[
136
3.8099996914101204e-6,
137
1.6745575717106341e-6,
138
7.732189531480852e-6
139
],
140
linf=[
141
1.2971473393186272e-5,
142
9.270328934274374e-6,
143
3.092514399671842e-5
144
])
145
# Ensure that we do not have excessive memory allocations
146
# (e.g., from type instabilities)
147
@test_allocations(Trixi.rhs!, semi, sol, 1000)
148
end
149
150
@trixi_testset "elixir_euler_source_terms_nonperiodic.jl (Gauss-Legendre)" begin
151
@test_trixi_include(joinpath(EXAMPLES_DIR,
152
"elixir_euler_source_terms_nonperiodic.jl"),
153
solver=DGSEM(polydeg = 3, basis_type = GaussLegendreBasis,
154
surface_flux = flux_lax_friedrichs),
155
l2=[
156
6.179119971404758e-7,
157
6.831335637140733e-7,
158
1.8153512648336213e-6
159
],
160
linf=[
161
2.3035825069683824e-6,
162
2.7398314812465685e-6,
163
7.132056524916663e-6
164
])
165
# Ensure that we do not have excessive memory allocations
166
# (e.g., from type instabilities)
167
@test_allocations(Trixi.rhs!, semi, sol, 1000)
168
end
169
170
@trixi_testset "elixir_euler_ec.jl" begin
171
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_ec.jl"),
172
l2=[
173
0.11821957357197649,
174
0.15330089521538678,
175
0.4417674632047301
176
],
177
linf=[
178
0.24280567569982958,
179
0.29130548795961936,
180
0.8847009003152442
181
])
182
# Ensure that we do not have excessive memory allocations
183
# (e.g., from type instabilities)
184
@test_allocations(Trixi.rhs!, semi, sol, 1000)
185
end
186
187
@trixi_testset "elixir_euler_ec.jl with flux_kennedy_gruber" begin
188
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_ec.jl"),
189
l2=[
190
0.07803455838661963,
191
0.10032577312032283,
192
0.29228156303827935
193
],
194
linf=[
195
0.2549869853794955,
196
0.3376472164661263,
197
0.9650477546553962
198
],
199
maxiters=10,
200
surface_flux=flux_kennedy_gruber,
201
volume_flux=flux_kennedy_gruber)
202
# Ensure that we do not have excessive memory allocations
203
# (e.g., from type instabilities)
204
@test_allocations(Trixi.rhs!, semi, sol, 1000)
205
end
206
207
@trixi_testset "elixir_euler_ec.jl with flux_shima_etal" begin
208
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_ec.jl"),
209
l2=[
210
0.07800654460172655,
211
0.10030365573277883,
212
0.2921481199111959
213
],
214
linf=[
215
0.25408579350400395,
216
0.3388657679031271,
217
0.9776486386921928
218
],
219
maxiters=10,
220
surface_flux=flux_shima_etal,
221
volume_flux=flux_shima_etal)
222
# Ensure that we do not have excessive memory allocations
223
# (e.g., from type instabilities)
224
@test_allocations(Trixi.rhs!, semi, sol, 1000)
225
end
226
227
@trixi_testset "elixir_euler_ec.jl with flux_chandrashekar" begin
228
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_ec.jl"),
229
l2=[
230
0.07801923089205756,
231
0.10039557434912669,
232
0.2922210399923278
233
],
234
linf=[
235
0.2576521982607225,
236
0.3409717926625057,
237
0.9772961936567048
238
],
239
maxiters=10,
240
surface_flux=flux_chandrashekar,
241
volume_flux=flux_chandrashekar)
242
# Ensure that we do not have excessive memory allocations
243
# (e.g., from type instabilities)
244
@test_allocations(Trixi.rhs!, semi, sol, 1000)
245
end
246
247
@trixi_testset "elixir_euler_ec.jl with flux_hll" begin
248
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_ec.jl"),
249
l2=[0.07855251823583848, 0.10213903748267686, 0.293985892532479],
250
linf=[
251
0.192621556068018,
252
0.25184744005299536,
253
0.7264977555504792
254
],
255
maxiters=10,
256
surface_flux=flux_hll,
257
volume_flux=flux_ranocha)
258
# Ensure that we do not have excessive memory allocations
259
# (e.g., from type instabilities)
260
@test_allocations(Trixi.rhs!, semi, sol, 1000)
261
end
262
263
@trixi_testset "elixir_euler_modified_sod.jl" begin
264
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_modified_sod.jl"),
265
l2=[
266
0.26349506781509047,
267
0.4513675325534254,
268
0.9267120782427303],
269
linf=[
270
0.5943951748778555,
271
0.8137950751741141,
272
1.8213980620968218
273
],
274
adaptive=false)
275
# Ensure that we do not have excessive memory allocations
276
# (e.g., from type instabilities)
277
@test_allocations(Trixi.rhs!, semi, sol, 1000)
278
end
279
280
@trixi_testset "elixir_euler_modified_sod.jl (Weak Form + Positivity Preserving Limiter)" begin
281
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_modified_sod.jl"),
282
volume_integral=VolumeIntegralWeakForm(),
283
ode_alg=SSPRK43(stage_limiter! = PositivityPreservingLimiterZhangShu(thresholds = (5.0e-6,
284
5.0e-6),
285
variables = (Trixi.density,
286
pressure))),
287
l2=[
288
0.25447577347459555,
289
0.4522025971222652,
290
0.905120285656665],
291
linf=[
292
0.492497205699472,
293
0.8282754221813863,
294
1.542007170560898
295
],
296
adaptive=false)
297
# Ensure that we do not have excessive memory allocations
298
# (e.g., from type instabilities)
299
@test_allocations(Trixi.rhs!, semi, sol, 1000)
300
end
301
302
@trixi_testset "elixir_euler_shockcapturing.jl" begin
303
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_shockcapturing.jl"),
304
l2=[
305
0.11606096465319675,
306
0.15028768943458806,
307
0.4328230323046703
308
],
309
linf=[
310
0.18031710091067965,
311
0.2351582421501841,
312
0.6776805692092567
313
])
314
# Ensure that we do not have excessive memory allocations
315
# (e.g., from type instabilities)
316
@test_allocations(Trixi.rhs!, semi, sol, 1000)
317
end
318
319
@trixi_testset "elixir_euler_sedov_blast_wave.jl" begin
320
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_sedov_blast_wave.jl"),
321
l2=[1.250005061244617, 0.06878411345533507, 0.9264328311018613],
322
linf=[
323
2.9766770877037168,
324
0.16838100902295852,
325
2.6655773445485798
326
])
327
# Ensure that we do not have excessive memory allocations
328
# (e.g., from type instabilities)
329
@test_allocations(Trixi.rhs!, semi, sol, 1000)
330
end
331
332
@trixi_testset "elixir_euler_sedov_blast_wave.jl (HLLE)" begin
333
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_sedov_blast_wave.jl"),
334
l2=[0.6442208390304879, 0.508817280068289, 0.9482809853033687],
335
linf=[3.007059066482486, 2.4678899558345506, 2.3952311739389787],
336
tspan=(0.0, 0.5),
337
surface_flux=flux_hlle)
338
# Ensure that we do not have excessive memory allocations
339
# (e.g., from type instabilities)
340
@test_allocations(Trixi.rhs!, semi, sol, 1000)
341
end
342
343
@trixi_testset "elixir_euler_sedov_blast_wave_pure_fv.jl" begin
344
@test_trixi_include(joinpath(EXAMPLES_DIR,
345
"elixir_euler_sedov_blast_wave_pure_fv.jl"),
346
l2=[1.0735456065491455, 0.07131078703089379, 0.9205739468590453],
347
linf=[
348
3.4296365168219216,
349
0.17635583964559245,
350
2.6574584326179505
351
])
352
# Ensure that we do not have excessive memory allocations
353
# (e.g., from type instabilities)
354
@test_allocations(Trixi.rhs!, semi, sol, 1000)
355
end
356
357
@trixi_testset "elixir_euler_sedov_blast_wave.jl with pressure" begin
358
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_sedov_blast_wave.jl"),
359
l2=[1.297525985166995, 0.07964929522694145, 0.9269991156246368],
360
linf=[
361
3.1773015255764427,
362
0.21331831536493773,
363
2.6650170188241047
364
],
365
shock_indicator_variable=pressure,
366
cfl=0.2)
367
# Ensure that we do not have excessive memory allocations
368
# (e.g., from type instabilities)
369
@test_allocations(Trixi.rhs!, semi, sol, 1000)
370
end
371
372
@trixi_testset "elixir_euler_sedov_blast_wave.jl with density" begin
373
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_sedov_blast_wave.jl"),
374
l2=[1.2798798835860528, 0.07103461242058921, 0.9273792517187003],
375
linf=[
376
3.1087017048015824,
377
0.17734706962928956,
378
2.666689753470263
379
],
380
shock_indicator_variable=density,
381
cfl=0.2)
382
# Ensure that we do not have excessive memory allocations
383
# (e.g., from type instabilities)
384
@test_allocations(Trixi.rhs!, semi, sol, 1000)
385
end
386
387
@trixi_testset "elixir_euler_positivity.jl" begin
388
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_positivity.jl"),
389
l2=[1.6493820253458906, 0.19793887460986834, 0.9783506076125921],
390
linf=[4.71751203912051, 0.5272411022735763, 2.7426163947635844])
391
# Ensure that we do not have excessive memory allocations
392
# (e.g., from type instabilities)
393
@test_allocations(Trixi.rhs!, semi, sol, 1000)
394
end
395
396
@trixi_testset "elixir_euler_blast_wave.jl" begin
397
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_blast_wave.jl"),
398
l2=[0.21934822867340323, 0.28131919126002686, 0.554361702716662],
399
linf=[
400
1.5180897390290355,
401
1.3967085956620369,
402
2.0663825294019595
403
],
404
maxiters=30)
405
# Ensure that we do not have excessive memory allocations
406
# (e.g., from type instabilities)
407
@test_allocations(Trixi.rhs!, semi, sol, 1000)
408
end
409
410
@trixi_testset "elixir_euler_shu_osher.jl" begin
411
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_shu_osher.jl"),
412
abstol=1e-11, reltol=1e-11,
413
l2=[0.5003722074045994, 1.7969921454130888, 6.505994574859934],
414
linf=[2.9946689312100907, 10.11428777614952, 36.371663950285836],
415
tspan=(0.0, 0.1))
416
# Ensure that we do not have excessive memory allocations
417
# (e.g., from type instabilities)
418
@test_allocations(Trixi.rhs!, semi, sol, 1000)
419
420
# Test/cover `:compact` `show`
421
@test_nowarn show(IOContext(IOBuffer(), :compact => true), MIME"text/plain"(),
422
volume_integral)
423
@test_nowarn show(IOContext(IOBuffer(), :compact => false), MIME"text/plain"(),
424
volume_integral)
425
end
426
427
@trixi_testset "elixir_euler_blast_wave_entropy_bounded.jl" begin
428
@test_trixi_include(joinpath(EXAMPLES_DIR,
429
"elixir_euler_blast_wave_entropy_bounded.jl"),
430
l2=[0.9689207881108007, 0.1617708899929322, 1.3847895715669456],
431
linf=[2.95591859210077, 0.3135723412205586, 2.3871554358655365])
432
# Ensure that we do not have excessive memory allocations
433
# (e.g., from type instabilities)
434
@test_allocations(Trixi.rhs!, semi, sol, 1000)
435
end
436
437
@trixi_testset "test_quasi_1D_entropy" begin
438
using Trixi: CompressibleEulerEquationsQuasi1D, CompressibleEulerEquations1D,
439
entropy, SVector
440
a = 0.9
441
u_1D = SVector(1.1, 0.2, 2.1)
442
u_quasi_1D = SVector(a * 1.1, a * 0.2, a * 2.1, a)
443
@test entropy(u_quasi_1D, CompressibleEulerEquationsQuasi1D(1.4))
444
a * entropy(u_1D, CompressibleEulerEquations1D(1.4))
445
end
446
447
@trixi_testset "elixir_euler_quasi_1d_source_terms.jl" begin
448
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_quasi_1d_source_terms.jl"),
449
l2=[
450
3.876288369618363e-7,
451
2.2247043122302947e-7,
452
2.964004224572679e-7,
453
5.2716983399807875e-8
454
],
455
linf=[
456
2.3925118561862746e-6,
457
1.3603693522767912e-6,
458
1.821888865105592e-6,
459
1.1166012159335992e-7
460
])
461
462
# Ensure that we do not have excessive memory allocations
463
# (e.g., from type instabilities)
464
@test_allocations(Trixi.rhs!, semi, sol, 1000)
465
end
466
467
@trixi_testset "elixir_euler_quasi_1d_source_terms_dirichlet.jl" begin
468
@test_trixi_include(joinpath(EXAMPLES_DIR,
469
"elixir_euler_quasi_1d_source_terms_dirichlet.jl"),
470
l2=[
471
4.872024234552286e-7,
472
3.130367137655672e-7,
473
3.769970598394213e-7,
474
5.271698341013997e-8
475
],
476
linf=[
477
3.2661405451328562e-6,
478
1.7577543389712957e-6,
479
2.5106918934980627e-6,
480
1.1166012159335992e-7
481
])
482
# Ensure that we do not have excessive memory allocations
483
# (e.g., from type instabilities)
484
@test_allocations(Trixi.rhs!, semi, sol, 1000)
485
end
486
487
@trixi_testset "elixir_euler_quasi_1d_source_terms_dirichlet.jl with LLF-dissipation" begin
488
@test_trixi_include(joinpath(EXAMPLES_DIR,
489
"elixir_euler_quasi_1d_source_terms_dirichlet.jl"),
490
l2=[
491
9.186083331399549e-7,
492
4.6021844470935155e-7,
493
6.652256237473482e-7,
494
5.271698341013997e-8
495
],
496
linf=[
497
3.425473511065036e-6,
498
2.1611905385299224e-6,
499
2.7957639341380514e-6,
500
1.1166012159335992e-7
501
],
502
surface_flux=(FluxPlusDissipation(flux_chan_etal,
503
DissipationLocalLaxFriedrichs()),
504
flux_nonconservative_chan_etal))
505
# Ensure that we do not have excessive memory allocations
506
# (e.g., from type instabilities)
507
@test_allocations(Trixi.rhs!, semi, sol, 1000)
508
end
509
510
@trixi_testset "elixir_euler_quasi_1d_discontinuous.jl" begin
511
@test_trixi_include(joinpath(EXAMPLES_DIR,
512
"elixir_euler_quasi_1d_discontinuous.jl"),
513
l2=[
514
0.045510421156346015,
515
0.036750584788912195,
516
0.2468985959132176,
517
0.03684494180829024
518
],
519
linf=[
520
0.3313374853025697,
521
0.11621933362158643,
522
1.827403013568638,
523
0.28045939999015723
524
])
525
# Ensure that we do not have excessive memory allocations
526
# (e.g., from type instabilities)
527
@test_allocations(Trixi.rhs!, semi, sol, 1000)
528
end
529
530
@trixi_testset "elixir_euler_quasi_1d_ec.jl" begin
531
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_quasi_1d_ec.jl"),
532
l2=[
533
0.08889113985713998,
534
0.16199235348889673,
535
0.40316524365054346,
536
2.9602775074723667e-16
537
],
538
linf=[
539
0.28891355898284043,
540
0.3752709888964313,
541
0.84477102402413,
542
8.881784197001252e-16
543
])
544
# Ensure that we do not have excessive memory allocations
545
# (e.g., from type instabilities)
546
@test_allocations(Trixi.rhs!, semi, sol, 1000)
547
end
548
549
@trixi_testset "elixir_euler_convergence_pure_fvO2.jl" begin
550
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_convergence_pure_fvO2.jl"),
551
l2=[
552
0.0004651066144227485,
553
0.0005058715155540577,
554
0.0007705686813156139
555
],
556
linf=[
557
0.0014354711538595577,
558
0.0014154880871579678,
559
0.0027044481967184453
560
])
561
# Ensure that we do not have excessive memory allocations
562
# (e.g., from type instabilities)
563
@test_allocations(Trixi.rhs!, semi, sol, 1000)
564
end
565
566
@trixi_testset "elixir_euler_laplace_diffusion.jl" begin
567
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_laplace_diffusion.jl"),
568
l2=[0.10954500481114468,
569
0.1417583694046777,
570
0.4087206508328759],
571
linf=[
572
0.17183237920520245,
573
0.2203023610743297,
574
0.6347464031934038
575
])
576
# Ensure that we do not have excessive memory allocations
577
# (e.g., from type instabilities)
578
@test_allocations(Trixi.rhs!, semi, sol, 1000)
579
end
580
581
@trixi_testset "elixir_euler_nonideal_density_wave.jl" begin
582
@test_trixi_include(joinpath(EXAMPLES_DIR,
583
"elixir_euler_nonideal_density_wave.jl"),
584
tspan=(0.0, 0.1),
585
l2=[
586
0.0015588934102678423,
587
0.0003742341750148338,
588
0.06751527068762786
589
],
590
linf=[
591
0.002915446030492097,
592
0.0007398343306145305,
593
0.19630387991431064
594
])
595
596
# Ensure that we do not have excessive memory allocations
597
# (e.g., from type instabilities)
598
@test_allocations(Trixi.rhs!, semi, sol, 1000)
599
end
600
601
@trixi_testset "elixir_euler_nonideal_density_wave.jl with FluxHLL(min_max_speed_davis)" begin
602
@test_trixi_include(joinpath(EXAMPLES_DIR,
603
"elixir_euler_nonideal_density_wave.jl"),
604
surface_flux=FluxHLL(min_max_speed_davis), tspan=(0.0, 0.1),
605
l2=[
606
0.001560204102149942,
607
0.0003730629606214752,
608
0.06761471309660204
609
],
610
linf=[
611
0.0029288236477780227,
612
0.0007326399340998047,
613
0.19711518375221715
614
])
615
616
# Ensure that we do not have excessive memory allocations
617
# (e.g., from type instabilities)
618
@test_allocations(Trixi.rhs!, semi, sol, 1000)
619
end
620
621
@trixi_testset "elixir_euler_nonideal_density_wave_FVO2.jl" begin
622
@test_trixi_include(joinpath(EXAMPLES_DIR,
623
"elixir_euler_nonideal_density_wave_FVO2.jl"),
624
l2=[
625
0.21859905356668904,
626
0.021312774105832932,
627
6.159274882735111
628
],
629
linf=[
630
0.343642444425342,
631
0.03393451559504808,
632
10.142735502826085
633
])
634
635
# Ensure that we do not have excessive memory allocations
636
# (e.g., from type instabilities)
637
@test_allocations(Trixi.rhs!, semi, sol, 1000)
638
end
639
640
@trixi_testset "elixir_euler_nonideal_density_wave.jl with ideal gas" begin
641
@test_trixi_include(joinpath(EXAMPLES_DIR,
642
"elixir_euler_nonideal_density_wave.jl"),
643
eos=IdealGas(1.4), surface_flux=FluxHLL(min_max_speed_naive),
644
tspan=(0.0, 0.1),
645
l2=[
646
0.001422862066298697,
647
0.00014228620662995602,
648
7.1143103323789825e-6
649
],
650
linf=[
651
0.0023347309200370883,
652
0.00023347309200390763,
653
1.1673654647381682e-5
654
])
655
656
# check that the IdealGas EOS recovers the same solution as
657
# CompressibleEulerEquations1D
658
sol_nonideal = deepcopy(sol)
659
660
# we pass @__MODULE__ to ensure that variables defined during the test
661
# are visible inside the @trixi_testset block
662
trixi_include(@__MODULE__,
663
joinpath(EXAMPLES_DIR,
664
"elixir_euler_nonideal_density_wave.jl"),
665
equations = CompressibleEulerEquations1D(1.4),
666
initial_condition = Trixi.initial_condition_density_wave,
667
surface_flux = FluxHLL(min_max_speed_naive),
668
tspan = (0.0, 0.1))
669
670
using LinearAlgebra: norm
671
@test norm(sol.u[end] - sol_nonideal.u[end]) < 10 * eps() * length(sol.u[end])
672
673
# Ensure that we do not have excessive memory allocations
674
# (e.g., from type instabilities)
675
@test_allocations(Trixi.rhs!, semi, sol, 1000)
676
end
677
678
@trixi_testset "elixir_euler_nonideal_density_wave.jl (IdealGas vs HelmholtzIdealGas)" begin
679
using Trixi: IdealGas, HelmholtzIdealGas, FluxHLL, min_max_speed_naive
680
681
# we pass @__MODULE__ to ensure that variables defined during the test
682
# are visible inside the @trixi_testset block
683
trixi_include(@__MODULE__,
684
joinpath(EXAMPLES_DIR,
685
"elixir_euler_nonideal_density_wave.jl"),
686
eos = IdealGas(1.4), surface_flux = FluxHLL(min_max_speed_naive),
687
tspan = (0.0, 0.1))
688
689
sol_ideal = deepcopy(sol)
690
691
# we pass @__MODULE__ to ensure that variables defined during the test
692
# are visible inside the @trixi_testset block
693
trixi_include(@__MODULE__,
694
joinpath(EXAMPLES_DIR,
695
"elixir_euler_nonideal_density_wave.jl"),
696
eos = HelmholtzIdealGas(1.4),
697
surface_flux = FluxHLL(min_max_speed_naive),
698
tspan = (0.0, 0.1))
699
700
# check that the IdealGas EOS recovers the same solution as
701
# HelmholtzIdealGas EOS
702
using LinearAlgebra: norm
703
@test norm(sol.u[end] - sol_ideal.u[end]) < 10 * eps() * length(sol.u[end])
704
end
705
706
@trixi_testset "elixir_euler_nonideal_density_wave.jl with flux_terashima_etal" begin
707
@test_trixi_include(joinpath(EXAMPLES_DIR,
708
"elixir_euler_nonideal_density_wave.jl"),
709
solver=DGSEM(polydeg = 3,
710
volume_integral = VolumeIntegralFluxDifferencing(flux_terashima_etal),
711
surface_flux = flux_lax_friedrichs),
712
tspan=(0.0, 0.1),
713
l2=[
714
0.00142950049295259,
715
0.00015714474261267127,
716
0.06074209773082164
717
],
718
linf=[
719
0.0023392515519630314,
720
0.0003073704254786813,
721
0.1641094398916465
722
])
723
724
# Ensure that we do not have excessive memory allocations
725
# (e.g., from type instabilities)
726
@test_allocations(Trixi.rhs!, semi, sol, 1000)
727
end
728
729
@trixi_testset "elixir_euler_nonideal_density_wave.jl with flux_terashima_etal_central" begin
730
@test_trixi_include(joinpath(EXAMPLES_DIR,
731
"elixir_euler_nonideal_density_wave.jl"),
732
solver=DGSEM(polydeg = 3,
733
volume_integral = VolumeIntegralFluxDifferencing(flux_central_terashima_etal),
734
surface_flux = flux_lax_friedrichs),
735
tspan=(0.0, 0.1),
736
l2=[
737
0.0014281751347953525,
738
0.0001541528829242385,
739
0.06071534187096569
740
],
741
linf=[
742
0.0023366029974749604,
743
0.00029085539996634435,
744
0.16384597075523288
745
])
746
747
# Ensure that we do not have excessive memory allocations
748
# (e.g., from type instabilities)
749
@test_allocations(Trixi.rhs!, semi, sol, 1000)
750
end
751
752
@trixi_testset "elixir_euler_modified_sod_entropy_correction_amr.jl (IndicatorEntropyCorrectionShockCapturingCombined)" begin
753
@test_trixi_include(joinpath(EXAMPLES_DIR,
754
"elixir_euler_modified_sod_entropy_correction_amr.jl"),
755
tspan=(0.0, 0.1),
756
l2=[0.18464446565258658, 0.3140498549283543, 0.6496099923312244],
757
linf=[
758
0.5635649557004835,
759
0.8086426785591834,
760
1.7109218921081835
761
])
762
763
# Ensure that we do not have excessive memory allocations
764
# (e.g., from type instabilities)
765
@test_allocations(Trixi.rhs!, semi, sol, 1000)
766
767
# Test/cover `:compact` `show` for IndicatorEntropyCorrectionShockCapturingCombined
768
@test_nowarn show(IOContext(IOBuffer(), :compact => true), MIME"text/plain"(),
769
indicator)
770
@test_nowarn show(IOContext(IOBuffer(), :compact => false), MIME"text/plain"(),
771
indicator)
772
end
773
774
@trixi_testset "elixir_euler_modified_sod_entropy_correction_amr.jl (IndicatorEntropyCorrection)" begin
775
@test_trixi_include(joinpath(EXAMPLES_DIR,
776
"elixir_euler_modified_sod_entropy_correction_amr.jl"),
777
indicator=IndicatorEntropyCorrection(equations, basis),
778
tspan=(0.0, 0.1),
779
l2=[0.18410518515764235, 0.3151497970340809, 0.6485302765750537],
780
linf=[
781
0.5561756505040076,
782
0.8355026358832652,
783
1.6896042720266948
784
])
785
786
# Ensure that we do not have excessive memory allocations
787
# (e.g., from type instabilities)
788
@test_allocations(Trixi.rhs!, semi, sol, 1000)
789
end
790
791
@trixi_testset "elixir_euler_nonideal_transcritical_wave.jl (Peng Robinson)" begin
792
@test_trixi_include(joinpath(EXAMPLES_DIR,
793
"elixir_euler_nonideal_transcritical_wave.jl"),
794
tspan=(0.0, 0.001),
795
# note that errors are large because the solution magnitude is large
796
l2=[3.5624314278401767, 307.08047341497075, 671891.3209204172],
797
linf=[
798
11.245466632528647,
799
1012.4992037314532,
800
2.193707958061479e6
801
])
802
803
# Ensure that we do not have excessive memory allocations
804
# (e.g., from type instabilities)
805
@test_allocations(Trixi.rhs!, semi, sol, 1000)
806
end
807
808
@trixi_testset "elixir_euler_nonideal_density_wave.jl with entropy correction" begin
809
@test_trixi_include(joinpath(EXAMPLES_DIR,
810
"elixir_euler_nonideal_density_wave.jl"),
811
solver=DGSEM(LobattoLegendreBasis(3), flux_lax_friedrichs,
812
VolumeIntegralAdaptive(IndicatorEntropyCorrection(equations,
813
LobattoLegendreBasis(3)),
814
VolumeIntegralWeakForm(),
815
VolumeIntegralPureLGLFiniteVolume(flux_lax_friedrichs))),
816
tspan=(0.0, 0.1),
817
l2=[
818
0.0017122131198515455,
819
0.00036348851462562144,
820
0.07342375187001934
821
],
822
linf=[
823
0.003190471783387716,
824
0.0018240656867738736,
825
0.21543232235440257
826
])
827
# Ensure that we do not have excessive memory allocations
828
# (e.g., from type instabilities)
829
@test_allocations(Trixi.rhs!, semi, sol, 1000)
830
end
831
832
@trixi_testset "elixir_euler_nonideal_transcritical_shock.jl with Peng Robinson" begin
833
@test_trixi_include(joinpath(EXAMPLES_DIR,
834
"elixir_euler_nonideal_transcritical_shock.jl"),
835
initial_condition=initial_condition_transcritical_shock,
836
tspan=(0.0, 5e-5),
837
# note that rho_e_total errors are large because pressure is 5e6
838
l2=[46.87606704575898, 12776.72009989676, 3.0691124394639865e6],
839
linf=[728.557135738047, 82812.85038902842, 7.330706462442407e7])
840
841
# Ensure that we do not have excessive memory allocations
842
# (e.g., from type instabilities)
843
@test_allocations(Trixi.rhs!, semi, sol, 1000)
844
end
845
end # testset
846
end # module
847
848