Skip to content

Commit 480307e

Browse files
authored
Merge pull request #41 from LukasFuchs/main
add documentation
2 parents bc80d21 + b969428 commit 480307e

File tree

102 files changed

+2754
-2212
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

102 files changed

+2754
-2212
lines changed

.github/workflows/Documenter.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Note: this workflow is copied from the Trixi.jl package
2+
name: Documentation
3+
on:
4+
push:
5+
branches:
6+
- 'main'
7+
tags: '*'
8+
paths-ignore:
9+
- '.zenodo.json'
10+
- '.github/workflows/SpellCheck.yml'
11+
- '.github/workflows/UnitTests.yml'
12+
- '.github/workflows/TagBot.yml'
13+
pull_request:
14+
paths-ignore:
15+
- '.github/workflows/SpellCheck.yml'
16+
- '.github/workflows/UnitTests.yml'
17+
- '.github/workflows/TagBot.yml'
18+
workflow_dispatch:
19+
20+
# Cancel redundant CI tests automatically
21+
concurrency:
22+
group: ${{ github.workflow }}-${{ github.ref }}
23+
cancel-in-progress: true
24+
25+
jobs:
26+
build:
27+
permissions:
28+
contents: write
29+
pull-requests: read
30+
statuses: write
31+
runs-on: ubuntu-latest
32+
steps:
33+
- uses: actions/checkout@v4
34+
- uses: julia-actions/setup-julia@v2
35+
with:
36+
version: '1'
37+
- uses: julia-actions/cache@v2
38+
- uses: julia-actions/julia-buildpkg@latest
39+
- name: Install dependencies
40+
run: julia --project=docs/ -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate()'
41+
- name: Build and deploy
42+
uses: julia-actions/julia-docdeploy@v1
43+
env:
44+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # If authenticating with GitHub Actions token
45+
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }} # If authenticating with SSH deploy key

Project.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ version = "0.1.0"
66
[deps]
77
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
88
Dierckx = "39dd38d3-220a-591b-8e3c-4c3a8c710a94"
9+
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
10+
DocumenterTools = "35a29f4d-8980-5a13-9543-d66fff28ecb8"
911
ExactFieldSolutions = "2a6b1ac7-2de5-4354-bffb-bf009f6a4bef"
1012
ExtendableSparse = "95c220a8-a1cf-11e9-0c77-dbfce5f500b3"
1113
GLM = "38e38edf-8417-5370-95a0-9cbb8c7f171a"
@@ -16,3 +18,8 @@ Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
1618
SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b"
1719
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
1820
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
21+
22+
[compat]
23+
Documenter = "1.9.0"
24+
DocumenterTools = "0.1.20"
25+

README.md

