Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
trixi-framework
GitHub Repository: trixi-framework/Trixi.jl
Path: blob/main/test/test_tree_2d_acoustics.jl
2055 views
1
module TestExamples2DAcousticPerturbation
2
3
using Test
4
using Trixi
5
6
include("test_trixi.jl")
7
8
EXAMPLES_DIR = joinpath(examples_dir(), "tree_2d_dgsem")
9
10
@testset "Acoustic Perturbation" begin
11
#! format: noindent
12
13
@trixi_testset "elixir_acoustics_convergence.jl" begin
14
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_acoustics_convergence.jl"),
15
l2=[
16
0.0019921138796370834,
17
0.002090394698052287,
18
0.0006091925854593805,
19
0.0,
20
0.0,
21
0.0,
22
0.0
23
],
24
linf=[
25
0.00769282588065634,
26
0.008276649669227254,
27
0.004196479023954813,
28
0.0,
29
0.0,
30
0.0,
31
0.0
32
])
33
# Ensure that we do not have excessive memory allocations
34
# (e.g., from type instabilities)
35
let
36
t = sol.t[end]
37
u_ode = sol.u[end]
38
du_ode = similar(u_ode)
39
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
40
end
41
end
42
43
@trixi_testset "elixir_acoustics_gauss.jl" begin
44
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_acoustics_gauss.jl"),
45
l2=[
46
0.08005276517890283,
47
0.08005276517890268,
48
0.4187202920734123,
49
0.0,
50
0.0,
51
0.0,
52
0.0
53
],
54
linf=[
55
0.17261097190220992,
56
0.17261097190220973,
57
1.13601894068238,
58
0.0,
59
0.0,
60
0.0,
61
0.0
62
])
63
# Ensure that we do not have excessive memory allocations
64
# (e.g., from type instabilities)
65
let
66
t = sol.t[end]
67
u_ode = sol.u[end]
68
du_ode = similar(u_ode)
69
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
70
end
71
end
72
73
@trixi_testset "elixir_acoustics_gaussian_source.jl" begin
74
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_acoustics_gaussian_source.jl"),
75
l2=[
76
0.004296394903650806,
77
0.004241280404758938,
78
0.006269684906035964,
79
0.0,
80
0.0,
81
0.0,
82
0.0
83
],
84
linf=[
85
0.03970270697049378,
86
0.04151096349298151,
87
0.0640019829058819,
88
0.0,
89
0.0,
90
0.0,
91
0.0
92
])
93
# Ensure that we do not have excessive memory allocations
94
# (e.g., from type instabilities)
95
let
96
t = sol.t[end]
97
u_ode = sol.u[end]
98
du_ode = similar(u_ode)
99
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
100
end
101
end
102
103
@trixi_testset "elixir_acoustics_gauss_wall.jl" begin
104
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_acoustics_gauss_wall.jl"),
105
l2=[0.019419398248465843, 0.019510701017551826,
106
0.04818246051887614,
107
7.382060834820337e-17, 0.0, 1.4764121669640674e-16,
108
1.4764121669640674e-16],
109
linf=[0.18193631937316496, 0.1877464607867628,
110
1.0355388011792845,
111
2.220446049250313e-16, 0.0, 4.440892098500626e-16,
112
4.440892098500626e-16])
113
# Ensure that we do not have excessive memory allocations
114
# (e.g., from type instabilities)
115
let
116
t = sol.t[end]
117
u_ode = sol.u[end]
118
du_ode = similar(u_ode)
119
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
120
end
121
end
122
123
@trixi_testset "elixir_acoustics_monopole.jl" begin
124
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_acoustics_monopole.jl"),
125
l2=[0.006816790293009947, 0.0065068948357351625,
126
0.008724512056168938,
127
0.0009894398191644543, 0.0, 7.144325530679576e-17,
128
7.144325530679576e-17],
129
linf=[1.000633375007386, 0.5599788929862504, 0.5738432957070382,
130
0.015590137026938428, 0.0, 2.220446049250313e-16,
131
2.220446049250313e-16],
132
maxiters=50)
133
# Ensure that we do not have excessive memory allocations
134
# (e.g., from type instabilities)
135
let
136
t = sol.t[end]
137
u_ode = sol.u[end]
138
du_ode = similar(u_ode)
139
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
140
end
141
end
142
end
143
144
end # module
145
146