Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
115 commits
Select commit Hold shift + click to select a range
d04034a
first changes
cwittens Jul 28, 2025
51b4657
finished overview.md
cwittens Jul 28, 2025
1eba781
change make.jl to build in my fork
cwittens Jul 28, 2025
ce60bc3
try to fic corss ref error
cwittens Jul 28, 2025
a41e32f
fixed images that are not here yet
cwittens Jul 28, 2025
bdc0cac
chnages to documenter.yml
cwittens Jul 28, 2025
d2c4738
changes branch in make.jl
cwittens Jul 28, 2025
9e8c0af
change to documenter
cwittens Jul 28, 2025
30f6fae
changes to table
cwittens Jul 28, 2025
772db23
new table
cwittens Jul 28, 2025
a73db62
start cross ref
cwittens Jul 28, 2025
942d787
small changes
cwittens Jul 28, 2025
020072e
zwischenspeicher
cwittens Jul 29, 2025
bb3590e
new chapter on callbacks
cwittens Jul 29, 2025
ea24945
added ref on relaxation
cwittens Jul 29, 2025
cd17abb
excluted callbackset
cwittens Jul 29, 2025
fe2be6d
added callbackset information
cwittens Jul 29, 2025
8b97737
now with bbmbbm
cwittens Jul 29, 2025
0082e57
new parameters
cwittens Jul 29, 2025
6bd90d0
added sbp draft
cwittens Jul 29, 2025
9c06b2e
added sbp to bing biuld
cwittens Jul 29, 2025
56a56ad
correct file name
cwittens Jul 29, 2025
40bccad
started new chapter
cwittens Jul 29, 2025
3b226e5
save procress
cwittens Jul 29, 2025
9b855b4
more infos in solvers.md
cwittens Jul 29, 2025
8efee08
first version of new solver page
cwittens Jul 29, 2025
f0d7d8b
finished solver and spb part (expect the comparison)
cwittens Jul 29, 2025
2b5911d
added cross refs
cwittens Jul 29, 2025
8b7f22e
changed ordering
cwittens Jul 29, 2025
f4eed68
added error growth plot
cwittens Jul 29, 2025
296142a
fixed error
cwittens Jul 29, 2025
b7a5657
fixes to miscalleneous
cwittens Jul 29, 2025
67d65c1
refresh site
cwittens Jul 29, 2025
d58f205
fixed labeling
cwittens Jul 29, 2025
b8f2c60
new plotting chapter
cwittens Jul 29, 2025
a0bbf67
updated plots
cwittens Jul 29, 2025
8563029
try to make higher quality plots
cwittens Jul 29, 2025
ed44fd0
even more beautiful pictures
cwittens Jul 29, 2025
81cbb4b
recomplie website again
cwittens Jul 29, 2025
05f52de
again picture update
cwittens Jul 29, 2025
b39143a
made plotting its own
cwittens Jul 29, 2025
9788d8b
added default plotting values
cwittens Jul 29, 2025
3d6f1fa
different colors
cwittens Jul 29, 2025
44a04c6
refactor again
cwittens Jul 29, 2025
442d3c9
added dingemans
cwittens Jul 30, 2025
43982d5
small changes to dingemans
cwittens Jul 30, 2025
5fae95b
changes to dingemans
cwittens Jul 30, 2025
d0e8cab
added equations
cwittens Jul 30, 2025
981a981
refactor
cwittens Jul 30, 2025
1ba5328
trying to make it complie
cwittens Jul 30, 2025
1bcdba4
new try with filter
cwittens Jul 30, 2025
a8afa92
pls complie
cwittens Jul 30, 2025
be45e84
why do i still get cross ref errors?
cwittens Jul 30, 2025
eea7ceb
removed in ref.md
cwittens Jul 30, 2025
6ebca77
found the error
cwittens Jul 30, 2025
f8ea8c1
new try with filter
cwittens Jul 30, 2025
282aeca
small chanmges
cwittens Jul 30, 2025
4ab76af
updates overview.md
cwittens Jul 30, 2025
fdec94e
changed headline
cwittens Jul 30, 2025
982f428
small change to overview
cwittens Jul 30, 2025
f004bd1
changed plotting.md
cwittens Aug 4, 2025
120a882
small fix
cwittens Aug 4, 2025
4556913
improved / finished relaxation part
cwittens Aug 4, 2025
12133e5
formatting
cwittens Aug 4, 2025
7d2ca4b
Apply suggestions from code review
cwittens Aug 13, 2025
3e2099b
incorporated changes from 3 comments
cwittens Aug 13, 2025
e465fd3
new sbp comparison eq try
cwittens Aug 13, 2025
e7d3157
restored text which i killed on accident
cwittens Aug 13, 2025
972949c
changed t to e
cwittens Aug 13, 2025
9ba13b1
changes to make.jl
cwittens Aug 14, 2025
b24f5c7
fixed sbp_operators typo
cwittens Aug 14, 2025
8747e5f
Apply suggestions from code review
cwittens Aug 14, 2025
6888546
Apply suggestions from code review
cwittens Aug 14, 2025
b7dac36
added Lobatto-Legendre operators per hand to not get conflict with batch
cwittens Aug 14, 2025
9927711
added references and fixed "options..."
cwittens Aug 14, 2025
663b422
added linestyles and got ride of white space
cwittens Aug 14, 2025
11e1d56
bigger suplots in vertical direction
cwittens Aug 14, 2025
4acb41a
added changes to Plain program
cwittens Aug 14, 2025
63df851
added zoomed plots
cwittens Aug 18, 2025
d3781a8
commented out SK
cwittens Aug 18, 2025
2b11497
Apply suggestions from code review
cwittens Aug 20, 2025
46a0a4d
added sketch to overview.md
cwittens Aug 20, 2025
75b5f31
add section about SBP operator types
JoshuaLampert Aug 20, 2025
bfe70b8
Merge branch 'improved-documantation' of https://github.com/cwittens/…
JoshuaLampert Aug 20, 2025
eb3ac87
fix captions
JoshuaLampert Aug 20, 2025
0e1253f
math mode
JoshuaLampert Aug 20, 2025
aa7eff2
fixed minor typos and changes uk spelling of flavours to us version (…
cwittens Aug 20, 2025
2687201
Apply suggestions from code review
cwittens Aug 20, 2025
2d58bf0
Update docs/src/overview.md
cwittens Aug 20, 2025
265240b
incorporated some remarks
cwittens Aug 20, 2025
294f5c9
Merge branch 'improved-documantation' of github.com:cwittens/Dispersi…
cwittens Aug 20, 2025
ed15520
incorporated suggestions for overview and plotting
cwittens Aug 20, 2025
3320da0
Update docs/src/overview.md
cwittens Aug 20, 2025
27367a1
Update docs/src/overview.md
cwittens Aug 20, 2025
58bb706
Update docs/src/overview.md
cwittens Aug 20, 2025
a26f5fd
deleted whitespaces
cwittens Aug 20, 2025
b86e074
Apply suggestions from code review
cwittens Aug 21, 2025
70e35bc
linked all(?) occurrences of packages
cwittens Aug 21, 2025
7bd11ae
only show TrixiBase.trixi_include (test)
cwittens Aug 21, 2025
594a6e4
second try
cwittens Aug 21, 2025
b7ee32f
try no 3
cwittens Aug 21, 2025
e60d596
4
cwittens Aug 21, 2025
de51dac
4.1
cwittens Aug 21, 2025
1562736
5
cwittens Aug 21, 2025
c0e1889
6
cwittens Aug 21, 2025
d5bd0ba
7
cwittens Aug 21, 2025
0e3040b
remove all of TrixiBase from Docs
cwittens Aug 21, 2025
572d755
try no 8
cwittens Aug 22, 2025
a8ea8cd
added TrixiBase to Utilities with disclaimer
cwittens Aug 22, 2025
6330ca9
removed auther in make.jl (and linked trixibase.jl)
cwittens Aug 22, 2025
7723913
deleted ref-trixibase.md
cwittens Aug 22, 2025
f03dfad
Merge branch 'main' into improved-documantation
JoshuaLampert Aug 22, 2025
e22787c
changed back make.jl and documenter to be able to merge
cwittens Aug 22, 2025
d1df6b6
added News entry
cwittens Aug 22, 2025
d613c1e
Update NEWS.md
cwittens Aug 22, 2025
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 NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ for human readability.

#### Added

- Improved documentation ([#233]).
- Add linear dispersion relation for the `KdVEquation1D` ([#230]).
- Support reflecting boundary conditions for `HyperbolicSerreGreenNaghdiEquations1D` ([#228]).
- Add conversion functions `prim2nondim` and `nondim2prim` for non-dimensional variables for `KdVEquation1D` ([#217]).
Expand Down
12 changes: 7 additions & 5 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ end

makedocs(;
modules = [DispersiveShallowWater, TrixiBase],
authors = "Joshua Lampert <joshua.lampert@uni-hamburg.de>",
repo = Remotes.GitHub("NumericalMathematics", "DispersiveShallowWater.jl"),
sitename = "DispersiveShallowWater.jl",
format = Documenter.HTML(;
Expand All @@ -81,12 +80,15 @@ makedocs(;
size_threshold_warn = 1000 * 1024),
pages = ["Home" => "index.md",
"Overview" => "overview.md",
"Basic Example" => "basic_example.md",
"Summation-by-Parts Operators" => "SBP_Operators.md",
"Dispersion" => "dispersion.md",
"Using Different Solvers" => "solvers.md",
"Callbacks and Relaxation" => "callbacks.md",
"Plotting" => "plotting.md",
"Experimental Data" => "dingemans.md",
"Development" => "development.md",
"Reference" => [
"TrixiBase" => "ref-trixibase.md",
"DispersiveShallowWater" => "ref.md"
],
"Reference" => "ref.md",
"Changelog" => "changelog.md",
"Contributing" => "contributing.md",
"Code of Conduct" => "code_of_conduct.md",
Expand Down
193 changes: 193 additions & 0 deletions docs/src/SBP_Operators.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,193 @@
# [Summation-by-Parts Operators](@id sbp_operators)

This chapter covers the analytical and mathematical background of summation-by-parts operators in general.

To learn more about different solvers and how to use them in [DispersiveShallowWater.jl](https://github.com/NumericalMathematics/DispersiveShallowWater.jl), go to the chapter about [Solvers](@ref solvers).

## 1. Introduction & Overview

In recent years, summation-by-parts (SBP) operators have gained particular interest in computational mathematics as they allow transferring analytical results from the continuous level to numerical methods in a systematic manner. This is achieved by mimicking integration by parts discretely, which is one of the key ingredients for conservation and stability proofs at the continuous level. In this way, many fundamental analytical properties of hyperbolic-dominated partial differential equations can be obtained in a straightforward manner at the discrete level.[^LampertRanocha2024]

SBP operators were first developed for finite difference methods to mimic stability proofs based on integration by parts as traditionally used in finite element methods. However, exact integration can be impossible or computationally expensive in finite element methods, particularly for complex geometries or nonlinear problems. In this case, SBP formulations can be advantageous since they naturally include a quadrature rule through the mass matrix. In particular, split forms can be used with SBP operators to avoid the need for exact integration while maintaining discrete analogs of important analytical properties such as the chain rule and product rule.

Several classes of numerical methods can be formulated via SBP operators, including finite difference methods, finite volume methods, continuous Galerkin methods, discontinuous Galerkin (DG) methods, and flux reconstruction methods. This unifying framework has made SBP operators a cornerstone of structure-preserving numerical methods across various computational disciplines.

### Why SBP Operators Matter for Dispersive Shallow Water Equations

For dispersive shallow water equations implemented in [DispersiveShallowWater.jl](https://github.com/NumericalMathematics/DispersiveShallowWater.jl), maintaining physical properties like mass and energy conservation is crucial for:

- **Long-time stability**: Simulations remain stable over extended time periods without spurious growth of numerical errors
- **Physical accuracy**: The discrete solution respects fundamental physical laws such as conservation of mass, momentum, and energy
- **Robustness**: Methods are less sensitive to parameter choices and grid resolution, leading to more reliable simulations

SBP operators achieve this by providing:

- **Exact conservation**: Discrete conservation laws that hold to machine precision
- **Provable stability**: Mathematical guarantees about the behavior of the numerical method through discrete energy estimates
- **Flexibility**: A unified framework that encompasses finite differences, finite elements, and spectral methods

[^LampertRanocha2024]:
Lampert, Ranocha (2024):
Structure-Preserving Numerical Methods for Two Nonlinear Systems of Dispersive Wave Equations
[arXiv: 2402.16669](https://arxiv.org/abs/2402.16669)

## 2. Mathematical Foundation

### The Core SBP Property

The fundamental property that defines a first-derivative SBP operator is:

```math
MD + D^T M = \boldsymbol{e}_R \boldsymbol{e}_R^T - \boldsymbol{e}_L \boldsymbol{e}_L^T
```

where:

- ``D`` is the derivative operator (matrix)
- ``M`` is the symmetric, positive definite mass matrix
- ``\boldsymbol{e}_L = (1,0,...,0)^T`` and ``\boldsymbol{e}_R = (0,...,0,1)^T`` extract boundary values

This property is the discrete analog of integration by parts:

```math
\begin{array}{ccccccc}
\underbrace{\boldsymbol{u}^T M D \boldsymbol{v}}_{\approx} &+& \underbrace{\boldsymbol{u}^T D^T M \boldsymbol{v}}_{\approx} &=& \underbrace{\boldsymbol{u}^T \boldsymbol{e}_R \boldsymbol{e}_R^T \boldsymbol{v}}_{=} &-& \underbrace{\boldsymbol{u}^T \boldsymbol{e}_L \boldsymbol{e}_L^T \boldsymbol{v}}_{=}\\
\overbrace{\displaystyle\int_\Omega u v_x \, dx} &+& \overbrace{\displaystyle\int_\Omega u_x v \, dx} &=& \overbrace{u(x_{\text{max}}) v(x_{\text{max}})} &-& \overbrace{u(x_{\text{min}}) v(x_{\text{min}})}.
\end{array}
```

where for periodic SBP operators their property naturally simplifies to

```math
MD + D^T M = 0.
```

### Understanding the Mass Matrix

The mass matrix ``M`` approximates the continuous inner product:

```math
\langle \boldsymbol{u}, \boldsymbol{v} \rangle_M = \boldsymbol{u}^T M \boldsymbol{v} \approx \int_{x_{min}}^{x_{max}} u(x) v(x) dx
```

For the approximation to be meaningful, we require:

```math
\boldsymbol{1}^T M \boldsymbol{1} = x_{\max} - x_{\min}
```

This ensures that the discrete inner product correctly integrates constants. This property is always fulfilled for at least first-order SBP operators.

### Understanding the Derivative Operator

The derivative operator ``D`` approximates the spatial derivative of a function on a discrete grid. That is, for a smooth function ``u(x)``, we want the discrete expression ``D \boldsymbol{u}`` to approximate ``\partial_x u(x)`` at the grid points.

A first-derivative SBP operator is said to be **$p$-th order accurate** if it satisfies:

```math
D\, \boldsymbol{x}^k = k\, \boldsymbol{x}^{k-1}, \quad \text{for all } k = 0, 1, ..., p,
```

where ``\boldsymbol{x}^k = (x_1^k, \dots, x_N^k)^T``. This means the discrete operator correctly differentiates monomials up to degree $p$. In particular, **consistency** requires at least zeroth-order accuracy, i.e.,

```math
D\, \boldsymbol{1} = \boldsymbol{0}.
```

However, approximating derivatives near boundaries poses a challenge: interior points can use standard finite difference stencils, but near the edges (e.g., at `x_1` or `x_N`), one must use specially designed one-sided approximations that still preserve stability and accuracy. Periodic SBP Operators do not have this problem.

### Example: Central Difference Operator

A simple example is the classical second-order central difference operator on a uniform grid:

```math
D = \frac{1}{\Delta x} \begin{pmatrix}
-1 & 1 & & & \\
-1/2 & 0 & 1/2 & & \\
& -1/2 & 0 & 1/2 & \\
& & \ddots & \ddots & \ddots \\
& & & -1 & 1
\end{pmatrix}
```

with mass matrix:

```math
M = \Delta x \cdot \text{diag}(1/2, 1, 1, \ldots, 1, 1/2)
```

You can verify that this satisfies the SBP property and provides second-order accuracy in the interior with first-order accuracy at the boundaries.

## 3. Types of SBP Operators

In practice SBP operators come in various *flavors*. Consult the [documentation of SummationByPartsOperators.jl](https://ranocha.de/SummationByPartsOperators.jl/stable/)
for more details on how to construct the different types.

### Central Finite Difference (FD) SBP Operators

The simplest form of SBP operators are central finite difference operators and these are the operators that are mostly used in [DispersiveShallowWater.jl](https://github.com/NumericalMathematics/DispersiveShallowWater.jl)
For periodic boundary conditions, they can be created with `periodic_derivative_operator` and for non-periodic boundary conditions with `derivative_operator`
from [SummationByPartsOperators.jl](https://github.com/ranocha/SummationByPartsOperators.jl/).

### [Upwind SBP Operators](@id upwind_sbp)

Upwind operators come in pairs ``D_+`` and ``D_-``, which satisfy the relation

```math
MD_+ + D_-^T M = \boldsymbol{e}_R \boldsymbol{e}_R^T - \boldsymbol{e}_L \boldsymbol{e}_L^T,
```

where additionally ``M(D_+ - D_-)`` is negative semidefinite. This property is often useful to construct dissipative numerical schemes, which have an improved stability.
The operators ``D_+`` and ``D_-`` are biased in one direction and are therefore useful in simulations with unidirectional flow, which favor a specific flow direction.
They can also be helpful to construct (central) second-derivative operators by ``D_2 = D_+D_-`` (or ``D_2 = D_-D_+``), which is often advantageous compared to wide-stencil
central FD operators like ``D_2 = D_1^2`` because second-derivative operators based on upwind operators have a narrow stencil leading to a better resolution.
With [SummationByPartsOperators.jl](https://github.com/ranocha/SummationByPartsOperators.jl/), upwind operators can be constructed using `upwind_operators`. Each part of the operator can be accessed by the `minus` and `plus` fields.
Additionally, upwind operators induce a central first-derivative operator by ``D = (D_+ + D_-)/2``, which can be accessed by `central`.

### [Discontinuous Galerkin (DG) SBP](@id dg_sbp)

Classically, SBP operators were developed from the perspective of finite difference methods. However, more recently especially in [^Gassner2013] and subsequent papers,
the connection of finite element method to SBP operators was developed. It turns out that many finite element schemes, like the discontinuous Galerkin spectral element
method (DGSEM), can be interpreted as schemes based on certain SBP operators. In this context, the SBP operators are defined locally on a reference element. The
DGSEM uses Gauss-Lobatto-Legendre nodes and weights to form a quadrature rule, which also leads to a differentiation matrix. Together, these satisfy the SBP property.
To obtain global mass and derivative matrices, the local operators can be coupled across the elements as presented in [^RanochaMitsotakisKetcheson2021]. You can create periodic
DG operators with

```julia
coordinates_min, coordinates_max = -1.0, 1.0
N = 16 # N needs to be divisible by p + 1, i.e. this corresponds to N/(p + 1) = 4 elements
p = 3 # polynomial degree
D_legendre = legendre_derivative_operator(-1.0, 1.0, p + 1)
uniform_mesh = UniformPeriodicMesh1D(coordinates_min, coordinates_max, div(N, p + 1))
D = couple_discontinuously(D_legendre, uniform_mesh)
```

Using `couple_discontinuously`, you can also construct upwind SBP operators by additionally passing `Val(:plus)` or `Val(:minus)`. Note that this construction results into non-uniformly
distributed nodes and due to the discontinuous nature to repeated nodes at interfaces between elements.

### [Continuous Galerkin (CG) SBP](@id cg_sbp)

Similarly to DG operators, CG operators can be constructed using `couple_continuously`. In contrast to the DG operators, `N` needs to be divisible by `p` and there are no repeated nodes at the interfaces.

### [Fourier/Spectral SBP](@id fourier_sbp)

Fourier or spectral SBP operators are constructed using Fourier basis functions. These operators can be used for problems with periodic boundary conditions. The key idea is to represent the solution in
terms of its Fourier coefficients and to apply differentiation in the Fourier space. Note that these operators have dense derivative matrices and are therefore often more computationally expensive. In
[SummationByPartsOperators.jl](https://github.com/ranocha/SummationByPartsOperators.jl/), they can be constructed with `fourier_derivative_matrix`.

### Variable Coefficient Operators

A special class of SBP operators is given by variable coefficient operators, which are discrete operators for the second derivative approximating terms of the form ``\partial_x(b \partial_x u)``. Directly
incorporating the variable coefficient `b` into the SBP operator is desirable compared to subsequent application of first-derivative operators ``D \textrm{diag}(\boldsymbol{b}) D`` because it leads to a
more compact stencil and therefore improved numerical properties. You can use `var_coef_derivative_operator` with source `Mattsson2012` to construct such operators.

[^Gassner2013]:
Gassner (2013):
A Skew-Symmetric Discontinuous Galerkin Spectral Element Discretization
and Its Relation to SBP-SAT Finite Difference Methods
[DOI: 10.1137/120890144](https://epubs.siam.org/doi/10.1137/120890144)

[^RanochaMitsotakisKetcheson2021]:
Ranocha, Mitsokatis, Ketcheson (2021):
A broad class of conservative numerical methods for dispersive wave equations
[DOI: 10.4208/cicp.oa-2020-0119](https://doi.org/10.4208/cicp.oa-2020-0119)
Loading
Loading