Lines changed: 20 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,13 @@
1+
[![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://lukasfuchs.github.io/GeoModBox.jl/)
2+
13
# GeoModBox.jl
24
The **Geod**ynamic **Mod**elling Tool**Box** is a julia package mainly used for teaching purposes. The package provides different finite difference, staggered, discretization schemes to numerically solve the governing equations for a two-dimensional geodynamic problem. The governing equations are the conservation equations of
3-
1) [**energy**](/examples/HeatEquation/README.md),
4-
2) [**momentum**](/examples/...),
5-
3) [**mass** and **compositon**](/examples/AdvectionEquation/README.md).
6-
7-
&emsp; The ```GeoModBox.jl``` includes a series of [exercises](./exercises/) and [examples](./examples/) of different geodynamically well defined problems. The exercises are given as Jupyter notebooks for the students to complete. Most of the theoretical background is given in the corresponding README.md files and in the documentation. <!-- documentation needs to be done!-->
8-
9-
<!-- I will add some question directly here for the time beeing: I would like to add similar informations to this package as I did in my [FDCSGm repository](https://github.com/LukasFuchs/FDCSGm). However, I am not familiar with the doc option in github yet, that's why I added all the information in a README.md file for each module etc. I guess the doc option would be more suitable to add the details and simply add some figures and general information in the README.md. Have you ever worked with doc in github? -->
10-
11-
------------------
12-
------------------
13-
## Staggered Finite Difference
14-
<!--- brief general description of a staggered finite difference scheme
15-
- Energy equation
16-
- Momentum equation
17-
- add Figure of FD-Grid including all variables...
18-
-->
19-
------------------
20-
------------------
21-
## [Energy Conservation Equation](./examples/DiffusionEquation/README.md)
22-
&emsp; In geodynamics, the energy is described by the temperature and needs to be conserved within a closed system. Here, we solve the *temperature conservation equation*, or *temperature equation*, using an operator splitting method, that is, we first solve the *advective* part of the *temperature equation*, followed by the *diffusive* part.
23-
<!-- - General formulation of the energy equation (advection + diffusion term + radiogenic heating)
24-
- Operator splitting
25-
- Solution of the conductive part -->
26-
------------------
27-
### [Heat Diffusion Equation](./examples/DiffusionEquation/1D/README.md)
28-
&emsp; The **GeoModBox** provides different finite difference (**FD**) schemes (e.g., [forward](./src/HeatEquation/ForwardEuler.jl) and [backward](./src/HeatEquation/BackwardEuler.jl) Euler, [Crank-Nicholson approach](./src/HeatEquation/CNA.jl), [ADI](./src/HeatEquation/ADI.jl)) to solve the *diffusive part* of the time-dependent or steady-state *temperature equation* including radioactive heating, in [1-D](./examples/DiffusionEquation/1D/README.md) and [2-D](./examples/DiffusionEquation/2D/README.md). The solvers are located in [src/HeatEquation](./src/HeatEquation/). So far, only *Dirichlet* and *Neumann* thermal boundary conditions are available. Currently, most of the functions assume constant thermal parameters (except for the 1-D solvers).
29-
30-
The examples of solving the *heat diffusion equation* include, amongst others:
31-
- the determination of an [oceanic](./examples/DiffusionEquation/1D/OceanicGeotherm_1D.jl) and [continental](./examples/DiffusionEquation/1D/ContinentalGeotherm_1D.jl) 1-D geotherm profile,
32-
- [a comparison of the different **FD**-schemes applied on a 1-D gaussian temperature anomaly](./examples/DiffusionEquation/1D/Heat_1D_discretization.jl),
33-
- [a 2-D resolution test for each **FD**-scheme using a gaussian temperature anomaly](./examples/DiffusionEquation/2D/Gaussian_Diffusion.jl), and
34-
- [a resolution test for a 2-D poisson problem](./examples/DiffusionEquation/2D/Poisson_ResTest.jl).
35-
36-
For more examples see the [example folder](./examples/DiffusionEquation/). The [exercises](./exercises/) include solving
37-
- the 1-D diffusion equation using the [forward](./exercises/02_1D_Heat_explicit.ipynb) and [backward](./exercises/03_1D_Heat_implicit.ipynb) Euler methods,
38-
- [a 2-D poisson problem](./exercises/04_2D_Diffusion_Stationary.ipynb), and
39-
- a time-dependent temperature distribution within the lithosphere assuming a [plume](./exercises/05_2D_Diffusion_TD_Plume.ipynb) or [sill](./exercises/05_2D_Diffusion_TD_Sill.ipynb).
40-
41-
<!-- #### Numerical Schemes
42-
43-
All numerical schemes methods can be used in the [thermal convection code]() and the [Blankenbach Benchmark]() and are generally available to chose in the code.
44-
------------------ -->
455

46-
### [Heat Advection Equation](./examples/AdvectionEquation/README.md)
6+
1) [**energy**](./docs/src/man/DiffMain.md),
7+
2) [**momentum**](./docs/src/man/MomentumMain.md),
8+
3) [**mass** and **compositon**](./docs/src/man/AdvectMain.md).
479

