Skip to content

Commit

Permalink
complete test
Browse files Browse the repository at this point in the history
  • Loading branch information
huiyuxie committed Jul 26, 2024
1 parent b2c7fe1 commit d171dec
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/equations/traffic_flow_lwr_1d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ function initial_condition_convergence_test(x, t, equations::TrafficFlowLWREquat
c = 2
A = 1
L = 1
f = 1 / L
f = 1.0f0 / L
omega = 2 * convert(RealT, pi) * f
scalar = c + A * sin(omega * (x[1] - t))

Expand All @@ -60,7 +60,7 @@ Source terms used for convergence tests in combination with
c = 2
A = 1
L = 1
f = 1 / L
f = 1.0f0 / L
omega = 2 * convert(RealT, pi) * f
du = omega * cos(omega * (x[1] - t)) *
(-1 - equations.v_max * (2 * sin(omega * (x[1] - t)) + 3))
Expand Down
33 changes: 33 additions & 0 deletions test/test_type.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2194,6 +2194,39 @@ isdir(outdir) && rm(outdir, recursive = true)
@test typeof(@inferred lake_at_rest_error(u, equations)) == RealT
end
end

@timed_testset "Traffic Flow LWR 1D" begin
for RealT in (Float32, Float64)
equations = @inferred TrafficFlowLWREquations1D(RealT(1))

x = SVector(zero(RealT))
t = zero(RealT)
u = u_ll = u_rr = SVector(one(RealT))
orientation = 1
c = one(RealT)

@test eltype(@inferred initial_condition_convergence_test(x, t, equations)) ==
RealT
@test eltype(@inferred source_terms_convergence_test(u, x, t, equations)) ==
RealT

@test eltype(@inferred flux(u, orientation, equations)) == RealT

@test typeof(@inferred max_abs_speed_naive(u_ll, u_rr, orientation, equations)) ==
RealT
@test eltype(@inferred min_max_speed_naive(u_ll, u_rr, orientation, equations)) ==
RealT
@test eltype(@inferred min_max_speed_davis(u_ll, u_rr, orientation, equations)) ==
RealT
@test eltype(@inferred Trixi.max_abs_speeds(u, equations)) == RealT
@test eltype(@inferred cons2prim(u, equations)) == RealT
@test eltype(@inferred cons2entropy(u, equations)) == RealT
@test typeof(@inferred entropy(c, equations)) == RealT
@test typeof(@inferred entropy(u, equations)) == RealT
@test typeof(@inferred energy_total(c, equations)) == RealT
@test typeof(@inferred energy_total(u, equations)) == RealT
end
end
end

end # module

0 comments on commit d171dec

Please sign in to comment.