Skip to content

Commit

Permalink
Merge branch 'main' into interpolate-x-plot
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshuaLampert authored Nov 20, 2023
2 parents c947853 + fa16ae3 commit c8f40f3
Show file tree
Hide file tree
Showing 29 changed files with 391 additions and 1,168 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,25 @@ on:
- main
tags: ['*']
paths-ignore:
- 'CITATION.bib'
- 'LICENSE.md'
- 'README.md'
- '.zenodo.json'
- '.github/workflows/CompatHelper.yml'
- '.github/workflows/Documenter.yml'
- '.github/workflows/Format-check.yml'
- '.github/workflows/TagBot.yml'
- '.github/workflows/SpellCheck.yml'
- 'docs/**'
pull_request:
paths-ignore:
- 'CITATION.bib'
- 'LICENSE.md'
- 'README.md'
- '.zenodo.json'
- '.github/workflows/CompatHelper.yml'
- '.github/workflows/Documenter.yml'
- '.github/workflows/Format-check.yml'
- '.github/workflows/TagBot.yml'
- '.github/workflows/SpellCheck.yml'
- 'docs/**'
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/Documenter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
- 'main'
tags: '*'
paths-ignore:
- '.zenodo.json'
- '.github/workflows/CI.yml'
- '.github/workflows/CompatHelper.yml'
- '.github/workflows/TagBot.yml'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/Format-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- name: Install JuliaFormatter and format
run: |
julia -e 'using Pkg; Pkg.add(PackageSpec(name = "JuliaFormatter"))'
julia -e 'using JuliaFormatter; format(["src", "test", "examples", "visualization"], verbose = true)'
julia -e 'using JuliaFormatter; format(["src", "test", "examples"], verbose = true)'
- name: Format check
run: |
julia -e '
Expand Down
9 changes: 9 additions & 0 deletions CITATION.bib
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
@misc{lampert2023dispersive,
title={{D}ispersive{S}hallow{W}ater.jl: {S}tructure-preserving numerical
methods for dispersive shallow water models},
author={Lampert, Joshua},
year={2023},
month={10},
howpublished={\url{https://github.com/JoshuaLampert/DispersiveShallowWater.jl}},
doi={10.5281/zenodo.10034636}
}
3 changes: 3 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,15 @@ SummationByPartsOperators = "9f78cca6-572e-554e-b819-917d2f1cf240"
[compat]
DiffEqBase = "6.121"
Interpolations = "0.14"
LinearAlgebra = "1"
PolynomialBases = "0.4.15"
Printf = "1"
RecipesBase = "1.1"
Reexport = "1.0"
Roots = "2.0.17"
SciMLBase = "1.90, 2"
SimpleUnPack = "1.1"
SparseArrays = "1"
StaticArrays = "1"
SummationByPartsOperators = "0.5.41"
julia = "1.8"
17 changes: 16 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,24 @@ for more details. Other examples can be found in the subdirectory [examples/](ht
A list of all examples is returned by running `get_examples()`. You can pass the filename of one of the examples or your own simulation file to `include` in order to run it,
e.g., `include(joinpath(examples_dir(), "svaerd_kalisch_1d", "svaerd_kalisch_1d_dingemans_relaxation.jl"))`.

## Referencing

You can directly refer to DispersiveShallowWater.jl as
```bibtex
@misc{lampert2023dispersive,
title={{D}ispersive{S}hallow{W}ater.jl: {S}tructure-preserving numerical
methods for dispersive shallow water models},
author={Lampert, Joshua},
year={2023},
month={10},
howpublished={\url{https://github.com/JoshuaLampert/DispersiveShallowWater.jl}},
doi={10.5281/zenodo.10034636}
}
```

## Authors

The package is developed and maintained by Joshua Lampert and was initiated as part of the master thesis "Structure-Preserving Numerical Methods for Dispersive Shallow Water Models" (2023).
The package is developed and maintained by Joshua Lampert (University of Hamburg).
Some parts of this repository are based on parts of [Dispersive-wave-schemes-notebooks. A Broad Class of Conservative Numerical Methods for Dispersive Wave Equations](https://github.com/ranocha/Dispersive-wave-schemes-notebooks)
by Hendrik Ranocha, Dimitrios Mitsotakis and David Ketcheson. The code structure is inspired by [Trixi.jl](https://github.com/trixi-framework/Trixi.jl/).

Expand Down
1 change: 0 additions & 1 deletion docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ makedocs(;
pages = [
"Home" => "index.md",
"Overview" => "overview.md",
"Reproduce figures" => "reproduce.md",
"Reference" => "ref.md",
"License" => "license.md",
])
Expand Down
25 changes: 20 additions & 5 deletions docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ The semidiscretizations are based on summation by parts (SBP) operators, which a
In order to obtain fully discrete schemes, the time integration methods from [OrdinaryDiffEq.jl](https://github.com/SciML/OrdinaryDiffEq.jl) are used to solve the resulting ordinary differential equations.
Fully discrete entropy-conservative methods can be obtained by using the [relaxation method](https://epubs.siam.org/doi/10.1137/19M1263662) provided by DispersiveShallowWater.jl.

# Installation
## Installation

If you have not yet installed Julia, then you first need to [download Julia](https://julialang.org/downloads/). Please [follow the instructions for your operating system](https://julialang.org/downloads/platform/).
DispersiveShallowWater.jl works with Julia v1.8 and newer. DispersiveShallowWater.jl is a registered Julia package. Therefore, you can install it by executing the following commands from the Julia REPL
Expand All @@ -34,7 +34,7 @@ which can be installed running
julia> Pkg.add("SummationByPartsOperators")
```

# Usage
## Usage

In the Julia REPL, first load the package DispersiveShallowWater.jl
```julia
Expand All @@ -55,12 +55,27 @@ for more details. Other examples can be found in the subdirectory [examples/](ht
A list of all examples is returned by running [`get_examples()`](@ref). You can pass the filename of one of the examples or your own simulation file to `include` in order to run it,
e.g., `include(joinpath(examples_dir(), "svaerd_kalisch_1d", "svaerd_kalisch_1d_dingemans_relaxation.jl"))`.

# Authors
## Referencing

The package is developed and maintained by Joshua Lampert and was initiated as part of the master thesis "Structure-Preserving Numerical Methods for Dispersive Shallow Water Models" (2023).
You can directly refer to DispersiveShallowWater.jl as
```bibtex
@misc{lampert2023dispersive,
title={{D}ispersive{S}hallow{W}ater.jl: {S}tructure-preserving numerical
methods for dispersive shallow water models},
author={Lampert, Joshua},
year={2023},
month={10},
howpublished={\url{https://github.com/JoshuaLampert/DispersiveShallowWater.jl}},
doi={10.5281/zenodo.10034636}
}
```

## Authors

The package is developed and maintained by Joshua Lampert (University of Hamburg).
Some parts of this repository are based on parts of [Dispersive-wave-schemes-notebooks. A Broad Class of Conservative Numerical Methods for Dispersive Wave Equations](https://github.com/ranocha/Dispersive-wave-schemes-notebooks)
by Hendrik Ranocha, Dimitrios Mitsotakis and David Ketcheson. The code structure is inspired by [Trixi.jl](https://github.com/trixi-framework/Trixi.jl/).

# License and contributing
## License and contributing

DispersiveShallowWater.jl is published under the MIT license (see [License](https://github.com/JoshuaLampert/DispersiveShallowWater.jl/blob/main/LICENSE)). We are pleased to accept contributions from everyone, preferably in the form of a PR.
5 changes: 3 additions & 2 deletions docs/src/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@ end
gif(anim, "shoaling_solution.gif", fps = 25)
```

It is also possible to plot the solution variables at a fixed spatial point over time by calling `plot(semi => sol, x)` for some `x`-value, see [plot_examples.jl](https://github.com/JoshuaLampert/DispersiveShallowWater.jl/blob/main/visualization/plot_examples.jl) for some examples.
It is also possible to plot the solution variables at a fixed spatial point over time by calling `plot(semi => sol, x)` for some `x`-value, see [plot_examples.jl](https://github.com/JoshuaLampert/2023-master-thesis/blob/main/code/plot_examples.jl) from
the reproducibility repository of the master thesis of Joshua Lampert for some examples.

Often, it is interesting to have a look at how the quantities that are recorded by the `AnalysisCallback` evolve in time. To this end, you can `plot` the `AnalysisCallback` by

Expand Down Expand Up @@ -224,7 +225,7 @@ For more details see also the [documentation of SummationByPartsOperators.jl](ht

Some more examples sorted by the simulated equations can be found in the [examples/](https://github.com/JoshuaLampert/DispersiveShallowWater.jl/tree/main/examples) subdirectory. Especially, in [examples/svaerd\_kalisch\_1d/](https://github.com/JoshuaLampert/DispersiveShallowWater.jl/tree/main/examples/svaerd_kalisch_1d) you can find Julia scripts that solve the [`SvaerdKalischEquations1D`](@ref) that were not covered in this tutorial. The same steps as described above, however, apply in the same way to these equations. Attention must be paid for these equations because they do not conserve the classical total entropy ``\mathcal E``, but a modified entropy ``\hat{\mathcal E}``, available as [`entropy_modified`](@ref).

More examples, especially focussing on plotting, can be found in the scripts [create_figures.jl](https://github.com/JoshuaLampert/DispersiveShallowWater.jl/blob/main/visualization/create_figures.jl) and [plot_examples.jl](https://github.com/JoshuaLampert/DispersiveShallowWater.jl/blob/main/visualization/plot_examples.jl).
More examples, especially focussing on plotting, can be found in the scripts [create_figures.jl](https://github.com/JoshuaLampert/2023-master-thesis/blob/main/code/create_figures.jl) and [plot_examples.jl](https://github.com/JoshuaLampert/2023-master-thesis/blob/main/code/plot_examples.jl) from the reproducibility repository of the master thesis of Joshua Lampert.

## References

Expand Down
19 changes: 0 additions & 19 deletions docs/src/reproduce.md

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,36 +1,33 @@
using OrdinaryDiffEq
using DispersiveShallowWater
using SummationByPartsOperators: periodic_derivative_operator
using SparseArrays: sparse

###############################################################################
# Semidiscretization of the BBM-BBM equations

equations = BBMBBMEquations1D(gravity_constant = 9.81, D = 2.0)
equations = BBMBBMEquations1D(gravity_constant = 9.81, D = 4.0)

# initial_condition_convergence_test needs periodic boundary conditions
initial_condition = initial_condition_convergence_test
initial_condition = initial_condition_manufactured
source_terms = source_terms_manufactured
boundary_conditions = boundary_condition_periodic

# create homogeneous mesh
coordinates_min = -35.0
coordinates_max = 35.0
coordinates_min = 0.0
coordinates_max = 1.0
N = 512
mesh = Mesh1D(coordinates_min, coordinates_max, N)

# create solver with periodic SBP operators of accuracy order 4
accuracy_order = 4
D1 = periodic_derivative_operator(1, accuracy_order, mesh.xmin, mesh.xmax, mesh.N)
D2 = sparse(D1)^2
solver = Solver(D1, D2)
solver = Solver(mesh, accuracy_order)

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

###############################################################################
# Create `ODEProblem` and run the simulation
tspan = (0.0, 30.0)
tspan = (0.0, 1.0)
ode = semidiscretize(semi, tspan)
analysis_callback = AnalysisCallback(semi; interval = 10,
extra_analysis_errors = (:conservation_error,),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,36 +1,33 @@
using OrdinaryDiffEq
using DispersiveShallowWater
using SummationByPartsOperators: periodic_derivative_operator
using SparseArrays: sparse

###############################################################################
# Semidiscretization of the BBM-BBM equations

equations = BBMBBMVariableEquations1D(gravity_constant = 9.81)

# initial_condition_convergence_test needs periodic boundary conditions
initial_condition = initial_condition_convergence_test
initial_condition = initial_condition_manufactured
source_terms = source_terms_manufactured
boundary_conditions = boundary_condition_periodic

# create homogeneous mesh
coordinates_min = -35.0
coordinates_max = 35.0
coordinates_min = 0.0
coordinates_max = 1.0
N = 512
mesh = Mesh1D(coordinates_min, coordinates_max, N)

# create solver with periodic SBP operators of accuracy order 4
accuracy_order = 4
D1 = periodic_derivative_operator(1, accuracy_order, mesh.xmin, mesh.xmax, mesh.N)
D2 = sparse(D1)^2
solver = Solver(D1, D2)
solver = Solver(mesh, accuracy_order)

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

###############################################################################
# Create `ODEProblem` and run the simulation
tspan = (0.0, 30.0)
tspan = (0.0, 1.0)
ode = semidiscretize(semi, tspan)
analysis_callback = AnalysisCallback(semi; interval = 10,
extra_analysis_errors = (:conservation_error,),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,38 +1,36 @@
using OrdinaryDiffEq
using DispersiveShallowWater
using SummationByPartsOperators: upwind_operators, periodic_derivative_operator
using SparseArrays: sparse

###############################################################################
# Semidiscretization of the BBM-BBM equations
# Semidiscretization of the Svärd-Kalisch equations

equations = BBMBBMVariableEquations1D(gravity_constant = 9.81)
equations = SvaerdKalischEquations1D(gravity_constant = 1.0, eta0 = 0.0,
alpha = 0.0004040404040404049,
beta = 0.49292929292929294,
gamma = 0.15707070707070708)

# initial_condition_convergence_test needs periodic boundary conditions
initial_condition = initial_condition_convergence_test
initial_condition = initial_condition_manufactured
source_terms = source_terms_manufactured
boundary_conditions = boundary_condition_periodic

# create homogeneous mesh
coordinates_min = -35.0
coordinates_max = 35.0
N = 512
coordinates_min = 0.0
coordinates_max = 1.0
N = 128
mesh = Mesh1D(coordinates_min, coordinates_max, N)

# create solver with periodic SBP operators of accuracy order 4
accuracy_order = 4
D1 = upwind_operators(periodic_derivative_operator; derivative_order = 1,
accuracy_order = accuracy_order, xmin = mesh.xmin, xmax = mesh.xmax,
N = mesh.N)
D2 = sparse(D1.plus) * sparse(D1.minus)
solver = Solver(D1, D2)
solver = Solver(mesh, accuracy_order)

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

###############################################################################
# Create `ODEProblem` and run the simulation
tspan = (0.0, 30.0)
tspan = (0.0, 1.0)
ode = semidiscretize(semi, tspan)
analysis_callback = AnalysisCallback(semi; interval = 10,
extra_analysis_errors = (:conservation_error,),
Expand Down
6 changes: 4 additions & 2 deletions src/DispersiveShallowWater.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ import SummationByPartsOperators: grid, xmin, xmax

include("boundary_conditions.jl")
include("mesh.jl")
include("solver.jl")
include("equations/equations.jl")
include("solver.jl")
include("semidiscretization.jl")
include("callbacks_step/callbacks_step.jl")
include("visualization.jl")
Expand All @@ -48,7 +48,9 @@ export Semidiscretization, semidiscretize, grid

export boundary_condition_periodic

export initial_condition_convergence_test, initial_condition_dingemans
export initial_condition_convergence_test,
initial_condition_manufactured, source_terms_manufactured,
initial_condition_dingemans

export AnalysisCallback, RelaxationCallback
export tstops, errors, integrals
Expand Down
Loading

0 comments on commit c8f40f3

Please sign in to comment.