Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
trixi-framework
GitHub Repository: trixi-framework/Trixi.jl
Path: blob/main/test/test_structured_2d.jl
5582 views
1
module TestExamplesStructuredMesh2D
2
3
using Test
4
using Trixi
5
6
include("test_trixi.jl")
7
8
EXAMPLES_DIR = joinpath(examples_dir(), "structured_2d_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 "StructuredMesh2D" 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=[8.311947673061856e-6],
21
linf=[6.627000273229378e-5])
22
# Ensure that we do not have excessive memory allocations
23
# (e.g., from type instabilities)
24
@test_allocations(Trixi.rhs!, semi, sol, 1000)
25
end
26
27
@trixi_testset "elixir_advection_float32.jl" begin
28
# Expected errors are taken from elixir_advection_basic.jl
29
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_advection_float32.jl"),
30
# Expected errors are taken from elixir_advection_basic.jl
31
l2=[Float32(8.311947673061856e-6)],
32
linf=[Float32(6.627000273229378e-5)],
33
RealT_for_test_tolerances=Float32)
34
# Ensure that we do not have excessive memory allocations
35
# (e.g., from type instabilities)
36
@test_allocations(Trixi.rhs!, semi, sol, 1000)
37
end
38
39
@trixi_testset "elixir_advection_coupled.jl" begin
40
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_advection_coupled.jl"),
41
l2=[
42
7.816742843336293e-6,
43
7.816742843340186e-6,
44
7.816742843025513e-6,
45
7.816742843061526e-6
46
],
47
linf=[
48
6.314906965276812e-5,
49
6.314906965187994e-5,
50
6.31490696496595e-5,
51
6.314906965032563e-5
52
])
53
54
@testset "analysis_callback(sol) for AnalysisCallbackCoupled" begin
55
errors = analysis_callback(sol)
56
@test errors.l2≈[
57
7.816742843336293e-6,
58
7.816742843340186e-6,
59
7.816742843025513e-6,
60
7.816742843061526e-6
61
] rtol=1.0e-4
62
@test errors.linf≈[
63
6.314906965276812e-5,
64
6.314906965187994e-5,
65
6.31490696496595e-5,
66
6.314906965032563e-5
67
] rtol=1.0e-4
68
# Ensure that we do not have excessive memory allocations
69
# (e.g., from type instabilities)
70
@test_allocations(Trixi.rhs!, semi, sol, 1000)
71
end
72
73
# Test plotdata construction for coupled semidiscretization
74
@test_nowarn pd = PlotData2D(sol)
75
end
76
77
@trixi_testset "elixir_advection_meshview.jl" begin
78
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_advection_meshview.jl"),
79
l2=[
80
8.311947673083206e-6,
81
8.311947673068427e-6
82
],
83
linf=[
84
6.627000273318195e-5,
85
6.62700027264096e-5
86
])
87
88
@testset "analysis_callback(sol) for AnalysisCallbackCoupled" begin
89
# Ensure that we do not have excessive memory allocations
90
# (e.g., from type instabilities)
91
@test_allocations(Trixi.rhs!, semi, sol, 1000)
92
end
93
end
94
95
@trixi_testset "elixir_advection_meshview.jl with time-dependent CFL" begin
96
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_advection_meshview.jl"),
97
l2=[
98
8.311947673083206e-6,
99
8.311947673068427e-6
100
],
101
linf=[
102
6.627000273318195e-5,
103
6.62700027264096e-5
104
],
105
stepsize_callback=StepsizeCallback(cfl = x -> 1.6))
106
107
@testset "analysis_callback(sol) for AnalysisCallbackCoupled" begin
108
# Ensure that we do not have excessive memory allocations
109
# (e.g., from type instabilities)
110
@test_allocations(Trixi.rhs!, semi, sol, 1000)
111
end
112
end
113
114
@trixi_testset "elixir_advection_extended.jl" begin
115
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_advection_extended.jl"),
116
l2=[4.220397559713772e-6],
117
linf=[3.477948874874848e-5])
118
# Ensure that we do not have excessive memory allocations
119
# (e.g., from type instabilities)
120
@test_allocations(Trixi.rhs!, semi, sol, 1000)
121
end
122
123
@trixi_testset "elixir_advection_extended.jl with polydeg=4" begin
124
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_advection_extended.jl"),
125
l2=[5.32996976442737e-7],
126
linf=[4.1344662966569246e-6],
127
atol=1e-12, # required to make CI tests pass on macOS
128
cells_per_dimension=(16, 23),
129
polydeg=4,
130
cfl=1.4)
131
# Ensure that we do not have excessive memory allocations
132
# (e.g., from type instabilities)
133
@test_allocations(Trixi.rhs!, semi, sol, 1000)
134
end
135
136
@testset "elixir_advection_rotated.jl" begin
137
@trixi_testset "elixir_advection_rotated.jl with α = 0.0" begin
138
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_advection_rotated.jl"),
139
# Expected errors are exactly the same as in elixir_advection_basic!
140
l2=[8.311947673061856e-6],
141
linf=[6.627000273229378e-5],
142
alpha=0.0)
143
# Ensure that we do not have excessive memory allocations
144
# (e.g., from type instabilities)
145
@test_allocations(Trixi.rhs!, semi, sol, 1000)
146
end
147
148
@trixi_testset "elixir_advection_rotated.jl with α = 0.1" begin
149
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_advection_rotated.jl"),
150
# Expected errors differ only slightly from elixir_advection_basic!
151
l2=[8.3122750550501e-6],
152
linf=[6.626802581322089e-5],
153
alpha=0.1)
154
# Ensure that we do not have excessive memory allocations
155
# (e.g., from type instabilities)
156
@test_allocations(Trixi.rhs!, semi, sol, 1000)
157
end
158
159
@trixi_testset "elixir_advection_rotated.jl with α = 0.5 * pi" begin
160
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_advection_rotated.jl"),
161
# Expected errors are exactly the same as in elixir_advection_basic!
162
l2=[8.311947673061856e-6],
163
linf=[6.627000273229378e-5],
164
alpha=0.5 * pi)
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
end
170
171
@trixi_testset "elixir_advection_parallelogram.jl" begin
172
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_advection_parallelogram.jl"),
173
# Expected errors are exactly the same as in elixir_advection_basic!
174
l2=[8.311947673061856e-6],
175
linf=[6.627000273229378e-5])
176
# Ensure that we do not have excessive memory allocations
177
# (e.g., from type instabilities)
178
@test_allocations(Trixi.rhs!, semi, sol, 1000)
179
end
180
181
@trixi_testset "elixir_advection_waving_flag.jl" begin
182
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_advection_waving_flag.jl"),
183
l2=[0.00018553859900545866],
184
linf=[0.0016167719118129753])
185
# Ensure that we do not have excessive memory allocations
186
# (e.g., from type instabilities)
187
@test_allocations(Trixi.rhs!, semi, sol, 1000)
188
end
189
190
@trixi_testset "elixir_advection_free_stream.jl" begin
191
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_advection_free_stream.jl"),
192
l2=[6.8925194184204476e-15],
193
linf=[9.903189379656396e-14])
194
# Ensure that we do not have excessive memory allocations
195
# (e.g., from type instabilities)
196
@test_allocations(Trixi.rhs!, semi, sol, 1000)
197
end
198
199
@trixi_testset "elixir_advection_nonperiodic.jl" begin
200
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_advection_nonperiodic.jl"),
201
l2=[0.00025552740731641223],
202
linf=[0.007252625722805939])
203
# Ensure that we do not have excessive memory allocations
204
# (e.g., from type instabilities)
205
@test_allocations(Trixi.rhs!, semi, sol, 1000)
206
end
207
208
@trixi_testset "elixir_advection_restart.jl" begin
209
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_advection_restart.jl"),
210
l2=[4.219208035582454e-6],
211
linf=[3.438434404412494e-5])
212
# Ensure that we do not have excessive memory allocations
213
# (e.g., from type instabilities)
214
@test_allocations(Trixi.rhs!, semi, sol, 1000)
215
end
216
217
@trixi_testset "elixir_advection_restart.jl with waving flag mesh" begin
218
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_advection_restart.jl"),
219
l2=[0.00016265538265929818],
220
linf=[0.0015194252169410394],
221
rtol=5.0e-5, # Higher tolerance to make tests pass in CI (in particular with macOS)
222
elixir_file="elixir_advection_waving_flag.jl",
223
restart_file="restart_000000021.h5")
224
# Ensure that we do not have excessive memory allocations
225
# (e.g., from type instabilities)
226
@test_allocations(Trixi.rhs!, semi, sol, 1000)
227
end
228
229
@trixi_testset "elixir_advection_restart.jl with free stream mesh" begin
230
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_advection_restart.jl"),
231
l2=[7.841217436552029e-15],
232
linf=[1.0857981180834031e-13],
233
elixir_file="elixir_advection_free_stream.jl",
234
restart_file="restart_000000036.h5")
235
# Ensure that we do not have excessive memory allocations
236
# (e.g., from type instabilities)
237
@test_allocations(Trixi.rhs!, semi, sol, 1000)
238
end
239
240
@trixi_testset "elixir_euler_convergence_implicit_sparse_jacobian.jl" begin
241
@test_trixi_include(joinpath(EXAMPLES_DIR,
242
"elixir_euler_convergence_implicit_sparse_jacobian.jl"),
243
tspan=(0.0, 1.0),
244
l2=[
245
0.0025545032994393493,
246
0.0025848892135096136,
247
0.002585815262287367,
248
0.0031668773337869584
249
],
250
linf=[
251
0.010367159504626189,
252
0.009326212633131492,
253
0.008372785091578683,
254
0.011242647117379434
255
])
256
# Ensure that we do not have excessive memory allocations
257
# (e.g., from type instabilities)
258
@test_allocations(Trixi.rhs!, semi, sol, 1000)
259
end
260
261
@trixi_testset "elixir_euler_convergence_implicit_sparse_jacobian.jl with flux_ranocha" begin
262
@test_trixi_include(joinpath(EXAMPLES_DIR,
263
"elixir_euler_convergence_implicit_sparse_jacobian.jl"),
264
solver=DGSEM(polydeg = 3, surface_flux = surface_flux,
265
volume_integral = VolumeIntegralFluxDifferencing(flux_ranocha)),
266
tspan=(0.0, 1.0),
267
l2=[
268
0.002488034310310255,
269
0.002537347299714133,
270
0.002533529761212216,
271
0.0030150881617191675
272
],
273
linf=[
274
0.005844630331331979,
275
0.005507186931414498,
276
0.005377359689946237,
277
0.00631648929531492
278
])
279
# Ensure that we do not have excessive memory allocations
280
# (e.g., from type instabilities)
281
@test_allocations(Trixi.rhs!, semi, sol, 1000)
282
end
283
284
@trixi_testset "elixir_eulermulti_convergence_ec.jl" begin
285
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_eulermulti_convergence_ec.jl"),
286
l2=[
287
1.5123651627525257e-5,
288
1.51236516273878e-5,
289
2.4544918394022538e-5,
290
5.904791661362391e-6,
291
1.1809583322724782e-5
292
],
293
linf=[
294
8.393471747591974e-5,
295
8.393471748258108e-5,
296
0.00015028562494778797,
297
3.504466610437795e-5,
298
7.00893322087559e-5
299
])
300
# Ensure that we do not have excessive memory allocations
301
# (e.g., from type instabilities)
302
@test_allocations(Trixi.rhs!, semi, sol, 1000)
303
end
304
305
@trixi_testset "elixir_eulermulti_blastwave_ec.jl with boundary_condition_slip_wall" begin
306
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_eulermulti_blastwave_ec.jl"),
307
l2=[
308
0.005884923780993405,
309
0.005815148890903912,
310
0.023438850211096113,
311
0.006254106697017372
312
],
313
linf=[
314
0.24483047700349253,
315
0.13364458078315503,
316
0.38469398740194993,
317
0.1024647566986494
318
],
319
tspan=(0.0, 0.001))
320
# Ensure that we do not have excessive memory allocations
321
# (e.g., from type instabilities)
322
@test_allocations(Trixi.rhs!, semi, sol, 1000)
323
end
324
325
@trixi_testset "elixir_euler_source_terms.jl" begin
326
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_source_terms.jl"),
327
# Expected errors are exactly the same as with TreeMesh!
328
l2=[
329
9.321181253186009e-7,
330
1.4181210743438511e-6,
331
1.4181210743487851e-6,
332
4.824553091276693e-6
333
],
334
linf=[
335
9.577246529612893e-6,
336
1.1707525976012434e-5,
337
1.1707525976456523e-5,
338
4.8869615580926506e-5
339
])
340
# Ensure that we do not have excessive memory allocations
341
# (e.g., from type instabilities)
342
@test_allocations(Trixi.rhs!, semi, sol, 1000)
343
end
344
345
@testset "elixir_euler_source_terms_rotated.jl" begin
346
@trixi_testset "elixir_euler_source_terms_rotated.jl with α = 0.0" begin
347
@test_trixi_include(joinpath(EXAMPLES_DIR,
348
"elixir_euler_source_terms_rotated.jl"),
349
# Expected errors are exactly the same as in elixir_euler_source_terms!
350
l2=[
351
9.321181253186009e-7,
352
1.4181210743438511e-6,
353
1.4181210743487851e-6,
354
4.824553091276693e-6
355
],
356
linf=[
357
9.577246529612893e-6,
358
1.1707525976012434e-5,
359
1.1707525976456523e-5,
360
4.8869615580926506e-5
361
],
362
alpha=0.0)
363
# Ensure that we do not have excessive memory allocations
364
# (e.g., from type instabilities)
365
@test_allocations(Trixi.rhs!, semi, sol, 1000)
366
end
367
368
@trixi_testset "elixir_euler_source_terms_rotated.jl with α = 0.1" begin
369
@test_trixi_include(joinpath(EXAMPLES_DIR,
370
"elixir_euler_source_terms_rotated.jl"),
371
# Expected errors differ only slightly from elixir_euler_source_terms!
372
l2=[
373
9.321188057029291e-7,
374
1.3195106906473365e-6,
375
1.510307360354032e-6,
376
4.82455408101712e-6
377
],
378
linf=[
379
9.57723626271445e-6,
380
1.0480225511866337e-5,
381
1.2817828088262928e-5,
382
4.886962393513272e-5
383
],
384
alpha=0.1)
385
# Ensure that we do not have excessive memory allocations
386
# (e.g., from type instabilities)
387
@test_allocations(Trixi.rhs!, semi, sol, 1000)
388
end
389
390
@trixi_testset "elixir_euler_source_terms_rotated.jl with α = 0.2 * pi" begin
391
@test_trixi_include(joinpath(EXAMPLES_DIR,
392
"elixir_euler_source_terms_rotated.jl"),
393
# Expected errors differ only slightly from elixir_euler_source_terms!
394
l2=[
395
9.32127973957391e-7,
396
8.477824799744325e-7,
397
1.8175286311402784e-6,
398
4.824562453521076e-6
399
],
400
linf=[
401
9.576898420737834e-6,
402
5.057704352218195e-6,
403
1.635260719945464e-5,
404
4.886978754825577e-5
405
],
406
alpha=0.2 * pi)
407
# Ensure that we do not have excessive memory allocations
408
# (e.g., from type instabilities)
409
@test_allocations(Trixi.rhs!, semi, sol, 1000)
410
end
411
412
@trixi_testset "elixir_euler_source_terms_rotated.jl with α = 0.5 * pi" begin
413
@test_trixi_include(joinpath(EXAMPLES_DIR,
414
"elixir_euler_source_terms_rotated.jl"),
415
# Expected errors are exactly the same as in elixir_euler_source_terms!
416
l2=[
417
9.321181253186009e-7,
418
1.4181210743438511e-6,
419
1.4181210743487851e-6,
420
4.824553091276693e-6
421
],
422
linf=[
423
9.577246529612893e-6,
424
1.1707525976012434e-5,
425
1.1707525976456523e-5,
426
4.8869615580926506e-5
427
],
428
alpha=0.5 * pi)
429
# Ensure that we do not have excessive memory allocations
430
# (e.g., from type instabilities)
431
@test_allocations(Trixi.rhs!, semi, sol, 1000)
432
end
433
end
434
435
@trixi_testset "elixir_euler_source_terms_parallelogram.jl" begin
436
@test_trixi_include(joinpath(EXAMPLES_DIR,
437
"elixir_euler_source_terms_parallelogram.jl"),
438
l2=[
439
1.1167802955144833e-5,
440
1.0805775514153104e-5,
441
1.953188337010932e-5,
442
5.5033856574857146e-5
443
],
444
linf=[
445
8.297006495561199e-5,
446
8.663281475951301e-5,
447
0.00012264160606778596,
448
0.00041818802502024965
449
])
450
# Ensure that we do not have excessive memory allocations
451
# (e.g., from type instabilities)
452
@test_allocations(Trixi.rhs!, semi, sol, 1000)
453
end
454
455
@trixi_testset "elixir_euler_source_terms_waving_flag.jl" begin
456
@test_trixi_include(joinpath(EXAMPLES_DIR,
457
"elixir_euler_source_terms_waving_flag.jl"),
458
l2=[
459
2.991891317562739e-5,
460
3.6063177168283174e-5,
461
2.7082941743640572e-5,
462
0.00011414695350996946
463
],
464
linf=[
465
0.0002437454930492855,
466
0.0003438936171968887,
467
0.00024217622945688078,
468
0.001266380414757684
469
])
470
# Ensure that we do not have excessive memory allocations
471
# (e.g., from type instabilities)
472
@test_allocations(Trixi.rhs!, semi, sol, 1000)
473
end
474
475
@trixi_testset "elixir_euler_free_stream.jl" begin
476
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_free_stream.jl"),
477
l2=[
478
2.063350241405049e-15,
479
1.8571016296925367e-14,
480
3.1769447886391905e-14,
481
1.4104095258528071e-14
482
],
483
linf=[
484
1.9539925233402755e-14,
485
2.9791447087035294e-13,
486
6.502853810985698e-13,
487
2.7000623958883807e-13
488
],
489
atol=7.0e-13)
490
# Ensure that we do not have excessive memory allocations
491
# (e.g., from type instabilities)
492
@test_allocations(Trixi.rhs!, semi, sol, 1000)
493
end
494
495
# Up to version 0.13.0, `max_abs_speed_naive` was used as the default wave speed estimate of
496
# `const flux_lax_friedrichs = FluxLaxFriedrichs(), i.e., `FluxLaxFriedrichs(max_abs_speed = max_abs_speed_naive)`.
497
# In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`.
498
# Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`.
499
# To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`.
500
# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the
501
# `StepsizeCallback` (CFL-Condition) and less diffusion.
502
@trixi_testset "elixir_euler_free_stream.jl with FluxRotated(FluxLaxFriedrichs(max_abs_speed_naive))" begin
503
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_free_stream.jl"),
504
surface_flux=FluxRotated(FluxLaxFriedrichs(max_abs_speed_naive)),
505
l2=[
506
2.063350241405049e-15,
507
1.8571016296925367e-14,
508
3.1769447886391905e-14,
509
1.4104095258528071e-14
510
],
511
linf=[
512
1.9539925233402755e-14,
513
2.9791447087035294e-13,
514
6.502853810985698e-13,
515
2.7000623958883807e-13
516
],
517
atol=7.0e-13)
518
# Ensure that we do not have excessive memory allocations
519
# (e.g., from type instabilities)
520
@test_allocations(Trixi.rhs!, semi, sol, 1000)
521
end
522
523
@trixi_testset "elixir_euler_source_terms_nonperiodic.jl" begin
524
@test_trixi_include(joinpath(EXAMPLES_DIR,
525
"elixir_euler_source_terms_nonperiodic.jl"),
526
l2=[
527
2.259440511901724e-6,
528
2.3188881559075347e-6,
529
2.3188881559568146e-6,
530
6.332786324137878e-6
531
],
532
linf=[
533
1.4987382622067003e-5,
534
1.918201192063762e-5,
535
1.918201192019353e-5,
536
6.052671713430158e-5
537
])
538
# Ensure that we do not have excessive memory allocations
539
# (e.g., from type instabilities)
540
@test_allocations(Trixi.rhs!, semi, sol, 1000)
541
end
542
543
@trixi_testset "elixir_euler_source_terms_nonperiodic_fvO2.jl" begin
544
@test_trixi_include(joinpath(EXAMPLES_DIR,
545
"elixir_euler_source_terms_nonperiodic_fvO2.jl"),
546
l2=[
547
0.0027535201954222072,
548
0.0017808463145373606,
549
0.0017808463145373874,
550
0.005589356782700206
551
],
552
linf=[
553
0.010801198634897702,
554
0.00787469718577416,
555
0.007874697185775936,
556
0.02417877751394304
557
])
558
# Ensure that we do not have excessive memory allocations
559
# (e.g., from type instabilities)
560
@test_allocations(Trixi.rhs!, semi, sol, 1000)
561
end
562
563
@trixi_testset "elixir_euler_vortex_perk4.jl" begin
564
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_vortex_perk4.jl"),
565
l2=[
566
0.0001846244731283424,
567
0.00042537910268029285,
568
0.0003724909264689687,
569
0.0026689613797051493
570
],
571
linf=[
572
0.0025031072787504716,
573
0.009266316022570331,
574
0.009876399281272374,
575
0.0306915591360557
576
])
577
# Ensure that we do not have excessive memory allocations
578
# (e.g., from type instabilities)
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
@test_allocations(Trixi.rhs!, semi, sol, 8000)
584
end
585
586
@trixi_testset "elixir_euler_ec.jl" begin
587
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_ec.jl"),
588
l2=[
589
0.03774907669925568,
590
0.02845190575242045,
591
0.028262802829412605,
592
0.13785915638851698
593
],
594
linf=[
595
0.3368296929764073,
596
0.27644083771519773,
597
0.27990039685141377,
598
1.1971436487402016
599
],
600
tspan=(0.0, 0.3))
601
# Ensure that we do not have excessive memory allocations
602
# (e.g., from type instabilities)
603
@test_allocations(Trixi.rhs!, semi, sol, 1000)
604
end
605
606
@trixi_testset "elixir_euler_sedov.jl" begin
607
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_sedov.jl"),
608
l2=[
609
3.69856202e-01,
610
2.35242180e-01,
611
2.41444928e-01,
612
1.28807120e+00
613
],
614
linf=[
615
1.82786223e+00,
616
1.30452904e+00,
617
1.40347257e+00,
618
6.21791658e+00
619
],
620
tspan=(0.0, 0.3))
621
# Ensure that we do not have excessive memory allocations
622
# (e.g., from type instabilities)
623
@test_allocations(Trixi.rhs!, semi, sol, 1000)
624
end
625
626
@trixi_testset "elixir_euler_sedov_blast_wave_sc_subcell.jl (local bounds)" begin
627
@test_trixi_include(joinpath(EXAMPLES_DIR,
628
"elixir_euler_sedov_blast_wave_sc_subcell.jl"),
629
l2=[
630
0.6403528328480915,
631
0.3068073114438902,
632
0.3140151910019577,
633
1.2977732581465693
634
],
635
linf=[
636
2.239791987419344,
637
1.5580885989144924,
638
1.5392923786831547,
639
6.2729281824590855
640
],
641
tspan=(0.0, 0.5))
642
# Ensure that we do not have excessive memory allocations
643
# (e.g., from type instabilities)
644
# Larger values for allowed allocations due to usage of custom
645
# integrator which are not *recorded* for the methods from
646
# OrdinaryDiffEq.jl
647
# Corresponding issue: https://github.com/trixi-framework/Trixi.jl/issues/1877
648
@test_allocations(Trixi.rhs!, semi, sol, 10000)
649
end
650
651
@trixi_testset "elixir_euler_sedov_blast_wave_sc_subcell.jl (global bounds)" begin
652
@test_trixi_include(joinpath(EXAMPLES_DIR,
653
"elixir_euler_sedov_blast_wave_sc_subcell.jl"),
654
positivity_variables_cons=["rho"],
655
positivity_variables_nonlinear=[pressure],
656
local_twosided_variables_cons=[],
657
local_onesided_variables_nonlinear=[],
658
l2=[
659
0.7979084213982606,
660
0.3980284851419719,
661
0.4021949448633982,
662
1.2956482394747346
663
],
664
linf=[
665
5.477809925838038,
666
3.7793130706228273,
667
3.2838862964081637,
668
6.316943647948965
669
],
670
tspan=(0.0, 0.5))
671
# Ensure that we do not have excessive memory allocations
672
# (e.g., from type instabilities)
673
# Larger values for allowed allocations due to usage of custom
674
# integrator which are not *recorded* for the methods from
675
# OrdinaryDiffEq.jl
676
# Corresponding issue: https://github.com/trixi-framework/Trixi.jl/issues/1877
677
@test_allocations(Trixi.rhs!, semi, sol, 10000)
678
end
679
680
@trixi_testset "elixir_euler_rayleigh_taylor_instability.jl" begin
681
@test_trixi_include(joinpath(EXAMPLES_DIR,
682
"elixir_euler_rayleigh_taylor_instability.jl"),
683
l2=[
684
0.06365630515019809, 0.007166887172039836,
685
0.0028787103533600804, 0.010247678008197966
686
],
687
linf=[
688
0.47992143569849377, 0.02459548251933757,
689
0.02059810091623976, 0.0319077000843877
690
],
691
cells_per_dimension=(8, 8),
692
tspan=(0.0, 0.3))
693
# Ensure that we do not have excessive memory allocations
694
# (e.g., from type instabilities)
695
@test_allocations(Trixi.rhs!, semi, sol, 1000)
696
end
697
698
@trixi_testset "elixir_euler_richtmyer_meshkov.jl" begin
699
@test_trixi_include(joinpath(EXAMPLES_DIR,
700
"elixir_euler_richtmyer_meshkov.jl"),
701
l2=[
702
0.11325554126117648,
703
3.846072397992506e-14,
704
0.30067515354593266,
705
0.4451325203339372
706
],
707
linf=[
708
0.4630182829483884,
709
3.795750685486191e-13,
710
1.265147868668324,
711
1.8837528418813672
712
],
713
adaptive=false, dt=1e-2,
714
tspan=(0.0, 0.5))
715
# Ensure that we do not have excessive memory allocations
716
# (e.g., from type instabilities)
717
@test_allocations(Trixi.rhs!, semi, sol, 1000)
718
end
719
720
@trixi_testset "elixir_euler_warm_bubble.jl" begin
721
@test_trixi_include(joinpath(EXAMPLES_DIR,
722
"elixir_euler_warm_bubble.jl"),
723
l2=[
724
0.00019387402388722496,
725
0.03086514388623955,
726
0.04541427917165,
727
43.892826583444716
728
],
729
linf=[
730
0.0015942305974430138,
731
0.17449778969139373,
732
0.3729704262394843,
733
307.6706958565337
734
],
735
cells_per_dimension=(32, 16),
736
tspan=(0.0, 10.0))
737
# Ensure that we do not have excessive memory allocations
738
# (e.g., from type instabilities)
739
@test_allocations(Trixi.rhs!, semi, sol, 100)
740
end
741
742
@trixi_testset "elixir_euler_peng_robinson_transcritical_mixing" begin
743
@test_trixi_include(joinpath(EXAMPLES_DIR,
744
"elixir_euler_peng_robinson_transcritical_mixing.jl"),
745
tspan=(0.0, 0.0003),
746
# note that errors are large because the solution values are of the order 1e5-1e7
747
l2=[
748
0.8907552376416852,
749
274.6262332037992,
750
129.95629990639333,
751
94420.33529773205
752
],
753
linf=[
754
6.617401501819359,
755
732.0947275447616,
756
403.74606195408825,
757
584504.7663076259
758
])
759
760
# Ensure that we do not have excessive memory allocations
761
# (e.g., from type instabilities)
762
@test_allocations(Trixi.rhs!, semi, sol, 1000)
763
end
764
765
@trixi_testset "elixir_eulerpolytropic_convergence.jl" begin
766
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_eulerpolytropic_convergence.jl"),
767
l2=[
768
0.00166898321776379, 0.00259202637930991,
769
0.0032810744946276406
770
],
771
linf=[
772
0.010994883201888683, 0.013309526619369905,
773
0.020080326611175536
774
])
775
# Ensure that we do not have excessive memory allocations
776
# (e.g., from type instabilities)
777
@test_allocations(Trixi.rhs!, semi, sol, 1000)
778
end
779
780
@trixi_testset "elixir_eulerpolytropic_convergence.jl with FluxHLL(min_max_speed_naive)" begin
781
@test_trixi_include(joinpath(EXAMPLES_DIR,
782
"elixir_eulerpolytropic_convergence.jl"),
783
solver=DGSEM(polydeg = 3,
784
surface_flux = FluxHLL(min_max_speed_naive),
785
volume_integral = VolumeIntegralFluxDifferencing(volume_flux)),
786
l2=[
787
0.001668882059653298, 0.002592168188567654,
788
0.0032809503514328307
789
],
790
linf=[
791
0.01099467966437917, 0.013311978456333584,
792
0.020080117011337606
793
])
794
# Ensure that we do not have excessive memory allocations
795
# (e.g., from type instabilities)
796
@test_allocations(Trixi.rhs!, semi, sol, 1000)
797
end
798
799
@trixi_testset "elixir_eulerpolytropic_convergence.jl sparsity detection" begin
800
@test_trixi_include(joinpath(EXAMPLES_DIR,
801
"elixir_eulerpolytropic_convergence.jl"),
802
surface_flux=flux_lax_friedrichs,
803
tspan=(0.0, 0.0))
804
805
import SparseConnectivityTracer: TracerSparsityDetector,
806
jacobian_eltype,
807
jacobian_sparsity
808
809
jac_detector = TracerSparsityDetector()
810
# We need to construct the semidiscretization with the correct
811
# sparsity-detection ready datatype, which is retrieved here
812
jac_eltype = jacobian_eltype(real(solver), jac_detector)
813
814
# Semidiscretization for sparsity pattern detection
815
semi_jac_type = SemidiscretizationHyperbolic(mesh, equations,
816
initial_condition,
817
solver;
818
boundary_conditions = boundary_condition_periodic,
819
source_terms = source_terms_convergence_test,
820
uEltype = jac_eltype) # Need to supply Jacobian element type
821
822
# Call `semidiscretize` to create the ODE problem to have access to the
823
# initial condition based on which the sparsity pattern is computed
824
ode_jac_type = semidiscretize(semi_jac_type, tspan)
825
u0_ode = ode_jac_type.u0
826
du_ode = similar(u0_ode)
827
828
###############################################################################
829
### Compute the Jacobian sparsity pattern ###
830
831
# Wrap the `Trixi.rhs!` function to match the signature `f!(du, u)`, see
832
# https://adrianhill.de/SparseConnectivityTracer.jl/stable/user/api/#ADTypes.jacobian_sparsity
833
rhs_wrapped! = (du_ode, u0_ode) -> Trixi.rhs!(du_ode, u0_ode, semi_jac_type,
834
tspan[1])
835
836
@test_nowarn jacobian_sparsity(rhs_wrapped!, du_ode, u0_ode, jac_detector)
837
end
838
839
@trixi_testset "elixir_eulerpolytropic_ec.jl" begin
840
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_eulerpolytropic_ec.jl"),
841
l2=[
842
0.03647890611450939,
843
0.025284915444045052,
844
0.025340697771609126
845
],
846
linf=[
847
0.32516731565355583,
848
0.37509762516540046,
849
0.29812843284727336
850
])
851
# Ensure that we do not have excessive memory allocations
852
# (e.g., from type instabilities)
853
@test_allocations(Trixi.rhs!, semi, sol, 1000)
854
end
855
856
@trixi_testset "elixir_eulerpolytropic_isothermal_wave.jl" begin
857
@test_trixi_include(joinpath(EXAMPLES_DIR,
858
"elixir_eulerpolytropic_isothermal_wave.jl"),
859
l2=[
860
0.004998778512795407, 0.004998916021367992,
861
8.991558055435833e-17
862
],
863
linf=[
864
0.010001103632831354, 0.010051165055185603,
865
7.60697457718599e-16
866
])
867
# Ensure that we do not have excessive memory allocations
868
# (e.g., from type instabilities)
869
@test_allocations(Trixi.rhs!, semi, sol, 1000)
870
end
871
872
@trixi_testset "elixir_eulerpolytropic_wave.jl" begin
873
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_eulerpolytropic_wave.jl"),
874
l2=[
875
0.23642871172548174, 0.2090519382039672,
876
8.778842676292274e-17
877
],
878
linf=[
879
0.4852276879687425, 0.25327870807625175,
880
5.533921691832115e-16
881
])
882
# Ensure that we do not have excessive memory allocations
883
# (e.g., from type instabilities)
884
@test_allocations(Trixi.rhs!, semi, sol, 1000)
885
end
886
887
@trixi_testset "elixir_hypdiff_nonperiodic.jl" begin
888
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_hypdiff_nonperiodic.jl"),
889
l2=[0.8799744480157664, 0.8535008397034816, 0.7851383019164209],
890
linf=[1.0771947577311836, 1.9143913544309838, 2.149549109115789],
891
tspan=(0.0, 0.1))
892
# Ensure that we do not have excessive memory allocations
893
# (e.g., from type instabilities)
894
# Larger values for allowed allocations due to usage of custom
895
# integrator which are not *recorded* for the methods from
896
# OrdinaryDiffEq.jl
897
# Corresponding issue: https://github.com/trixi-framework/Trixi.jl/issues/1877
898
@test_allocations(Trixi.rhs!, semi, sol, 15000)
899
end
900
901
@trixi_testset "elixir_hypdiff_harmonic_nonperiodic.jl" begin
902
@test_trixi_include(joinpath(EXAMPLES_DIR,
903
"elixir_hypdiff_harmonic_nonperiodic.jl"),
904
l2=[
905
0.19357947606509474,
906
0.47041398037626814,
907
0.4704139803762686
908
],
909
linf=[
910
0.35026352556630114,
911
0.8344372248051408,
912
0.8344372248051408
913
],
914
tspan=(0.0, 0.1))
915
# Ensure that we do not have excessive memory allocations
916
# (e.g., from type instabilities)
917
@test_allocations(Trixi.rhs!, semi, sol, 1000)
918
end
919
920
@trixi_testset "elixir_mhd_ec.jl" begin
921
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_mhd_ec.jl"),
922
l2=[0.04937478399958968, 0.0611701500558669,
923
0.06099805934392425, 0.031551737882277144,
924
0.23191853685798858, 0.02476297013104899,
925
0.024482975007695532, 0.035440179203707095,
926
0.0016002328034991635],
927
linf=[0.24744671083295033, 0.2990591185187605,
928
0.3968520446251412, 0.2226544553988576,
929
0.9752669317263143, 0.12117894533967843,
930
0.12845218263379432, 0.17795590713819576,
931
0.0348517136607105],
932
tspan=(0.0, 0.3))
933
# Ensure that we do not have excessive memory allocations
934
# (e.g., from type instabilities)
935
@test_allocations(Trixi.rhs!, semi, sol, 1000)
936
end
937
938
@trixi_testset "elixir_mhd_alfven_wave.jl" begin
939
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_mhd_alfven_wave.jl"),
940
l2=[0.028905589451357638, 0.006259570019325034,
941
0.005649791156739933, 0.0073272570974805004,
942
0.004890348793116962, 0.00720944138561451,
943
0.0069984328989438115, 0.006729800315219757,
944
0.004318314151888631],
945
linf=[0.17528323378978317, 0.06161030852803388,
946
0.0388335541348234, 0.052906440559080926,
947
0.0380036034027319, 0.04291841215471082,
948
0.03702743958268562, 0.04815794489066357,
949
0.0433064571343779],
950
tspan=(0.0, 1.0))
951
# Ensure that we do not have excessive memory allocations
952
# (e.g., from type instabilities)
953
@test_allocations(Trixi.rhs!, semi, sol, 1000)
954
end
955
956
@trixi_testset "elixir_mhd_onion.jl" begin
957
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_mhd_onion.jl"),
958
l2=[0.00614563999392665, 0.04298975803343982,
959
0.009442309044853874, 0.0,
960
0.023466074865980138, 0.0037008480771081663,
961
0.006939946049331198, 0.0, 5.379545284544848e-7],
962
linf=[0.04033992113717799, 0.2507389500590966,
963
0.05597919737542288, 0.0,
964
0.14115256348718308, 0.01995761261479123,
965
0.038667260744994714, 0.0, 3.376777801961409e-6])
966
# Ensure that we do not have excessive memory allocations
967
# (e.g., from type instabilities)
968
@test_allocations(Trixi.rhs!, semi, sol, 1000)
969
end
970
971
@trixi_testset "elixir_mhd_ec_shockcapturing.jl" begin
972
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_mhd_ec_shockcapturing.jl"),
973
l2=[0.03641928087745194, 0.04266672246194787,
974
0.042616743034675685,
975
0.025884076832341982,
976
0.16181640309885276, 0.017346521291731105,
977
0.017291600359415987, 0.026856207871456043,
978
0.0007448774124272682],
979
linf=[0.25144155032118376, 0.3288086335996786,
980
0.30532573631664345, 0.20990150465080706,
981
0.9929091025128138, 0.11053858971264774,
982
0.12578085409726314,
983
0.16283334251103732,
984
0.026146463886273865])
985
# Ensure that we do not have excessive memory allocations
986
# (e.g., from type instabilities)
987
@test_allocations(Trixi.rhs!, semi, sol, 1000)
988
end
989
990
@trixi_testset "elixir_mhd_orszag_tang_sc_subcell.jl (local * symmetric)" begin
991
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_mhd_orszag_tang_sc_subcell.jl"),
992
l2=[
993
0.01971024989875626,
994
0.09104800714369102,
995
0.09850531236459953,
996
0.0,
997
0.11257300398205827,
998
0.0663796508325794,
999
0.1046810844992422,
1000
0.0,
1001
1.3771070897457708e-7
1002
],
1003
linf=[
1004
0.06892691571947851,
1005
0.2359568430620927,
1006
0.27708425716878604,
1007
0.0,
1008
0.32729450754783485,
1009
0.16594293308909247,
1010
0.28427225533782474,
1011
0.0,
1012
1.5760984369383474e-6
1013
],
1014
tspan=(0.0, 0.025))
1015
# Ensure that we do not have excessive memory allocations
1016
# (e.g., from type instabilities)
1017
@test_allocations(Trixi.rhs!, semi, sol, 10000)
1018
end
1019
1020
@trixi_testset "elixir_mhd_orszag_tang_sc_subcell.jl (local * jump)" begin
1021
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_mhd_orszag_tang_sc_subcell.jl"),
1022
l2=[
1023
0.019710787852084945,
1024
0.09104739316084506,
1025
0.09850451818593346,
1026
0.0,
1027
0.11257089275762928,
1028
0.0663755234418436,
1029
0.10468586115056747,
1030
0.0,
1031
4.200881361783599e-6
1032
],
1033
linf=[
1034
0.06893188693406871,
1035
0.23594610243501996,
1036
0.2770924621975269,
1037
0.0,
1038
0.32731120349573106,
1039
0.1659395971443428,
1040
0.2842678645407109,
1041
0.0,
1042
2.6014507178710646e-5
1043
],
1044
# Up to version 0.13.0, `max_abs_speed_naive` was used as the default wave speed estimate of
1045
# `const flux_lax_friedrichs = FluxLaxFriedrichs(), i.e., `FluxLaxFriedrichs(max_abs_speed = max_abs_speed_naive)`.
1046
# In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`.
1047
# Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`.
1048
# To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`.
1049
# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the
1050
# `StepsizeCallback` (CFL-Condition) and less diffusion.
1051
surface_flux=(FluxLaxFriedrichs(max_abs_speed_naive),
1052
flux_nonconservative_powell_local_jump),
1053
volume_flux=(flux_central,
1054
flux_nonconservative_powell_local_jump),
1055
tspan=(0.0, 0.025))
1056
# Ensure that we do not have excessive memory allocations
1057
# (e.g., from type instabilities)
1058
@test_allocations(Trixi.rhs!, semi, sol, 10000)
1059
end
1060
1061
@trixi_testset "elixir_mhdmultiion_ec.jl" begin
1062
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_mhdmultiion_ec.jl"),
1063
l2=[
1064
0.001213161200979075,
1065
0.0012130848294820726,
1066
0.0015755001554277398,
1067
0.0013582923009927254,
1068
0.0020117645260758414,
1069
0.002011172963281366,
1070
4.809766518427324e-5,
1071
0.017144539884022238,
1072
0.002725517676213416,
1073
0.002881115950314307,
1074
0.002879122244461666,
1075
0.00019209433660607767,
1076
0.011925524606599836,
1077
2.6719402415663762e-8
1078
],
1079
linf=[
1080
0.097859973877228,
1081
0.09690728356274181,
1082
0.13431313472001527,
1083
0.05311488868916897,
1084
0.09355072731834056,
1085
0.09355996145995278,
1086
0.004795107808363838,
1087
0.8722675916712932,
1088
0.10974816636830609,
1089
0.15983705713358845,
1090
0.13675344214792837,
1091
0.019081518305426586,
1092
0.7126785929162383,
1093
5.6197760273085075e-6
1094
],
1095
tspan=(0.0, 0.002))
1096
# Ensure that we do not have excessive memory allocations
1097
# (e.g., from type instabilities)
1098
@test_allocations(Trixi.rhs!, semi, sol, 1000)
1099
end
1100
1101
@trixi_testset "elixir_mhdmultiion_ec.jl with local Lax-Friedrichs at the surface" begin
1102
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_mhdmultiion_ec.jl"),
1103
l2=[
1104
0.0011033979927766748,
1105
0.0011034179185842633,
1106
0.0014691729962388591,
1107
0.0013355107747779773,
1108
0.0019050117958305927,
1109
0.0019038291863233438,
1110
3.6572032347831196e-5,
1111
0.016664167388106423,
1112
0.0026895584922699152,
1113
0.002787640168848639,
1114
0.0027843010508327975,
1115
0.00014627111755617758,
1116
0.01154990855334394,
1117
6.943248884497632e-7
1118
],
1119
linf=[
1120
0.06939001371446096,
1121
0.06926864952622269,
1122
0.11513905163412463,
1123
0.045270416449765816,
1124
0.08204570060964968,
1125
0.08205454581110574,
1126
0.002824171274841899,
1127
0.7319481885201382,
1128
0.09235891401707053,
1129
0.16128957341727507,
1130
0.12439795810457398,
1131
0.011237062227958462,
1132
0.5923410602688102,
1133
0.00011972366162122378
1134
],
1135
tspan=(0.0, 0.002),
1136
surface_flux=(FluxLaxFriedrichs(max_abs_speed_naive),
1137
flux_nonconservative_central))
1138
# Ensure that we do not have excessive memory allocations
1139
# (e.g., from type instabilities)
1140
@test_allocations(Trixi.rhs!, semi, sol, 1000)
1141
end
1142
1143
@trixi_testset "elixir_mhdmultiion_convergence_twospecies.jl" begin
1144
@test_trixi_include(joinpath(EXAMPLES_DIR,
1145
"elixir_mhdmultiion_convergence_twospecies.jl"),
1146
l2=[
1147
0.0010051333701703825,
1148
0.0010394775468233015,
1149
0.0002811601603064331,
1150
0.0011347597481031293,
1151
0.004308549702423105,
1152
0.004034566673203751,
1153
0.00016314810227339212,
1154
0.009733230503960424,
1155
0.0016373815502533284,
1156
0.00830712611315323,
1157
0.008424476361399211,
1158
0.0002693869498956917,
1159
0.01786371557065078,
1160
0.0010551940921468834
1161
],
1162
linf=[
1163
0.004331125692400628,
1164
0.006326095686991051,
1165
0.001622796413497718,
1166
0.005898819200413019,
1167
0.023231022862884698,
1168
0.02015682661284135,
1169
0.0007163788637357393,
1170
0.04864671278045618,
1171
0.010511130196469765,
1172
0.0391322779237806,
1173
0.03334142743633839,
1174
0.0014513724607740641,
1175
0.09978672252281795,
1176
0.005053531087457125
1177
],
1178
tspan=(0.0, 0.1))
1179
# Ensure that we do not have excessive memory allocations
1180
# (e.g., from type instabilities)
1181
@test_allocations(Trixi.rhs!, semi, sol, 1000)
1182
end
1183
1184
@trixi_testset "elixir_mhd_coupled.jl" begin
1185
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_mhd_coupled.jl"),
1186
l2=[
1187
1.0743426976677776e-7,
1188
5.941703122781545e-8,
1189
6.373264854058786e-8,
1190
1.0327320202980158e-7,
1191
8.259193826511926e-8,
1192
8.377839796183567e-8,
1193
7.469434303577898e-8,
1194
1.0770585130793933e-7,
1195
8.735923402823923e-9,
1196
1.0743426990741475e-7,
1197
5.941703121622708e-8,
1198
6.373264853185012e-8,
1199
1.0327320202884373e-7,
1200
8.259193828324533e-8,
1201
8.377839796046157e-8,
1202
7.469434302767398e-8,
1203
1.077058513088068e-7,
1204
8.735923400740853e-9
1205
],
1206
linf=[
1207
9.021023420485719e-7,
1208
5.540360292766167e-7,
1209
8.97403747285308e-7,
1210
9.962467816537757e-7,
1211
9.48702334468976e-7,
1212
1.4284730157632097e-6,
1213
5.317911039304235e-7,
1214
9.92786089865083e-7,
1215
3.4306731372516224e-8,
1216
9.021023412714158e-7,
1217
5.540360226014007e-7,
1218
8.974037428166604e-7,
1219
9.962467838325884e-7,
1220
9.487023256982141e-7,
1221
1.4284730160962766e-6,
1222
5.317911003777098e-7,
1223
9.92786092363085e-7,
1224
3.430672968714232e-8
1225
])
1226
1227
@testset "analysis_callback(sol) for AnalysisCallbackCoupled" begin
1228
errors = analysis_callback(sol)
1229
@test errors.l2≈[
1230
1.0743426976677776e-7,
1231
5.941703122781545e-8,
1232
6.373264854058786e-8,
1233
1.0327320202980158e-7,
1234
8.259193826511926e-8,
1235
8.377839796183567e-8,
1236
7.469434303577898e-8,
1237
1.0770585130793933e-7,
1238
8.735923402823923e-9,
1239
1.0743426990741475e-7,
1240
5.941703121622708e-8,
1241
6.373264853185012e-8,
1242
1.0327320202884373e-7,
1243
8.259193828324533e-8,
1244
8.377839796046157e-8,
1245
7.469434302767398e-8,
1246
1.077058513088068e-7,
1247
8.735923400740853e-9
1248
] rtol=1.0e-4
1249
@test errors.linf≈[
1250
9.021023420485719e-7,
1251
5.540360292766167e-7,
1252
8.97403747285308e-7,
1253
9.962467816537757e-7,
1254
9.48702334468976e-7,
1255
1.4284730157632097e-6,
1256
5.317911039304235e-7,
1257
9.92786089865083e-7,
1258
3.4306731372516224e-8,
1259
9.021023412714158e-7,
1260
5.540360226014007e-7,
1261
8.974037428166604e-7,
1262
9.962467838325884e-7,
1263
9.487023256982141e-7,
1264
1.4284730160962766e-6,
1265
5.317911003777098e-7,
1266
9.92786092363085e-7,
1267
3.430672968714232e-8
1268
] rtol=1.0e-4
1269
# Ensure that we do not have excessive memory allocations
1270
# (e.g., from type instabilities)
1271
@test_allocations(Trixi.rhs!, semi, sol, 1000)
1272
end
1273
end
1274
1275
@trixi_testset "elixir_lbm_lid_driven_cavity.jl" begin
1276
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_lbm_lid_driven_cavity.jl"),
1277
l2=[
1278
0.0013650620243296592,
1279
0.00022198751341720896,
1280
0.0012598874493852138,
1281
0.0003717179135584138,
1282
0.0004378131417115368,
1283
0.0003981707758995024,
1284
0.00025217328296435736,
1285
0.00026487031088613346,
1286
0.0004424433618470548
1287
],
1288
linf=[
1289
0.024202160934419875,
1290
0.011909887052061488,
1291
0.021787515301598115,
1292
0.03618036838142735,
1293
0.008017773116953682,
1294
0.0068482058999433,
1295
0.010286155761527443,
1296
0.009919734282811003,
1297
0.05568155678921127
1298
],
1299
tspan=(0.0, 1.0))
1300
# Ensure that we do not have excessive memory allocations
1301
# (e.g., from type instabilities)
1302
@test_allocations(Trixi.rhs!, semi, sol, 1000)
1303
end
1304
1305
@trixi_testset "elixir_lbm_eulerpolytropic_coupled.jl" begin
1306
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_lbm_eulerpolytropic_coupled.jl"),
1307
l2=[
1308
0.004425408662988481,
1309
0.004450324455480091,
1310
6.443442487292444e-17,
1311
0.0013646410236054789,
1312
0.000492124768468392,
1313
0.00035879680384107377,
1314
0.0004921247684683822,
1315
0.0003411602559013719,
1316
8.969920096027091e-5,
1317
8.969920096027404e-5,
1318
0.00034116025590136945,
1319
0.001968499073873568
1320
],
1321
linf=[
1322
0.009769926457488198,
1323
0.009821015729172138,
1324
3.313984464407251e-16,
1325
0.003072464362545338,
1326
0.001104208150516095,
1327
0.000791310479149987,
1328
0.0011042081505159979,
1329
0.000768116090636338,
1330
0.0001978276197874898,
1331
0.00019782761978750715,
1332
0.0007681160906363102,
1333
0.0044168326020643245
1334
])
1335
1336
@testset "analysis_callback(sol) for AnalysisCallbackCoupled" begin
1337
# Ensure that we do not have excessive memory allocations
1338
# (e.g., from type instabilities)
1339
@test_allocations(Trixi.rhs!, semi, sol, 1000)
1340
end
1341
end
1342
end
1343
1344
# Clean up afterwards: delete Trixi.jl output directory
1345
@test_nowarn rm(outdir, recursive = true)
1346
1347
end # module
1348
1349