Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielDoehring committed Oct 30, 2023
1 parent ccf55a5 commit aca8cb7
Show file tree
Hide file tree
Showing 9 changed files with 137 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/equations/compressible_euler_1d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -826,7 +826,7 @@ Compactly summarized:
[Link](https://metaphor.ethz.ch/x/2019/hs/401-4671-00L/literature/mishra_hyperbolic_pdes.pdf)
"""
function min_max_speed_einfeldt(u_ll, u_rr, orientation::Integer,
equations::CompressibleEulerEquations1D)
equations::CompressibleEulerEquations1D)
# Calculate primitive variables, enthalpy and speed of sound
rho_ll, v_ll, p_ll = cons2prim(u_ll, equations)
rho_rr, v_rr, p_rr = cons2prim(u_rr, equations)
Expand Down
4 changes: 2 additions & 2 deletions src/equations/compressible_euler_2d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1268,7 +1268,7 @@ of the numerical flux.
[DOI: 10.1016/0021-9991(91)90211-3](https://doi.org/10.1016/0021-9991(91)90211-3)
"""
function min_max_speed_einfeldt(u_ll, u_rr, orientation::Integer,
equations::CompressibleEulerEquations2D)
equations::CompressibleEulerEquations2D)
# Calculate primitive variables, enthalpy and speed of sound
rho_ll, v1_ll, v2_ll, p_ll = cons2prim(u_ll, equations)
rho_rr, v1_rr, v2_rr, p_rr = cons2prim(u_rr, equations)
Expand Down Expand Up @@ -1325,7 +1325,7 @@ of the numerical flux.
[DOI: 10.1016/0021-9991(91)90211-3](https://doi.org/10.1016/0021-9991(91)90211-3)
"""
function min_max_speed_einfeldt(u_ll, u_rr, normal_direction::AbstractVector,
equations::CompressibleEulerEquations2D)
equations::CompressibleEulerEquations2D)
# Calculate primitive variables, enthalpy and speed of sound
rho_ll, v1_ll, v2_ll, p_ll = cons2prim(u_ll, equations)
rho_rr, v1_rr, v2_rr, p_rr = cons2prim(u_rr, equations)
Expand Down
4 changes: 2 additions & 2 deletions src/equations/compressible_euler_3d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1337,7 +1337,7 @@ of the numerical flux.
[DOI: 10.1016/0021-9991(91)90211-3](https://doi.org/10.1016/0021-9991(91)90211-3)
"""
function min_max_speed_einfeldt(u_ll, u_rr, orientation::Integer,
equations::CompressibleEulerEquations3D)
equations::CompressibleEulerEquations3D)
# Calculate primitive variables, enthalpy and speed of sound
rho_ll, v1_ll, v2_ll, v3_ll, p_ll = cons2prim(u_ll, equations)
rho_rr, v1_rr, v2_rr, v3_rr, p_rr = cons2prim(u_rr, equations)
Expand Down Expand Up @@ -1398,7 +1398,7 @@ of the numerical flux.
[DOI: 10.1016/0021-9991(91)90211-3](https://doi.org/10.1016/0021-9991(91)90211-3)
"""
function min_max_speed_einfeldt(u_ll, u_rr, normal_direction::AbstractVector,
equations::CompressibleEulerEquations3D)
equations::CompressibleEulerEquations3D)
# Calculate primitive variables, enthalpy and speed of sound
rho_ll, v1_ll, v2_ll, v3_ll, p_ll = cons2prim(u_ll, equations)
rho_rr, v1_rr, v2_rr, v3_rr, p_rr = cons2prim(u_rr, equations)
Expand Down
28 changes: 27 additions & 1 deletion test/test_p4est_2d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,32 @@ end
end
end

@trixi_testset "elixir_euler_sedov.jl (HLLE)" begin
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_sedov.jl"),
l2=[
0.411541263324004,
0.2558929632770186,
0.2558929632770193,
1.298715766843915,
],
linf=[
1.3457201726152221,
1.3138961427140758,
1.313896142714079,
6.293305112638921,
],
surface_flux=FluxHLL(min_max_speed_einfeldt),
tspan=(0.0, 0.3))
# Ensure that we do not have excessive memory allocations
# (e.g., from type instabilities)
let
t = sol.t[end]
u_ode = sol.u[end]
du_ode = similar(u_ode)
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
end
end

@trixi_testset "elixir_euler_blast_wave_amr.jl" begin
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_blast_wave_amr.jl"),
l2=[
Expand Down Expand Up @@ -460,4 +486,4 @@ end
# Clean up afterwards: delete Trixi.jl output directory
@test_nowarn rm(outdir, recursive = true)

end # module
end # module
30 changes: 29 additions & 1 deletion test/test_p4est_3d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,34 @@ end
end
end

@trixi_testset "elixir_euler_sedov.jl (HLLE)" begin
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_sedov.jl"),
l2=[
0.09946224487902565,
0.04863386374672001,
0.048633863746720116,
0.04863386374672032,
0.3751015774232693,
],
linf=[
0.789241521871487,
0.42046970270100276,
0.42046970270100276,
0.4204697027010028,
4.730877375538398,
],
tspan=(0.0, 0.3),
surface_flux=FluxHLL(min_max_speed_einfeldt))
# Ensure that we do not have excessive memory allocations
# (e.g., from type instabilities)
let
t = sol.t[end]
u_ode = sol.u[end]
du_ode = similar(u_ode)
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
end
end

@trixi_testset "elixir_euler_source_terms_nonconforming_earth.jl" begin
@test_trixi_include(joinpath(EXAMPLES_DIR,
"elixir_euler_source_terms_nonconforming_earth.jl"),
Expand Down Expand Up @@ -458,4 +486,4 @@ end
# Clean up afterwards: delete Trixi.jl output directory
@test_nowarn rm(outdir, recursive = true)

end # module
end # module
16 changes: 16 additions & 0 deletions test/test_tree_1d_euler.jl
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,22 @@ end
end
end

@trixi_testset "elixir_euler_sedov_blast_wave.jl (HLLE)" begin
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_sedov_blast_wave.jl"),
l2=[0.6442208390304879, 0.508817280068289, 0.9482809853033687],
linf=[3.007059066482486, 2.4678899558345506, 2.3952311739389787],
tspan=(0.0, 0.5),
surface_flux=FluxHLL(min_max_speed_einfeldt))
# Ensure that we do not have excessive memory allocations
# (e.g., from type instabilities)
let
t = sol.t[end]
u_ode = sol.u[end]
du_ode = similar(u_ode)
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
end
end

@trixi_testset "elixir_euler_sedov_blast_wave_pure_fv.jl" begin
@test_trixi_include(joinpath(EXAMPLES_DIR,
"elixir_euler_sedov_blast_wave_pure_fv.jl"),
Expand Down
26 changes: 26 additions & 0 deletions test/test_tree_2d_euler.jl
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,32 @@ end
end
end

@trixi_testset "elixir_euler_sedov_blast_wave.jl (HLLE)" begin
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_sedov_blast_wave.jl"),
l2=[
0.35267160519013807,
0.17218307108369638,
0.17218308329362564,
0.6236143065592946,
],
linf=[
2.7748404581629016,
1.828111132651005,
1.8281111866225315,
6.24263754517303,
],
tspan=(0.0, 0.5),
surface_flux=FluxHLL(min_max_speed_einfeldt))
# Ensure that we do not have excessive memory allocations
# (e.g., from type instabilities)
let
t = sol.t[end]
u_ode = sol.u[end]
du_ode = similar(u_ode)
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
end
end

@trixi_testset "elixir_euler_sedov_blast_wave_neuralnetwork_perssonperaire.jl" begin
@test_trixi_include(joinpath(EXAMPLES_DIR,
"elixir_euler_sedov_blast_wave_neuralnetwork_perssonperaire.jl"),
Expand Down
28 changes: 28 additions & 0 deletions test/test_tree_3d_euler.jl
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,34 @@ end
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
end
end

@trixi_testset "elixir_euler_sedov_blast_wave.jl (HLLE)" begin
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_sedov_blast_wave.jl"),
l2=[
0.0007871241159752619,
0.0037168004033428146,
0.0037168004033428094,
0.0037168004033428514,
0.011119869089205635,
],
linf=[
0.13982864363612468,
0.786004687738243,
0.786004687738243,
0.7860046877382431,
1.7082524045150382,
],
tspan=(0.0, 0.01),
surface_flux=FluxHLL(min_max_speed_einfeldt))
# Ensure that we do not have excessive memory allocations
# (e.g., from type instabilities)
let
t = sol.t[end]
u_ode = sol.u[end]
du_ode = similar(u_ode)
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
end
end
end

end # module
9 changes: 6 additions & 3 deletions test/test_unit.jl
Original file line number Diff line number Diff line change
Expand Up @@ -892,17 +892,20 @@ end
equations = CompressibleEulerEquations1D(1.4)
u = SVector(1.1, 2.34, 5.5)

# Test HLL flux with min_max_speed_einfeldt
flux_hll = FluxHLL(min_max_speed_einfeldt)

orientations = [1]
for orientation in orientations
@test flux_hlle(u, u, orientation, equations) flux(u, orientation, equations)
@test flux_hll(u, u, orientation, equations) flux(u, orientation, equations)
end

equations = CompressibleEulerEquations2D(1.4)
u = SVector(1.1, -0.5, 2.34, 5.5)

orientations = [1, 2]
for orientation in orientations
@test flux_hlle(u, u, orientation, equations) flux(u, orientation, equations)
@test flux_hll(u, u, orientation, equations) flux(u, orientation, equations)
end

normal_directions = [SVector(1.0, 0.0),
Expand All @@ -920,7 +923,7 @@ end

orientations = [1, 2, 3]
for orientation in orientations
@test flux_hlle(u, u, orientation, equations) flux(u, orientation, equations)
@test flux_hll(u, u, orientation, equations) flux(u, orientation, equations)
end

normal_directions = [SVector(1.0, 0.0, 0.0),
Expand Down

0 comments on commit aca8cb7

Please sign in to comment.