diff --git a/NEWS.md b/NEWS.md index ccb0028d..3837de3a 100644 --- a/NEWS.md +++ b/NEWS.md @@ -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`. @@ -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 @@ -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 @@ -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]). @@ -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 diff --git a/Project.toml b/Project.toml index 5092407f..7081888e 100644 --- a/Project.toml +++ b/Project.toml @@ -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" diff --git a/docs/src/dispersion.md b/docs/src/dispersion.md index 28797fe4..93d5dd8c 100644 --- a/docs/src/dispersion.md +++ b/docs/src/dispersion.md @@ -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") diff --git a/docs/src/overview.md b/docs/src/overview.md index e404b875..049c8192 100644 --- a/docs/src/overview.md +++ b/docs/src/overview.md @@ -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 diff --git a/examples/bbm_1d/bbm_1d_basic.jl b/examples/bbm_1d/bbm_1d_basic.jl index d619e3c1..ca51a5a3 100644 --- a/examples/bbm_1d/bbm_1d_basic.jl +++ b/examples/bbm_1d/bbm_1d_basic.jl @@ -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 diff --git a/examples/bbm_1d/bbm_1d_fourier.jl b/examples/bbm_1d/bbm_1d_fourier.jl index 57642a26..504d6e22 100644 --- a/examples/bbm_1d/bbm_1d_fourier.jl +++ b/examples/bbm_1d/bbm_1d_fourier.jl @@ -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 diff --git a/examples/bbm_1d/bbm_1d_hamiltonian_relaxation.jl b/examples/bbm_1d/bbm_1d_hamiltonian_relaxation.jl index 39e78b3c..2bfe3816 100644 --- a/examples/bbm_1d/bbm_1d_hamiltonian_relaxation.jl +++ b/examples/bbm_1d/bbm_1d_hamiltonian_relaxation.jl @@ -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 diff --git a/examples/bbm_1d/bbm_1d_manufactured.jl b/examples/bbm_1d/bbm_1d_manufactured.jl index 15627872..14545876 100644 --- a/examples/bbm_1d/bbm_1d_manufactured.jl +++ b/examples/bbm_1d/bbm_1d_manufactured.jl @@ -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 diff --git a/examples/bbm_1d/bbm_1d_relaxation.jl b/examples/bbm_1d/bbm_1d_relaxation.jl index 59f11d9b..8f1d2214 100644 --- a/examples/bbm_1d/bbm_1d_relaxation.jl +++ b/examples/bbm_1d/bbm_1d_relaxation.jl @@ -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 diff --git a/examples/bbm_bbm_1d/bbm_bbm_1d_basic.jl b/examples/bbm_bbm_1d/bbm_bbm_1d_basic.jl index ecdcaba2..66683296 100644 --- a/examples/bbm_bbm_1d/bbm_bbm_1d_basic.jl +++ b/examples/bbm_bbm_1d/bbm_bbm_1d_basic.jl @@ -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 diff --git a/examples/bbm_bbm_1d/bbm_bbm_1d_basic_reflecting.jl b/examples/bbm_bbm_1d/bbm_bbm_1d_basic_reflecting.jl index bcdec7fb..b99947d6 100644 --- a/examples/bbm_bbm_1d/bbm_bbm_1d_basic_reflecting.jl +++ b/examples/bbm_bbm_1d/bbm_bbm_1d_basic_reflecting.jl @@ -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 diff --git a/examples/bbm_bbm_1d/bbm_bbm_1d_dg.jl b/examples/bbm_bbm_1d/bbm_bbm_1d_dg.jl index e4590b59..aaa25f92 100644 --- a/examples/bbm_bbm_1d/bbm_bbm_1d_dg.jl +++ b/examples/bbm_bbm_1d/bbm_bbm_1d_dg.jl @@ -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 diff --git a/examples/bbm_bbm_1d/bbm_bbm_1d_dingemans.jl b/examples/bbm_bbm_1d/bbm_bbm_1d_dingemans.jl index f19f27d2..65e48492 100644 --- a/examples/bbm_bbm_1d/bbm_bbm_1d_dingemans.jl +++ b/examples/bbm_bbm_1d/bbm_bbm_1d_dingemans.jl @@ -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 diff --git a/examples/bbm_bbm_1d/bbm_bbm_1d_fourier.jl b/examples/bbm_bbm_1d/bbm_bbm_1d_fourier.jl index c1b0c17f..c57ecf86 100644 --- a/examples/bbm_bbm_1d/bbm_bbm_1d_fourier.jl +++ b/examples/bbm_bbm_1d/bbm_bbm_1d_fourier.jl @@ -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 diff --git a/examples/bbm_bbm_1d/bbm_bbm_1d_manufactured.jl b/examples/bbm_bbm_1d/bbm_bbm_1d_manufactured.jl index a28bce1a..76557c88 100644 --- a/examples/bbm_bbm_1d/bbm_bbm_1d_manufactured.jl +++ b/examples/bbm_bbm_1d/bbm_bbm_1d_manufactured.jl @@ -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 diff --git a/examples/bbm_bbm_1d/bbm_bbm_1d_relaxation.jl b/examples/bbm_bbm_1d/bbm_bbm_1d_relaxation.jl index 54479064..15d67638 100644 --- a/examples/bbm_bbm_1d/bbm_bbm_1d_relaxation.jl +++ b/examples/bbm_bbm_1d/bbm_bbm_1d_relaxation.jl @@ -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 diff --git a/examples/bbm_bbm_1d/bbm_bbm_1d_upwind_relaxation.jl b/examples/bbm_bbm_1d/bbm_bbm_1d_upwind_relaxation.jl index 3365617a..5c69ea8c 100644 --- a/examples/bbm_bbm_1d/bbm_bbm_1d_upwind_relaxation.jl +++ b/examples/bbm_bbm_1d/bbm_bbm_1d_upwind_relaxation.jl @@ -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 diff --git a/examples/bbm_bbm_1d/bbm_bbm_1d_well_balanced.jl b/examples/bbm_bbm_1d/bbm_bbm_1d_well_balanced.jl index 9c3eb959..f81cb93c 100644 --- a/examples/bbm_bbm_1d/bbm_bbm_1d_well_balanced.jl +++ b/examples/bbm_bbm_1d/bbm_bbm_1d_well_balanced.jl @@ -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 diff --git a/examples/hyperbolic_serre_green_naghdi_1d/hyperbolic_serre_green_naghdi_conservation.jl b/examples/hyperbolic_serre_green_naghdi_1d/hyperbolic_serre_green_naghdi_conservation.jl index 75c57f0c..8e1ad901 100644 --- a/examples/hyperbolic_serre_green_naghdi_1d/hyperbolic_serre_green_naghdi_conservation.jl +++ b/examples/hyperbolic_serre_green_naghdi_1d/hyperbolic_serre_green_naghdi_conservation.jl @@ -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, diff --git a/examples/hyperbolic_serre_green_naghdi_1d/hyperbolic_serre_green_naghdi_dingemans.jl b/examples/hyperbolic_serre_green_naghdi_1d/hyperbolic_serre_green_naghdi_dingemans.jl index 012487e9..e1e79472 100644 --- a/examples/hyperbolic_serre_green_naghdi_1d/hyperbolic_serre_green_naghdi_dingemans.jl +++ b/examples/hyperbolic_serre_green_naghdi_1d/hyperbolic_serre_green_naghdi_dingemans.jl @@ -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 diff --git a/examples/hyperbolic_serre_green_naghdi_1d/hyperbolic_serre_green_naghdi_manufactured.jl b/examples/hyperbolic_serre_green_naghdi_1d/hyperbolic_serre_green_naghdi_manufactured.jl index b3107bee..91c28bd1 100644 --- a/examples/hyperbolic_serre_green_naghdi_1d/hyperbolic_serre_green_naghdi_manufactured.jl +++ b/examples/hyperbolic_serre_green_naghdi_1d/hyperbolic_serre_green_naghdi_manufactured.jl @@ -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 diff --git a/examples/hyperbolic_serre_green_naghdi_1d/hyperbolic_serre_green_naghdi_soliton.jl b/examples/hyperbolic_serre_green_naghdi_1d/hyperbolic_serre_green_naghdi_soliton.jl index 9906f407..45deda9b 100644 --- a/examples/hyperbolic_serre_green_naghdi_1d/hyperbolic_serre_green_naghdi_soliton.jl +++ b/examples/hyperbolic_serre_green_naghdi_1d/hyperbolic_serre_green_naghdi_soliton.jl @@ -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 @@ -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, diff --git a/examples/hyperbolic_serre_green_naghdi_1d/hyperbolic_serre_green_naghdi_soliton_relaxation.jl b/examples/hyperbolic_serre_green_naghdi_1d/hyperbolic_serre_green_naghdi_soliton_relaxation.jl index ccf84265..f5830fb7 100644 --- a/examples/hyperbolic_serre_green_naghdi_1d/hyperbolic_serre_green_naghdi_soliton_relaxation.jl +++ b/examples/hyperbolic_serre_green_naghdi_1d/hyperbolic_serre_green_naghdi_soliton_relaxation.jl @@ -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 @@ -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, diff --git a/examples/hyperbolic_serre_green_naghdi_1d/hyperbolic_serre_green_naghdi_well_balanced.jl b/examples/hyperbolic_serre_green_naghdi_1d/hyperbolic_serre_green_naghdi_well_balanced.jl index 35663746..ff6c4531 100644 --- a/examples/hyperbolic_serre_green_naghdi_1d/hyperbolic_serre_green_naghdi_well_balanced.jl +++ b/examples/hyperbolic_serre_green_naghdi_1d/hyperbolic_serre_green_naghdi_well_balanced.jl @@ -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 diff --git a/examples/serre_green_naghdi_1d/serre_green_naghdi_conservation.jl b/examples/serre_green_naghdi_1d/serre_green_naghdi_conservation.jl index 9f8ee990..b9ad80bb 100644 --- a/examples/serre_green_naghdi_1d/serre_green_naghdi_conservation.jl +++ b/examples/serre_green_naghdi_1d/serre_green_naghdi_conservation.jl @@ -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, diff --git a/examples/serre_green_naghdi_1d/serre_green_naghdi_dingemans.jl b/examples/serre_green_naghdi_1d/serre_green_naghdi_dingemans.jl index b8592cfd..828ba0cd 100644 --- a/examples/serre_green_naghdi_1d/serre_green_naghdi_dingemans.jl +++ b/examples/serre_green_naghdi_1d/serre_green_naghdi_dingemans.jl @@ -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 diff --git a/examples/serre_green_naghdi_1d/serre_green_naghdi_soliton.jl b/examples/serre_green_naghdi_1d/serre_green_naghdi_soliton.jl index 1eb416a3..5006a206 100644 --- a/examples/serre_green_naghdi_1d/serre_green_naghdi_soliton.jl +++ b/examples/serre_green_naghdi_1d/serre_green_naghdi_soliton.jl @@ -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 diff --git a/examples/serre_green_naghdi_1d/serre_green_naghdi_soliton_fourier.jl b/examples/serre_green_naghdi_1d/serre_green_naghdi_soliton_fourier.jl index a1d1db24..77d876f6 100644 --- a/examples/serre_green_naghdi_1d/serre_green_naghdi_soliton_fourier.jl +++ b/examples/serre_green_naghdi_1d/serre_green_naghdi_soliton_fourier.jl @@ -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 diff --git a/examples/serre_green_naghdi_1d/serre_green_naghdi_soliton_relaxation.jl b/examples/serre_green_naghdi_1d/serre_green_naghdi_soliton_relaxation.jl index 0ed0d420..ada7c817 100644 --- a/examples/serre_green_naghdi_1d/serre_green_naghdi_soliton_relaxation.jl +++ b/examples/serre_green_naghdi_1d/serre_green_naghdi_soliton_relaxation.jl @@ -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 diff --git a/examples/serre_green_naghdi_1d/serre_green_naghdi_soliton_upwind.jl b/examples/serre_green_naghdi_1d/serre_green_naghdi_soliton_upwind.jl index 227921ad..18cfcd4e 100644 --- a/examples/serre_green_naghdi_1d/serre_green_naghdi_soliton_upwind.jl +++ b/examples/serre_green_naghdi_1d/serre_green_naghdi_soliton_upwind.jl @@ -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 diff --git a/examples/serre_green_naghdi_1d/serre_green_naghdi_well_balanced.jl b/examples/serre_green_naghdi_1d/serre_green_naghdi_well_balanced.jl index 023456ff..df00d739 100644 --- a/examples/serre_green_naghdi_1d/serre_green_naghdi_well_balanced.jl +++ b/examples/serre_green_naghdi_1d/serre_green_naghdi_well_balanced.jl @@ -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 diff --git a/examples/svaerd_kalisch_1d/svaerd_kalisch_1d_basic_reflecting.jl b/examples/svaerd_kalisch_1d/svaerd_kalisch_1d_basic_reflecting.jl index 0590c419..a2b4a803 100644 --- a/examples/svaerd_kalisch_1d/svaerd_kalisch_1d_basic_reflecting.jl +++ b/examples/svaerd_kalisch_1d/svaerd_kalisch_1d_basic_reflecting.jl @@ -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 diff --git a/examples/svaerd_kalisch_1d/svaerd_kalisch_1d_dingemans.jl b/examples/svaerd_kalisch_1d/svaerd_kalisch_1d_dingemans.jl index 32a17bf8..ec6c5670 100644 --- a/examples/svaerd_kalisch_1d/svaerd_kalisch_1d_dingemans.jl +++ b/examples/svaerd_kalisch_1d/svaerd_kalisch_1d_dingemans.jl @@ -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 diff --git a/examples/svaerd_kalisch_1d/svaerd_kalisch_1d_dingemans_cg.jl b/examples/svaerd_kalisch_1d/svaerd_kalisch_1d_dingemans_cg.jl index 422741e7..f686f64a 100644 --- a/examples/svaerd_kalisch_1d/svaerd_kalisch_1d_dingemans_cg.jl +++ b/examples/svaerd_kalisch_1d/svaerd_kalisch_1d_dingemans_cg.jl @@ -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 diff --git a/examples/svaerd_kalisch_1d/svaerd_kalisch_1d_dingemans_fourier.jl b/examples/svaerd_kalisch_1d/svaerd_kalisch_1d_dingemans_fourier.jl index d61d1e44..b7f468aa 100644 --- a/examples/svaerd_kalisch_1d/svaerd_kalisch_1d_dingemans_fourier.jl +++ b/examples/svaerd_kalisch_1d/svaerd_kalisch_1d_dingemans_fourier.jl @@ -5,7 +5,7 @@ using SummationByPartsOperators: fourier_derivative_operator ############################################################################### # 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 diff --git a/examples/svaerd_kalisch_1d/svaerd_kalisch_1d_dingemans_relaxation.jl b/examples/svaerd_kalisch_1d/svaerd_kalisch_1d_dingemans_relaxation.jl index eebbae51..61dc13c0 100644 --- a/examples/svaerd_kalisch_1d/svaerd_kalisch_1d_dingemans_relaxation.jl +++ b/examples/svaerd_kalisch_1d/svaerd_kalisch_1d_dingemans_relaxation.jl @@ -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 diff --git a/examples/svaerd_kalisch_1d/svaerd_kalisch_1d_dingemans_upwind.jl b/examples/svaerd_kalisch_1d/svaerd_kalisch_1d_dingemans_upwind.jl index 10144c2e..e81eb9f6 100644 --- a/examples/svaerd_kalisch_1d/svaerd_kalisch_1d_dingemans_upwind.jl +++ b/examples/svaerd_kalisch_1d/svaerd_kalisch_1d_dingemans_upwind.jl @@ -5,7 +5,7 @@ using SummationByPartsOperators: upwind_operators, periodic_derivative_operator ############################################################################### # 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 diff --git a/examples/svaerd_kalisch_1d/svaerd_kalisch_1d_manufactured.jl b/examples/svaerd_kalisch_1d/svaerd_kalisch_1d_manufactured.jl index ef57de85..31e7659d 100644 --- a/examples/svaerd_kalisch_1d/svaerd_kalisch_1d_manufactured.jl +++ b/examples/svaerd_kalisch_1d/svaerd_kalisch_1d_manufactured.jl @@ -4,7 +4,7 @@ using DispersiveShallowWater ############################################################################### # Semidiscretization of the Svärd-Kalisch equations -equations = SvaerdKalischEquations1D(gravity_constant = 1.0, eta0 = 0.0, +equations = SvaerdKalischEquations1D(gravity = 1.0, eta0 = 0.0, alpha = 0.0004040404040404049, beta = 0.49292929292929294, gamma = 0.15707070707070708) diff --git a/examples/svaerd_kalisch_1d/svaerd_kalisch_1d_well_balanced.jl b/examples/svaerd_kalisch_1d/svaerd_kalisch_1d_well_balanced.jl index 708ab790..951fb885 100644 --- a/examples/svaerd_kalisch_1d/svaerd_kalisch_1d_well_balanced.jl +++ b/examples/svaerd_kalisch_1d/svaerd_kalisch_1d_well_balanced.jl @@ -4,7 +4,7 @@ using DispersiveShallowWater ############################################################################### # Semidiscretization of the Svärd-Kalisch equations -equations = SvaerdKalischEquations1D(gravity_constant = 1.0, eta0 = 2.0, +equations = SvaerdKalischEquations1D(gravity = 1.0, eta0 = 2.0, alpha = 0.0004040404040404049, beta = 0.49292929292929294, gamma = 0.15707070707070708) diff --git a/src/DispersiveShallowWater.jl b/src/DispersiveShallowWater.jl index d2ce66b2..8db441f9 100644 --- a/src/DispersiveShallowWater.jl +++ b/src/DispersiveShallowWater.jl @@ -71,7 +71,7 @@ export LinearDispersionRelation, EulerEquations1D, wave_speed export prim2prim, prim2cons, cons2prim, prim2phys, waterheight_total, waterheight, velocity, momentum, discharge, - gravity_constant, + gravity, bathymetry, still_water_surface, energy_total, entropy, lake_at_rest_error, energy_total_modified, entropy_modified, diff --git a/src/dispersion_relation.jl b/src/dispersion_relation.jl index 8d022d7f..88507149 100644 --- a/src/dispersion_relation.jl +++ b/src/dispersion_relation.jl @@ -25,7 +25,7 @@ Base.broadcastable(disp_rel::LinearDispersionRelation) = (disp_rel,) Compute the wave speed ``c`` for a given wavenumber ``k`` using the [`LinearDispersionRelation`](@ref) `disp_rel` of the `equations`. The wave speed is given by ``c = \omega(k) / k``. If `normalize` is `true`, the wave speed is normalized -by the shallow water wave speed ``\sqrt{g h_0}``, where ``g`` is the `gravity_constant` of the `equations` +by the shallow water wave speed ``\sqrt{g h_0}``, where ``g`` is the gravitational acceleration of the `equations` and ``h_0`` is the `ref_height` of the dispersion relation `disp_rel`. See also [`LinearDispersionRelation`](@ref). @@ -35,15 +35,15 @@ function wave_speed(disp_rel::LinearDispersionRelation, equations, k; omega = disp_rel(equations, k) c = omega / k if normalize - c /= sqrt(gravity_constant(equations) * disp_rel.ref_height) + c /= sqrt(gravity(equations) * disp_rel.ref_height) end return c end @doc raw""" - EulerEquations1D(; gravity_constant, eta0 = 0.0) + EulerEquations1D(; gravity, eta0 = 0.0) -A struct representing the 1D Euler equations with a given gravity constant and a still-water surface +A struct representing the 1D Euler equations with a given gravitational acceleration `gravity` and a still-water surface `eta0`. !!! note @@ -60,20 +60,20 @@ struct EulerEquations1D{RealT <: Real} <: AbstractEquations{1, 0} eta0::RealT end -function EulerEquations1D(; gravity_constant, eta0 = 0.0) - return EulerEquations1D(gravity_constant, eta0) +function EulerEquations1D(; gravity, eta0 = 0.0) + return EulerEquations1D(gravity, eta0) end function (disp_rel::LinearDispersionRelation)(equations::EulerEquations1D, k) h0 = disp_rel.ref_height - g = gravity_constant(equations) + g = gravity(equations) return sqrt(g * k * tanh(h0 * k)) end function (disp_rel::LinearDispersionRelation)(equations::BBMEquation1D, k) eta0 = equations.eta0 h0 = disp_rel.ref_height - g = gravity_constant(equations) + g = gravity(equations) return sqrt(g * h0) * k * (1 + 1.5 * eta0 / h0) / (1 + 1 / 6 * (h0 * k)^2) end @@ -84,7 +84,7 @@ end # Here, for general `eta0`. function (disp_rel::LinearDispersionRelation)(equations::BBMBBMEquations1D, k) h0 = disp_rel.ref_height - g = gravity_constant(equations) + g = gravity(equations) return sqrt(g * (h0 + equations.eta0)) * k / (1 + 1 / 6 * (h0 * k)^2) end @@ -94,7 +94,7 @@ end # [arXiv: 2302.09924](https://arxiv.org/abs/2302.09924) function (disp_rel::LinearDispersionRelation)(equations::SvärdKalischEquations1D, k) h0 = disp_rel.ref_height - g = gravity_constant(equations) + g = gravity(equations) c0 = sqrt(g * h0) alpha = equations.alpha * c0 * h0^2 beta = equations.beta * h0^3 @@ -117,6 +117,6 @@ end # [DOI: 10.1016/j.cnsns.2016.10.009](https://doi.org/10.1016/j.cnsns.2016.10.009) function (disp_rel::LinearDispersionRelation)(equations::SerreGreenNaghdiEquations1D, k) h0 = disp_rel.ref_height - g = gravity_constant(equations) + g = gravity(equations) return sqrt(g * h0) * k / sqrt(1.0 + (k * h0)^2 / 3) end diff --git a/src/equations/bbm_1d.jl b/src/equations/bbm_1d.jl index dfec66fe..9148d969 100644 --- a/src/equations/bbm_1d.jl +++ b/src/equations/bbm_1d.jl @@ -1,5 +1,5 @@ @doc raw""" - BBMEquation1D(; gravity_constant, D = 1.0, eta0 = 0.0, split_form = true) + BBMEquation1D(; gravity, D = 1.0, eta0 = 0.0, split_form = true) BBM (Benjamin–Bona–Mahony) equation in one spatial dimension. The equation is given by @@ -10,7 +10,7 @@ The equation is given by ``` The unknown quantity of the BBM equation is the total water height ``\eta``. -The gravitational constant is denoted by `g` and the constant bottom topography (bathymetry) ``b = \eta_0 - D``, +The gravitational acceleration `gravity` is denoted by ``g`` and the constant bottom topography (bathymetry) ``b = \eta_0 - D``, where ``\eta_0`` is the constant still-water surface and ``D`` the still-water depth. The water height above the bathymetry is therefore given by ``h = \eta - \eta_0 + D``. The BBM equation is only implemented for ``\eta_0 = 0``. @@ -42,15 +42,15 @@ for periodic boundary conditions. [DOI: 10.1007/s10543-023-00992-w](https://doi.org/10.1007/s10543-023-00992-w) """ struct BBMEquation1D{RealT <: Real} <: AbstractBBMEquation{1, 1} - gravity::RealT # gravitational constant + gravity::RealT # gravitational acceleration D::RealT # still-water depth eta0::RealT # constant still-water surface split_form::Bool # whether to use a split-form or not end -function BBMEquation1D(; gravity_constant, D = 1.0, eta0 = 0.0, split_form = true) +function BBMEquation1D(; gravity, D = 1.0, eta0 = 0.0, split_form = true) eta0 == 0.0 || @warn "The still-water surface needs to be 0 for the BBM equations" - BBMEquation1D(gravity_constant, D, eta0, split_form) + BBMEquation1D(gravity, D, eta0, split_form) end """ @@ -65,7 +65,7 @@ See section 4.1.3 in (there is an error in paper: it should be `sech^2` instead [DOI: 10.4208/cicp.OA-2020-0119](https://doi.org/10.4208/cicp.OA-2020-0119) """ function initial_condition_convergence_test(x, t, equations::BBMEquation1D, mesh) - g = gravity_constant(equations) + g = gravity(equations) D = equations.D alpha = sqrt(g * D) beta = 3 / 2 * sqrt(g / D) @@ -96,7 +96,7 @@ end A smooth manufactured solution in combination with [`initial_condition_manufactured`](@ref). """ function source_terms_manufactured(q, x, t, equations::BBMEquation1D) - g = gravity_constant(equations) + g = gravity(equations) D = still_waterdepth(q, equations) a1 = sqrt(g * D) a2 = sqrt(g / D) @@ -121,7 +121,7 @@ function create_cache(mesh, equations::BBMEquation1D, eta_x = zero(eta2) etaeta_x = zero(eta2) eta_xx = zero(eta2) - g = gravity_constant(equations) + g = gravity(equations) c_0 = sqrt(g * D) c_1 = sqrt(g / D) cache = (; invImD2, eta2, eta2_x, eta_x, etaeta_x, eta_xx, c_0, c_1, diff --git a/src/equations/bbm_bbm_1d.jl b/src/equations/bbm_bbm_1d.jl index 20d93724..826ccfaa 100644 --- a/src/equations/bbm_bbm_1d.jl +++ b/src/equations/bbm_bbm_1d.jl @@ -1,6 +1,6 @@ @doc raw""" BBMBBMEquations1D(; bathymetry_type = bathymetry_variable, - gravity_constant, eta0 = 0.0) + gravity, eta0 = 0.0) BBM-BBM (Benjamin–Bona–Mahony) system in one spatial dimension. The equations for flat bathymetry are given by ```math @@ -10,8 +10,9 @@ BBM-BBM (Benjamin–Bona–Mahony) system in one spatial dimension. The equation \end{aligned} ``` The unknown quantities of the BBM-BBM equations are the total water height ``\eta`` and the velocity ``v``. -The gravitational constant is denoted by `g` and the constant bottom topography (bathymetry) ``b = \eta_0 - D``. The water height above the bathymetry is therefore given by -``h = \eta - \eta_0 + D``. The BBM-BBM equations are only implemented for ``\eta_0 = 0``. +The gravitational acceleration `gravity` is denoted by ``g`` and the constant bottom topography (bathymetry) ``b = \eta_0 - D``. +The water height above the bathymetry is therefore given by ``h = \eta - \eta_0 + D``. +The BBM-BBM equations are only implemented for ``\eta_0 = 0``. Two types of `bathymetry_type` are supported: - [`bathymetry_flat`](@ref): flat bathymetry (typically ``b = 0`` everywhere) @@ -53,20 +54,20 @@ Additionally, it is well-balanced for the lake-at-rest stationary solution, see struct BBMBBMEquations1D{Bathymetry <: AbstractBathymetry, RealT <: Real} <: AbstractBBMBBMEquations{1, 3} bathymetry_type::Bathymetry # type of bathymetry - gravity::RealT # gravitational constant + gravity::RealT # gravitational acceleration eta0::RealT # constant still-water surface end function BBMBBMEquations1D(; bathymetry_type = bathymetry_variable, - gravity_constant, eta0 = 0.0) + gravity, eta0 = 0.0) eta0 == 0.0 || @warn "The still-water surface needs to be 0 for the BBM-BBM equations" - BBMBBMEquations1D(bathymetry_type, gravity_constant, eta0) + BBMBBMEquations1D(bathymetry_type, gravity, eta0) end """ initial_condition_convergence_test(x, t, equations::BBMBBMEquations1D, mesh) -A travelling-wave solution used for convergence tests in a periodic domain. +A traveling-wave solution used for convergence tests in a periodic domain. The bathymetry is constant. For details see Example 5 in Section 3 from (here adapted for dimensional equations): @@ -75,7 +76,7 @@ For details see Example 5 in Section 3 from (here adapted for dimensional equati [DOI: 10.1023/A:1026667903256](https://doi.org/10.1023/A:1026667903256) """ function initial_condition_convergence_test(x, t, equations::BBMBBMEquations1D, mesh) - g = gravity_constant(equations) + g = gravity(equations) D = 2.0 # constant bathymetry in this case c = 5 / 2 * sqrt(D * g) rho = 18 / 5 @@ -112,7 +113,7 @@ end A smooth manufactured solution in combination with [`initial_condition_manufactured`](@ref). """ function source_terms_manufactured(q, x, t, equations::BBMBBMEquations1D) - g = gravity_constant(equations) + g = gravity(equations) a1 = cospi(2 * x) a2 = sinpi(2 * x) a3 = cospi(t - 2 * x) @@ -140,7 +141,7 @@ function source_terms_manufactured(q, x, t, equations::BBMBBMEquations1D) end function source_terms_manufactured(q, x, t, equations::BBMBBMEquations1D{BathymetryFlat}) - g = gravity_constant(equations) + g = gravity(equations) D = still_waterdepth(q, equations) a3 = cospi(t - 2 * x) a4 = sinpi(t - 2 * x) @@ -185,7 +186,7 @@ A smooth manufactured solution for reflecting boundary conditions in combination with [`initial_condition_manufactured_reflecting`](@ref). """ function source_terms_manufactured_reflecting(q, x, t, equations::BBMBBMEquations1D) - g = gravity_constant(equations) + g = gravity(equations) a1 = cospi(2 * x) a2 = sinpi(2 * x) a8 = cospi(x) @@ -206,7 +207,7 @@ end function source_terms_manufactured_reflecting(q, x, t, equations::BBMBBMEquations1D{BathymetryFlat}) - g = gravity_constant(equations) + g = gravity(equations) D = still_waterdepth(q, equations) a1 = cospi(2 * x) a2 = sinpi(2 * x) @@ -243,7 +244,7 @@ References: [link](https://repository.tudelft.nl/islandora/object/uuid:c2091d53-f455-48af-a84b-ac86680455e9/datastream/OBJ/download) """ function initial_condition_dingemans(x, t, equations::BBMBBMEquations1D, mesh) - g = gravity_constant(equations) + g = gravity(equations) h0 = 0.8 A = 0.02 # omega = 2*pi/(2.02*sqrt(2)) @@ -416,7 +417,7 @@ function rhs!(dq, q, t, mesh, equations::BBMBBMEquations1D, initial_condition, (; invImDKD, invImD2K) = cache end - g = gravity_constant(equations) + g = gravity(equations) eta, v, D = q.x deta, dv, dD = dq.x fill!(dD, zero(eltype(dD))) @@ -483,7 +484,7 @@ function rhs!(dq, q, t, mesh, equations::BBMBBMEquations1D, initial_condition, (; etav, Dv, v2, tmp1, tmp2) = cache (; invImD2d, invImD2n) = cache - g = gravity_constant(equations) + g = gravity(equations) eta, v, D = q.x deta, dv, dD = dq.x fill!(dD, zero(eltype(dD))) diff --git a/src/equations/equations.jl b/src/equations/equations.jl index 6aadc944..cd0163e1 100644 --- a/src/equations/equations.jl +++ b/src/equations/equations.jl @@ -38,7 +38,7 @@ In 1D, the shallow water equations with flat bathymetry are given by ``` where ``h`` is the [`waterheight`](@ref), ``v`` the [`velocity`](@ref), and -``g`` the [`gravity_constant`](@ref). +``g`` the [`gravity`](@ref). """ abstract type AbstractShallowWaterEquations{NDIMS, NVARS} <: AbstractEquations{NDIMS, NVARS} end @@ -48,7 +48,7 @@ abstract type AbstractShallowWaterEquations{NDIMS, NVARS} <: AbstractEquations{N Return the canonical, human-readable name for the given system of equations. # Examples ```jldoctest -julia> DispersiveShallowWater.get_name(BBMBBMEquations1D(gravity_constant=1.0)) +julia> DispersiveShallowWater.get_name(BBMBBMEquations1D(gravity=1.0)) "BBMBBMEquations1D-BathymetryVariable" ``` """ @@ -257,11 +257,11 @@ be a constant value over time (given by the value ``\\eta_0`` passed to the end """ - gravity_constant(equations) + gravity(equations) -Return the gravity constant ``g`` for a given set of `equations`. +Return the gravitational acceleration ``g`` for a given set of `equations`. """ -@inline function gravity_constant(equations::AbstractEquations) +@inline function gravity(equations::AbstractEquations) return equations.gravity end @@ -277,7 +277,7 @@ shallow water subsystem, i.e., ``` in 1D, where ``h`` is the [`waterheight`](@ref), ``\\eta = h + b`` the [`waterheight_total`](@ref), -``v`` the [`velocity`](@ref), and ``g`` the [`gravity_constant`](@ref). +``v`` the [`velocity`](@ref), and ``g`` the [`gravity`](@ref). `q` is a vector of the primitive variables at a single node, i.e., a vector of the correct length `nvariables(equations)`. @@ -286,7 +286,7 @@ of the correct length `nvariables(equations)`. h = waterheight(q, equations) eta = waterheight_total(q, equations) v = velocity(q, equations) - return 0.5f0 * h * v^2 + 0.5f0 * gravity_constant(equations) * eta^2 + return 0.5f0 * h * v^2 + 0.5f0 * gravity(equations) * eta^2 end varnames(::typeof(energy_total), equations) = ("e_total",) @@ -618,7 +618,7 @@ References: [link](https://repository.tudelft.nl/islandora/object/uuid:c2091d53-f455-48af-a84b-ac86680455e9/datastream/OBJ/download) """ function initial_condition_dingemans(x, t, equations::AbstractShallowWaterEquations, mesh) - g = gravity_constant(equations) + g = gravity(equations) h0 = 0.8 A = 0.02 # omega = 2*pi/(2.02*sqrt(2)) diff --git a/src/equations/hyperbolic_serre_green_naghdi_1d.jl b/src/equations/hyperbolic_serre_green_naghdi_1d.jl index 1dbd9eb6..f80d8562 100644 --- a/src/equations/hyperbolic_serre_green_naghdi_1d.jl +++ b/src/equations/hyperbolic_serre_green_naghdi_1d.jl @@ -1,6 +1,6 @@ @doc raw""" HyperbolicSerreGreenNaghdiEquations1D(; bathymetry_type = bathymetry_mild_slope, - gravity_constant, + gravity, eta0 = 0.0, lambda) @@ -17,7 +17,7 @@ dimension. The equations for flat bathymetry are given by ``` The unknown quantities of the hyperbolized Serre-Green-Naghdi equations are the total water height ``\eta = h + b`` and the velocity ``v``. -The gravitational constant is denoted by `g` and the bottom topography +The gravitational acceleration `gravity` is denoted by ``g`` and the bottom topography (bathymetry) ``b = \eta_0 - D``. The water height above the bathymetry is therefore given by ``h = \eta - \eta_0 + D``. The total water height is therefore given by ``\eta = h + b``. @@ -88,16 +88,16 @@ struct HyperbolicSerreGreenNaghdiEquations1D{Bathymetry <: RealT <: Real} <: AbstractSerreGreenNaghdiEquations{1, 5} bathymetry_type::Bathymetry # type of bathymetry - gravity::RealT # gravitational constant + gravity::RealT # gravitational acceleration eta0::RealT # constant still-water surface lambda::RealT # hyperbolic relaxation parameter (→ ∞ for Serre-Green-Naghdi) end function HyperbolicSerreGreenNaghdiEquations1D(; bathymetry_type = bathymetry_mild_slope, - gravity_constant, + gravity, eta0 = 0.0, lambda) - HyperbolicSerreGreenNaghdiEquations1D(bathymetry_type, gravity_constant, eta0, lambda) + HyperbolicSerreGreenNaghdiEquations1D(bathymetry_type, gravity, eta0, lambda) end function varnames(::typeof(prim2prim), ::HyperbolicSerreGreenNaghdiEquations1D) @@ -164,7 +164,7 @@ See also [`initial_condition_convergence_test`](@ref). """ function initial_condition_soliton(x, t, equations::HyperbolicSerreGreenNaghdiEquations1D, mesh) - g = gravity_constant(equations) + g = gravity(equations) # setup parameters data h1 = 1.0 @@ -218,7 +218,7 @@ A smooth manufactured solution in combination with """ function source_terms_manufactured(q, x, t, equations::HyperbolicSerreGreenNaghdiEquations1D) - g = gravity_constant(equations) + g = gravity(equations) a1 = sinpi(4 * t - 2 * x) a2 = cospi(4 * t - 2 * x) @@ -285,7 +285,7 @@ function rhs!(dq, q, t, mesh, source_terms, solver, cache) # Unpack physical parameters and SBP operator `D1` - g = gravity_constant(equations) + g = gravity(equations) (; lambda, bathymetry_type) = equations (; D1) = solver @@ -434,7 +434,7 @@ function energy_total_modified!(e, q_global, equations::HyperbolicSerreGreenNaghdiEquations1D, cache) # unpack physical parameters and SBP operator `D1` - g = gravity_constant(equations) + g = gravity(equations) (; lambda) = equations (; h, b) = cache diff --git a/src/equations/serre_green_naghdi_1d.jl b/src/equations/serre_green_naghdi_1d.jl index d9e162a3..af544537 100644 --- a/src/equations/serre_green_naghdi_1d.jl +++ b/src/equations/serre_green_naghdi_1d.jl @@ -1,6 +1,6 @@ @doc raw""" SerreGreenNaghdiEquations1D(; bathymetry_type = bathymetry_variable, - gravity_constant, eta0 = 0.0) + gravity, eta0 = 0.0) Serre-Green-Naghdi system in one spatial dimension. The equations for flat bathymetry are given by @@ -13,7 +13,7 @@ The equations for flat bathymetry are given by ``` The unknown quantities of the Serre-Green-Naghdi equations are the total water height ``\eta = h + b`` and the velocity ``v``. -The gravitational constant is denoted by `g` and the bottom topography +The gravitational acceleration `gravity` is denoted by ``g`` and the bottom topography (bathymetry) ``b = \eta_0 - D``. The water height above the bathymetry is therefore given by ``h = \eta - \eta_0 + D``. The total water height is therefore given by ``\eta = h + b``. @@ -71,13 +71,13 @@ Additionally, it is well-balanced for the lake-at-rest stationary solution, see struct SerreGreenNaghdiEquations1D{Bathymetry <: AbstractBathymetry, RealT <: Real} <: AbstractSerreGreenNaghdiEquations{1, 3} bathymetry_type::Bathymetry # type of bathymetry - gravity::RealT # gravitational constant + gravity::RealT # gravitational acceleration eta0::RealT # constant still-water surface end function SerreGreenNaghdiEquations1D(; bathymetry_type = bathymetry_variable, - gravity_constant, eta0 = 0.0) - SerreGreenNaghdiEquations1D(bathymetry_type, gravity_constant, eta0) + gravity, eta0 = 0.0) + SerreGreenNaghdiEquations1D(bathymetry_type, gravity, eta0) end """ @@ -87,7 +87,7 @@ A soliton solution used for convergence tests in a periodic domain. """ function initial_condition_convergence_test(x, t, equations::SerreGreenNaghdiEquations1D, mesh) - g = gravity_constant(equations) + g = gravity(equations) # setup parameters data h1 = 1.0 @@ -332,7 +332,7 @@ function rhs_sgn_central!(dq, q, equations, source_terms, cache, ::BathymetryFla boundary_conditions::BoundaryConditionPeriodic) # Unpack physical parameters and SBP operator `D1` as well as the # SBP operator in sparse matrix form `D1mat` - g = gravity_constant(equations) + g = gravity(equations) (; D1, D1mat) = cache # `q` and `dq` are `ArrayPartition`s. They collect the individual @@ -413,7 +413,7 @@ function rhs_sgn_upwind!(dq, q, equations, source_terms, cache, ::BathymetryFlat boundary_conditions::BoundaryConditionPeriodic) # Unpack physical parameters and SBP operator `D1` as well as the # SBP upwind operator in sparse matrix form `D1mat_minus` - g = gravity_constant(equations) + g = gravity(equations) (; D1mat_minus) = cache D1_upwind = cache.D1 D1 = D1_upwind.central @@ -500,7 +500,7 @@ function rhs_sgn_central!(dq, q, equations, source_terms, cache, boundary_conditions::BoundaryConditionPeriodic) # Unpack physical parameters and SBP operator `D1` as well as the # SBP operator in sparse matrix form `D1mat` - g = gravity_constant(equations) + g = gravity(equations) (; D1, D1mat) = cache # `q` and `dq` are `ArrayPartition`s. They collect the individual @@ -606,7 +606,7 @@ function rhs_sgn_upwind!(dq, q, equations, source_terms, cache, boundary_conditions::BoundaryConditionPeriodic) # Unpack physical parameters and SBP operator `D1` as well as the # SBP operator in sparse matrix form `D1mat` - g = gravity_constant(equations) + g = gravity(equations) (; D1mat_minus) = cache D1_upwind = cache.D1 D1 = D1_upwind.central @@ -748,7 +748,7 @@ function energy_total_modified!(e, q_global, equations::SerreGreenNaghdiEquations1D, cache) # unpack physical parameters and SBP operator `D1` - g = gravity_constant(equations) + g = gravity(equations) (; D1, h, b, v_x) = cache # `q_global` is an `ArrayPartition`. It collects the individual arrays for diff --git a/src/equations/svaerd_kalisch_1d.jl b/src/equations/svaerd_kalisch_1d.jl index 71e633c6..2e0bfad1 100644 --- a/src/equations/svaerd_kalisch_1d.jl +++ b/src/equations/svaerd_kalisch_1d.jl @@ -1,6 +1,6 @@ @doc raw""" SvaerdKalischEquations1D(; bathymetry_type = bathymetry_variable, - gravity_constant, eta0 = 0.0, alpha = 0.0, + gravity, eta0 = 0.0, alpha = 0.0, beta = 0.2308939393939394, gamma = 0.04034343434343434) Dispersive system by Svärd and Kalisch (2023) in one spatial dimension. The equations for variable bathymetry @@ -22,7 +22,7 @@ The equations can be rewritten in primitive variables as \end{aligned} ``` The unknown quantities of the Svärd-Kalisch equations are the total water height ``\eta`` and the velocity ``v``. -The gravitational constant is denoted by `g` and the bottom topography (bathymetry) ``b = \eta_0 - D``. +The gravitational acceleration `gravity` is denoted by ``g`` and the bottom topography (bathymetry) ``b = \eta_0 - D``. The water height above the bathymetry is therefore given by ``h = \eta - \eta_0 + D``. @@ -49,7 +49,7 @@ Additionally, it is well-balanced for the lake-at-rest stationary solution, see struct SvaerdKalischEquations1D{Bathymetry <: AbstractBathymetry, RealT <: Real} <: AbstractSvaerdKalischEquations{1, 3} bathymetry_type::Bathymetry # type of bathymetry - gravity::RealT # gravitational constant + gravity::RealT # gravitational acceleration eta0::RealT # constant still-water surface alpha::RealT # coefficient beta::RealT # coefficient @@ -59,9 +59,9 @@ end const SvärdKalischEquations1D = SvaerdKalischEquations1D function SvaerdKalischEquations1D(; bathymetry_type = bathymetry_variable, - gravity_constant, eta0 = 0.0, alpha = 0.0, + gravity, eta0 = 0.0, alpha = 0.0, beta = 0.2308939393939394, gamma = 0.04034343434343434) - SvaerdKalischEquations1D(bathymetry_type, gravity_constant, eta0, alpha, beta, gamma) + SvaerdKalischEquations1D(bathymetry_type, gravity, eta0, alpha, beta, gamma) end """ @@ -85,7 +85,7 @@ end A smooth manufactured solution in combination with [`initial_condition_manufactured`](@ref). """ function source_terms_manufactured(q, x, t, equations::SvaerdKalischEquations1D) - g = gravity_constant(equations) + g = gravity(equations) eta0 = still_water_surface(q, equations) alpha = equations.alpha beta = equations.beta @@ -163,7 +163,7 @@ A smooth manufactured solution for reflecting boundary conditions in combination with [`initial_condition_manufactured_reflecting`](@ref). """ function source_terms_manufactured_reflecting(q, x, t, equations::SvaerdKalischEquations1D) - g = gravity_constant(equations) + g = gravity(equations) eta0 = still_water_surface(q, equations) beta = equations.beta a1 = sinpi(2 * x) @@ -234,7 +234,7 @@ function create_cache(mesh, equations::SvaerdKalischEquations1D, for i in eachnode(solver) D[i] = still_waterdepth(initial_condition(x[i], 0.0, equations, mesh), equations) end - g = gravity_constant(equations) + g = gravity(equations) h = ones(RealT, nnodes(mesh)) hv = zero(h) b = zero(h) @@ -364,7 +364,7 @@ function rhs!(dq, q, t, mesh, equations::SvaerdKalischEquations1D, y_v_x, h_v_x, hv2_x, v_xx, gamma_v_xx_x, gamma_v_x_xx, alpha_hat, gamma_hat, tmp1, tmp2, D1_central, D1) = cache - g = gravity_constant(equations) + g = gravity(equations) eta, v = q.x deta, dv, dD = dq.x fill!(dD, zero(eltype(dD))) @@ -457,7 +457,7 @@ function rhs!(dq, q, t, mesh, equations::SvaerdKalischEquations1D, # We use this explicitly in the code below. (; D, h, hv, b, eta_x, v_x, h_v_x, hv2_x, tmp1, D1_central, D1) = cache - g = gravity_constant(equations) + g = gravity(equations) eta, v = q.x deta, dv, dD = dq.x fill!(dD, zero(eltype(dD))) @@ -519,7 +519,7 @@ See also [`energy_total_modified`](@ref). @inline function energy_total_modified!(e, q_global, equations::SvaerdKalischEquations1D, cache) # unpack physical parameters and SBP operator `D1` - g = gravity_constant(equations) + g = gravity(equations) (; D1, h, b, v_x, beta_hat) = cache # `q_global` is an `ArrayPartition`. It collects the individual arrays for diff --git a/test/test_unit.jl b/test/test_unit.jl index 5baf89f8..6727b065 100644 --- a/test/test_unit.jl +++ b/test/test_unit.jl @@ -56,7 +56,7 @@ end end @testitem "Semidiscretization" setup=[Setup] begin - equations = BBMBBMEquations1D(gravity_constant = 9.81) + equations = BBMBBMEquations1D(gravity = 9.81) initial_condition = initial_condition_convergence_test boundary_conditions = boundary_condition_periodic mesh = Mesh1D(-1, 1, 10) @@ -74,7 +74,7 @@ end @test solver == solver equations_flat = BBMBBMEquations1D(bathymetry_type = bathymetry_flat, - gravity_constant = 9.81) + gravity = 9.81) initial_condition = initial_condition_dingemans mesh = Mesh1D(-138, 46, 10) solver = Solver(mesh, 4) @@ -92,7 +92,7 @@ end end @testitem "BBMEquation1D" setup=[Setup] begin - equations = @test_nowarn @inferred BBMEquation1D(gravity_constant = 1.0) + equations = @test_nowarn @inferred BBMEquation1D(gravity = 1.0) @test_nowarn print(equations) @test_nowarn display(equations) conversion_functions = [ @@ -140,7 +140,7 @@ end end @testitem "BBMBBMEquations1D" setup=[Setup] begin - equations = @test_nowarn @inferred BBMBBMEquations1D(gravity_constant = 9.81) + equations = @test_nowarn @inferred BBMBBMEquations1D(gravity = 9.81) @test_nowarn print(equations) @test_nowarn display(equations) conversion_functions = [ @@ -195,7 +195,7 @@ end end @testitem "SvaerdKalischEquations1D" setup=[Setup] begin - equations = @test_nowarn SvaerdKalischEquations1D(gravity_constant = 9.81, + equations = @test_nowarn SvaerdKalischEquations1D(gravity = 9.81, alpha = 0.0004040404040404049, beta = 0.49292929292929294, gamma = 0.15707070707070708) @@ -262,7 +262,7 @@ end end @testitem "SerreGreenNaghdiEquations1D" setup=[Setup] begin - equations = @test_nowarn @inferred SerreGreenNaghdiEquations1D(gravity_constant = 9.81) + equations = @test_nowarn @inferred SerreGreenNaghdiEquations1D(gravity = 9.81) @test_nowarn print(equations) @test_nowarn display(equations) conversion_functions = [ @@ -316,7 +316,7 @@ end end @testitem "HyperbolicSerreGreenNaghdiEquations1D" setup=[Setup] begin - equations = @test_nowarn @inferred HyperbolicSerreGreenNaghdiEquations1D(gravity_constant = 9.81, + equations = @test_nowarn @inferred HyperbolicSerreGreenNaghdiEquations1D(gravity = 9.81, lambda = 500.0) @test_nowarn print(equations) @test_nowarn display(equations) @@ -371,7 +371,7 @@ end end @testitem "AnalysisCallback" setup=[Setup] begin - equations = SvaerdKalischEquations1D(gravity_constant = 9.81) + equations = SvaerdKalischEquations1D(gravity = 9.81) initial_condition = initial_condition_dingemans boundary_conditions = boundary_condition_periodic mesh = Mesh1D(-1, 1, 10) @@ -424,11 +424,11 @@ end 0.4963966757387569 ] - for (i, equations) in enumerate((EulerEquations1D(gravity_constant = g), - BBMEquation1D(gravity_constant = g), - BBMBBMEquations1D(gravity_constant = g), - SvärdKalischEquations1D(gravity_constant = g), - SerreGreenNaghdiEquations1D(gravity_constant = g))) + for (i, equations) in enumerate((EulerEquations1D(gravity = g), + BBMEquation1D(gravity = g), + BBMBBMEquations1D(gravity = g), + SvärdKalischEquations1D(gravity = g), + SerreGreenNaghdiEquations1D(gravity = g))) @test isapprox(disp_rel(equations, k), frequencies[i]) @test isapprox(wave_speed(disp_rel, equations, k), wave_speeds[i]) # Add test for correct broadcasting