Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
trixi-framework
GitHub Repository: trixi-framework/Trixi.jl
Path: blob/main/test/test_parabolic_3d.jl
5582 views
1
module TestExamplesParabolic3D
2
3
using Test
4
using Trixi
5
6
include("test_trixi.jl")
7
8
EXAMPLES_DIR = examples_dir()
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 "SemidiscretizationHyperbolicParabolic (3D)" begin
15
#! format: noindent
16
17
@trixi_testset "DGMulti: elixir_navierstokes_convergence.jl" begin
18
@test_trixi_include(joinpath(EXAMPLES_DIR, "dgmulti_3d",
19
"elixir_navierstokes_convergence.jl"),
20
cells_per_dimension=(4, 4, 4), tspan=(0.0, 0.1),
21
l2=[
22
0.0005532846479614563,
23
0.000659263463988067,
24
0.0007776436003494915,
25
0.000659263463988129,
26
0.0038073624941206956
27
],
28
linf=[
29
0.001703986341275776,
30
0.0026285618026252733,
31
0.00353105737957371,
32
0.002628561802588858,
33
0.015587831432887
34
])
35
# Ensure that we do not have excessive memory allocations
36
# (e.g., from type instabilities)
37
@test_allocations(Trixi.rhs!, semi, sol, 1000)
38
@test_allocations(Trixi.rhs_parabolic!, semi, sol, 1000)
39
end
40
41
@trixi_testset "DGMulti: elixir_navierstokes_convergence_curved.jl" begin
42
@test_trixi_include(joinpath(EXAMPLES_DIR, "dgmulti_3d",
43
"elixir_navierstokes_convergence_curved.jl"),
44
cells_per_dimension=(4, 4, 4), tspan=(0.0, 0.1),
45
l2=[
46
0.0014027227340680359,
47
0.0021322235583299425,
48
0.002787374145873934,
49
0.002458747307842109,
50
0.009978368214450204
51
],
52
linf=[
53
0.006341750448945582,
54
0.010306014425485621,
55
0.015207402553448324,
56
0.010968264060799426,
57
0.04745438898236998
58
])
59
# Ensure that we do not have excessive memory allocations
60
# (e.g., from type instabilities)
61
@test_allocations(Trixi.rhs!, semi, sol, 1000)
62
@test_allocations(Trixi.rhs_parabolic!, semi, sol, 1000)
63
end
64
65
@trixi_testset "DGMulti: elixir_navierstokes_taylor_green_vortex.jl" begin
66
@test_trixi_include(joinpath(EXAMPLES_DIR, "dgmulti_3d",
67
"elixir_navierstokes_taylor_green_vortex.jl"),
68
cells_per_dimension=(4, 4, 4), tspan=(0.0, 0.25),
69
l2=[
70
0.00018257125088549987,
71
0.015589736346235174,
72
0.015589736346235415,
73
0.021943924698669025,
74
0.019273688367502154
75
],
76
linf=[
77
0.0006268461326666142,
78
0.03218881686243058,
79
0.03218881686357877,
80
0.053872494644958,
81
0.05183811394229565
82
])
83
# Ensure that we do not have excessive memory allocations
84
# (e.g., from type instabilities)
85
@test_allocations(Trixi.rhs!, semi, sol, 1000)
86
@test_allocations(Trixi.rhs_parabolic!, semi, sol, 1000)
87
end
88
89
@trixi_testset "TreeMesh3D: elixir_navierstokes_convergence.jl" begin
90
@test_trixi_include(joinpath(EXAMPLES_DIR, "tree_3d_dgsem",
91
"elixir_navierstokes_convergence.jl"),
92
initial_refinement_level=2, tspan=(0.0, 0.1),
93
l2=[
94
0.0019582188528520267,
95
0.002653449504302849,
96
0.002898264205184317,
97
0.0026534495043028534,
98
0.009511572365092744
99
],
100
linf=[
101
0.013680656759089693,
102
0.03569104501543785,
103
0.023526343547761893,
104
0.03569104501543733,
105
0.11482570604049513
106
])
107
# Ensure that we do not have excessive memory allocations
108
# (e.g., from type instabilities)
109
@test_allocations(Trixi.rhs!, semi, sol, 1000)
110
@test_allocations(Trixi.rhs_parabolic!, semi, sol, 1000)
111
end
112
113
@trixi_testset "TreeMesh3D: elixir_navierstokes_convergence.jl (isothermal walls)" begin
114
@test_trixi_include(joinpath(EXAMPLES_DIR, "tree_3d_dgsem",
115
"elixir_navierstokes_convergence.jl"),
116
initial_refinement_level=2, tspan=(0.0, 0.1),
117
heat_bc_top_bottom=Isothermal((x, t, equations) -> Trixi.temperature(initial_condition_navier_stokes_convergence_test(x,
118
t,
119
equations),
120
equations)),
121
l2=[
122
0.001954686519653731,
123
0.0026554367897028506,
124
0.0028927304027240026,
125
0.0026554367897028437,
126
0.00959635179660988
127
],
128
linf=[
129
0.013680508110646583,
130
0.03567344635942522,
131
0.024024936779738822,
132
0.035673446359425674,
133
0.11839497110814179
134
])
135
# Ensure that we do not have excessive memory allocations
136
# (e.g., from type instabilities)
137
@test_allocations(Trixi.rhs!, semi, sol, 1000)
138
@test_allocations(Trixi.rhs_parabolic!, semi, sol, 1000)
139
end
140
141
@trixi_testset "TreeMesh3D: elixir_navierstokes_convergence.jl (Entropy gradient variables)" begin
142
@test_trixi_include(joinpath(EXAMPLES_DIR, "tree_3d_dgsem",
143
"elixir_navierstokes_convergence.jl"),
144
initial_refinement_level=2, tspan=(0.0, 0.1),
145
gradient_variables=GradientVariablesEntropy(),
146
l2=[
147
0.0019770444875097737,
148
0.002652475094640119,
149
0.0029086003083239236,
150
0.002652475094640097,
151
0.009509568981441823
152
],
153
linf=[
154
0.013879361129145007,
155
0.035262606093049195,
156
0.02355419709739138,
157
0.03526260609304984,
158
0.11719963716518933
159
])
160
# Ensure that we do not have excessive memory allocations
161
# (e.g., from type instabilities)
162
@test_allocations(Trixi.rhs!, semi, sol, 1000)
163
@test_allocations(Trixi.rhs_parabolic!, semi, sol, 1000)
164
end
165
166
@trixi_testset "TreeMesh3D: elixir_navierstokes_convergence.jl (Entropy gradient variables, isothermal walls)" begin
167
@test_trixi_include(joinpath(EXAMPLES_DIR, "tree_3d_dgsem",
168
"elixir_navierstokes_convergence.jl"),
169
initial_refinement_level=2, tspan=(0.0, 0.1),
170
gradient_variables=GradientVariablesEntropy(),
171
heat_bc_top_bottom=Isothermal((x, t, equations) -> Trixi.temperature(initial_condition_navier_stokes_convergence_test(x,
172
t,
173
equations),
174
equations)),
175
l2=[
176
0.0019746314233993435,
177
0.0026547682591448896,
178
0.0029070310636460494,
179
0.0026547682591448922,
180
0.00958779288300152
181
],
182
linf=[
183
0.013879193801400458,
184
0.03524408452641245,
185
0.023986146220843566,
186
0.035244084526412915,
187
0.1200505651257302
188
])
189
# Ensure that we do not have excessive memory allocations
190
# (e.g., from type instabilities)
191
@test_allocations(Trixi.rhs!, semi, sol, 1000)
192
@test_allocations(Trixi.rhs_parabolic!, semi, sol, 1000)
193
end
194
195
@trixi_testset "TreeMesh3D: elixir_navierstokes_convergence.jl (flux differencing)" begin
196
@test_trixi_include(joinpath(EXAMPLES_DIR, "tree_3d_dgsem",
197
"elixir_navierstokes_convergence.jl"),
198
initial_refinement_level=2, tspan=(0.0, 0.1),
199
volume_integral=VolumeIntegralFluxDifferencing(flux_central),
200
l2=[
201
0.0019582188528208754,
202
0.0026534495043017935,
203
0.002898264205195059,
204
0.0026534495043017917,
205
0.009511572364832972
206
],
207
linf=[
208
0.013680656758958687,
209
0.03569104501523916,
210
0.02352634354684648,
211
0.03569104501523987,
212
0.11482570603774533
213
])
214
# Ensure that we do not have excessive memory allocations
215
# (e.g., from type instabilities)
216
@test_allocations(Trixi.rhs!, semi, sol, 1000)
217
@test_allocations(Trixi.rhs_parabolic!, semi, sol, 1000)
218
end
219
220
@trixi_testset "TreeMesh3D: elixir_navierstokes_convergence.jl (Refined mesh)" begin
221
@test_trixi_include(joinpath(EXAMPLES_DIR, "tree_3d_dgsem",
222
"elixir_navierstokes_convergence.jl"),
223
tspan=(0.0, 0.0))
224
LLID = Trixi.local_leaf_cells(mesh.tree)
225
num_leaves = length(LLID)
226
@assert num_leaves % 16 == 0
227
Trixi.refine!(mesh.tree, LLID[1:Int(num_leaves / 16)])
228
tspan = (0.0, 0.25)
229
semi = SemidiscretizationHyperbolicParabolic(mesh, (equations, equations_parabolic),
230
initial_condition, solver;
231
boundary_conditions = (boundary_conditions,
232
boundary_conditions_parabolic),
233
source_terms = source_terms_navier_stokes_convergence_test)
234
ode = semidiscretize(semi, tspan)
235
analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
236
callbacks = CallbackSet(summary_callback, alive_callback, analysis_callback)
237
sol = solve(ode, RDPK3SpFSAL49(); abstol = time_int_tol, reltol = time_int_tol,
238
dt = 1e-5,
239
ode_default_options()..., callback = callbacks)
240
l2_error, linf_error = analysis_callback(sol)
241
@test l2_error
242
[0.00031093362536287433;
243
0.0006473493036800964;
244
0.0007705277238221976;
245
0.0006280517917194624;
246
0.0009039277899421355]
247
@test linf_error
248
[0.0023694155363713776;
249
0.01063493262248095;
250
0.006772070862041679;
251
0.010640551561807883;
252
0.019256819037817507]
253
# Ensure that we do not have excessive memory allocations
254
# (e.g., from type instabilities)
255
@test_allocations(Trixi.rhs!, semi, sol, 1000)
256
@test_allocations(Trixi.rhs_parabolic!, semi, sol, 1000)
257
end
258
259
@trixi_testset "TreeMesh3D: elixir_navierstokes_taylor_green_vortex.jl" begin
260
@test_trixi_include(joinpath(EXAMPLES_DIR, "tree_3d_dgsem",
261
"elixir_navierstokes_taylor_green_vortex.jl"),
262
initial_refinement_level=2, tspan=(0.0, 0.25),
263
l2=[
264
0.00024173250389635442,
265
0.015684268393762454,
266
0.01568426839376248,
267
0.021991909545192333,
268
0.02825413672911425
269
],
270
linf=[
271
0.0008410587892853094,
272
0.04740176181772552,
273
0.04740176181772507,
274
0.07483494924031157,
275
0.150181591534448
276
])
277
278
# For testing other solution functionals
279
u_ode = copy(sol.u[end])
280
du_ode = zero(u_ode)
281
u = Trixi.wrap_array(u_ode, semi)
282
du = Trixi.wrap_array(du_ode, semi)
283
284
enstrophy_ = Trixi.analyze(enstrophy, du, u, tspan[end], semi)
285
@test isapprox(enstrophy_, 0.3773381126096875, atol = 1e-13)
286
287
# Ensure that we do not have excessive memory allocations
288
# (e.g., from type instabilities)
289
@test_allocations(Trixi.rhs!, semi, sol, 1000)
290
@test_allocations(Trixi.rhs_parabolic!, semi, sol, 1000)
291
end
292
293
@trixi_testset "TreeMesh3D: elixir_navierstokes_taylor_green_vortex.jl (GradientVariablesEntropy)" begin
294
@test_trixi_include(joinpath(EXAMPLES_DIR, "tree_3d_dgsem",
295
"elixir_navierstokes_taylor_green_vortex.jl"),
296
initial_refinement_level=2, tspan=(0.0, 0.25),
297
gradient_variables=GradientVariablesEntropy(),
298
l2=[
299
0.000241730983009407,
300
0.015684271361255244,
301
0.015684271361255223,
302
0.021991915828078544,
303
0.028253810752858436
304
],
305
linf=[
306
0.0008410544911241491,
307
0.04740230181893817,
308
0.047402301818937974,
309
0.07483473947005896,
310
0.15017808325123383
311
])
312
313
# For testing other solution functionals
314
u_ode = copy(sol.u[end])
315
du_ode = zero(u_ode)
316
u = Trixi.wrap_array(u_ode, semi)
317
du = Trixi.wrap_array(du_ode, semi)
318
319
enstrophy_ = Trixi.analyze(enstrophy, du, u, tspan[end], semi)
320
@test isapprox(enstrophy_, 0.37731523193564825, atol = 1e-13)
321
322
# Ensure that we do not have excessive memory allocations
323
# (e.g., from type instabilities)
324
@test_allocations(Trixi.rhs!, semi, sol, 1000)
325
@test_allocations(Trixi.rhs_parabolic!, semi, sol, 1000)
326
end
327
328
@trixi_testset "TreeMesh3D: elixir_navierstokes_taylor_green_vortex.jl (Refined mesh)" begin
329
@test_trixi_include(joinpath(EXAMPLES_DIR, "tree_3d_dgsem",
330
"elixir_navierstokes_taylor_green_vortex.jl"),
331
tspan=(0.0, 0.0))
332
LLID = Trixi.local_leaf_cells(mesh.tree)
333
num_leaves = length(LLID)
334
@assert num_leaves % 32 == 0
335
Trixi.refine!(mesh.tree, LLID[1:Int(num_leaves / 32)])
336
tspan = (0.0, 0.1)
337
semi = SemidiscretizationHyperbolicParabolic(mesh, (equations, equations_parabolic),
338
initial_condition, solver;
339
boundary_conditions = (boundary_condition_periodic,
340
boundary_condition_periodic))
341
ode = semidiscretize(semi, tspan)
342
analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
343
save_analysis = true,
344
extra_analysis_integrals = (energy_kinetic,
345
energy_internal,
346
enstrophy))
347
callbacks = CallbackSet(summary_callback, alive_callback, analysis_callback)
348
# Use CarpenterKennedy2N54 since `RDPK3SpFSAL49` gives slightly different results on different machines
349
sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false);
350
dt = 5e-3,
351
ode_default_options()..., callback = callbacks)
352
l2_error, linf_error = analysis_callback(sol)
353
@test l2_error [
354
7.314319856736271e-5,
355
0.006266480163542894,
356
0.006266489911815533,
357
0.008829222305770226,
358
0.0032859166842329228
359
]
360
@test linf_error [
361
0.0002943968186086554,
362
0.013876261980614757,
363
0.013883619864959451,
364
0.025201279960491936,
365
0.018679364985388247
366
]
367
# Ensure that we do not have excessive memory allocations
368
# (e.g., from type instabilities)
369
@test_allocations(Trixi.rhs!, semi, sol, 100)
370
@test_allocations(Trixi.Trixi.rhs_parabolic!, semi, sol, 100)
371
end
372
373
@trixi_testset "TreeMesh3D: elixir_navierstokes_taylor_green_vortex_adaptive_vol_int.jl" begin
374
@test_trixi_include(joinpath(EXAMPLES_DIR, "tree_3d_dgsem",
375
"elixir_navierstokes_taylor_green_vortex_adaptive_vol_int.jl"),
376
initial_refinement_level=2, tspan=(0.0, 0.25),
377
l2=[
378
0.00025800573172892296,
379
0.015878675665016953,
380
0.015878675665016915,
381
0.022155261837700068,
382
0.03444127194430855
383
],
384
linf=[
385
0.0011435012451959103,
386
0.055120912982969096,
387
0.05512091298296796,
388
0.07988480693544064,
389
0.22511095832379624
390
])
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
@test_allocations(Trixi.rhs_parabolic!, semi, sol, 1000)
395
end
396
397
@trixi_testset "P4estMesh3D: elixir_advection_diffusion_nonperiodic.jl" begin
398
@test_trixi_include(joinpath(EXAMPLES_DIR, "p4est_3d_dgsem",
399
"elixir_advection_diffusion_nonperiodic.jl"),
400
l2=[0.006421164728264022], linf=[0.41638021060047015])
401
# Ensure that we do not have excessive memory allocations
402
# (e.g., from type instabilities)
403
@test_allocations(Trixi.rhs!, semi, sol, 1000)
404
@test_allocations(Trixi.rhs_parabolic!, semi, sol, 1000)
405
end
406
407
@trixi_testset "P4estMesh3D: elixir_navierstokes_convergence.jl" begin
408
@test_trixi_include(joinpath(EXAMPLES_DIR, "p4est_3d_dgsem",
409
"elixir_navierstokes_convergence.jl"),
410
initial_refinement_level=2, tspan=(0.0, 0.1),
411
l2=[
412
0.00026599105557723507,
413
0.00046187779448444603,
414
0.0005424899076194272,
415
0.00046187779448445546,
416
0.0015846392584275121
417
],
418
linf=[
419
0.0025241668964857134,
420
0.006308461684409397,
421
0.004334939668473314,
422
0.006308461684396753,
423
0.03176343483364796
424
])
425
# Ensure that we do not have excessive memory allocations
426
# (e.g., from type instabilities)
427
@test_allocations(Trixi.rhs!, semi, sol, 1000)
428
@test_allocations(Trixi.rhs_parabolic!, semi, sol, 1000)
429
end
430
431
@trixi_testset "P4estMesh3D: elixir_navierstokes_taylor_green_vortex.jl" begin
432
@test_trixi_include(joinpath(EXAMPLES_DIR, "p4est_3d_dgsem",
433
"elixir_navierstokes_taylor_green_vortex.jl"),
434
initial_refinement_level=2, tspan=(0.0, 0.25),
435
surface_flux=FluxHLL(min_max_speed_naive),
436
l2=[
437
0.0001547509861140407,
438
0.015637861347119624,
439
0.015637861347119687,
440
0.022024699158522523,
441
0.009711013505930812
442
],
443
linf=[
444
0.0006696415247340326,
445
0.03442565722527785,
446
0.03442565722577423,
447
0.06295407168705314,
448
0.032857472756916195
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
@test_allocations(Trixi.rhs_parabolic!, semi, sol, 1000)
454
end
455
456
@trixi_testset "P4estMesh3D: elixir_navierstokes_taylor_green_vortex.jl (Parabolic CFL)" begin
457
@test_trixi_include(joinpath(EXAMPLES_DIR, "p4est_3d_dgsem",
458
"elixir_navierstokes_taylor_green_vortex.jl"),
459
tspan=(0.0, 0.1),
460
mu=0.5, # render flow diffusion-dominated
461
callbacks=CallbackSet(summary_callback, analysis_callback,
462
alive_callback,
463
StepsizeCallback(cfl = 2.3,
464
cfl_parabolic = 0.4)),
465
adaptive=false, # respect CFL
466
ode_alg=CKLLSRK95_4S(),
467
l2=[
468
0.0001022410497625877,
469
0.04954975879887512,
470
0.049549758798875056,
471
0.005853983721675305,
472
0.09161121143324424
473
],
474
linf=[
475
0.00039284994602417633,
476
0.14026307274342587,
477
0.14026307274350203,
478
0.017003338595870714,
479
0.2823457296549634
480
])
481
# Ensure that we do not have excessive memory allocations
482
# (e.g., from type instabilities)
483
@test_allocations(Trixi.rhs!, semi, sol, 1000)
484
@test_allocations(Trixi.rhs_parabolic!, semi, sol, 1000)
485
end
486
487
@trixi_testset "TreeMesh3D: elixir_advection_diffusion_amr.jl" begin
488
@test_trixi_include(joinpath(EXAMPLES_DIR, "tree_3d_dgsem",
489
"elixir_advection_diffusion_amr.jl"),
490
initial_refinement_level=2,
491
base_level=2,
492
med_level=3,
493
max_level=4,
494
l2=[0.0003687746805397333],
495
linf=[0.0015844326511498252])
496
# Ensure that we do not have excessive memory allocations
497
# (e.g., from type instabilities)
498
@test_allocations(Trixi.rhs!, semi, sol, 1000)
499
@test_allocations(Trixi.rhs_parabolic!, semi, sol, 1000)
500
end
501
502
@trixi_testset "TreeMesh3D: elixir_advection_diffusion_amr.jl (LDG)" begin
503
@test_trixi_include(joinpath(EXAMPLES_DIR, "tree_3d_dgsem",
504
"elixir_advection_diffusion_amr.jl"),
505
solver_parabolic=ParabolicFormulationLocalDG(),
506
initial_refinement_level=2,
507
base_level=2,
508
med_level=3,
509
max_level=4,
510
l2=[0.00036862382924645736],
511
linf=[0.0015952118405399007])
512
# Ensure that we do not have excessive memory allocations
513
# (e.g., from type instabilities)
514
@test_allocations(Trixi.rhs!, semi, sol, 1000)
515
@test_allocations(Trixi.rhs_parabolic!, semi, sol, 1000)
516
end
517
518
@trixi_testset "TreeMesh3D: elixir_advection_diffusion_gradient_source_terms.jl" begin
519
@test_trixi_include(joinpath(EXAMPLES_DIR, "tree_3d_dgsem",
520
"elixir_advection_diffusion_gradient_source_terms.jl"),
521
initial_refinement_level=2, tspan=(0.0, 0.4), polydeg=3,
522
l2=[0.0012820684787807487], linf=[0.014093588253177747])
523
# Ensure that we do not have excessive memory allocations
524
# (e.g., from type instabilities)
525
@test_allocations(Trixi.rhs!, semi, sol, 1000)
526
@test_allocations(Trixi.rhs_parabolic!, semi, sol, 1000)
527
end
528
529
@trixi_testset "TreeMesh3D: elixir_advection_diffusion_nonperiodic.jl" begin
530
@test_trixi_include(joinpath(EXAMPLES_DIR, "tree_3d_dgsem",
531
"elixir_advection_diffusion_nonperiodic.jl"),
532
l2=[0.0009808996243280868],
533
linf=[0.01732621559135459])
534
# Ensure that we do not have excessive memory allocations
535
# (e.g., from type instabilities)
536
@test_allocations(Trixi.rhs!, semi, sol, 1000)
537
@test_allocations(Trixi.rhs_parabolic!, semi, sol, 1000)
538
end
539
540
@trixi_testset "TreeMesh3D: elixir_advection_diffusion_nonperiodic.jl (LDG)" begin
541
@test_trixi_include(joinpath(EXAMPLES_DIR, "tree_3d_dgsem",
542
"elixir_advection_diffusion_nonperiodic.jl"),
543
solver_parabolic=ParabolicFormulationLocalDG(),
544
l2=[0.0009432415534931421], linf=[0.016955330290404563])
545
# Ensure that we do not have excessive memory allocations
546
# (e.g., from type instabilities)
547
@test_allocations(Trixi.rhs!, semi, sol, 1000)
548
end
549
550
@trixi_testset "TreeMesh3D: elixir_advection_diffusion_nonconforming.jl" begin
551
@test_trixi_include(joinpath(EXAMPLES_DIR, "tree_3d_dgsem",
552
"elixir_advection_diffusion_nonconforming.jl"),
553
l2=[0.00098089913839922], linf=[0.017326216776220663])
554
# Ensure that we do not have excessive memory allocations
555
# (e.g., from type instabilities)
556
@test_allocations(Trixi.rhs!, semi, sol, 1000)
557
@test_allocations(Trixi.rhs_parabolic!, semi, sol, 1000)
558
end
559
560
@trixi_testset "P4estMesh3D: elixir_advection_diffusion_nonconforming.jl" begin
561
@test_trixi_include(joinpath(EXAMPLES_DIR, "p4est_3d_dgsem",
562
"elixir_advection_diffusion_nonconforming.jl"),
563
l2=[0.0009808996243281306], linf=[0.017326215591354437])
564
# Ensure that we do not have excessive memory allocations
565
# (e.g., from type instabilities)
566
@test_allocations(Trixi.rhs!, semi, sol, 1000)
567
@test_allocations(Trixi.rhs_parabolic!, semi, sol, 1000)
568
end
569
570
@trixi_testset "P4estMesh3D: elixir_advection_diffusion_nonperiodic.jl (LDG)" begin
571
@test_trixi_include(joinpath(EXAMPLES_DIR, "p4est_3d_dgsem",
572
"elixir_advection_diffusion_nonperiodic.jl"),
573
solver_parabolic=ParabolicFormulationLocalDG(),
574
cfl_parabolic=0.07,
575
l2=[0.004185076476662267], linf=[0.05166349548111486])
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
@test_allocations(Trixi.rhs_parabolic!, semi, sol, 1000)
580
end
581
582
@trixi_testset "P4estMesh3D: elixir_advection_diffusion_amr_curved.jl" begin
583
@test_trixi_include(joinpath(EXAMPLES_DIR, "p4est_3d_dgsem",
584
"elixir_advection_diffusion_amr_curved.jl"),
585
l2=[0.000683123952524889], linf=[0.023601069354373894])
586
# Ensure that we do not have excessive memory allocations
587
# (e.g., from type instabilities)
588
@test_allocations(Trixi.rhs!, semi, sol, 1000)
589
@test_allocations(Trixi.rhs_parabolic!, semi, sol, 1000)
590
end
591
592
@trixi_testset "P4estMesh3D: elixir_advection_diffusion_amr_curved.jl (LDG)" begin
593
@test_trixi_include(joinpath(EXAMPLES_DIR, "p4est_3d_dgsem",
594
"elixir_advection_diffusion_amr_curved.jl"),
595
solver_parabolic=ParabolicFormulationLocalDG(),
596
l2=[0.0006853004145232737], linf=[0.02352694543085776])
597
# Ensure that we do not have excessive memory allocations
598
# (e.g., from type instabilities)
599
@test_allocations(Trixi.rhs!, semi, sol, 1000)
600
@test_allocations(Trixi.rhs_parabolic!, semi, sol, 1000)
601
end
602
603
@trixi_testset "P4estMesh3D: elixir_navierstokes_freestream_boundaries.jl" begin
604
@test_trixi_include(joinpath(EXAMPLES_DIR, "p4est_3d_dgsem",
605
"elixir_navierstokes_freestream_boundaries.jl"),
606
tspan=(0.0, 0.1),
607
l2=[
608
1.050376383380673e-16,
609
1.0175313793753473e-16,
610
1.158489273890016e-16,
611
2.0654608507933775e-16,
612
3.3590256030698164e-15
613
],
614
linf=[
615
1.7763568394002505e-15,
616
1.0130785099704553e-15,
617
1.3322676295501878e-15,
618
2.4424906541753444e-15,
619
4.263256414560601e-14
620
])
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
@test_allocations(Trixi.rhs_parabolic!, semi, sol, 1000)
625
end
626
627
@trixi_testset "P4estMesh3D: elixir_navierstokes_taylor_green_vortex_amr.jl" begin
628
@test_trixi_include(joinpath(EXAMPLES_DIR, "p4est_3d_dgsem",
629
"elixir_navierstokes_taylor_green_vortex_amr.jl"),
630
initial_refinement_level=0,
631
max_level=2,
632
tspan=(0.0, 0.1),
633
l2=[
634
0.0011069115461970517,
635
0.013872454764036899,
636
0.013872454764036934,
637
0.012060120516483785,
638
0.14491993697252206
639
],
640
linf=[
641
0.004408900543641403,
642
0.05154019471576565,
643
0.051540194715650245,
644
0.035283556918085636,
645
0.6804810816393854
646
])
647
# Ensure that we do not have excessive memory allocations
648
# (e.g., from type instabilities)
649
@test_allocations(Trixi.rhs!, semi, sol, 1000)
650
@test_allocations(Trixi.rhs_parabolic!, semi, sol, 1000)
651
end
652
653
@trixi_testset "P4estMesh3D: elixir_navierstokes_taylor_green_vortex_amr.jl static AMR" begin
654
@test_trixi_include(joinpath(EXAMPLES_DIR, "p4est_3d_dgsem",
655
"elixir_navierstokes_taylor_green_vortex_amr.jl"),
656
tspan=(0.0, 5.0),
657
amr_indicator=IndicatorNodalFunction((u, x, t) -> (((x[1] < 0) &&
658
(x[2] < 0) &&
659
(x[3] < 0)) ||
660
((x[1] > 0) &&
661
(x[2] > 0) &&
662
(x[3] > 0))) ?
663
1.0 : 0, semi),
664
amr_controller=ControllerThreeLevel(semi, amr_indicator;
665
base_level = 0,
666
med_level = 1,
667
med_threshold = 0.5,
668
max_level = 2,
669
max_threshold = 0.9),
670
amr_callback=AMRCallback(semi,
671
amr_controller;
672
interval = typemax(Int), # no further AMR
673
adapt_initial_condition = true,
674
adapt_initial_condition_only_refine = true),
675
l2=[
676
0.001716903538135598,
677
0.2566781540081305,
678
0.2566781540081202,
679
0.22556320347015937,
680
0.33779107381452556
681
],
682
linf=[
683
0.01139265672066836,
684
1.4145605813055888,
685
1.4145605813076223,
686
1.070081196321056,
687
3.332907472310012
688
])
689
@test_allocations(Trixi.rhs!, semi, sol, 1000)
690
@test_allocations(Trixi.rhs_parabolic!, semi, sol, 1000)
691
end
692
693
@trixi_testset "TreeMesh3D: elixir_navierstokes_viscous_shock.jl" begin
694
@test_trixi_include(joinpath(EXAMPLES_DIR, "tree_3d_dgsem",
695
"elixir_navierstokes_viscous_shock.jl"),
696
l2=[
697
0.0002576235757916208,
698
0.00014336914033937938,
699
3.361746364570895e-17,
700
3.1399702631471645e-17,
701
0.00017369856897561295
702
],
703
linf=[
704
0.0016731997562187129,
705
0.0010638567566626511,
706
1.733671234158084e-16,
707
1.9060786274399122e-16,
708
0.001149518946967798
709
])
710
end
711
712
@trixi_testset "P4estMesh3D: elixir_navierstokes_blast_wave_amr.jl" begin
713
@test_trixi_include(joinpath(EXAMPLES_DIR, "p4est_3d_dgsem",
714
"elixir_navierstokes_blast_wave_amr.jl"),
715
tspan=(0.0, 0.01),
716
l2=[
717
0.009449115832266491,
718
0.0017932092857965453,
719
0.0017932092857965449,
720
0.001793209285796548,
721
0.02432855189940458
722
],
723
linf=[
724
0.6811440777026873,
725
0.17744074602770776,
726
0.17744074602770762,
727
0.1774407460277074,
728
1.7402299022804495
729
])
730
# Ensure that we do not have excessive memory allocations
731
# (e.g., from type instabilities)
732
@test_allocations(Trixi.rhs!, semi, sol, 1000)
733
@test_allocations(Trixi.rhs_parabolic!, semi, sol, 1000)
734
end
735
736
@trixi_testset "P4estMesh3D: elixir_navierstokes_viscous_shock.jl" begin
737
@test_trixi_include(joinpath(EXAMPLES_DIR, "p4est_3d_dgsem",
738
"elixir_navierstokes_viscous_shock.jl"),
739
l2=[
740
0.0002576235461250765,
741
0.0001433693418567713,
742
1.5583069105517042e-16,
743
1.257551423107977e-16,
744
0.00017369872990116004
745
],
746
linf=[
747
0.0016731930282756213,
748
0.0010638586882356638,
749
2.738015991633e-15,
750
3.281831854493919e-15,
751
0.0011495231318404686
752
])
753
# Ensure that we do not have excessive memory allocations
754
# (e.g., from type instabilities)
755
@test_allocations(Trixi.rhs!, semi, sol, 1000)
756
@test_allocations(Trixi.rhs_parabolic!, semi, sol, 1000)
757
end
758
759
@trixi_testset "P4estMesh3D: elixir_navierstokes_viscous_shock_dirichlet_bc.jl" begin
760
@test_trixi_include(joinpath(EXAMPLES_DIR, "p4est_3d_dgsem",
761
"elixir_navierstokes_viscous_shock_dirichlet_bc.jl"),
762
l2=[
763
0.0002576236289909761,
764
0.00014336952925040063,
765
1.446929414778897e-16,
766
1.1843685819074592e-16,
767
0.00017369912976070335
768
],
769
linf=[
770
0.0016731934566309725,
771
0.0010638647433908188,
772
2.9923988317619584e-15,
773
3.501658589636682e-15,
774
0.0011495334919645606
775
])
776
# Ensure that we do not have excessive memory allocations
777
# (e.g., from type instabilities)
778
@test_allocations(Trixi.rhs!, semi, sol, 1000)
779
@test_allocations(Trixi.rhs_parabolic!, semi, sol, 1000)
780
end
781
782
@trixi_testset "P4estMesh3D: elixir_navierstokes_crm.jl" begin
783
@test_trixi_include(joinpath(EXAMPLES_DIR, "p4est_3d_dgsem",
784
"elixir_navierstokes_crm.jl"),
785
l2=[
786
2.2353998537135728e-10,
787
6.438248564149087e-8,
788
4.8158393932278836e-8,
789
6.287149707414103e-8,
790
7.591822518308327e-5
791
],
792
linf=[
793
0.36753460935979454,
794
209.1460932734352,
795
51.303610073892436,
796
41.45867326162659,
797
113004.34493505303
798
],
799
tspan=(0.0, 1e-10))
800
# Ensure that we do not have excessive memory allocations
801
# (e.g., from type instabilities)
802
@test_allocations(Trixi.rhs!, semi, sol, 1000)
803
@test_allocations(Trixi.rhs_parabolic!, semi, sol, 1000)
804
end
805
end
806
807
# Clean up afterwards: delete Trixi.jl output directory
808
@test_nowarn isdir(outdir) && rm(outdir, recursive = true)
809
810
end # module
811
812