Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
trixi-framework
GitHub Repository: trixi-framework/Trixi.jl
Path: blob/main/test/test_tree_1d_fdsbp.jl
5582 views
1
module TestTree1DFDSBP
2
3
using Test
4
using Trixi
5
6
include("test_trixi.jl")
7
8
EXAMPLES_DIR = joinpath(examples_dir(), "tree_1d_fdsbp")
9
10
@testset "Linear scalar advection" begin
11
#! format: noindent
12
13
@trixi_testset "elixir_advection_upwind.jl" begin
14
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_advection_upwind.jl"),
15
l2=[1.7735637157305526e-6],
16
linf=[1.0418854521951328e-5],
17
tspan=(0.0, 0.5))
18
19
# Ensure that we do not have excessive memory allocations
20
# (e.g., from type instabilities)
21
@test_allocations(Trixi.rhs!, semi, sol, 1000)
22
end
23
24
@trixi_testset "elixir_advection_upwind_periodic.jl" begin
25
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_advection_upwind_periodic.jl"),
26
l2=[1.1672962783692568e-5],
27
linf=[1.650514414558435e-5])
28
29
# Ensure that we do not have excessive memory allocations
30
# (e.g., from type instabilities)
31
@test_allocations(Trixi.rhs!, semi, sol, 1000)
32
end
33
end
34
35
@testset "Inviscid Burgers" begin
36
@trixi_testset "elixir_burgers_basic.jl" begin
37
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_burgers_basic.jl"),
38
l2=[8.316190308678742e-7],
39
linf=[7.1087263324720595e-6],
40
tspan=(0.0, 0.5))
41
42
# Ensure that we do not have excessive memory allocations
43
# (e.g., from type instabilities)
44
@test_allocations(Trixi.rhs!, semi, sol, 1000)
45
end
46
47
# same tolerances as above since the methods should be identical (up to
48
# machine precision)
49
@trixi_testset "elixir_burgers_basic.jl with SurfaceIntegralStrongForm and FluxUpwind" begin
50
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_burgers_basic.jl"),
51
l2=[8.316190308678742e-7],
52
linf=[7.1087263324720595e-6],
53
tspan=(0.0, 0.5),
54
solver=DG(D_upw, nothing,
55
SurfaceIntegralStrongForm(FluxUpwind(flux_splitting)),
56
VolumeIntegralUpwind(flux_splitting)))
57
end
58
59
@trixi_testset "elixir_burgers_linear_stability.jl" begin
60
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_burgers_linear_stability.jl"),
61
l2=[0.9999995642691271],
62
linf=[1.824702804788453],
63
tspan=(0.0, 0.25))
64
65
# Ensure that we do not have excessive memory allocations
66
# (e.g., from type instabilities)
67
@test_allocations(Trixi.rhs!, semi, sol, 1000)
68
end
69
end
70
71
@testset "Compressible Euler" begin
72
@trixi_testset "elixir_euler_convergence.jl" begin
73
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_convergence.jl"),
74
l2=[
75
4.1370344463620254e-6,
76
4.297052451817826e-6,
77
9.857382045003056e-6
78
],
79
linf=[
80
1.675305070092392e-5,
81
1.3448113863834266e-5,
82
3.8185336878271414e-5
83
],
84
tspan=(0.0, 0.5))
85
86
# Ensure that we do not have excessive memory allocations
87
# (e.g., from type instabilities)
88
@test_allocations(Trixi.rhs!, semi, sol, 1000)
89
end
90
91
@trixi_testset "elixir_euler_convergence.jl with splitting_vanleer_haenel" begin
92
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_convergence.jl"),
93
l2=[
94
3.4137906030996366e-6,
95
4.24395804622208e-6,
96
8.667369559486434e-6
97
],
98
linf=[
99
1.4228079725286946e-5,
100
1.324988815953887e-5,
101
3.20155297650615e-5
102
],
103
tspan=(0.0, 0.5),
104
flux_splitting=splitting_vanleer_haenel)
105
106
# Ensure that we do not have excessive memory allocations
107
# (e.g., from type instabilities)
108
@test_allocations(Trixi.rhs!, semi, sol, 1000)
109
end
110
111
@trixi_testset "elixir_euler_convergence.jl with VolumeIntegralStrongForm" begin
112
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_convergence.jl"),
113
l2=[
114
8.612676636826464e-6,
115
7.670896994006107e-6,
116
1.4972772137651304e-5
117
],
118
linf=[
119
6.707982749043495e-5,
120
3.48725672254524e-5,
121
0.00010170331503767116
122
],
123
tspan=(0.0, 0.5),
124
solver=DG(D_upw.central, nothing, SurfaceIntegralStrongForm(),
125
VolumeIntegralStrongForm()))
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_density_wave.jl" begin
133
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_density_wave.jl"),
134
l2=[
135
1.5894925236031034e-5,
136
9.428412101106044e-6,
137
0.0008986477358789918
138
],
139
linf=[
140
4.969438024382544e-5,
141
2.393091812063694e-5,
142
0.003271817388146303
143
],
144
tspan=(0.0, 0.005), abstol=1.0e-9, reltol=1.0e-9)
145
146
# Ensure that we do not have excessive memory allocations
147
# (e.g., from type instabilities)
148
@test_allocations(Trixi.rhs!, semi, sol, 1000)
149
end
150
end
151
152
end # module
153
154