Skip to content

Rename the keyword gravity_constant to gravity for the ShallowWaterEquations3D #81

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

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
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ using TrixiAtmo
# Entropy conservation for the spherical shallow water equations in Cartesian
# form obtained through an entropy correction term

equations = ShallowWaterEquations3D(gravity_constant = 9.81)
equations = ShallowWaterEquations3D(gravity = 9.81)

# Create DG solver with polynomial degree = 3 and Wintemeyer et al.'s flux as surface flux
polydeg = 3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ using TrixiAtmo
# form obtained through the projection of the momentum onto the divergence-free
# tangential contravariant vectors

equations = ShallowWaterEquations3D(gravity_constant = 9.81)
equations = ShallowWaterEquations3D(gravity = 9.81)

# Create DG solver with polynomial degree = 3 and Wintemeyer et al.'s flux as surface flux
polydeg = 3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ cells_per_dimension = (5, 5)

# We use the ShallowWaterEquations3D equations structure but modify the rhs! function to
# convert it to a variable-coefficient advection equation
equations = ShallowWaterEquations3D(gravity_constant = 0.0)
equations = ShallowWaterEquations3D(gravity = 0.0)

# Create DG solver with polynomial degree = 3 and (local) Lax-Friedrichs/Rusanov flux as surface flux
solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ using TrixiAtmo
# Entropy consistency test for the spherical shallow water equations in Cartesian
# form using the standard DGSEM with LLF dissipation

equations = ShallowWaterEquations3D(gravity_constant = 9.81)
equations = ShallowWaterEquations3D(gravity = 9.81)

# Create DG solver with polynomial degree = 3 and (local) Lax-Friedrichs as surface flux
polydeg = 3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ cells_per_dimension = (2, 2)

# We use the ShallowWaterEquations3D equations structure but modify the rhs! function to
# convert it to a variable-coefficient advection equation
equations = ShallowWaterEquations3D(gravity_constant = 0.0)
equations = ShallowWaterEquations3D(gravity = 0.0)

# Create DG solver with polynomial degree = 3 and (local) Lax-Friedrichs/Rusanov flux as surface flux
solver = DGSEM(polydeg = polydeg, surface_flux = flux_lax_friedrichs)
Expand Down
2 changes: 1 addition & 1 deletion src/equations/covariant_shallow_water.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ on a two-dimensional surface in three-dimensional ambient space as
\end{aligned}
```
where $h$ is the fluid height, $v^a$ and $G^{ab}$ are the contravariant velocity and metric
tensor components, $g$ is the gravitational constant, $f$ is the Coriolis parameter,
tensor components, $g$ is the gravitational acceleration, $f$ is the Coriolis parameter,
$J$ is the area element, and $\partial_a$ is used as a shorthand for
$\partial / \partial \xi^a$. Combining the advective and pressure terms in order to define
the momentum flux components
Expand Down
14 changes: 7 additions & 7 deletions src/equations/shallow_water_3d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ The equations are given by
\end{aligned}
```
The unknown quantities of the SWE are the water height ``h`` and the velocities ``\mathbf{v} = (v_1, v_2, v_3)^T``.
The gravitational constant is denoted by `g`.
The gravitational acceleration is denoted by `g`.

The 3D Shallow Water Equations (SWE) extend the 2D SWE to model shallow water flows on 2D manifolds embedded within 3D space.
To confine the flow to the 2D manifold, a source term incorporating a Lagrange multiplier is applied.
Expand Down Expand Up @@ -48,17 +48,17 @@ References:
"""
struct ShallowWaterEquations3D{RealT <: Real} <:
Trixi.AbstractShallowWaterEquations{3, 5}
gravity::RealT # gravitational constant
gravity::RealT # gravitational acceleration
H0::RealT # constant "lake-at-rest" total water height
end

# Allow for flexibility to set the gravitational constant within an elixir depending on the
# application where `gravity_constant=1.0` or `gravity_constant=9.81` are common values.
# Allow for flexibility to set the gravitational acceleration within an elixir depending on the
# application where `gravity=1.0` or `gravity=9.81` are common values.
# The reference total water height H0 defaults to 0.0 but is used for the "lake-at-rest"
# well-balancedness test cases.
function ShallowWaterEquations3D(; gravity_constant, H0 = zero(gravity_constant))
T = promote_type(typeof(gravity_constant), typeof(H0))
ShallowWaterEquations3D(gravity_constant, H0)
function ShallowWaterEquations3D(; gravity, H0 = zero(gravity))
T = promote_type(typeof(gravity), typeof(H0))
ShallowWaterEquations3D(gravity, H0)
end

Trixi.have_nonconservative_terms(::ShallowWaterEquations3D) = False() # Deactivate non-conservative terms for the moment...
Expand Down
Loading