Skip to content

Commit

Permalink
More figures (#50)
Browse files Browse the repository at this point in the history
* add some more figures

* format

* create more figures

* several minor changes

* more figures

* fix typo
  • Loading branch information
JoshuaLampert authored Sep 30, 2023
1 parent 595e409 commit daeb6a7
Show file tree
Hide file tree
Showing 31 changed files with 1,065 additions and 384 deletions.
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", "create_figures.jl", "plot_examples.jl"], verbose = true)'
julia -e 'using JuliaFormatter; format(["src", "test", "examples", "visualization"], verbose = true)'
- name: Format check
run: |
julia -e '
Expand Down
256 changes: 0 additions & 256 deletions create_figures.jl

This file was deleted.

12 changes: 6 additions & 6 deletions docs/src/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,16 +173,16 @@ As an example, let us create a semidiscretization based on discontinuous Galerki
```@example overview
mesh = Mesh1D(coordinates_min, coordinates_max, N)
accuracy_order = 4
Dop = legendre_derivative_operator(-1.0, 1.0, accuracy_order)
sbp_mesh = UniformPeriodicMesh1D(mesh.xmin, mesh.xmax, div(mesh.N, accuracy_order))
D_legendre = legendre_derivative_operator(-1.0, 1.0, accuracy_order)
uniform_mesh = UniformPeriodicMesh1D(mesh.xmin, mesh.xmax, div(mesh.N, accuracy_order))
```

Upwind DG operators in negative, central and positive operators can be obtained by `couple_discontinuously`

```@example overview
central = couple_discontinuously(Dop, sbp_mesh)
minus = couple_discontinuously(Dop, sbp_mesh, Val(:minus))
plus = couple_discontinuously(Dop, sbp_mesh, Val(:plus))
central = couple_discontinuously(D_legendre, uniform_mesh)
minus = couple_discontinuously(D_legendre, uniform_mesh, Val(:minus))
plus = couple_discontinuously(D_legendre, uniform_mesh, Val(:plus))
D1 = PeriodicUpwindOperators(minus, central, plus)
```

Expand Down Expand Up @@ -224,7 +224,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/create_figures.jl) and [plot_examples.jl](https://github.com/JoshuaLampert/DispersiveShallowWater.jl/blob/main/plot_examples.jl).
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).

## References

Expand Down
8 changes: 7 additions & 1 deletion docs/src/reproduce.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,13 @@ In order to reproduce all figures used in the master thesis "Structure-Preservin
julia> using DispersiveShallowWater
julia> include(DispersiveShallowWater.path_create_figures())
```
Executing this script may take a while. It will generate a folder `out/` with certain subfolders containing the figures. If you want to modify the plots or only produce a subset of plots, you can download the script [`create_figures.jl`](https://github.com/JoshuaLampert/DispersiveShallowWater.jl/blob/main/create_figures.jl), modify it accordingly and run it by:
Note that for one figure [Trixi.jl](https://github.com/trixi-framework/Trixi.jl) is needed, so download Trixi.jl first:

```julia
julia> using Pkg
julia> Pkg.add("Trixi")
```
Executing the script may take a while. It will generate a folder `out/` with certain subfolders containing the figures. If you want to modify the plots or only produce a subset of plots, you can download the script [`create_figures.jl`](https://github.com/JoshuaLampert/DispersiveShallowWater.jl/blob/main/visualization/create_figures.jl), modify it accordingly and run it by:

```julia
julia> include("create_figures.jl")
Expand Down
10 changes: 5 additions & 5 deletions examples/bbm_bbm_1d/bbm_bbm_1d_dg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ mesh = Mesh1D(coordinates_min, coordinates_max, N)

# create solver
p = 3 # N needs to be divisible by p + 1
Dop = legendre_derivative_operator(-1.0, 1.0, p + 1)
sbp_mesh = UniformPeriodicMesh1D(coordinates_min, coordinates_max, div(N, p + 1))
D1 = couple_discontinuously(Dop, sbp_mesh)
D_pl = couple_discontinuously(Dop, sbp_mesh, Val(:plus))
D_min = couple_discontinuously(Dop, sbp_mesh, Val(:minus))
D_legendre = legendre_derivative_operator(-1.0, 1.0, p + 1)
uniform_mesh = UniformPeriodicMesh1D(coordinates_min, coordinates_max, div(N, p + 1))
D1 = couple_discontinuously(D_legendre, uniform_mesh)
D_pl = couple_discontinuously(D_legendre, uniform_mesh, Val(:plus))
D_min = couple_discontinuously(D_legendre, uniform_mesh, Val(:minus))
D2 = sparse(D_pl) * sparse(D_min)
solver = Solver(D1, D2)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ N = 512
mesh = Mesh1D(coordinates_min, coordinates_max, N)

# create solver with periodic SBP operators of accuracy order 4
solver = Solver(mesh, 4)
accuracy_order = 4
solver = Solver(mesh, accuracy_order)

# semidiscretization holds all the necessary data structures for the spatial discretization
semi = Semidiscretization(mesh, equations, initial_condition, solver,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,23 @@ using SparseArrays: sparse

equations = BBMBBMVariableEquations1D(gravity_constant = 9.81)

# initial_condition_variable_bathymetry needs periodic boundary conditions
initial_condition = initial_condition_sin_bathymetry
# initial_condition_convergence_test needs periodic boundary conditions
initial_condition = initial_condition_convergence_test
boundary_conditions = boundary_condition_periodic

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

# create solver
accuracy_order = 4
Dop = legendre_derivative_operator(-1.0, 1.0, accuracy_order)
sbp_mesh = UniformPeriodicMesh1D(mesh.xmin, mesh.xmax, div(mesh.N, accuracy_order))
central = couple_discontinuously(Dop, sbp_mesh)
minus = couple_discontinuously(Dop, sbp_mesh, Val(:minus))
plus = couple_discontinuously(Dop, sbp_mesh, Val(:plus))
p = 3 # N needs to be divisible by p + 1
D_legendre = legendre_derivative_operator(-1.0, 1.0, p + 1)
uniform_mesh = UniformPeriodicMesh1D(mesh.xmin, mesh.xmax, div(mesh.N, p + 1))
central = couple_discontinuously(D_legendre, uniform_mesh)
minus = couple_discontinuously(D_legendre, uniform_mesh, Val(:minus))
plus = couple_discontinuously(D_legendre, uniform_mesh, Val(:plus))
D1 = PeriodicUpwindOperators(minus, central, plus)
D2 = sparse(plus) * sparse(minus)
solver = Solver(D1, D2)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ using DispersiveShallowWater
###############################################################################
# Semidiscretization of the BBM-BBM equations

equations = BBMBBMVariableEquations1D(gravity_constant = 9.81)
equations = BBMBBMVariableEquations1D(gravity_constant = 9.81, eta0 = 0.8)

initial_condition = initial_condition_dingemans
boundary_conditions = boundary_condition_periodic
Expand All @@ -16,7 +16,8 @@ N = 512
mesh = Mesh1D(coordinates_min, coordinates_max, N)

# create solver with periodic SBP operators of accuracy order 4
solver = Solver(mesh, 4)
accuracy_order = 4
solver = Solver(mesh, accuracy_order)

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

0 comments on commit daeb6a7

Please sign in to comment.