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

variable bathymetry Serre-Green-Naghdi equations #135

Merged
merged 36 commits into from
Aug 17, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
eb9606f
variable bathymetry Serre-Green-Naghdi equations
ranocha Aug 15, 2024
6e1b1e6
Dingemans
ranocha Aug 15, 2024
37d4201
format
ranocha Aug 15, 2024
2ae5012
various fixes
ranocha Aug 16, 2024
f32caee
Apply suggestions from code review
ranocha Aug 16, 2024
6a4e907
move function waterheight
ranocha Aug 16, 2024
22a354a
bathymetry -> bathymetry_type
ranocha Aug 16, 2024
59b2a9d
add bathymetry_type to elixirs and well-balanced test
ranocha Aug 16, 2024
05c25cd
move comments
ranocha Aug 16, 2024
853662e
Apply suggestions from code review
ranocha Aug 16, 2024
dc5ed5a
format
ranocha Aug 16, 2024
f09b10d
Merge branch 'main' into hr/serre_green_naghdi
ranocha Aug 16, 2024
1740e5a
Apply suggestions from code review
ranocha Aug 17, 2024
711864f
Apply suggestions from code review
ranocha Aug 17, 2024
b1ba5e6
Update src/equations/serre_green_naghdi_1d.jl
ranocha Aug 17, 2024
5578e53
use D1 for SBP op.
ranocha Aug 17, 2024
c1cbda4
(h + b) -> eta
ranocha Aug 17, 2024
33115e3
explain mild slope
ranocha Aug 17, 2024
e321a8d
-=
ranocha Aug 17, 2024
3e633a5
format
ranocha Aug 17, 2024
6008569
update Dingemans test values
ranocha Aug 17, 2024
5a4dbb2
fix bug
ranocha Aug 17, 2024
d5bb6e6
add new test used for benchmarks
ranocha Aug 17, 2024
d27cfd7
fix typo
ranocha Aug 17, 2024
3bfc324
Apply suggestions from code review
ranocha Aug 17, 2024
e673414
Update examples/serre_green_naghdi_1d/serre_green_naghdi_well_balance…
ranocha Aug 17, 2024
c7ff29a
assemble_system_matrix!
ranocha Aug 17, 2024
0062720
solve_system_matrix!
ranocha Aug 17, 2024
5b2bc46
Update src/equations/serre_green_naghdi_1d.jl
ranocha Aug 17, 2024
a0cdae4
update Dingemans
ranocha Aug 17, 2024
a898e7e
Update src/equations/serre_green_naghdi_1d.jl
ranocha Aug 17, 2024
7e28939
Update src/equations/serre_green_naghdi_1d.jl
ranocha Aug 17, 2024
59f7729
fix docstring of energy_total_modified
ranocha Aug 17, 2024
d6a4626
Merge branch 'main' into hr/serre_green_naghdi
ranocha Aug 17, 2024
0dfab87
adapt tolerances for macOS CI
ranocha Aug 17, 2024
d4f9dd6
not only integrals
ranocha Aug 17, 2024
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ out*/
/docs/build/
run
run/*
**/*.code-workspace
49 changes: 49 additions & 0 deletions examples/serre_green_naghdi_1d/serre_green_naghdi_dingemans.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
using OrdinaryDiffEq
using DispersiveShallowWater
using SummationByPartsOperators: upwind_operators, periodic_derivative_operator

###############################################################################
# Semidiscretization of the Svärd-Kalisch equations
ranocha marked this conversation as resolved.
Show resolved Hide resolved

bathymetry = bathymetry_variable # or bathymetry_mild_slope
equations = SerreGreenNaghdiEquations1D(bathymetry;
gravity_constant = 9.81)

initial_condition = initial_condition_dingemans
boundary_conditions = boundary_condition_periodic

# create homogeneous mesh
coordinates_min = -140.0
coordinates_max = 100.0
JoshuaLampert marked this conversation as resolved.
Show resolved Hide resolved
N = 512
mesh = Mesh1D(coordinates_min, coordinates_max, N)

# create solver with periodic upwind SBP operators of accuracy order 4
# (note that only central-type with even order are used)
JoshuaLampert marked this conversation as resolved.
Show resolved Hide resolved
D1 = upwind_operators(periodic_derivative_operator;
derivative_order = 1, accuracy_order = 3,
xmin = xmin(mesh), xmax = xmax(mesh),
N = nnodes(mesh))
solver = Solver(D1, nothing)

# semidiscretization holds all the necessary data structures for the spatial discretization
semi = Semidiscretization(mesh, equations, initial_condition, solver,
boundary_conditions = boundary_conditions)

###############################################################################
# Create `ODEProblem` and run the simulation
tspan = (0.0, 70.0)
ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()
analysis_callback = AnalysisCallback(semi; interval = 10,
extra_analysis_errors = (:conservation_error,),
extra_analysis_integrals = (waterheight_total,
momentum,
entropy,
entropy_modified))

callbacks = CallbackSet(analysis_callback, summary_callback)

saveat = range(tspan..., length = 500)
sol = solve(ode, Tsit5(), abstol = 1e-7, reltol = 1e-7,
save_everystep = false, callback = callbacks, saveat = saveat)
2 changes: 1 addition & 1 deletion src/DispersiveShallowWater.jl
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export Semidiscretization, semidiscretize, grid

export boundary_condition_periodic, boundary_condition_reflecting

export bathymetry_flat
export bathymetry_flat, bathymetry_mild_slope, bathymetry_variable

export initial_condition_convergence_test,
initial_condition_manufactured, source_terms_manufactured,
Expand Down
27 changes: 26 additions & 1 deletion src/equations/equations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -325,14 +325,39 @@ Default analysis integrals used by the [`AnalysisCallback`](@ref).
default_analysis_integrals(::AbstractEquations) = Symbol[]

abstract type AbstractBathymetry end

struct BathymetryFlat <: AbstractBathymetry end
"""
bathymetry_flat = DispersiveShallowWater.BathymetryFlat()

A singleton struct indicating a flat bathymetry.

See also [`bathymetry_mild_slope`](@ref) and [`bathymetry_variable`](@ref).
"""
const bathymetry_flat = BathymetryFlat()

struct BathymetryMildSlope <: AbstractBathymetry end
"""
bathymetry_mild_slope = DispersiveShallowWater.BathymetryMildSlope()

A singleton struct indicating a variable bathymetry with mild-slope
approximation.
JoshuaLampert marked this conversation as resolved.
Show resolved Hide resolved

See also [`bathymetry_flat`](@ref) and [`bathymetry_variable`](@ref).
"""
const bathymetry_mild_slope = BathymetryMildSlope()

struct BathymetryVariable <: AbstractBathymetry end
"""
bathymetry_variable = DispersiveShallowWater.BathymetryVariable()

A singleton struct indicating a variable bathymetry (without
mild-slope approximation).

See also [`bathymetry_flat`](@ref) and [`bathymetry_mild_slope`](@ref).
"""
const bathymetry_variable = BathymetryVariable()

# BBM-BBM equations
abstract type AbstractBBMBBMEquations{NDIMS, NVARS} <:
AbstractShallowWaterEquations{NDIMS, NVARS} end
Expand All @@ -347,4 +372,4 @@ include("svaerd_kalisch_1d.jl")
# Serre-Green-Naghdi equations
abstract type AbstractSerreGreenNaghdiEquations{NDIMS, NVARS} <:
AbstractShallowWaterEquations{NDIMS, NVARS} end
include("serre_green_naghdi_flat_1d.jl")
include("serre_green_naghdi_1d.jl")
Loading
Loading