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

Remove normal_direction_ll #58

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ Printf = "1"
Roots = "2.1.6"
Static = "0.3, 0.4, 0.5, 0.6, 0.7, 0.8"
StaticArrays = "1"
Trixi = "0.8.7"
Trixi = "0.9"
julia = "1.8"
18 changes: 0 additions & 18 deletions src/equations/numerical_fluxes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,4 @@ For complete details see Section 2.4 of the following reference
[DOI: 10.1137/15M1053074](https://doi.org/10.1137/15M1053074)
"""
const flux_hll_chen_noelle = FluxHLL(min_max_speed_chen_noelle)

# Additional version of `FluxHydrostaticReconstruction` to add support for nonconservative fluxes on
# unstructured meshes. These can depend on both the contravariant vectors (normal direction) at
# the current node and the averaged ones.
@inline function (numflux::Trixi.FluxHydrostaticReconstruction)(u_ll, u_rr,
normal_direction_ll,
normal_direction_average,
equations::Trixi.AbstractEquations)
@unpack numerical_flux, hydrostatic_reconstruction = numflux

# Create the reconstructed left/right solution states in conservative form
u_ll_star, u_rr_star = hydrostatic_reconstruction(u_ll, u_rr, equations)

# Use the reconstructed states to compute the nonconservative surface flux
return numerical_flux(u_ll_star, u_rr_star, normal_direction_ll,
normal_direction_average,
equations)
end
end
10 changes: 4 additions & 6 deletions src/equations/shallow_water_multilayer_2d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -451,8 +451,7 @@
flux_nonconservative_ersing_etal(u_ll, u_rr, orientation::Integer,
equations::ShallowWaterMultiLayerEquations2D)
flux_nonconservative_ersing_etal(u_ll, u_rr,
normal_direction_ll::AbstractVector,
normal_direction_average::AbstractVector,
normal_direction::AbstractVector,
equations::ShallowWaterMultiLayerEquations2D)

Non-symmetric path-conservative two-point flux discretizing the nonconservative (source) term
Expand Down Expand Up @@ -509,8 +508,7 @@
end

@inline function flux_nonconservative_ersing_etal(u_ll, u_rr,
normal_direction_ll::AbstractVector,
normal_direction_average::AbstractVector,
normal_direction::AbstractVector,
equations::ShallowWaterMultiLayerEquations2D)
# Pull the necessary left and right state information
h_ll = waterheight(u_ll, equations)
Expand All @@ -537,8 +535,8 @@
f_hv += g * h_ll[i] * h_jump[j]
end
end
setlayer!(f, f_h, f_hv * normal_direction_average[1],
f_hv * normal_direction_average[2], i, equations)
setlayer!(f, f_h, f_hv * normal_direction[1],

Check warning on line 538 in src/equations/shallow_water_multilayer_2d.jl

View check run for this annotation

Codecov / codecov/patch

src/equations/shallow_water_multilayer_2d.jl#L538

Added line #L538 was not covered by tests
f_hv * normal_direction[2], i, equations)
end

return SVector(f)
Expand Down
16 changes: 7 additions & 9 deletions src/equations/shallow_water_two_layer_2d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -322,8 +322,7 @@ end
flux_nonconservative_ersing_etal(u_ll, u_rr, orientation::Integer,
equations::ShallowWaterTwoLayerEquations2D)
flux_nonconservative_ersing_etal(u_ll, u_rr,
normal_direction_ll::AbstractVector,
normal_direction_average::AbstractVector,
normal_direction::AbstractVector,
equations::ShallowWaterTwoLayerEquations2D)

!!! warning "Experimental code"
Expand Down Expand Up @@ -382,8 +381,7 @@ For further details see:
end

@inline function flux_nonconservative_ersing_etal(u_ll, u_rr,
normal_direction_ll::AbstractVector,
normal_direction_average::AbstractVector,
normal_direction::AbstractVector,
equations::ShallowWaterTwoLayerEquations2D)
# Pull the necessary left and right state information
h_upper_ll, h_lower_ll = waterheight(u_ll, equations)
Expand All @@ -396,17 +394,17 @@ end
h_lower_jump = (h_lower_rr - h_lower_ll)
b_jump = (b_rr - b_ll)

# Note this routine only uses the `normal_direction_average` and the average of the
# Note this routine only uses the `normal_direction` 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_upper_ll *
normal_direction[1] * equations.gravity * h_upper_ll *
(b_jump + h_lower_jump),
normal_direction_average[2] * equations.gravity * h_upper_ll *
normal_direction[2] * equations.gravity * h_upper_ll *
(b_jump + h_lower_jump),
zero(eltype(u_ll)),
normal_direction_average[1] * equations.gravity * h_lower_ll *
normal_direction[1] * equations.gravity * h_lower_ll *
(b_jump + equations.r * h_upper_jump),
normal_direction_average[2] * equations.gravity * h_lower_ll *
normal_direction[2] * equations.gravity * h_lower_ll *
(b_jump + equations.r * h_upper_jump),
zero(eltype(u_ll)))
end
Expand Down
37 changes: 13 additions & 24 deletions src/equations/shallow_water_wet_dry_2d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,7 @@ end
flux_nonconservative_wintermeyer_etal(u_ll, u_rr, orientation::Integer,
equations::ShallowWaterEquationsWetDry2D)
flux_nonconservative_wintermeyer_etal(u_ll, u_rr,
normal_direction_ll ::AbstractVector,
normal_direction_average::AbstractVector,
normal_direction::AbstractVector,
equations::ShallowWaterEquationsWetDry2D)

Non-symmetric two-point volume flux discretizing the nonconservative (source) term
Expand All @@ -271,21 +270,18 @@ Further details are available in the papers:
end

@inline function Trixi.flux_nonconservative_wintermeyer_etal(u_ll, u_rr,
normal_direction_ll::AbstractVector,
normal_direction_average::AbstractVector,
normal_direction::AbstractVector,
equations::ShallowWaterEquationsWetDry2D)
return Trixi.flux_nonconservative_wintermeyer_etal(u_ll, u_rr,
normal_direction_ll,
normal_direction_average,
normal_direction,
equations.basic_swe)
end

"""
flux_nonconservative_fjordholm_etal(u_ll, u_rr, orientation::Integer,
equations::ShallowWaterEquationsWetDry2D)
flux_nonconservative_fjordholm_etal(u_ll, u_rr,
normal_direction_ll ::AbstractVector,
normal_direction_average::AbstractVector,
normal_direction::AbstractVector,
equations::ShallowWaterEquationsWetDry2D)

Non-symmetric two-point surface flux discretizing the nonconservative (source) term of
Expand All @@ -312,12 +308,10 @@ and for curvilinear 2D case in the paper:
end

@inline function Trixi.flux_nonconservative_fjordholm_etal(u_ll, u_rr,
normal_direction_ll::AbstractVector,
normal_direction_average::AbstractVector,
normal_direction::AbstractVector,
equations::ShallowWaterEquationsWetDry2D)
Trixi.flux_nonconservative_fjordholm_etal(u_ll, u_rr,
normal_direction_ll,
normal_direction_average,
normal_direction,
equations.basic_swe)
end

Expand Down Expand Up @@ -407,8 +401,7 @@ end
flux_nonconservative_audusse_etal(u_ll, u_rr, orientation::Integer,
equations::ShallowWaterEquationsWetDry2D)
flux_nonconservative_audusse_etal(u_ll, u_rr,
normal_direction_ll ::AbstractVector,
normal_direction_average::AbstractVector,
normal_direction::AbstractVector,
equations::ShallowWaterEquationsWetDry2D)

Non-symmetric two-point surface flux that discretizes the nonconservative (source) term.
Expand All @@ -433,12 +426,10 @@ Further details for the hydrostatic reconstruction and its motivation can be fou
end

@inline function Trixi.flux_nonconservative_audusse_etal(u_ll, u_rr,
normal_direction_ll::AbstractVector,
normal_direction_average::AbstractVector,
normal_direction::AbstractVector,
equations::ShallowWaterEquationsWetDry2D)
return Trixi.flux_nonconservative_audusse_etal(u_ll, u_rr,
normal_direction_ll,
normal_direction_average,
normal_direction,
equations.basic_swe)
end

Expand All @@ -447,8 +438,7 @@ end
orientation::Integer,
equations::ShallowWaterEquationsWetDry2D)
flux_nonconservative_chen_noelle(u_ll, u_rr,
normal_direction_ll ::AbstractVector,
normal_direction_average ::AbstractVector,
normal_direction::AbstractVector,
equations::ShallowWaterEquationsWetDry2D)

