Skip to content

Commit b59ee35

Browse files
committed
updated suggestions
1 parent e7581dc commit b59ee35

File tree

1 file changed

+53
-35
lines changed

1 file changed

+53
-35
lines changed

docs/src/examples.md

Lines changed: 53 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,85 +1,103 @@
11
# Examples
22

3-
### Advection
3+
## 1D Column examples
44

5-
The 1D Column advection example in [`examples/column/advect.jl`](https://github.com/CliMA/ClimaCore.jl/blob/main/examples/column/advect.jl).
5+
### Heat equation
66

7-
#### Equations and Discretizations
7+
The 1D Column heat example in [`examples/column/heat.jl`](https://github.com/CliMA/ClimaCore.jl/blob/main/examples/column/heat.jl).
88

9-
Follows the advection equation
9+
#### Equations and discretizations
10+
11+
Follows the heat equation
1012

1113
```math
1214
\begin{equation}
13-
\frac{\partial \theta}{\partial t} = -\frac{\partial (v \theta)}{\partial z}
14-
\label{eq:1d-column-advection-continuity}
15+
\frac{\partial T}{\partial t} = \alpha \cdot \nabla^2 T.
16+
\label{eq:1d-column-heat-continuity}
1517
\end{equation}
1618
```
19+
1720
This is discretized using the following
1821

1922
```math
2023
\begin{equation}
21-
\frac{\partial \theta}{\partial t} \approx - D(v, \theta)
22-
\label{eq:1d-column-advection-discrete}
24+
\frac{\partial T}{\partial t} \approx \alpha \cdot D(G(T)).
25+
\label{eq:1d-column-heat-discrete}
2326
\end{equation}
2427
```
2528

2629
#### Prognostic Variables
2730

28-
* ``\theta``: the scalar field
29-
* ``v``: the velocity field
30-
31-
#### Tendencies
31+
* ``\alpha``: thermal diffusivity measured in $\frac{m^2}{s}$
32+
* ``T``: temperature
3233

33-
The example code solves the equation for 4 different tendencies with the following discretizations:
34+
#### Differentiation Operators
3435

35-
* Tendency 1: ``D = \partial(UB)``, where ``\partial`` is the [`face-to-center divergence`](https://clima.github.io/ClimaCore.jl/dev/operators/#ClimaCore.Operators.DivergenceF2C) and $UB$ is the [`center-to-face upwind biased product`](https://clima.github.io/ClimaCore.jl/dev/operators/#ClimaCore.Operators.UpwindBiasedProductC2F) operator.
36-
* Tendency 2: Follows tendency 1, where ``D = \partial(UB)``. Similarly, ``\partial`` is the [`face-to-center divergence`](https://clima.github.io/ClimaCore.jl/dev/operators/#ClimaCore.Operators.DivergenceF2C) and $UB$ is the [`center-to-face upwind biased product`](https://clima.github.io/ClimaCore.jl/dev/operators/#ClimaCore.Operators.UpwindBiasedProductC2F) operator. Tendency 2 also includes the [`center-to-center flux correction`](https://github.com/CliMA/ClimaCore.jl/blob/main/src/Operators/finitedifference.jl#L2617), `fcc`.
37-
* Tendency 3: $D = A$, where $A$ is the [`center-to-center vertical advection`](https://clima.github.io/ClimaCore.jl/dev/operators/#ClimaCore.Operators.AdvectionC2C) operator.
38-
* Tendency 4: Follows tendency 3, where $D = A$, the [`center-to-center vertical advection`](https://clima.github.io/ClimaCore.jl/dev/operators/#ClimaCore.Operators.AdvectionC2C). Tendency 4 also includes the [`center-to-center flux correction`](https://github.com/CliMA/ClimaCore.jl/blob/main/src/Operators/finitedifference.jl#L2617), `fcc`.
36+
* ``D`` is the [face-to-center divergence](https://clima.github.io/ClimaCore.jl/dev/operators/#ClimaCore.Operators.DivergenceF2C) operator, called `divf2c` in the example code
37+
* ``G`` is the [center-to-face gradient](https://clima.github.io/ClimaCore.jl/dev/operators/#ClimaCore.Operators.GradientC2F) operator, called `gradc2f` in the example code
3938

4039
#### Set Up
4140

42-
This test case is set up in a 1D column domain ``z \in [0, 4\pi]``, discretized into a mesh of 128 elements. The velocity field is defined as a sinusoidal wave. The boundary conditions are operator dependent, so they depend on the tendency.
43-
* For tendencies 1 and 2 where the upwind biased operator ``UB`` is used, the left boundary is defined as ``sin(a - t)``. The right boundary is ``sin(b - t)``. Here ``a`` and ``b`` are the left and right bounds of the domain.
44-
* For tendencies 3 and 4, where the advection operator ``A`` is used, the left boundary is defined as ``sin(-t)``. The right boundary is extrapolated, meaning its value is set to the closest interior point.
41+
This test case is set up in a 1D column domain ``z \in [0, 1]`` and discretized into a mesh of 10 elements. A homogeneous Dirichlet boundary condition is set at the bottom boundary, `bcs_bottom`, setting the temperature to 0. A Neumann boundary condition is applied to the top boundary, `bcs_top`, setting the temperature gradient to 1.
4542

46-
### Heat
43+
### Advection equation
4744

48-
The 1D Column heat example in [`examples/column/heat.jl`](https://github.com/CliMA/ClimaCore.jl/blob/main/examples/column/heat.jl).
45+
The 1D Column advection example in [`examples/column/advect.jl`](https://github.com/CliMA/ClimaCore.jl/blob/main/examples/column/advect.jl).
4946

50-
#### Equations and discretizations
47+
#### Equations and Discretizations
5148

52-
Follows the heat equation
49+
Follows the advection equation
5350

5451
```math
5552
\begin{equation}
56-
\frac{\partial T}{\partial t} = \alpha \cdot \nabla^2 T.
57-
\label{eq:1d-column-heat-continuity}
53+
\frac{\partial \theta}{\partial t} = -\frac{\partial (v \theta)}{\partial z} .
54+
\label{eq:1d-column-advection-continuity}
5855
\end{equation}
5956
```
60-
6157
This is discretized using the following
6258

6359
```math
6460
\begin{equation}
65-
\frac{\partial T}{\partial t} \approx \alpha \cdot D(G(T)).
66-
\label{eq:1d-column-heat-discrete}
61+
\frac{\partial \theta}{\partial t} \approx - D(v, \theta) .
62+
\label{eq:1d-column-advection-discrete}
6763
\end{equation}
6864
```
6965

7066
#### Prognostic Variables
7167

72-
* ``\alpha``: thermal diffusivity measured in $\frac{m^2}{s}$
73-
* ``T``: temperature
68+
* ``\theta``: the scalar field
69+
* ``v``: the velocity field
7470

75-
#### Differentiation Operators
71+
#### Tendencies
7672

77-
* ``D`` is the [face-to-center divergence](https://clima.github.io/ClimaCore.jl/dev/operators/#ClimaCore.Operators.DivergenceF2C) operator, called `divf2c` in the example code
78-
* ``G`` is the [center-to-face gradient](https://clima.github.io/ClimaCore.jl/dev/operators/#ClimaCore.Operators.GradientC2F) operator, called `gradc2f` in the example code
73+
The example code solves the equation for 4 different tendencies with the following discretizations:
74+
75+
- Tendency 1:
76+
77+
$$D = \partial(UB),$$
78+
79+
where ``\partial`` is the [`face-to-center divergence`](https://clima.github.io/ClimaCore.jl/dev/operators/#ClimaCore.Operators.DivergenceF2C) and $UB$ is the [`center-to-face upwind biased product`](https://clima.github.io/ClimaCore.jl/dev/operators/#ClimaCore.Operators.UpwindBiasedProductC2F) operator.
80+
- Tendency 2:
81+
82+
$$D = \partial(UB) + \textrm{fcc}(v, \theta),$$
83+
84+
where $\textrm{fcc}(v, \theta)$ is the [`center-to-center flux correction`](https://github.com/CliMA/ClimaCore.jl/blob/main/src/Operators/finitedifference.jl#L2617) operator.
85+
- Tendency 3:
86+
87+
$$D = A,$$
88+
89+
where $A$ is the [`center-to-center vertical advection`](https://clima.github.io/ClimaCore.jl/dev/operators/#ClimaCore.Operators.AdvectionC2C) operator.
90+
- Tendency 4:
91+
92+
$$D = A + \textrm{fcc}(v, \theta),$$
93+
94+
where $\textrm{fcc}(v, \theta)$ is the [`center-to-center flux correction`](https://github.com/CliMA/ClimaCore.jl/blob/main/src/Operators/finitedifference.jl#L2617) operator.
7995

8096
#### Set Up
8197

82-
This test case is set up in a 1D column domain ``z \in [0, 1]`` and discretized into a mesh of 10 elements. A homogeneous Dirichlet boundary condition is set at the bottom boundary, `bcs_bottom`, setting the temperature to 0. A Neumann boundary condition is applied to the top boundary, `bcs_top`, setting the temperature gradient to 1.
98+
This test case is set up in a 1D column domain ``z \in [0, 4\pi]``, discretized into a mesh of 128 elements. The velocity field is defined as a sinusoidal wave. The boundary conditions are operator dependent, so they depend on the tendency.
99+
* For tendencies 1 and 2 where the upwind biased operator ``UB`` is used, the left boundary is defined as ``sin(a - t)``. The right boundary is ``sin(b - t)``. Here ``a`` and ``b`` are the left and right bounds of the domain.
100+
* For tendencies 3 and 4, where the advection operator ``A`` is used, the left boundary is defined as ``sin(-t)``. The right boundary is extrapolated, meaning its value is set to the closest interior point.
83101

84102
## 2D Cartesian examples
85103

0 commit comments

Comments
 (0)