Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HLL MHD Breaking changes for Consistency #1708

Merged
merged 24 commits into from
Nov 10, 2023
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
0f0dcac
Breaking changes HLL MHD
DanielDoehring Nov 6, 2023
738dd3a
format
DanielDoehring Nov 6, 2023
9a5ca9c
format examples
DanielDoehring Nov 6, 2023
c2493f7
hlle
DanielDoehring Nov 6, 2023
2869d5a
fix
DanielDoehring Nov 6, 2023
b2864a7
news, tests, example changes
DanielDoehring Nov 6, 2023
bdc35df
fmt
DanielDoehring Nov 6, 2023
4f5a754
remove left-right-biased flux from test
DanielDoehring Nov 6, 2023
4f37363
Set version to v0.6.0
sloede Nov 4, 2023
61c80ba
Migrate neural network-based indicators to new repository (#1701)
sloede Nov 7, 2023
29bb3d8
Merge branch 'v0.6-dev' into HLL_MHD_Breaking
ranocha Nov 7, 2023
426af45
fix hlle noncartesian 2d
DanielDoehring Nov 8, 2023
511f913
Merge branch 'HLL_MHD_Breaking' of github.com:DanielDoehring/Trixi.jl…
DanielDoehring Nov 8, 2023
2fd4142
remove parantheses
DanielDoehring Nov 8, 2023
8b7f20b
correct test vals
DanielDoehring Nov 8, 2023
9427816
Make parabolic terms nonexperimental (#1714)
sloede Nov 8, 2023
46cc2e5
Deprecate some `DGMultiMesh` constructors (#1709)
jlchan Nov 8, 2023
32c787d
add gradient variable type parameter to `AbstractEquationsParabolic` …
jlchan Nov 8, 2023
6c48c6d
Merge branch 'v0.6-dev' into HLL_MHD_Breaking
DanielDoehring Nov 9, 2023
e796dd6
Merge branch 'v0.6-dev' into HLL_MHD_Breaking
DanielDoehring Nov 10, 2023
95e3abd
bring downloads back
DanielDoehring Nov 10, 2023
ce32571
fix failing test
jlchan Nov 10, 2023
193be48
Merge remote-tracking branch 'TrixiJesse/jc/fix_v0.6_CI_DGMultiMesh' …
DanielDoehring Nov 10, 2023
8da6f76
fmt
DanielDoehring Nov 10, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,18 @@ Trixi.jl follows the interpretation of [semantic versioning (semver)](https://ju
used in the Julia ecosystem. Notable changes will be documented in this file
for human readability.

## Changes when updating to v0.6 from v0.5.x

#### Added

#### Changed

- The wave speed estimates for `flux_hll`, `FluxHLL()` are now consistent across equations.
In particular, the functions `min_max_speed_naive`, `min_max_speed_einfeldt` are now
conceptually identical across equations.
Users, who have been using `flux_hll` for MHD have now to use `flux_hlle` in order to use the
Einfeldt wave speed estimate.

## Changes in the v0.5 lifecycle

#### Added
Expand Down
4 changes: 3 additions & 1 deletion examples/p4est_2d_dgsem/elixir_mhd_alfven_wave.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ initial_condition = initial_condition_convergence_test

# Get the DG approximation space
volume_flux = (flux_central, flux_nonconservative_powell)
solver = DGSEM(polydeg = 4, surface_flux = (flux_hll, flux_nonconservative_powell),
solver = DGSEM(polydeg = 4,
surface_flux = (flux_hlle,
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,9 @@ equations = IdealGlmMhdEquations3D(5 / 3)
initial_condition = initial_condition_convergence_test

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

coordinates_min = (-1.0, -1.0, -1.0)
Expand Down
4 changes: 3 additions & 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,9 @@ equations = IdealGlmMhdEquations3D(5 / 3)
initial_condition = initial_condition_convergence_test

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

# Create the mesh
Expand Down
2 changes: 1 addition & 1 deletion examples/t8code_2d_dgsem/elixir_mhd_alfven_wave.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,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 = (flux_hll, flux_nonconservative_powell),
solver = DGSEM(polydeg = 4, surface_flux = (flux_hlle, flux_nonconservative_powell),
volume_integral = VolumeIntegralFluxDifferencing(volume_flux))

coordinates_min = (0.0, 0.0)
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 = flux_hll
surface_flux = flux_hlle
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 = flux_hll
surface_flux = flux_hlle
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 @@ -61,7 +61,7 @@ initial_condition = initial_condition_shu_osher_shock_tube

boundary_conditions = BoundaryConditionDirichlet(initial_condition)

surface_flux = flux_hll
surface_flux = flux_hlle
volume_flux = flux_hindenlang_gassner
basis = LobattoLegendreBasis(4)

Expand Down
4 changes: 3 additions & 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,9 @@ equations = IdealGlmMhdEquations2D(gamma)
initial_condition = initial_condition_convergence_test

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

coordinates_min = (0.0, 0.0)
Expand Down
4 changes: 3 additions & 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,9 @@ equations = IdealGlmMhdEquations3D(5 / 3)
initial_condition = initial_condition_convergence_test

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

coordinates_min = (-1.0, -1.0, -1.0)
Expand Down
4 changes: 3 additions & 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,9 @@ equations = IdealGlmMhdEquations2D(gamma)
initial_condition = initial_condition_convergence_test

volume_flux = (flux_central, flux_nonconservative_powell)
solver = DGSEM(polydeg = 7, surface_flux = (flux_hll, flux_nonconservative_powell),
solver = DGSEM(polydeg = 7,
surface_flux = (flux_hlle,
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: 19 additions & 3 deletions src/equations/ideal_glm_mhd_1d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,22 @@ 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,
ranocha marked this conversation as resolved.
Show resolved Hide resolved
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,
ranocha marked this conversation as resolved.
Show resolved Hide resolved
equations::IdealGlmMhdEquations1D)
Expand All @@ -298,15 +314,15 @@ end
end

"""
min_max_speed_naive(u_ll, u_rr, orientation::Integer, equations::IdealGlmMhdEquations1D)
min_max_speed_einfeldt(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_naive(u_ll, u_rr, orientation::Integer,
equations::IdealGlmMhdEquations1D)
@inline function min_max_speed_einfeldt(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: 55 additions & 5 deletions src/equations/ideal_glm_mhd_2d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -775,6 +775,56 @@ 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,
ranocha marked this conversation as resolved.
Show resolved Hide resolved
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,
ranocha marked this conversation as resolved.
Show resolved Hide resolved
equations::IdealGlmMhdEquations2D)
Expand Down Expand Up @@ -833,15 +883,15 @@ end
end

"""
min_max_speed_naive(u_ll, u_rr, orientation::Integer, equations::IdealGlmMhdEquations2D)
min_max_speed_einfeldt(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_naive(u_ll, u_rr, orientation::Integer,
equations::IdealGlmMhdEquations2D)
@inline function min_max_speed_einfeldt(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 @@ -870,8 +920,8 @@ Calculate minimum and maximum wave speeds for HLL-type fluxes as in
return λ_min, λ_max
end

@inline function min_max_speed_naive(u_ll, u_rr, normal_direction::AbstractVector,
equations::IdealGlmMhdEquations2D)
@inline function min_max_speed_einfeldt(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: 63 additions & 5 deletions src/equations/ideal_glm_mhd_3d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -670,6 +670,64 @@ 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,
ranocha marked this conversation as resolved.
Show resolved Hide resolved
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,
ranocha marked this conversation as resolved.
Show resolved Hide resolved
equations::IdealGlmMhdEquations3D)
Expand Down Expand Up @@ -742,15 +800,15 @@ end
end

"""
min_max_speed_naive(u_ll, u_rr, orientation_or_normal_direction, equations::IdealGlmMhdEquations3D)
min_max_speed_einfeldt(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_naive(u_ll, u_rr, orientation::Integer,
equations::IdealGlmMhdEquations3D)
@inline function min_max_speed_einfeldt(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 @@ -787,8 +845,8 @@ Calculate minimum and maximum wave speeds for HLL-type fluxes as in
return λ_min, λ_max
end

@inline function min_max_speed_naive(u_ll, u_rr, normal_direction::AbstractVector,
equations::IdealGlmMhdEquations3D)
@inline function min_max_speed_einfeldt(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
3 changes: 2 additions & 1 deletion test/test_tree_2d_mhd.jl
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,8 @@ end
0.04879208429337193,
],
tspan=(0.0, 0.06),
surface_flux=(flux_hll, flux_nonconservative_powell))
surface_flux=(flux_hlle,
flux_nonconservative_powell))
# Ensure that we do not have excessive memory allocations
# (e.g., from type instabilities)
let
Expand Down
3 changes: 2 additions & 1 deletion test/test_tree_3d_mhd.jl
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,8 @@ end
1000
end
end,
surface_flux=(flux_hll, flux_nonconservative_powell),
surface_flux=(flux_hlle,
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
Loading
Loading