Skip to content

Rename gravity_constant to gravity #174

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 2 commits into from
Apr 17, 2025
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
13 changes: 13 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,16 @@ DispersiveShallowWater.jl follows the interpretation of
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

#### Changed

- The keyword argument and function `gravity_constant` have been changed to `gravity` ([#174]).

## Changes in the v0.5 lifecycle

#### Added

- Add `LinearDispersionRelation` and documentation about dispersion ([#168]).
- Reflecting boundary conditions are added for the Svärd-Kalisch equations with `alpha = gamma = 0` ([#166]).
- Fix a bug in the upwind discretization of the `SvärdKalischEquations1D`.
Expand All @@ -20,6 +26,7 @@ for human readability.
## Changes when updating to v0.5 from v0.4.x

#### Changed

- The `BBMBBMVariableEquations1D` were removed and `BBMBBMEquations1D` now supports a `bathymetry_type` to
choose between a flat and a variable bathymetry ([#147]).
- The default of `bathymetry_type` for the `SerreGreenNaghdiEquations1D` changed from `bathymetry_flat` to
Expand All @@ -31,6 +38,7 @@ for human readability.
## Changes in the v0.4 lifecycle

#### Added

- The `SerreGreenNaghdiEquations1D` were added for different types of bathymetry ([#127], [#135]).
- The `HyperbolicSerreGreenNaghdiEquations1D` were added for different types of bathymetry ([#139]).
- The abstract interface `AbstractShallowWaterEquations` was added to unify several
Expand All @@ -41,11 +49,13 @@ for human readability.
## Changes when updating to v0.4 from v0.3.x

#### Changed

- Use `ArrayPartition` from RecursiveArrayTools.jl to store the solution of the `ODEProblem` ([#118]).

## Changes in the v0.3 lifecycle

#### Added

- Add possibility to pass vector of `Ns` to `convergence_test` ([#113]).
- Performance improvements by using factorized matrices for linear systems solves ([#108], [#112], [#114]).
- Reflecting boundary conditions are added for the BBM-BBM equations ([#104], [#109]).
Expand All @@ -55,17 +65,20 @@ for human readability.
## Changes when updating to v0.3 from v0.2.x

#### Changed

- Add keyword argument `start_from` when plotting `AnalysisCallback` ([#87]).
- Manufactured solution for Svärd-Kalisch equations uses a variable bathymetry ([#84]).

## Changes in the v0.2 lifecycle

#### Added

- Add `SummaryCallback` ([#75]).

## Changes when updating to v0.2 from v0.1.x

#### Changed

- The code from the master thesis of Joshua Lampert was separated ([#69]).
- Add support for source terms ([#65]).
- A higher order interpolation is used when plotting the solution at a value `x` outside
Expand Down
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ RecipesBase = "1.3.4"
RecursiveArrayTools = "3.27"
Reexport = "1.2.2"
Roots = "2.0.17"
SciMLBase = "2.56"
SciMLBase = "2.78"
SimpleUnPack = "1.1"
SparseArrays = "1"
StaticArrays = "1.9.7"
Expand Down
8 changes: 4 additions & 4 deletions docs/src/dispersion.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,19 @@ g = 9.81
disp_rel = LinearDispersionRelation(h0)
k = 0.01:0.01:5.0

euler = EulerEquations1D(; gravity_constant = g, eta0 = eta0)
euler = EulerEquations1D(; gravity = g, eta0 = eta0)
c_euler = wave_speed.(disp_rel, euler, k; normalize = true)
plot(k, c_euler, label = "Euler", xlabel = "k", ylabel = "c / c_0", legend = :topright)

bbm = BBMEquation1D(; gravity_constant = g, eta0 = eta0, D = h0)
bbm = BBMEquation1D(; gravity = g, eta0 = eta0, D = h0)
c_bbm = wave_speed.(disp_rel, bbm, k; normalize = true)
plot!(k, c_bbm, label = "BBM")

sk = SvaerdKalischEquations1D(; gravity_constant = g, eta0 = eta0)
sk = SvaerdKalischEquations1D(; gravity = g, eta0 = eta0)
c_sk = wave_speed.(disp_rel, sk, k; normalize = true)
plot!(k, c_sk, label = "Svärd-Kalisch")

sgn = SerreGreenNaghdiEquations1D(; gravity_constant = g, eta0 = eta0)
sgn = SerreGreenNaghdiEquations1D(; gravity = g, eta0 = eta0)
c_sgn = wave_speed.(disp_rel, sgn, k; normalize = true)
plot!(k, c_sgn, label = "Serre-Green-Naghdi")

Expand Down
2 changes: 1 addition & 1 deletion docs/src/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ including physical parameters, initial and boundary conditions as well as the do
describes a traveling wave that moves towards a beach, which is modeled by a linearly increasing bathymetry.

```@example overview
equations = BBMBBMEquations1D(bathymetry_type = bathymetry_variable, gravity_constant = 9.81)
equations = BBMBBMEquations1D(bathymetry_type = bathymetry_variable, gravity = 9.81)

function initial_condition_shoaling(x, t, equations::BBMBBMEquations1D, mesh)
A = 0.07 # amplitude of wave
Expand Down
2 changes: 1 addition & 1 deletion examples/bbm_1d/bbm_1d_basic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ using DispersiveShallowWater
###############################################################################
# Semidiscretization of the BBM equation (conserves the quadratic invariant)

equations = BBMEquation1D(gravity_constant = 9.81, split_form = true)
equations = BBMEquation1D(gravity = 9.81, split_form = true)

initial_condition = initial_condition_convergence_test
boundary_conditions = boundary_condition_periodic
Expand Down
2 changes: 1 addition & 1 deletion examples/bbm_1d/bbm_1d_fourier.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ using SummationByPartsOperators: fourier_derivative_operator
###############################################################################
# Semidiscretization of the BBM equation

equations = BBMEquation1D(gravity_constant = 9.81)
equations = BBMEquation1D(gravity = 9.81)

initial_condition = initial_condition_convergence_test
boundary_conditions = boundary_condition_periodic
Expand Down
2 changes: 1 addition & 1 deletion examples/bbm_1d/bbm_1d_hamiltonian_relaxation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ using DispersiveShallowWater
###############################################################################
# Semidiscretization of the BBM equation (conserves the cubic Hamiltonian)

equations = BBMEquation1D(gravity_constant = 9.81, split_form = false)
equations = BBMEquation1D(gravity = 9.81, split_form = false)

initial_condition = initial_condition_convergence_test
boundary_conditions = boundary_condition_periodic
Expand Down
2 changes: 1 addition & 1 deletion examples/bbm_1d/bbm_1d_manufactured.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ using DispersiveShallowWater
###############################################################################
# Semidiscretization of the BBM equation

equations = BBMEquation1D(gravity_constant = 9.81, D = 2.0)
equations = BBMEquation1D(gravity = 9.81, D = 2.0)

initial_condition = initial_condition_manufactured
source_terms = source_terms_manufactured
Expand Down
2 changes: 1 addition & 1 deletion examples/bbm_1d/bbm_1d_relaxation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ using DispersiveShallowWater
###############################################################################
# Semidiscretization of the BBM equation

equations = BBMEquation1D(gravity_constant = 9.81)
equations = BBMEquation1D(gravity = 9.81)

initial_condition = initial_condition_convergence_test
boundary_conditions = boundary_condition_periodic
Expand Down
2 changes: 1 addition & 1 deletion examples/bbm_bbm_1d/bbm_bbm_1d_basic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ using DispersiveShallowWater
# Semidiscretization of the BBM-BBM equations

# or bathymetry_variable instead of bathymetry_flat
equations = BBMBBMEquations1D(bathymetry_type = bathymetry_flat, gravity_constant = 9.81)
equations = BBMBBMEquations1D(bathymetry_type = bathymetry_flat, gravity = 9.81)

# initial_condition_convergence_test needs periodic boundary conditions
initial_condition = initial_condition_convergence_test
Expand Down
2 changes: 1 addition & 1 deletion examples/bbm_bbm_1d/bbm_bbm_1d_basic_reflecting.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ using SummationByPartsOperators: MattssonNordström2004, derivative_operator

# or bathymetry_flat instead of bathymetry_variable
equations = BBMBBMEquations1D(bathymetry_type = bathymetry_variable,
gravity_constant = 9.81)
gravity = 9.81)

initial_condition = initial_condition_manufactured_reflecting
source_terms = source_terms_manufactured_reflecting
Expand Down
2 changes: 1 addition & 1 deletion examples/bbm_bbm_1d/bbm_bbm_1d_dg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ using DispersiveShallowWater
# Semidiscretization of the BBM-BBM equations

# or bathymetry_variable instead of bathymetry_flat
equations = BBMBBMEquations1D(bathymetry_type = bathymetry_flat, gravity_constant = 1.0)
equations = BBMBBMEquations1D(bathymetry_type = bathymetry_flat, gravity = 1.0)

# initial_condition_convergence_test needs periodic boundary conditions
initial_condition = initial_condition_convergence_test
Expand Down
2 changes: 1 addition & 1 deletion examples/bbm_bbm_1d/bbm_bbm_1d_dingemans.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ using DispersiveShallowWater
# Semidiscretization of the BBM-BBM equations

equations = BBMBBMEquations1D(bathymetry_type = bathymetry_variable,
gravity_constant = 9.81)
gravity = 9.81)

initial_condition = initial_condition_dingemans
boundary_conditions = boundary_condition_periodic
Expand Down
2 changes: 1 addition & 1 deletion examples/bbm_bbm_1d/bbm_bbm_1d_fourier.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ using SummationByPartsOperators: fourier_derivative_operator
# Semidiscretization of the BBM-BBM equation

# or bathymetry_variable instead of bathymetry_flat
equations = BBMBBMEquations1D(bathymetry_type = bathymetry_flat, gravity_constant = 9.81)
equations = BBMBBMEquations1D(bathymetry_type = bathymetry_flat, gravity = 9.81)

# initial_condition_convergence_test needs periodic boundary conditions
initial_condition = initial_condition_convergence_test
Expand Down
2 changes: 1 addition & 1 deletion examples/bbm_bbm_1d/bbm_bbm_1d_manufactured.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ using DispersiveShallowWater

# or bathymetry_flat instead of bathymetry_variable
equations = BBMBBMEquations1D(bathymetry_type = bathymetry_variable,
gravity_constant = 9.81)
gravity = 9.81)

initial_condition = initial_condition_manufactured
source_terms = source_terms_manufactured
Expand Down
2 changes: 1 addition & 1 deletion examples/bbm_bbm_1d/bbm_bbm_1d_relaxation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ using DispersiveShallowWater
# Semidiscretization of the BBM-BBM equations

# or bathymetry_variable instead of bathymetry_flat
equations = BBMBBMEquations1D(bathymetry_type = bathymetry_flat, gravity_constant = 9.81)
equations = BBMBBMEquations1D(bathymetry_type = bathymetry_flat, gravity = 9.81)

# initial_condition_convergence_test needs periodic boundary conditions
initial_condition = initial_condition_convergence_test
Expand Down
2 changes: 1 addition & 1 deletion examples/bbm_bbm_1d/bbm_bbm_1d_upwind_relaxation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ using SparseArrays: sparse
# Semidiscretization of the BBM-BBM equations

# or bathymetry_variable instead of bathymetry_flat
equations = BBMBBMEquations1D(bathymetry_type = bathymetry_flat, gravity_constant = 9.81)
equations = BBMBBMEquations1D(bathymetry_type = bathymetry_flat, gravity = 9.81)

# initial_condition_convergence_test needs periodic boundary conditions
initial_condition = initial_condition_convergence_test
Expand Down
2 changes: 1 addition & 1 deletion examples/bbm_bbm_1d/bbm_bbm_1d_well_balanced.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ using SparseArrays: sparse
# Semidiscretization of the BBM-BBM equations

equations = BBMBBMEquations1D(bathymetry_type = bathymetry_variable,
gravity_constant = 1.0, eta0 = 2.0)
gravity = 1.0, eta0 = 2.0)

initial_condition = initial_condition_discontinuous_well_balancedness
boundary_conditions = boundary_condition_periodic
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ using DispersiveShallowWater

equations = HyperbolicSerreGreenNaghdiEquations1D(bathymetry_type = bathymetry_mild_slope,
lambda = 500.0,
gravity_constant = 9.81,
gravity = 9.81,
eta0 = 1.0)

function initial_condition_conservation_test(x, t,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ using DispersiveShallowWater

equations = HyperbolicSerreGreenNaghdiEquations1D(bathymetry_type = bathymetry_mild_slope,
lambda = 500.0,
gravity_constant = 9.81)
gravity = 9.81)

initial_condition = initial_condition_dingemans
boundary_conditions = boundary_condition_periodic
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ using DispersiveShallowWater

equations = HyperbolicSerreGreenNaghdiEquations1D(bathymetry_type = bathymetry_mild_slope,
lambda = 1.0e4,
gravity_constant = 9.81)
gravity = 9.81)

initial_condition = initial_condition_manufactured
source_terms = source_terms_manufactured
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ using DispersiveShallowWater

equations = HyperbolicSerreGreenNaghdiEquations1D(bathymetry_type = bathymetry_flat,
lambda = 500.0,
gravity_constant = 9.81)
gravity = 9.81)

initial_condition = initial_condition_soliton
boundary_conditions = boundary_condition_periodic
Expand All @@ -27,7 +27,7 @@ semi = Semidiscretization(mesh, equations, initial_condition, solver,

###############################################################################
# Create `ODEProblem` and run the simulation
tspan = (0.0, (xmax(mesh) - xmin(mesh)) / sqrt(1.2 * gravity_constant(equations))) # one period
tspan = (0.0, (xmax(mesh) - xmin(mesh)) / sqrt(1.2 * gravity(equations))) # one period
ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_callback = AnalysisCallback(semi; interval = 100,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ using SummationByPartsOperators: fourier_derivative_operator

equations = HyperbolicSerreGreenNaghdiEquations1D(bathymetry_type = bathymetry_flat,
lambda = 500.0,
gravity_constant = 9.81)
gravity = 9.81)

initial_condition = initial_condition_soliton
boundary_conditions = boundary_condition_periodic
Expand All @@ -28,7 +28,7 @@ semi = Semidiscretization(mesh, equations, initial_condition, solver,

###############################################################################
# Create `ODEProblem` and run the simulation
tspan = (0.0, (xmax(mesh) - xmin(mesh)) / sqrt(1.2 * gravity_constant(equations))) # one period
tspan = (0.0, (xmax(mesh) - xmin(mesh)) / sqrt(1.2 * gravity(equations))) # one period
ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_callback = AnalysisCallback(semi; interval = 100,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ using DispersiveShallowWater

equations = HyperbolicSerreGreenNaghdiEquations1D(bathymetry_type = bathymetry_mild_slope,
lambda = 500.0,
gravity_constant = 1.0,
gravity = 1.0,
eta0 = 2.0)

initial_condition = initial_condition_discontinuous_well_balancedness
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ using DispersiveShallowWater

# or bathymetry_mild_slope instead of bathymetry_variable
equations = SerreGreenNaghdiEquations1D(bathymetry_type = bathymetry_variable,
gravity_constant = 9.81,
gravity = 9.81,
eta0 = 1.0)

function initial_condition_conservation_test(x, t,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ using SummationByPartsOperators: upwind_operators, periodic_derivative_operator

# or bathymetry_mild_slope instead of bathymetry_variable
equations = SerreGreenNaghdiEquations1D(bathymetry_type = bathymetry_variable,
gravity_constant = 9.81)
gravity = 9.81)

initial_condition = initial_condition_dingemans
boundary_conditions = boundary_condition_periodic
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ using DispersiveShallowWater
# Semidiscretization of the Serre-Green-Naghdi equations

equations = SerreGreenNaghdiEquations1D(bathymetry_type = bathymetry_flat,
gravity_constant = 9.81)
gravity = 9.81)

# initial_condition_convergence_test needs periodic boundary conditions
initial_condition = initial_condition_convergence_test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ using SummationByPartsOperators: fourier_derivative_operator
# Semidiscretization of the Serre-Green-Naghdi equations

equations = SerreGreenNaghdiEquations1D(bathymetry_type = bathymetry_flat,
gravity_constant = 9.81)
gravity = 9.81)

# initial_condition_convergence_test needs periodic boundary conditions
initial_condition = initial_condition_convergence_test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ using SummationByPartsOperators: fourier_derivative_operator
# Semidiscretization of the Serre-Green-Naghdi equations

equations = SerreGreenNaghdiEquations1D(bathymetry_type = bathymetry_flat,
gravity_constant = 9.81)
gravity = 9.81)

# initial_condition_convergence_test needs periodic boundary conditions
initial_condition = initial_condition_convergence_test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ using SparseArrays: sparse
# Semidiscretization of the Serre-Green-Naghdi equations

equations = SerreGreenNaghdiEquations1D(bathymetry_type = bathymetry_flat,
gravity_constant = 9.81)
gravity = 9.81)

# initial_condition_convergence_test needs periodic boundary conditions
initial_condition = initial_condition_convergence_test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ using SummationByPartsOperators: upwind_operators, periodic_derivative_operator

# or bathymetry_mild_slope instead of bathymetry_variable
equations = SerreGreenNaghdiEquations1D(bathymetry_type = bathymetry_variable,
gravity_constant = 1.0, eta0 = 2.0)
gravity = 1.0, eta0 = 2.0)

initial_condition = initial_condition_discontinuous_well_balancedness
boundary_conditions = boundary_condition_periodic
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ using SummationByPartsOperators: MattssonNordström2004, derivative_operator
###############################################################################
# Semidiscretization of the Svärd-Kalisch equations
# For reflecting boundary conditions, alpha and gamma need to be 0
equations = SvaerdKalischEquations1D(gravity_constant = 1.0, eta0 = 0.0,
equations = SvaerdKalischEquations1D(gravity = 1.0, eta0 = 0.0,
alpha = 0.0, beta = 1 / 3, gamma = 0.0)

initial_condition = initial_condition_manufactured_reflecting
Expand Down
2 changes: 1 addition & 1 deletion examples/svaerd_kalisch_1d/svaerd_kalisch_1d_dingemans.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ using DispersiveShallowWater
###############################################################################
# Semidiscretization of the Svärd-Kalisch equations

equations = SvaerdKalischEquations1D(gravity_constant = 9.81, eta0 = 0.8, alpha = 0.0,
equations = SvaerdKalischEquations1D(gravity = 9.81, eta0 = 0.8, alpha = 0.0,
beta = 0.27946992481203003, gamma = 0.0521077694235589)

initial_condition = initial_condition_dingemans
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ using SummationByPartsOperators: legendre_derivative_operator, UniformPeriodicMe
###############################################################################
# Semidiscretization of the Svärd-Kalisch equations

equations = SvaerdKalischEquations1D(gravity_constant = 9.81, eta0 = 0.8, alpha = 0.0,
equations = SvaerdKalischEquations1D(gravity = 9.81, eta0 = 0.8, alpha = 0.0,
beta = 0.27946992481203003, gamma = 0.0521077694235589)

initial_condition = initial_condition_dingemans
Expand Down
Loading
Loading