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
2055 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
let
42
t = sol.t[end]
43
u_ode = sol.u[end]
44
du_ode = similar(u_ode)
45
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
46
end
47
end
48
49
@trixi_testset "elixir_advection_nonconforming_flag.jl" begin
50
@test_trixi_include(joinpath(EXAMPLES_DIR,
51
"elixir_advection_nonconforming_flag.jl"),
52
l2=[3.198940059144588e-5],
53
linf=[0.00030636069494005547])
54
55
# Ensure that we do not have excessive memory allocations
56
# (e.g., from type instabilities)
57
let
58
t = sol.t[end]
59
u_ode = sol.u[end]
60
du_ode = similar(u_ode)
61
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
62
end
63
end
64
65
@trixi_testset "elixir_advection_unstructured_flag.jl" begin
66
@test_trixi_include(joinpath(EXAMPLES_DIR,
67
"elixir_advection_unstructured_flag.jl"),
68
l2=[0.0005379687442422346],
69
linf=[0.007438525029884735])
70
71
# Ensure that we do not have excessive memory allocations
72
# (e.g., from type instabilities)
73
let
74
t = sol.t[end]
75
u_ode = sol.u[end]
76
du_ode = similar(u_ode)
77
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
78
end
79
end
80
81
@trixi_testset "elixir_advection_amr_solution_independent.jl" begin
82
@test_trixi_include(joinpath(EXAMPLES_DIR,
83
"elixir_advection_amr_solution_independent.jl"),
84
# Expected errors are exactly the same as with TreeMesh!
85
l2=[4.949660644033807e-5],
86
linf=[0.0004867846262313763])
87
88
# Ensure that we do not have excessive memory allocations
89
# (e.g., from type instabilities)
90
let
91
t = sol.t[end]
92
u_ode = sol.u[end]
93
du_ode = similar(u_ode)
94
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
95
end
96
end
97
98
@trixi_testset "elixir_advection_amr_unstructured_flag.jl" begin
99
@test_trixi_include(joinpath(EXAMPLES_DIR,
100
"elixir_advection_amr_unstructured_flag.jl"),
101
l2=[0.002019623611753929],
102
linf=[0.03542375961299987],
103
dynamic_load_balancing=false,)
104
105
# Ensure that we do not have excessive memory allocations
106
# (e.g., from type instabilities)
107
let
108
t = sol.t[end]
109
u_ode = sol.u[end]
110
du_ode = similar(u_ode)
111
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
112
end
113
end
114
115
@trixi_testset "elixir_advection_restart.jl" begin
116
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_advection_restart.jl"),
117
l2=[4.507575525876275e-6],
118
linf=[6.21489667023134e-5])
119
120
# Ensure that we do not have excessive memory allocations
121
# (e.g., from type instabilities)
122
let
123
t = sol.t[end]
124
u_ode = sol.u[end]
125
du_ode = similar(u_ode)
126
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
127
end
128
end
129
130
@trixi_testset "elixir_euler_source_terms_nonconforming_unstructured_flag.jl" begin
131
@test_trixi_include(joinpath(EXAMPLES_DIR,
132
"elixir_euler_source_terms_nonconforming_unstructured_flag.jl"),
133
l2=[
134
0.0034516244508588046,
135
0.0023420334036925493,
136
0.0024261923964557187,
137
0.004731710454271893
138
],
139
linf=[
140
0.04155789011775046,
141
0.024772109862748914,
142
0.03759938693042297,
143
0.08039824959535657
144
])
145
146
# Ensure that we do not have excessive memory allocations
147
# (e.g., from type instabilities)
148
let
149
t = sol.t[end]
150
u_ode = sol.u[end]
151
du_ode = similar(u_ode)
152
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
153
end
154
end
155
end
156
end # T8codeMesh MPI
157
158
end # module
159
160