Skip to content

Commit

Permalink
Remove breaking portionv from PR
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielDoehring committed Jul 6, 2023
1 parent f741306 commit 227332e
Show file tree
Hide file tree
Showing 15 changed files with 25 additions and 149 deletions.
2 changes: 1 addition & 1 deletion examples/p4est_2d_dgsem/elixir_mhd_alfven_wave.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ initial_condition = initial_condition_convergence_test

# Get the DG approximation space
volume_flux = (flux_central, flux_nonconservative_powell)
solver = DGSEM(polydeg=4, surface_flux=(FluxHLL(min_max_speed_einfeldt), flux_nonconservative_powell),
solver = DGSEM(polydeg=4, surface_flux=(flux_hll, flux_nonconservative_powell),
volume_integral=VolumeIntegralFluxDifferencing(volume_flux))

coordinates_min = (0.0 , 0.0 )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ equations = IdealGlmMhdEquations3D(5/3)
initial_condition = initial_condition_convergence_test

volume_flux = (flux_hindenlang_gassner, flux_nonconservative_powell)
solver = DGSEM(polydeg=3, surface_flux=(FluxHLL(min_max_speed_einfeldt), flux_nonconservative_powell),
solver = DGSEM(polydeg=3, surface_flux=(flux_hll, flux_nonconservative_powell),
volume_integral=VolumeIntegralFluxDifferencing(volume_flux))

coordinates_min = (-1.0, -1.0, -1.0)
Expand Down
2 changes: 1 addition & 1 deletion examples/structured_3d_dgsem/elixir_mhd_alfven_wave.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ equations = IdealGlmMhdEquations3D(5/3)
initial_condition = initial_condition_convergence_test

volume_flux = (flux_central, flux_nonconservative_powell)
solver = DGSEM(polydeg=5, surface_flux=(FluxHLL(min_max_speed_einfeldt), flux_nonconservative_powell),
solver = DGSEM(polydeg=5, surface_flux=(flux_hll, flux_nonconservative_powell),
volume_integral=VolumeIntegralFluxDifferencing(volume_flux))

# Create the mesh
Expand Down
2 changes: 1 addition & 1 deletion examples/tree_1d_dgsem/elixir_mhd_briowu_shock_tube.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ initial_condition = initial_condition_briowu_shock_tube

boundary_conditions = BoundaryConditionDirichlet(initial_condition)

surface_flux = FluxHLL(min_max_speed_einfeldt)
surface_flux = FluxHLL(flux_hll)
volume_flux = flux_derigs_etal
basis = LobattoLegendreBasis(4)

Expand Down
2 changes: 1 addition & 1 deletion examples/tree_1d_dgsem/elixir_mhd_ryujones_shock_tube.jl
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ initial_condition = initial_condition_ryujones_shock_tube

boundary_conditions = BoundaryConditionDirichlet(initial_condition)

surface_flux = FluxHLL(min_max_speed_einfeldt)
surface_flux = flux_hll
volume_flux = flux_hindenlang_gassner
basis = LobattoLegendreBasis(3)

Expand Down
2 changes: 1 addition & 1 deletion examples/tree_1d_dgsem/elixir_mhd_shu_osher_shock_tube.jl
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ initial_condition = initial_condition_shu_osher_shock_tube

boundary_conditions = BoundaryConditionDirichlet(initial_condition)

surface_flux = FluxHLL(min_max_speed_einfeldt)
surface_flux = flux_hll
volume_flux = flux_hindenlang_gassner
basis = LobattoLegendreBasis(4)

Expand Down
2 changes: 1 addition & 1 deletion examples/tree_2d_dgsem/elixir_mhd_alfven_wave_mortar.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ equations = IdealGlmMhdEquations2D(gamma)
initial_condition = initial_condition_convergence_test

volume_flux = (flux_hindenlang_gassner, flux_nonconservative_powell)
solver = DGSEM(polydeg=3, surface_flux=(FluxHLL(min_max_speed_einfeldt), flux_nonconservative_powell),
solver = DGSEM(polydeg=3, surface_flux=(flux_hll, flux_nonconservative_powell),
volume_integral=VolumeIntegralFluxDifferencing(volume_flux))

coordinates_min = (0.0, 0.0)
Expand Down
2 changes: 1 addition & 1 deletion examples/tree_3d_dgsem/elixir_mhd_alfven_wave_mortar.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ equations = IdealGlmMhdEquations3D(5/3)
initial_condition = initial_condition_convergence_test

volume_flux = (flux_hindenlang_gassner, flux_nonconservative_powell)
solver = DGSEM(polydeg=3, surface_flux=(FluxHLL(min_max_speed_einfeldt), flux_nonconservative_powell),
solver = DGSEM(polydeg=3, surface_flux=(flux_hll, flux_nonconservative_powell),
volume_integral=VolumeIntegralFluxDifferencing(volume_flux))

coordinates_min = (-1.0, -1.0, -1.0)
Expand Down
2 changes: 1 addition & 1 deletion examples/unstructured_2d_dgsem/elixir_mhd_alfven_wave.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ equations = IdealGlmMhdEquations2D(gamma)
initial_condition = initial_condition_convergence_test

volume_flux = (flux_central, flux_nonconservative_powell)
solver = DGSEM(polydeg=7, surface_flux=(FluxHLL(min_max_speed_einfeldt), flux_nonconservative_powell),
solver = DGSEM(polydeg=7, surface_flux=(flux_hll, flux_nonconservative_powell),
volume_integral=VolumeIntegralFluxDifferencing(volume_flux))

# Get the unstructured quad mesh from a file (downloads the file if not available locally)
Expand Down
22 changes: 3 additions & 19 deletions src/equations/ideal_glm_mhd_1d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -277,22 +277,6 @@ end
λ_max = max(abs(v_ll), abs(v_rr)) + max(cf_ll, cf_rr)
end

# Calculate estimates for minimum and maximum wave speeds for HLL-type fluxes
@inline function min_max_speed_naive(u_ll, u_rr, orientation::Integer,
equations::IdealGlmMhdEquations1D)
rho_ll, rho_v1_ll, _ = u_ll
rho_rr, rho_v1_rr, _ = u_rr

# Calculate primitive variables
v1_ll = rho_v1_ll / rho_ll
v1_rr = rho_v1_rr / rho_rr

λ_min = v1_ll - calc_fast_wavespeed(u_ll, orientation, equations)
λ_max = v1_rr + calc_fast_wavespeed(u_rr, orientation, equations)

return λ_min, λ_max
end

# More refined estimates for minimum and maximum wave speeds for HLL-type fluxes
@inline function min_max_speed_davis(u_ll, u_rr, orientation::Integer,
equations::IdealGlmMhdEquations1D)
Expand All @@ -314,15 +298,15 @@ end
end

"""
min_max_speed_einfeldt(u_ll, u_rr, orientation::Integer, equations::IdealGlmMhdEquations1D)
min_max_speed_naive(u_ll, u_rr, orientation::Integer, equations::IdealGlmMhdEquations1D)
Calculate minimum and maximum wave speeds for HLL-type fluxes as in
- Li (2005)
An HLLC Riemann solver for magneto-hydrodynamics
[DOI: 10.1016/j.jcp.2004.08.020](https://doi.org/10.1016/j.jcp.2004.08.020).
"""
@inline function min_max_speed_einfeldt(u_ll, u_rr, orientation::Integer,
equations::IdealGlmMhdEquations1D)
@inline function min_max_speed_naive(u_ll, u_rr, orientation::Integer,
equations::IdealGlmMhdEquations1D)
rho_ll, rho_v1_ll, _ = u_ll
rho_rr, rho_v1_rr, _ = u_rr

Expand Down
60 changes: 5 additions & 55 deletions src/equations/ideal_glm_mhd_2d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -585,56 +585,6 @@ end
return max(abs(v_ll), abs(v_rr)) + max(cf_ll, cf_rr)
end

# Calculate estimate for minimum and maximum wave speeds for HLL-type fluxes
@inline function min_max_speed_naive(u_ll, u_rr, orientation::Integer,
equations::IdealGlmMhdEquations2D)
rho_ll, rho_v1_ll, rho_v2_ll, _ = u_ll
rho_rr, rho_v1_rr, rho_v2_rr, _ = u_rr

# Calculate primitive velocity variables
v1_ll = rho_v1_ll / rho_ll
v2_ll = rho_v2_ll / rho_ll

v1_rr = rho_v1_rr / rho_rr
v2_rr = rho_v2_rr / rho_rr

# Approximate the left-most and right-most eigenvalues in the Riemann fan
if orientation == 1 # x-direction
λ_min = v1_ll - calc_fast_wavespeed(u_ll, orientation, equations)
λ_max = v1_rr + calc_fast_wavespeed(u_rr, orientation, equations)
else # y-direction
λ_min = v2_ll - calc_fast_wavespeed(u_ll, orientation, equations)
λ_max = v2_rr + calc_fast_wavespeed(u_rr, orientation, equations)
end

return λ_min, λ_max
end

@inline function min_max_speed_naive(u_ll, u_rr, normal_direction::AbstractVector,
equations::IdealGlmMhdEquations2D)
rho_ll, rho_v1_ll, rho_v2_ll, _ = u_ll
rho_rr, rho_v1_rr, rho_v2_rr, _ = u_rr

# Calculate primitive velocity variables
v1_ll = rho_v1_ll / rho_ll
v2_ll = rho_v2_ll / rho_ll

v1_rr = rho_v1_rr / rho_rr
v2_rr = rho_v2_rr / rho_rr

v_normal_ll = (v1_ll * normal_direction[1] + v2_ll * normal_direction[2])
v_normal_rr = (v1_rr * normal_direction[1] + v2_rr * normal_direction[2])

c_f_ll = calc_fast_wavespeed(u_ll, normal_direction, equations)
c_f_rr = calc_fast_wavespeed(u_rr, normal_direction, equations)

# Estimate the min/max eigenvalues in the normal direction
λ_min = min(v_normal_ll - c_f_ll, v_normal_rr - c_f_rr)
λ_max = max(v_normal_rr + c_f_rr, v_normal_rr + c_f_rr)

return λ_min, λ_max
end

# More refined estimates for minimum and maximum wave speeds for HLL-type fluxes
@inline function min_max_speed_davis(u_ll, u_rr, orientation::Integer,
equations::IdealGlmMhdEquations2D)
Expand Down Expand Up @@ -693,15 +643,15 @@ end
end

"""
min_max_speed_einfeldt(u_ll, u_rr, orientation::Integer, equations::IdealGlmMhdEquations2D)
min_max_speed_naive(u_ll, u_rr, orientation::Integer, equations::IdealGlmMhdEquations2D)
Calculate minimum and maximum wave speeds for HLL-type fluxes as in
- Li (2005)
An HLLC Riemann solver for magneto-hydrodynamics
[DOI: 10.1016/j.jcp.2004.08.020](https://doi.org/10.1016/j.jcp.2004.08.020).
"""
@inline function min_max_speed_einfeldt(u_ll, u_rr, orientation::Integer,
equations::IdealGlmMhdEquations2D)
@inline function min_max_speed_naive(u_ll, u_rr, orientation::Integer,
equations::IdealGlmMhdEquations2D)
rho_ll, rho_v1_ll, rho_v2_ll, _ = u_ll
rho_rr, rho_v1_rr, rho_v2_rr, _ = u_rr

Expand Down Expand Up @@ -730,8 +680,8 @@ Calculate minimum and maximum wave speeds for HLL-type fluxes as in
return λ_min, λ_max
end

@inline function min_max_speed_einfeldt(u_ll, u_rr, normal_direction::AbstractVector,
equations::IdealGlmMhdEquations2D)
@inline function min_max_speed_naive(u_ll, u_rr, normal_direction::AbstractVector,
equations::IdealGlmMhdEquations2D)
rho_ll, rho_v1_ll, rho_v2_ll, _ = u_ll
rho_rr, rho_v1_rr, rho_v2_rr, _ = u_rr

Expand Down
68 changes: 5 additions & 63 deletions src/equations/ideal_glm_mhd_3d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -670,64 +670,6 @@ end
return max(abs(v_ll), abs(v_rr)) + max(cf_ll, cf_rr)
end

# Calculate estimate for minimum and maximum wave speeds for HLL-type fluxes
@inline function min_max_speed_naive(u_ll, u_rr, orientation::Integer,
equations::IdealGlmMhdEquations3D)
rho_ll, rho_v1_ll, rho_v2_ll, rho_v3_ll, _ = u_ll
rho_rr, rho_v1_rr, rho_v2_rr, rho_v3_rr, _ = u_rr

# Calculate primitive variables and speed of sound
v1_ll = rho_v1_ll / rho_ll
v2_ll = rho_v2_ll / rho_ll
v3_ll = rho_v3_ll / rho_ll

v1_rr = rho_v1_rr / rho_rr
v2_rr = rho_v2_rr / rho_rr
v3_rr = rho_v3_rr / rho_rr

# Approximate the left-most and right-most eigenvalues in the Riemann fan
if orientation == 1 # x-direction
λ_min = v1_ll - calc_fast_wavespeed(u_ll, orientation, equations)
λ_max = v1_rr + calc_fast_wavespeed(u_rr, orientation, equations)
elseif orientation == 2 # y-direction
λ_min = v2_ll - calc_fast_wavespeed(u_ll, orientation, equations)
λ_max = v2_rr + calc_fast_wavespeed(u_rr, orientation, equations)
else # z-direction
λ_min = v3_ll - calc_fast_wavespeed(u_ll, orientation, equations)
λ_max = v3_rr + calc_fast_wavespeed(u_rr, orientation, equations)
end

return λ_min, λ_max
end

@inline function min_max_speed_naive(u_ll, u_rr, normal_direction::AbstractVector,
equations::IdealGlmMhdEquations3D)
rho_ll, rho_v1_ll, rho_v2_ll, rho_v3_ll, _ = u_ll
rho_rr, rho_v1_rr, rho_v2_rr, rho_v3_rr, _ = u_rr

# Calculate primitive velocity variables
v1_ll = rho_v1_ll / rho_ll
v2_ll = rho_v2_ll / rho_ll
v3_ll = rho_v3_ll / rho_ll

v1_rr = rho_v1_rr / rho_rr
v2_rr = rho_v2_rr / rho_rr
v3_rr = rho_v3_rr / rho_rr

v_normal_ll = (v1_ll * normal_direction[1] +
v2_ll * normal_direction[2] +
v3_ll * normal_direction[3])
v_normal_rr = (v1_rr * normal_direction[1] +
v2_rr * normal_direction[2] +
v3_rr * normal_direction[3])

# Estimate the min/max eigenvalues in the normal direction
λ_min = v_normal_ll - calc_fast_wavespeed(u_ll, normal_direction, equations)
λ_max = v_normal_rr + calc_fast_wavespeed(u_rr, normal_direction, equations)

return λ_min, λ_max
end

# More refined estimates for minimum and maximum wave speeds for HLL-type fluxes
@inline function min_max_speed_davis(u_ll, u_rr, orientation::Integer,
equations::IdealGlmMhdEquations3D)
Expand Down Expand Up @@ -800,15 +742,15 @@ end
end

"""
min_max_speed_einfeldt(u_ll, u_rr, orientation_or_normal_direction, equations::IdealGlmMhdEquations3D)
min_max_speed_naive(u_ll, u_rr, orientation_or_normal_direction, equations::IdealGlmMhdEquations3D)
Calculate minimum and maximum wave speeds for HLL-type fluxes as in
- Li (2005)
An HLLC Riemann solver for magneto-hydrodynamics
[DOI: 10.1016/j.jcp.2004.08.020](https://doi.org/10.1016/j.jcp.2004.08.020)
"""
@inline function min_max_speed_einfeldt(u_ll, u_rr, orientation::Integer,
equations::IdealGlmMhdEquations3D)
@inline function min_max_speed_naive(u_ll, u_rr, orientation::Integer,
equations::IdealGlmMhdEquations3D)
rho_ll, rho_v1_ll, rho_v2_ll, rho_v3_ll, _ = u_ll
rho_rr, rho_v1_rr, rho_v2_rr, rho_v3_rr, _ = u_rr

Expand Down Expand Up @@ -845,8 +787,8 @@ Calculate minimum and maximum wave speeds for HLL-type fluxes as in
return λ_min, λ_max
end

@inline function min_max_speed_einfeldt(u_ll, u_rr, normal_direction::AbstractVector,
equations::IdealGlmMhdEquations3D)
@inline function min_max_speed_naive(u_ll, u_rr, normal_direction::AbstractVector,
equations::IdealGlmMhdEquations3D)
rho_ll, rho_v1_ll, rho_v2_ll, rho_v3_ll, _ = u_ll
rho_rr, rho_v1_rr, rho_v2_rr, rho_v3_rr, _ = u_rr

Expand Down
2 changes: 1 addition & 1 deletion test/test_tree_2d_mhd.jl
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ EXAMPLES_DIR = pkgdir(Trixi, "examples", "tree_2d_dgsem")
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_mhd_orszag_tang.jl"),
l2 = [0.10806619664693064, 0.20199136742199922, 0.22984589847526207, 0.0, 0.29950152196422647, 0.15688413207147794, 0.24293641543490646, 0.0, 0.003246181006326598],
linf = [0.560316034595759, 0.5095520363866776, 0.6536748458764621, 0.0, 0.9627447086204038, 0.3981375420906146, 0.673472146198816, 0.0, 0.04879208429337193],
tspan = (0.0, 0.06), surface_flux = (FluxHLL(min_max_speed_einfeldt), flux_nonconservative_powell))
tspan = (0.0, 0.06), surface_flux = (FluxHLL(min_max_speed_naive), flux_nonconservative_powell))
end

@trixi_testset "elixir_mhd_alfven_wave.jl one step with initial_condition_constant" begin
Expand Down
2 changes: 1 addition & 1 deletion test/test_tree_3d_mhd.jl
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ EXAMPLES_DIR = pkgdir(Trixi, "examples", "tree_3d_dgsem")
psi = 0.0
return prim2cons(SVector(rho, v1, v2, v3, p, B1, B2, B3, psi), equations)
end,
surface_flux = (FluxHLL(min_max_speed_einfeldt), flux_nonconservative_powell),
surface_flux = (FluxHLL(min_max_speed_naive), flux_nonconservative_powell),
volume_flux = (flux_central, flux_nonconservative_powell),
coordinates_min = (0.0, 0.0, 0.0),
coordinates_max = (1.0, 1.0, 1.0),
Expand Down
2 changes: 1 addition & 1 deletion test/test_unit.jl
Original file line number Diff line number Diff line change
Expand Up @@ -805,7 +805,7 @@ isdir(outdir) && rm(outdir, recursive=true)
end

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

equations = ShallowWaterEquations1D(gravity_constant=9.81)
u = SVector(1, 0.5, 0.0)
Expand Down

0 comments on commit 227332e

Please sign in to comment.