You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/src/examples.md
+13-9Lines changed: 13 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -79,25 +79,29 @@ The example code solves the equation for 4 different tendencies with the followi
79
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
80
- Tendency 2:
81
81
82
-
$$D = \partial(UB) + \textrm{fcc}(v, \theta),$$
82
+
$$D = \partial(UB) - \textrm{fcc}(v, \theta),$$
83
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.
84
+
where $\textrm{fcc}(v, \theta) = \bar{\partial}(|v| G(\theta))$ is a flux correction term, built from the [face-to-center gradient](https://clima.github.io/ClimaCore.jl/dev/operators/#ClimaCore.Operators.GradientF2C) $\bar{\partial}$ and the [center-to-face gradient](https://clima.github.io/ClimaCore.jl/dev/operators/#ClimaCore.Operators.GradientC2F) $G$. The gradient of $\theta$ is set to zero on both boundary faces, so that no correction flux passes through them.
85
85
- Tendency 3:
86
86
87
-
$$D = v \cdot G(T)$$
87
+
$$D = \bar{I}(v \cdot G(\theta))$$
88
88
89
-
where``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
89
+
where``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) and $\bar{I}$ is the [face-to-center interpolation](https://clima.github.io/ClimaCore.jl/dev/operators/#ClimaCore.Operators.InterpolateF2C) operator.
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.
94
+
combining the discretizations of tendencies 3 and 2.
95
95
96
96
#### Set Up
97
97
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.
98
+
The example runs each of the four tendencies on two initial conditions:
99
+
* a smooth one, ``\theta(z, 0) = sin(z)``, on a 1D column domain ``z \in [0, 4\pi]`` discretized into a mesh of 128 elements, and
100
+
* a discontinuous one, a step function, on ``z \in [-20, 20]`` discretized into a mesh of 64 elements.
101
+
102
+
The velocity field is constant and upward. The boundary conditions are operator dependent, so they depend on the tendency.
103
+
* For tendencies 1 and 2, where the upwind biased operator ``UB`` is used, the value of ``\theta`` outside of the left boundary is ``sin(a - t)`` and outside of the right boundary is ``sin(b - t)``. Here ``a`` and ``b`` are the left and right bounds of the domain. Since `UpwindBiasedProductC2F` no longer takes a `SetValue` boundary condition, the example evaluates the upwind stencil at the boundary faces itself and imposes the result with a [`SetBoundaryOperator`](https://clima.github.io/ClimaCore.jl/dev/operators/#ClimaCore.Operators.SetBoundaryOperator).
104
+
* For tendencies 3 and 4, the gradient ``G(\theta)`` on the left boundary face is set to ``2 (\theta[1] - sin(-t))``, which is the value it takes when ``\theta = sin(-t)`` outside of the boundary. On the right boundary face it is set to the gradient of the closest interior faces, an extrapolation.
0 commit comments