Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
trixi-framework
GitHub Repository: trixi-framework/Trixi.jl
Path: blob/main/test/test_tree_1d_traffic_flow_lwr.jl
2055 views
1
module TestExamples1DTrafficFlowLWR
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 "Traffic-flow LWR" begin
11
#! format: noindent
12
13
@trixi_testset "elixir_traffic_flow_lwr_convergence.jl" begin
14
@test_trixi_include(joinpath(EXAMPLES_DIR,
15
"elixir_traffic_flow_lwr_convergence.jl"),
16
l2=[0.0008455067389588569],
17
linf=[0.004591951086623913])
18
# Ensure that we do not have excessive memory allocations
19
# (e.g., from type instabilities)
20
let
21
t = sol.t[end]
22
u_ode = sol.u[end]
23
du_ode = similar(u_ode)
24
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
25
end
26
end
27
28
@trixi_testset "elixir_traffic_flow_lwr_trafficjam.jl" begin
29
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_traffic_flow_lwr_trafficjam.jl"),
30
l2=[0.1761758135539748], linf=[0.5])
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
end
41
42
end # module
43
44