Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
trixi-framework
GitHub Repository: trixi-framework/Trixi.jl
Path: blob/main/test/test_tree_1d_burgers.jl
2055 views
1
module TestExamples1DBurgers
2
3
using Test
4
using Trixi
5
6
include("test_trixi.jl")
7
8
EXAMPLES_DIR = joinpath(examples_dir(), "tree_1d_dgsem")
9
10
@testset "Inviscid Burgers" begin
11
#! format: noindent
12
13
@trixi_testset "elixir_burgers_basic.jl" begin
14
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_burgers_basic.jl"),
15
l2=[2.967470209082194e-5],
16
linf=[0.00016152468882624227])
17
# Ensure that we do not have excessive memory allocations
18
# (e.g., from type instabilities)
19
let
20
t = sol.t[end]
21
u_ode = sol.u[end]
22
du_ode = similar(u_ode)
23
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
24
end
25
end
26
27
@trixi_testset "elixir_burgers_linear_stability.jl" begin
28
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_burgers_linear_stability.jl"),
29
l2=[0.5660569881106876],
30
linf=[1.9352238038313998])
31
# Ensure that we do not have excessive memory allocations
32
# (e.g., from type instabilities)
33
let
34
t = sol.t[end]
35
u_ode = sol.u[end]
36
du_ode = similar(u_ode)
37
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
38
end
39
end
40
41
@trixi_testset "elixir_burgers_shock.jl" begin
42
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_burgers_shock.jl"),
43
l2=[0.4429871964104191],
44
linf=[1.007778754747701])
45
# Ensure that we do not have excessive memory allocations
46
# (e.g., from type instabilities)
47
let
48
t = sol.t[end]
49
u_ode = sol.u[end]
50
du_ode = similar(u_ode)
51
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
52
end
53
end
54
55
@trixi_testset "elixir_burgers_rarefaction.jl" begin
56
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_burgers_rarefaction.jl"),
57
l2=[0.4038224690923722],
58
linf=[1.0049201454652736])
59
# Ensure that we do not have excessive memory allocations
60
# (e.g., from type instabilities)
61
let
62
t = sol.t[end]
63
u_ode = sol.u[end]
64
du_ode = similar(u_ode)
65
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
66
end
67
end
68
end
69
70
end # module
71
72