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

Add new non-conservative flux for standard and two-layer shallow water equations #1508

Merged
merged 30 commits into from
Nov 10, 2023
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
7de4ce1
Add flux_nonconservative_ersing_etal
patrickersing May 20, 2023
b239408
Change formulation of flux_nonconservative_ersing
patrickersing Jun 5, 2023
298918a
remove old fluxes (fjordholm, wintermeyer)
patrickersing Jun 5, 2023
e09b59c
Update tests for new flux_ersing_etal
patrickersing Jun 5, 2023
c6a441a
Add flux_nonconservative_ersing for standard SWE
patrickersing Jun 5, 2023
43d6608
Edit comments, change flux in elixir
patrickersing Jun 5, 2023
adc6806
fix well-balanced test
patrickersing Jun 5, 2023
3788c1f
Merge branch 'main' into twolayer_swe
patrickersing Jun 5, 2023
ed31467
Merge branch 'main' into twolayer_swe
andrewwinters5000 Jun 14, 2023
28668fe
Update src/Trixi.jl
patrickersing Jun 15, 2023
7d75332
fix indentation
patrickersing Jun 15, 2023
fb48934
fix indentation II
patrickersing Jun 15, 2023
9274c36
Update src/equations/shallow_water_2d.jl
patrickersing Jun 15, 2023
ba45d05
fix energy total function
patrickersing Jun 19, 2023
3cc36b5
Merge branch 'main' into twolayer_swe
patrickersing Jun 21, 2023
2381c2b
Apply formatter
patrickersing Jun 21, 2023
641a592
add docstring references
patrickersing Jun 27, 2023
2785d96
Merge branch 'main' into twolayer_swe
patrickersing Jun 27, 2023
66e9c60
remove flux_nonconservative_fjordholm_etal
patrickersing Jun 28, 2023
fae20c6
apply formatter
patrickersing Jun 28, 2023
30d73b2
Merge branch 'main' into twolayer_swe
patrickersing Aug 9, 2023
c1c0625
Merge branch 'main' into twolayer_swe
patrickersing Aug 9, 2023
a97efa2
Merge branch 'main' into twolayer_swe
patrickersing Aug 10, 2023
4a639dc
Merge branch 'main' into twolayer_swe
patrickersing Aug 24, 2023
41c6a22
Merge branch 'main' into twolayer_swe
patrickersing Nov 6, 2023
37867c4
Merge branch 'main' into twolayer_swe
patrickersing Nov 6, 2023
840f94e
Format examples
patrickersing Nov 6, 2023
8a0a674
Merge branch 'main' into twolayer_swe
patrickersing Nov 7, 2023
9cc4f6f
Merge branch 'main' into twolayer_swe
patrickersing Nov 7, 2023
0a594ec
Merge branch 'main' into twolayer_swe
patrickersing Nov 9, 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
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ initial_condition = initial_condition_convergence_test
###############################################################################
# Get the DG approximation space

