Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
trixi-framework
GitHub Repository: trixi-framework/Trixi.jl
Path: blob/main/test/test_mpi_t8code_2d.jl
5582 views
1
module TestExamplesMPIT8codeMesh2D
2
3
using Test
4
using Trixi
5
6
include("test_trixi.jl")
7
8
EXAMPLES_DIR = joinpath(examples_dir(), "t8code_2d_dgsem")
9
10
@testset "T8codeMesh MPI 2D" begin
11
#! format: noindent
12
13
# Run basic tests
14
@testset "Examples 2D" begin
15
# Linear scalar advection
16
@trixi_testset "elixir_advection_basic.jl" begin
17
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_advection_basic.jl"),
18
# Expected errors are exactly the same as with TreeMesh!
19
l2=[8.311947673061856e-6],
20
linf=[6.627000273229378e-5])
21
22
@testset "error-based step size control" begin
23
mpi_isroot() && println("-"^100)
24
mpi_isroot() &&
25
println("elixir_advection_basic.jl with error-based step size control")
26
27
# Use callbacks without stepsize_callback to test error-based step size control
28
callbacks = CallbackSet(summary_callback, analysis_callback)
29
sol = solve(ode, RDPK3SpFSAL35(); abstol = 1.0e-4, reltol = 1.0e-4,
30
ode_default_options()..., callback = callbacks)
31
summary_callback()
32
errors = analysis_callback(sol)
33
if mpi_isroot()
34
@test errors.l2≈[3.3022040342579066e-5] rtol=1.0e-4
35
@test errors.linf≈[0.00011787417954578494] rtol=1.0e-4
36
end
37
end
38
39
# Ensure that we do not have excessive memory allocations
40
# (e.g., from type instabilities)
41
@test_allocations(Trixi.rhs!, semi, sol, 1000)
42
end
43
44
@trixi_testset "elixir_advection_nonconforming_flag.jl" begin
45
@test_trixi_include(joinpath(EXAMPLES_DIR,
46
"elixir_advection_nonconforming_flag.jl"),
47
l2=[3.198940059144588e-5],
48
linf=[0.00030636069494005547])
49
50
# Ensure that we do not have excessive memory allocations
51
# (e.g., from type instabilities)
52
@test_allocations(Trixi.rhs!, semi, sol, 1000)
53
end
54
55
@trixi_testset "elixir_advection_unstructured_flag.jl" begin
56
@test_trixi_include(joinpath(EXAMPLES_DIR,
57
"elixir_advection_unstructured_flag.jl"),
58
l2=[0.0005379687442422346],
59
linf=[0.007438525029884735])
60
61
# Ensure that we do not have excessive memory allocations
62
# (e.g., from type instabilities)
63
@test_allocations(Trixi.rhs!, semi, sol, 1000)
64
end
65
66
@trixi_testset "elixir_advection_amr_solution_independent.jl" begin
67
@test_trixi_include(joinpath(EXAMPLES_DIR,
68
"elixir_advection_amr_solution_independent.jl"),
69
# Expected errors are exactly the same as with TreeMesh!
70
l2=[4.949660644033807e-5],
71
linf=[0.0004867846262313763])
72
73
# Ensure that we do not have excessive memory allocations
74
# (e.g., from type instabilities)
75
@test_allocations(Trixi.rhs!, semi, sol, 1000)
76
end
77
78
@trixi_testset "elixir_advection_amr_unstructured_flag.jl" begin
79
@test_trixi_include(joinpath(EXAMPLES_DIR,
80
"elixir_advection_amr_unstructured_flag.jl"),
81
l2=[0.002019623611753929],
82
linf=[0.03542375961299987],
83
dynamic_load_balancing=false)
84
85
# Ensure that we do not have excessive memory allocations
86
# (e.g., from type instabilities)
87
@test_allocations(Trixi.rhs!, semi, sol, 1000)
88
end
89
90
@trixi_testset "elixir_advection_restart.jl" begin
91
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_advection_restart.jl"),
92
l2=[4.507575525876275e-6],
93
linf=[6.21489667023134e-5])
94
95
# Ensure that we do not have excessive memory allocations
96
# (e.g., from type instabilities)
97
@test_allocations(Trixi.rhs!, semi, sol, 1000)
98
end
99
100
@trixi_testset "elixir_euler_source_terms_nonconforming_unstructured_flag.jl" begin
101
@test_trixi_include(joinpath(EXAMPLES_DIR,
102
"elixir_euler_source_terms_nonconforming_unstructured_flag.jl"),
103
l2=[
104
0.0034516244508588046,
105
0.0023420334036925493,
106
0.0024261923964557187,
107
0.004731710454271893
108
],
109
linf=[
110
0.04155789011775046,
111
0.024772109862748914,
112
0.03759938693042297,
113
0.08039824959535657
114
])
115
116
# Ensure that we do not have excessive memory allocations
117
# (e.g., from type instabilities)
118
@test_allocations(Trixi.rhs!, semi, sol, 1000)
119
end
120
end
121
end # T8codeMesh MPI
122
123
end # module
124
125