Skip to content

Commit

Permalink
apply suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielDoehring committed Oct 31, 2023
1 parent 2a08efa commit a0c0221
Show file tree
Hide file tree
Showing 11 changed files with 32 additions and 34 deletions.
2 changes: 1 addition & 1 deletion src/Trixi.jl
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ export LaplaceDiffusion1D, LaplaceDiffusion2D, LaplaceDiffusion3D,

export GradientVariablesPrimitive, GradientVariablesEntropy

export flux, flux_central, flux_lax_friedrichs, flux_hll, flux_hllc,
export flux, flux_central, flux_lax_friedrichs, flux_hll, flux_hllc, flux_hlle,
flux_godunov,
flux_chandrashekar, flux_ranocha, flux_derigs_etal, flux_hindenlang_gassner,
flux_nonconservative_powell, flux_nonconservative_powell_local_symmetric,
Expand Down
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)
"""
@inline 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)
"""
@inline 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)
"""
@inline 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)
"""
@inline 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)
"""
@inline 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
7 changes: 7 additions & 0 deletions src/equations/numerical_fluxes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,13 @@ See [`FluxHLL`](@ref).
"""
const flux_hll = FluxHLL()

"""
flux_hlle
See [`min_max_speed_einfeldt`](@ref).
"""
const flux_hlle = FluxHLL(min_max_speed_einfeldt)

# TODO: TrixiShallowWater: move the chen_noelle flux structure to the new package