48-
&emsp; To solve the *advective part* of the *temperature equation*, the ```GeoModBox.jl``` provides the following different methods:
49-
- an upwind scheme,
50-
- the staggered -leaped frog scheme,
51-
- a semi-lagrangian advection, and
52-
- passive tracers/markers.
53-
54-
The solvers for a the tracer advection method are located in [./src/Tracers](./src/Tracers/), where the remaining advection routines are located in [./src/AdvectionEquation](./src/AdvectionEquation/). The routines are structured in such a way, that any property, as long as the property is defined on the *centroids* including *ghost nodes* on all boundaries, can be advected with the first **three** advection methods listed above. Using passive tracers, one can so far choose to either advect the temperature or to advect the phases. In case of advecting phases, one can define a certain rheology ($\eta$) or density ($\rho$) associated to each phase. The phase ID is used to interpolate the corresponding property from the tracers to the *centroids*.
55-
56-
&emsp; A key aspect for the advection equation is the conservation of the **amplitude** and the **shape** of an anomaly. Depending on the method, numerical diffusion or interpolation effects lead to strong deviations of the initial anomaly. For more details see [here](./examples/AdvectionEquation/README.md). The ```GeoModBox.jl``` contains several [routines](./src/InitialCondition/2Dini.jl) to setup a certain initial anomaly, either for properties defined on their correspondig grid (i.e., temperature, velocity, or phase) or for tracers advecting (so far) a certain temperature or phase. Within the examples and the exercise one can choose differen initial temperature and velocity conditions.
57-
58-
&emsp; The examples for a two dimensional advection problem include:
59-
- [a 2-D advection, assuming a constant velocity field (e.g., a rigid body rotation)](./examples/AdvectionEquation/2D_Advection.jl), and
60-
- [a resolution test of the same advection example](./examples/AdvectionEquation/2D_Advection_ResolutionTest.jl).
61-
62-
&emsp; The exercises include a:
63-
- [1-D advection of a gaussian or block anomaly](./exercises/06_1D_Advection.ipynb), and
64-
- [a 2-D advection coupled with the solution of the diffusion equation](./exercises/07_2D_Energy_Equation.ipynb).
10+
The ```GeoModBox.jl``` includes a series of [exercises](/exercises/) and [examples](/examples/) of different geodynamically well defined problems. The exercises are given as Jupyter notebooks for the students to complete. The theoretical background and detailed explenations of the examples and functions are mainly given in the [documentation](https://lukasfuchs.github.io/GeoModBox.jl/).
6511

6612
<!--
6713
- Different properties can be advected!
@@ -70,9 +16,8 @@ The solvers for a the tracer advection method are located in [./src/Tracers](./s
7016
#### Staggered Leap Frog (SLF)
7117
#### Semi-Lagrangian
7218
#### Passive Tracers -->
73-
------------------
74-
------------------
75-
## [Momentum Conservation Equation](./examples/StokesEquation/README.md)
19+
20+
<!-- ## [Momentum Conservation Equation](./examples/StokesEquation/README.md) -->
7621

7722
<!--
7823
- Constant viscosity
@@ -83,37 +28,37 @@ The solvers for a the tracer advection method are located in [./src/Tracers](./s
8328
- Defect correction
8429
-->
8530

86-
------------------
87-
------------------
88-
## Code Structure
31+
## Structure
8932

90-
### Initial Conditions
33+
<!-- The ```GeoModBox.jl``` is -->
34+
35+
<!-- ## Initial Conditions -->
9136

9237
<!---
38+
- Set Up, Geometry, Grid, etc.
9339
- IniTemperature, IniVelocity, IniPhase,
9440
- Tracer Initialization
41+
- Solution of Stokes equation, Diffusion equation, Advection Equation,
9542
- ...
9643
-->
9744

98-
### Scaling
45+
<!-- ## Scaling -->
46+
9947

100-
------------------
101-
------------------
102-
## [Benchmarks](./examples/)
48+
## [Benchmarks and Examples](./examples/)
10349

10450
### [Gaussian Temperature Diffusion](./examples/DiffusionEquation/2D/Gaussian_Diffusion.jl)
10551
<img src="./examples/DiffusionEquation/2D/Results/Gaussian_Diffusion_CNA_nx_100_ny_100.gif" alt="drawing" width="600"/> <br>
10652
**Figure 1. Gaussian Diffusion.** Time-dependent, diffusive solution of a 2-D Gaussian temperature anomaly using the [Crank-Nicholson approach](./src/HeatEquation/CNA.jl) in comparison to its analytical solution. Top Left: 2-D temperature field of the numerical solution and isotherms lines of the numerical (solid black) and analytical (dashed yellow) solution. Top Right: Total deviation to the analytical solution. Bottom Left: 1-D y-profile along x=0. Bottom Right: Root Mean Square total devation of the temperature over time.
10753

108-
10954
<img src="./examples/DiffusionEquation/2D/Results/Gaussian_ResTest.png" alt="drawing" width="600"/> <br>
11055
**Figure 2. Resolution test.** Maximum *RMS* $\varepsilon$, maximum, and mean temperature for each **FD**-scheme and multiple resolutions.
11156

11257
### [Rigid-Body-Rotation](./examples/AdvectionEquation/2D_Advection.jl)
11358

114-
<img src="./examples/AdvectionEquation/Results/2D_advection_circle_RigidBody_upwind_100_100_nth_16.gif" alt="drawing" width="300"/>
115-
<img src="./examples/AdvectionEquation/Results/2D_advection_circle_RigidBody_semilag_100_100_nth_16.gif" alt="drawing" width="300"/>
116-
<img src="./examples/AdvectionEquation/Results/2D_advection_circle_RigidBody_tracers_100_100_nth_16.gif" alt="drawing" width="300"/>
59+
<img src="./examples/AdvectionEquation/Results/2D_advection_circle_RigidBody_upwind_100_100_nth_1.gif" alt="drawing" width="300"/>
60+
<img src="./examples/AdvectionEquation/Results/2D_advection_circle_RigidBody_semilag_100_100_nth_1.gif" alt="drawing" width="300"/>
61+
<img src="./examples/AdvectionEquation/Results/2D_advection_circle_RigidBody_tracers_100_100_nth_1.gif" alt="drawing" width="300"/>
11762
<br>
11863

11964
**Figure 3. Rigid-Body-Rotation.** Time-dependent solution of a rotating circular temperature anomaly using the **upwind (first)**, **semi-lagrangian (second)**, and **tracer (third)** method. Within a circular area of our model domain the velocity is set to the velocity of a rigid rotation and outside euqal to zero. The temperature is scaled by the maximum temperature of the anomaly.
@@ -132,9 +77,6 @@ The solvers for a the tracer advection method are located in [./src/Tracers](./s
13277

13378
**Figure 6. Falling Block Benchmark.** Final tracers distribution for specific cases with $\eta_r \ge 0$.
13479

135-
------------------
136-
------------------
137-
13880
<!--
13981
- Blanckenbach
14082
- Channel Flow

docs/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
build/
2+
site/

docs/Project.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[deps]
2+
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
3+
GeoModBox = "e210ae48-618e-410f-9a4d-7c1c87986529"
4+
5+
[sources]
6+
GeoModBox = {path = ".."}

docs/make.jl

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
using Documenter
2+
using GeoModBox
3+
4+
GMB_root_dir = dirname(@__DIR__)
5+
6+
license = read(joinpath(GMB_root_dir, "LICENSE"), String)
7+
write(joinpath(@__DIR__, "src", "man", "license.md"), license)
8+
9+
makedocs(
10+
sitename = "GeoModBox.jl",
11+
format = Documenter.HTML(),
12+
warnonly = [:missing_docs],
13+
modules = [GeoModBox],
14+
pages = [
15+
"Home" => "index.md",
16+
"Governing Equation" => Any[
17+
"Solution" => "man/GESolution.md",
18+
"Heat Diffusion Equation" => Any[
19+
"General" => "man/DiffMain.md",
20+
"1D" => "man/DiffOneD.md",
21+
"2D" => "man/DiffTwoD.md",
22+
],
23+
# "Advection Equation" => Any[
24+
# "General" => "man/AdvMain.md",
25+
# "1D" => "man/AdvOneD.md",
26+
# "2D" => "man/AdvTwoD.md",
27+
# ],
28+
# "Momentum Equation" => Any[
29+
# "General" => "man/MomentumMain.md",
30+
# "1D" => "man/MomentumOneD.md",
31+
# "2D" => "man/MomentumTwoD.md",
32+
# ],
33+
],
34+
# "Examples" => "man/Examples.md",
35+
"List of functions" => "man/listoffunctions.md",
36+
]
37+
)
38+
39+
# Documenter can also automatically deploy documentation to gh-pages.
40+
# See "Hosting Documentation" and deploydocs() in the Documenter manual
41+
# for more information.
42+
withenv("GITHUB_REPOSITORY" => "LukasFuchs/GeoModBox.jl") do
43+
deploydocs(
44+
# repo = "https://lukasfuchs.github.io/GeoModBox.jl",
45+
repo = "github.com/LukasFuchs/GeoModBox.jl",
46+
devbranch = "main",
47+
push_preview = true
48+
)
49+
end
File renamed without changes.

examples/AdvectionEquation/Results/2D_advection_circle_RigidBody_semilag.gif renamed to docs/src/assets/2D_advection_circle_RigidBody_semilag_100_100_nth_1.gif

File renamed without changes.
501 KB
Loading

examples/AdvectionEquation/Results/2D_advection_circle_RigidBody_upwind.gif renamed to docs/src/assets/2D_advection_circle_RigidBody_upwind_100_100_nth_1.gif

File renamed without changes.

0 commit comments

Comments
 (0)