volume_flux = (flux_wintermeyer_etal, flux_nonconservative_wintermeyer_etal)
solver = DGSEM(polydeg=3, surface_flux=(flux_fjordholm_etal, flux_nonconservative_fjordholm_etal),
volume_flux = (flux_wintermeyer_etal, flux_nonconservative_ersing_etal)
solver = DGSEM(polydeg=3, surface_flux=(flux_wintermeyer_etal, flux_nonconservative_ersing_etal),
volume_integral=VolumeIntegralFluxDifferencing(volume_flux))


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ initial_condition = initial_condition_dam_break
###############################################################################
# Get the DG approximation space

volume_flux = (flux_wintermeyer_etal, flux_nonconservative_wintermeyer_etal)
solver = DGSEM(polydeg=3, surface_flux=(flux_fjordholm_etal, flux_nonconservative_fjordholm_etal),
volume_flux = (flux_wintermeyer_etal, flux_nonconservative_ersing_etal)
solver = DGSEM(polydeg=3, surface_flux=(flux_wintermeyer_etal, flux_nonconservative_ersing_etal),
volume_integral=VolumeIntegralFluxDifferencing(volume_flux))

###############################################################################
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ initial_condition = initial_condition_fjordholm_well_balanced
###############################################################################
# Get the DG approximation space

volume_flux = (flux_wintermeyer_etal, flux_nonconservative_wintermeyer_etal)
solver = DGSEM(polydeg=3, surface_flux=(flux_es_fjordholm_etal, flux_nonconservative_fjordholm_etal),
volume_flux = (flux_wintermeyer_etal, flux_nonconservative_ersing_etal)
solver = DGSEM(polydeg=3, surface_flux=(flux_es_ersing_etal, flux_nonconservative_ersing_etal),
patrickersing marked this conversation as resolved.
Show resolved Hide resolved
volume_integral=VolumeIntegralFluxDifferencing(volume_flux))

###############################################################################
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ initial_condition = initial_condition_convergence_test
###############################################################################
# Get the DG approximation space

volume_flux = (flux_wintermeyer_etal, flux_nonconservative_wintermeyer_etal)
solver = DGSEM(polydeg=3, surface_flux=(flux_fjordholm_etal, flux_nonconservative_fjordholm_etal),
volume_flux = (flux_wintermeyer_etal, flux_nonconservative_ersing_etal)
solver = DGSEM(polydeg=3, surface_flux=(flux_wintermeyer_etal, flux_nonconservative_ersing_etal),
volume_integral=VolumeIntegralFluxDifferencing(volume_flux))


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ initial_condition = initial_condition_well_balanced
###############################################################################
# Get the DG approximation space

volume_flux = (flux_wintermeyer_etal, flux_nonconservative_wintermeyer_etal)
surface_flux = (flux_es_fjordholm_etal, flux_nonconservative_fjordholm_etal)
volume_flux = (flux_wintermeyer_etal, flux_nonconservative_ersing_etal)
surface_flux = (flux_es_ersing_etal, flux_nonconservative_ersing_etal)
solver = DGSEM(polydeg=3, surface_flux=surface_flux,
volume_integral=VolumeIntegralFluxDifferencing(volume_flux))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ initial_condition = initial_condition_convergence_test
###############################################################################
# Get the DG approximation space

volume_flux = (flux_wintermeyer_etal, flux_nonconservative_wintermeyer_etal)
surface_flux = (flux_fjordholm_etal, flux_nonconservative_fjordholm_etal)
volume_flux = (flux_wintermeyer_etal, flux_nonconservative_ersing_etal)
surface_flux = (flux_wintermeyer_etal, flux_nonconservative_ersing_etal)
solver = DGSEM(polydeg=6, surface_flux=surface_flux,
volume_integral=VolumeIntegralFluxDifferencing(volume_flux))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ boundary_condition_constant = BoundaryConditionDirichlet(initial_condition_dam_b
###############################################################################
# Get the DG approximation space

volume_flux = (flux_wintermeyer_etal, flux_nonconservative_wintermeyer_etal)
surface_flux= (flux_fjordholm_etal, flux_nonconservative_fjordholm_etal)
volume_flux = (flux_wintermeyer_etal, flux_nonconservative_ersing_etal)
surface_flux= (flux_wintermeyer_etal, flux_nonconservative_ersing_etal)
solver = DGSEM(polydeg=6, surface_flux=surface_flux,
volume_integral=VolumeIntegralFluxDifferencing(volume_flux))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ initial_condition = initial_condition_well_balanced
###############################################################################
# Get the DG approximation space

volume_flux = (flux_wintermeyer_etal, flux_nonconservative_wintermeyer_etal)
surface_flux = (flux_es_fjordholm_etal, flux_nonconservative_fjordholm_etal)
volume_flux = (flux_wintermeyer_etal, flux_nonconservative_ersing_etal)
surface_flux = (flux_es_ersing_etal, flux_nonconservative_ersing_etal)
solver = DGSEM(polydeg=6, surface_flux=surface_flux,
volume_integral=VolumeIntegralFluxDifferencing(volume_flux))

Expand Down
3 changes: 2 additions & 1 deletion src/Trixi.jl
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,9 @@ export flux, flux_central, flux_lax_friedrichs, flux_hll, flux_hllc, flux_hlle,
flux_chandrashekar, flux_ranocha, flux_derigs_etal, flux_hindenlang_gassner,
flux_nonconservative_powell,
flux_kennedy_gruber, flux_shima_etal, flux_ec,
flux_fjordholm_etal, flux_nonconservative_fjordholm_etal, flux_es_fjordholm_etal,
patrickersing marked this conversation as resolved.
Show resolved Hide resolved
flux_fjordholm_etal, flux_nonconservative_fjordholm_etal,
flux_wintermeyer_etal, flux_nonconservative_wintermeyer_etal,
flux_es_ersing_etal, flux_nonconservative_ersing_etal,
hydrostatic_reconstruction_audusse_etal, flux_nonconservative_audusse_etal,
FluxPlusDissipation, DissipationGlobalLaxFriedrichs, DissipationLocalLaxFriedrichs,
FluxLaxFriedrichs, max_abs_speed_naive,
Expand Down
38 changes: 38 additions & 0 deletions src/equations/shallow_water_1d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,44 @@ Further details on the hydrostatic reconstruction and its motivation can be foun
z)
end

"""
flux_nonconservative_ersing_etal(u_ll, u_rr, orientation::Integer,
equations::ShallowWaterEquations1D)

!!! warning "Experimental code"
This numerical flux is experimental and may change in any future release.

Non-symmetric path-conservative two-point volume flux discretizing the nonconservative (source) term
that contains the gradient of the bottom topography [`ShallowWaterEquations1D`](@ref).

This is a modified version of [`flux_nonconservative_wintermeyer_etal`](@ref) that gives entropy
conservation and well-balancedness in both the volume and surface when combined with
[`flux_wintermeyer_etal`](@ref).

For further details see:
- Patrick Ersing, Andrew R. Winters (2023)
An entropy stable discontinuous Galerkin method for the two-layer shallow water equations on
curvilinear meshes
[DOI: 10.48550/arXiv.2306.12699](https://doi.org/10.48550/arXiv.2306.12699)
"""
patrickersing marked this conversation as resolved.
Show resolved Hide resolved
@inline function flux_nonconservative_ersing_etal(u_ll, u_rr, orientation::Integer,
equations::ShallowWaterEquations1D)
# Pull the necessary left and right state information
h_ll = waterheight(u_ll, equations)
b_rr = u_rr[3]
b_ll = u_ll[3]

# Calculate jump
b_jump = b_rr - b_ll

z = zero(eltype(u_ll))

# Bottom gradient nonconservative term: (0, g h b_x, 0)
f = SVector(z, equations.gravity * h_ll * b_jump, z)

return f
end

"""
flux_fjordholm_etal(u_ll, u_rr, orientation,
equations::ShallowWaterEquations1D)
Expand Down
68 changes: 68 additions & 0 deletions src/equations/shallow_water_2d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,74 @@ end
return SVector(f1, f2, f3, f4)
end

"""
flux_nonconservative_ersing_etal(u_ll, u_rr, orientation::Integer,
equations::ShallowWaterEquations2D)
flux_nonconservative_ersing_etal(u_ll, u_rr,
normal_direction_ll::AbstractVector,
normal_direction_average::AbstractVector,
equations::ShallowWaterEquations2D)

!!! warning "Experimental code"
This numerical flux is experimental and may change in any future release.

Non-symmetric path-conservative two-point volume flux discretizing the nonconservative (source) term
that contains the gradient of the bottom topography [`ShallowWaterEquations2D`](@ref).

On curvilinear meshes, this nonconservative flux depends on both the
contravariant vector (normal direction) at the current node and the averaged
one. This is different from numerical fluxes used to discretize conservative
terms.

This is a modified version of [`flux_nonconservative_wintermeyer_etal`](@ref) that gives entropy
conservation and well-balancedness in both the volume and surface when combined with
[`flux_wintermeyer_etal`](@ref).

For further details see:
- Patrick Ersing, Andrew R. Winters (2023)
An entropy stable discontinuous Galerkin method for the two-layer shallow water equations on
curvilinear meshes
[DOI: 10.48550/arXiv.2306.12699](https://doi.org/10.48550/arXiv.2306.12699)
"""
patrickersing marked this conversation as resolved.
Show resolved Hide resolved
@inline function flux_nonconservative_ersing_etal(u_ll, u_rr, orientation::Integer,
equations::ShallowWaterEquations2D)
# Pull the necessary left and right state information
h_ll = waterheight(u_ll, equations)
b_rr = u_rr[4]
b_ll = u_ll[4]

# Calculate jump
b_jump = b_rr - b_ll

z = zero(eltype(u_ll))
# Bottom gradient nonconservative term: (0, g h b_x, g h b_y, 0)
if orientation == 1
f = SVector(z, equations.gravity * h_ll * b_jump, z, z)
else # orientation == 2
f = SVector(z, z, equations.gravity * h_ll * b_jump, z)
end
return f
end

@inline function flux_nonconservative_ersing_etal(u_ll, u_rr,
normal_direction_ll::AbstractVector,
normal_direction_average::AbstractVector,
equations::ShallowWaterEquations2D)
# Pull the necessary left and right state information
h_ll = waterheight(u_ll, equations)
b_rr = u_rr[4]
b_ll = u_ll[4]

# Calculate jump
b_jump = b_rr - b_ll
# Note this routine only uses the `normal_direction_average` and the average of the
# bottom topography to get a quadratic split form DG gradient on curved elements
return SVector(zero(eltype(u_ll)),
normal_direction_average[1] * equations.gravity * h_ll * b_jump,
normal_direction_average[2] * equations.gravity * h_ll * b_jump,
zero(eltype(u_ll)))
end

"""
flux_fjordholm_etal(u_ll, u_rr, orientation_or_normal_direction,
equations::ShallowWaterEquations2D)
Expand Down
Loading