Non-symmetric two-point surface flux that discretizes the nonconservative (source) term.
Expand Down Expand Up @@ -497,8 +487,7 @@ Further details on the hydrostatic reconstruction and its motivation can be foun
end

@inline function flux_nonconservative_chen_noelle(u_ll, u_rr,
normal_direction_ll::AbstractVector,
normal_direction_average::AbstractVector,
normal_direction::AbstractVector,
equations::ShallowWaterEquationsWetDry2D)
# Pull the water height and bottom topography on the left
h_ll, _, _, b_ll = u_ll
Expand All @@ -515,9 +504,9 @@ end
# Copy the reconstructed water height for easier to read code
h_ll_star = u_ll_star[1]

f2 = -normal_direction_average[1] * equations.gravity * (h_ll_star + h_ll) *
f2 = -normal_direction[1] * equations.gravity * (h_ll_star + h_ll) *
(b_ll - b_star)
f3 = -normal_direction_average[2] * equations.gravity * (h_ll_star + h_ll) *
f3 = -normal_direction[2] * equations.gravity * (h_ll_star + h_ll) *
(b_ll - b_star)

# First and last equations do not have a nonconservative flux
Expand Down
2 changes: 1 addition & 1 deletion test/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ OrdinaryDiffEq = "6.49.1"
Printf = "1"
Roots = "2.1.6"
Test = "1"
Trixi = "0.8.7"
Trixi = "0.9"

[preferences.OrdinaryDiffEq]
PrecompileAutoSpecialize = false
Expand Down
Loading