# An empty version of the `min_max_speed_chen_noelle` function is declared here
Expand Down
2 changes: 1 addition & 1 deletion test/test_p4est_2d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ end
1.313896142714079,
6.293305112638921,
],
surface_flux=FluxHLL(min_max_speed_einfeldt),
surface_flux=flux_hlle,
tspan=(0.0, 0.3))
# Ensure that we do not have excessive memory allocations
# (e.g., from type instabilities)
Expand Down
2 changes: 1 addition & 1 deletion test/test_p4est_3d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ end
4.730877375538398,
],
tspan=(0.0, 0.3),
surface_flux=FluxHLL(min_max_speed_einfeldt))
surface_flux=flux_hlles)
# Ensure that we do not have excessive memory allocations
# (e.g., from type instabilities)
let
Expand Down
2 changes: 1 addition & 1 deletion test/test_tree_1d_euler.jl
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ end
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))
surface_flux=flux_hlle)
# Ensure that we do not have excessive memory allocations
# (e.g., from type instabilities)
let
Expand Down
2 changes: 1 addition & 1 deletion test/test_tree_2d_euler.jl
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ end
6.24263735888126,
],
tspan=(0.0, 0.5),
surface_flux=FluxHLL(min_max_speed_einfeldt))
surface_flux=flux_hlle)
# Ensure that we do not have excessive memory allocations
# (e.g., from type instabilities)
let
Expand Down
2 changes: 1 addition & 1 deletion test/test_tree_3d_euler.jl
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ end
1.7082524045150382,
],
tspan=(0.0, 0.01),
surface_flux=FluxHLL(min_max_speed_einfeldt))
surface_flux=flux_hlle)
# Ensure that we do not have excessive memory allocations
# (e.g., from type instabilities)
let
Expand Down
37 changes: 14 additions & 23 deletions test/test_unit.jl
Original file line number Diff line number Diff line change
Expand Up @@ -892,20 +892,17 @@ 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_hll(u, u, orientation, equations) flux(u, orientation, equations)
@test flux_hlle(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_hll(u, u, orientation, equations) flux(u, orientation, equations)
@test flux_hlle(u, u, orientation, equations) flux(u, orientation, equations)
end

normal_directions = [SVector(1.0, 0.0),
Expand All @@ -914,7 +911,7 @@ end
SVector(-1.2, 0.3)]

for normal_direction in normal_directions
@test flux_hll(u, u, normal_direction, equations)
@test flux_hlle(u, u, normal_direction, equations)
flux(u, normal_direction, equations)
end

Expand All @@ -923,7 +920,7 @@ end

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

normal_directions = [SVector(1.0, 0.0, 0.0),
Expand All @@ -933,18 +930,15 @@ end
SVector(-1.2, 0.3, 1.4)]

for normal_direction in normal_directions
@test flux_hll(u, u, normal_direction, equations)
@test flux_hlle(u, u, normal_direction, equations)
flux(u, normal_direction, equations)
end
end

@timed_testset "Consistency check for HLLE flux: SWE" begin
# Test HLL flux with min_max_speed_einfeldt
flux_hll = FluxHLL(min_max_speed_einfeldt)

equations = ShallowWaterEquations1D(gravity_constant = 9.81)
u = SVector(1, 0.5, 0.0)
@test flux_hll(u, u, 1, equations) flux(u, 1, equations)
@test flux_hlle(u, u, 1, equations) flux(u, 1, equations)

equations = ShallowWaterEquations2D(gravity_constant = 9.81)
normal_directions = [SVector(1.0, 0.0),
Expand All @@ -956,25 +950,22 @@ end
u = SVector(1, 0.5, 0.5, 0.0)

for orientation in orientations
@test flux_hll(u, u, orientation, equations) flux(u, orientation, equations)
@test flux_hlle(u, u, orientation, equations) flux(u, orientation, equations)
end

for normal_direction in normal_directions
@test flux_hll(u, u, normal_direction, equations)
@test flux_hlle(u, u, normal_direction, equations)
flux(u, normal_direction, equations)
end
end

@timed_testset "Consistency check for HLLE flux: MHD" begin
# Test HLL flux with min_max_speed_einfeldt
flux_hll = FluxHLL(min_max_speed_naive)

equations = IdealGlmMhdEquations1D(1.4)
u_values = [SVector(1.0, 0.4, -0.5, 0.1, 1.0, 0.1, -0.2, 0.1),
SVector(1.5, -0.2, 0.1, 0.2, 5.0, -0.1, 0.1, 0.2)]

for u in u_values
@test flux_hll(u, u, 1, equations) flux(u, 1, equations)
@test flux_hlle(u, u, 1, equations) flux(u, 1, equations)
end

equations = IdealGlmMhdEquations2D(1.4, 5.0) #= c_h =#
Expand All @@ -988,11 +979,11 @@ end
SVector(1.5, -0.2, 0.1, 0.2, 5.0, -0.1, 0.1, 0.2, 0.2)]

for u in u_values, orientation in orientations
@test flux_hll(u, u, orientation, equations) flux(u, orientation, equations)
@test flux_hlle(u, u, orientation, equations) flux(u, orientation, equations)
end

for u in u_values, normal_direction in normal_directions
@test flux_hll(u, u, normal_direction, equations)
@test flux_hlle(u, u, normal_direction, equations)
flux(u, normal_direction, equations)
end

Expand All @@ -1008,11 +999,11 @@ end
SVector(1.5, -0.2, 0.1, 0.2, 5.0, -0.1, 0.1, 0.2, 0.2)]

for u in u_values, orientation in orientations
@test flux_hll(u, u, orientation, equations) flux(u, orientation, equations)
@test flux_hlle(u, u, orientation, equations) flux(u, orientation, equations)
end

for u in u_values, normal_direction in normal_directions
@test flux_hll(u, u, normal_direction, equations)
@test flux_hlle(u, u, normal_direction, equations)
flux(u, normal_direction, equations)
end
end
Expand Down Expand Up @@ -1245,7 +1236,7 @@ end
u = SVector(1, 0.5, 0.5, 0.0)

fluxes = [flux_central, flux_fjordholm_etal, flux_wintermeyer_etal,
flux_hll, FluxHLL(min_max_speed_davis), FluxHLL(min_max_speed_einfeldt)]
flux_hll, FluxHLL(min_max_speed_davis), flux_hlle]
end

@timed_testset "IdealGlmMhdEquations2D" begin
Expand Down

0 comments on commit a0c0221

Please sign in to comment.