Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
trixi-framework
GitHub Repository: trixi-framework/Trixi.jl
Path: blob/main/test/test_tree_1d_hypdiff.jl
2055 views
1
module TestExamples1DHypDiff
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 "Hyperbolic diffusion" begin
11
#! format: noindent
12
13
@trixi_testset "elixir_hypdiff_nonperiodic.jl" begin
14
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_hypdiff_nonperiodic.jl"),
15
l2=[1.3655114953278825e-7, 1.0200345026471077e-6],
16
linf=[7.173285075379177e-7, 4.507116828644797e-6])
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_hypdiff_nonperiodic_perk4.jl" begin
28
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_hypdiff_nonperiodic_perk4.jl"),
29
l2=[1.3655114994521285e-7, 1.0200345014751413e-6],
30
linf=[7.173289867656862e-7, 4.507115296537023e-6],
31
atol=2.5e-13)
32
# Ensure that we do not have excessive memory allocations
33
# (e.g., from type instabilities)
34
let
35
t = sol.t[end]
36
u_ode = sol.u[end]
37
du_ode = similar(u_ode)
38
# Larger values for allowed allocations due to usage of custom
39
# integrator which are not *recorded* for the methods from
40
# OrdinaryDiffEq.jl
41
# Corresponding issue: https://github.com/trixi-framework/Trixi.jl/issues/1877
42
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 8000
43
end
44
end
45
46
@trixi_testset "elixir_hypdiff_harmonic_nonperiodic.jl" begin
47
@test_trixi_include(joinpath(EXAMPLES_DIR,
48
"elixir_hypdiff_harmonic_nonperiodic.jl"),
49
l2=[3.0130941075207524e-12, 2.6240829677090014e-12],
50
linf=[4.054534485931072e-12, 3.8826719617190975e-12],
51
atol=2.5e-13)
52
# Ensure that we do not have excessive memory allocations
53
# (e.g., from type instabilities)
54
let
55
t = sol.t[end]
56
u_ode = sol.u[end]
57
du_ode = similar(u_ode)
58
# Larger values for allowed allocations due to usage of custom
59
# integrator which are not *recorded* for the methods from
60
# OrdinaryDiffEq.jl
61
# Corresponding issue: https://github.com/trixi-framework/Trixi.jl/issues/1877
62
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 10000
63
end
64
end
65
end
66
67
end # module
68
69