Skip to content

Commit 674c345

Browse files
committed
Revisions based on V1 equations
1 parent 506b9ec commit 674c345

File tree

3 files changed

+89
-68
lines changed

3 files changed

+89
-68
lines changed

components/omega/doc/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
SPHINXOPTS ?=
77
SPHINXBUILD ?= sphinx-build
88
SOURCEDIR = .
9-
BUILDDIR = /global/cfs/cdirs/e3sm/www/sbrus/pgrad
9+
BUILDDIR = _build
1010

1111
# Put it first so that "make" without argument is like "make help".
1212
help:

components/omega/doc/design/OmegaV1GoverningEqns.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
(omega-design-gonverning-equations-omega1)=
12
# Omega V1: Governing Equations
23

34
<!--
@@ -726,6 +727,7 @@ In the tracer equation, we note that surface fluxes (e.g. latent heat fluxes) wi
726727
727728
Omega will only predict the layer average normal velocity, so we drop the bold face on the $u$ terms except for the product of primes, which is specified in the next section.
728729
730+
(omega-v1-momentum-eq)=
729731
$$
730732
\frac{\partial u_{e,k}}{\partial t}
731733
& + \left[ {\bf k} \cdot \nabla \times u_{e,k} +f_v\right]_e\left(u_{e,k}^{\perp}\right) + \left[\nabla K\right]_e \\

components/omega/doc/design/PGrad.md

Lines changed: 86 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
## 1 Overview
66
The pressure gradient will be responsible for computing the horizontal gradients of both the pressure and geopotential terms for the non-Boussinesq primitive equations implemented in Omega.
77
In the non-Boussinesq model, the conserved quantity is mass rather than volume.
8-
In Omega the prognostic variable $\tilde{h}$ is a pseudo thickness, rather than geometric thickness in m as in a Boussinesq model.
8+
In Omega the prognostic variable $\tilde{h}$ is a pseudo thickness, rather than geometric thickness as in a Boussinesq model.
99
Some non-Boussinesq models are written in pressure coordinates (e.g. [de Szoeke and Samelson 2002](https://journals.ametsoc.org/view/journals/phoc/32/7/1520-0485_2002_032_2194_tdbtba_2.0.co_2.xml).
1010
However, Omega is written in general vertical coordinates and can reference either pressure $p$ or distance $z$ in the vertical.
1111
In a pure pressure coordinate the pressure gradient term disappears (since the pressure does not vary along lines of constant pressure), just as how the geopotential term disappears in a pure z coordinate model.
@@ -18,6 +18,7 @@ This means that Omega will need to compute both the pressure and geopotential gr
1818

1919
The pressure gradient will compute the horizontal gradients of both the pressure and geopotential to support tilted pressure coordinates in the non-Boussinesq model.
2020
This will allow for the use of a $p^\star$ coordinate, which functions similarly to the $z^\star$ in the Boussinesq MPAS-Ocean model.
21+
Note that we use the "$p^\star$" to refer to the vertical coordinate, in Omega it will be expressed in terms of the pseudo-height, $\tilde{z}$, as opposed to pressure directly.
2122

2223
### 2.2 Requirement: Initial support for a simple centered pressure gradient
2324

@@ -34,7 +35,7 @@ In later versions of Omega, the pressure gradient will need to be able to includ
3435
These tidal forcings include both the tidal potential and the self attraction and loading terms.
3536
Additionally, other long-term changes to the geoid can be included in the geopotential.
3637

37-
### 2.5 Disired: Pressure gradient for barotropic mode
38+
### 2.5 Desired: Pressure gradient for barotropic mode
3839

3940
For split barotropic-baroclinic timestepping, the pressure gradient should provide the bottom pressure gradient tendency in the barotropic mode.
4041
This will be added in a future version when split time stepping is implemented.
@@ -43,22 +44,23 @@ This will be added in a future version when split time stepping is implemented.
4344

4445
## 3 Algorithmic Formulation
4546
### 3.1 Centered Pressure Gradient
46-
In the layered non-Boussinesq [momentum equation](OmegaV1GoverningEqns.md#discrete-momentum) solved in Omega, the pressure gradient tendency term for edge $e$ and level $k$, $T^p_{e,k}$, includes the gradient of the pressure and the gradient of the geopotential,
47+
In the layered non-Boussinesq {ref}`momentum equation <omega-v1-momentum-eq>` solved in Omega, the pressure gradient tendency term for edge $e$ and level $k$, $T^p_{e,k}$, includes the gradient of the geopotential, the gradient of a term involving pressure, and two terms evaluated at the cell interface:
4748

4849
$$
49-
T^p_{e,k} = -\left[ \alpha_{i,k} \right]_e \nabla p_{i,k} - \nabla \Phi_{i,k},
50+
T^p_{e,k} = - \left(\nabla \Phi \right)_{e,k} - \frac{1}{\left[\tilde{h}_k\right]_e} \nabla \left( \tilde{h}_k \alpha_k p_k \right) + \frac{1}{\left[\tilde{h}_k\right]_e} \left\{ \left[ \alpha p \nabla \tilde{z}\right]_{e,k}^\text{top} - \left[ \alpha p \nabla \tilde{z}\right]_{e,k+1}^\text{top} \right\}.
5051
$$
5152

52-
where the second term is necessary to account for tilted layers that occur when using a general vertical coordinate.
53-
In this equation, $\alpha_{i,k}$ is the specific volume for cell $i$ at the mid-point of level $k$, $p_{i,k}$ is the pressure, and $\Phi_{i,k}$ is the geopotential.
53+
The geopotential and interface terms are necessary to account for tilted layers that occur when using a general vertical coordinate, where the gradient operator is taken along layers.
54+
In this equation, $\alpha_{i,k}$ specific volume, $p_{i,k}$ is the pressure, and $\Phi_{i,k}$ is the geopotential.
55+
These three quantities are evaluated at the mid-point of level $k$ of cell $i$ in the first two terms and at the cell interfaces in the third term along with the interface psudo-height, \tilde{z}.
5456
The discrete gradient operator at an edge is:
5557

5658
$$
5759
\nabla {(\cdot)} = \frac{1}{d_e} \sum_{i\in CE(e)} -n_{e,i} (\cdot)_i
5860
$$
5961

6062
where $d_e$ is the distance between cell centers, $CE(e)$ are the cells on edge $e$, and $n_{e,i}$ is the sign of the edge normal with respect to cell $i$.
61-
The horizontal averaging operator is:
63+
The (cell-to-edge) horizontal averaging operator is:
6264

6365
$$
6466
[\cdot]_e = \frac{1}{2}\sum_{i\in CE(e)} (\cdot)_i
@@ -67,53 +69,60 @@ $$
6769
Therefore, the centered pressure gradient will be calculated as:
6870

6971
$$
70-
T^p_{e,k} = \frac{1}{d_e} \left( [\alpha_{i,k}]_e \sum_{i \in CE(e)} n_{e,i} p_{k,i} + \sum_{i\in CE(e)} n_{e,i} \Phi_{k,i}\right),
71-
$$
72-
73-
$$
74-
= \frac{1}{d_e} \left( \sum_{i \in CE(e)} n_{e,i} \left( [\alpha_{i,k}]_ep_{k,i} + \Phi_{k,i} \right) \right),
75-
$$
76-
77-
### 3.2 Barotropic Pressure Gradient
78-
79-
When split baroclinic-barotropic time stepping is implemented in the future, the barotropic pressure gradient will be calculated by the pressure gradient class.
80-
The barotropic pressure gradient is found by depth integrating the pressure gradient.
81-
The pressure is
82-
83-
$$
84-
p(z) = p_b - g \int^z_{-h} \rho dz^\prime,
85-
$$
86-
87-
where $p_b$ is the bottom pressure.
88-
The bottom pressure is the sum of the atmospheric surface pressure, $p_s$, and the pressure contribution of the water column:
89-
90-
$$
91-
p(z) &= p_s + g\int_{-h}^\eta \rho dz - g \int^z_{-h} \rho dz^\prime, \\
92-
&= p_s + g\rho_0\widetilde{H} - g \int^z_{-h} \rho dz^\prime,
93-
$$
94-
95-
where the total water column pseudo height is expressed by
96-
97-
$$
98-
\widetilde{H} = \int_{-h}^\eta \frac{\rho}{\rho_0} dz.
99-
$$
100-
101-
$\widetilde{H}$ is the prognositc variable in the barotropic continuity equation.
102-
The vertical integral of the pressure gradient is
103-
104-
$$
105-
\frac{1}{\rho_0\widetilde{H}}\int^\eta_{-h} \nabla p dz &= \frac{1}{\rho_0\widetilde{H}}\int^\eta_{-h} \nabla \left( p_s + g\rho_0 \widetilde{H} - g \int^z_{-h} \rho dz^\prime \right) dz, \\
106-
&= \frac{H}{\rho_0\widetilde{H}}\nabla p_s + \frac{gH}{\widetilde{H}}\nabla \widetilde{H} - \frac{g}{\rho_0\widetilde{H}} \int_{-h}^\eta \left( \nabla \int_{-h}^z \rho dz^\prime\right) dz,
107-
$$
108-
109-
where the height of the water column is represented by $H$.
110-
The $1/\rho_0\widetilde{H}$ factor comes vertically integrating the material derivative and expressing the resulting barotropic momentum equation in non-conservative form.
111-
112-
Therefore, the barotorpic pressure gradient term is discretized as:
113-
114-
$$
115-
\overline{T}_e^p = g\left[ \frac{H_i}{\widetilde{H}_i} \right]_e\sum_{i \in CE(e)} n_{e,i}\widetilde{H}_e
116-
$$
72+
T^p_{e,k} = \frac{1}{d_e}\sum_{i\in CE(e)} n_{e,i} \Phi_{k,i} + \frac{2}{d_e\sum_{i \in CE(e)}\tilde{h}_{k,i}}\left(\sum_{i \in CE(e)} n_{e,i} \tilde{h}_{k,i}\alpha_{k,i}p_{k,i}\right. \\ \left. - \frac{1}{2} \sum_{i\in CE(e)} \alpha_{i,k-1/2} p_{i,k-1/2}\sum_{i\in CE(e)} n_{e,i}\tilde{z}_{i,k-1/2} \right.\\ \left.+ \frac{1}{2} \sum_{i\in CE(e)} \alpha_{i,k+1/2} p_{i,k+1/2}\sum_{i\in CE(e)} n_{e,i}\tilde{z}_{i,k+1/2}\right),
73+
$$
74+
75+
76+
### 3.2 High-order Pressure Gradient
77+
The high order pressure gradient will be based on the full volume integral
78+
79+
$$
80+
- \int_A \int_{\tilde{z}_k^{\text{bot}}}^{\tilde{z}_k^{\text{top}}} \nabla \left<\Phi\right> d\tilde{z} dA
81+
+ \int_{\partial A} \left( \int_{\tilde{z}_k^{\text{bot}}}^{\tilde{z}_k^{\text{top}}} \rho_0 \left(\left< \alpha \right> \left<p \right> + \left<\alpha^\prime p^\prime\right> \right) \, d\tilde{z} \right) dl \\
82+
+ \int_A \rho_0 \left[ \left< \alpha \right> \left<p \nabla \tilde{z}_k^{\text{top}} \right> + \left<\alpha^\prime \left(p \nabla \tilde{z}_k^{\text{top}}\right)^\prime\right> \right]_{\tilde{z} = \tilde{z}_k^{\text{top}}} \, dA \\
83+
- \int_A \rho_0 \left[ \left< \alpha \right> \left<p \nabla \tilde{z}_k^{\text{bot}} \right> + \left<\alpha^\prime \left(p \nabla \tilde{z}_k^{\text{bot}}\right)^\prime\right> \right]_{\tilde{z} = \tilde{z}_k^{\text{bot}}} \, dA.
84+
$$
85+
86+
%### 3.3 Barotropic Pressure Gradient
87+
%
88+
%When split baroclinic-barotropic time stepping is implemented in the future, the barotropic pressure gradient will be calculated by the pressure gradient class.
89+
%The barotropic pressure gradient is found by depth integrating the pressure gradient.
90+
%The pressure is
91+
%
92+
%$$
93+
%p(z) = p_b - g \int^z_{-h} \rho dz^\prime,
94+
%$$
95+
%
96+
%where $p_b$ is the bottom pressure.
97+
%The bottom pressure is the sum of the atmospheric surface pressure, $p_s$, and the pressure contribution of the water column:
98+
%
99+
%$$
100+
%p(z) &= p_s + g\int_{-h}^\eta \rho dz - g \int^z_{-h} \rho dz^\prime, \\
101+
% &= p_s + g\rho_0\widetilde{H} - g \int^z_{-h} \rho dz^\prime,
102+
%$$
103+
%
104+
%where the total water column pseudo height is expressed by
105+
%
106+
%$$
107+
%\widetilde{H} = \int_{-h}^\eta \frac{\rho}{\rho_0} dz.
108+
%$$
109+
%
110+
%$\widetilde{H}$ is the prognositc variable in the barotropic continuity equation.
111+
%The vertical integral of the pressure gradient is
112+
%
113+
%$$
114+
%\frac{1}{\rho_0\widetilde{H}}\int^\eta_{-h} \nabla p dz &= \frac{1}{\rho_0\widetilde{H}}\int^\eta_{-h} \nabla \left( p_s + g\rho_0 \widetilde{H} - g \int^z_{-h} \rho dz^\prime \right) dz, \\
115+
% &= \frac{H}{\rho_0\widetilde{H}}\nabla p_s + \frac{gH}{\widetilde{H}}\nabla \widetilde{H} - \frac{g}{\rho_0\widetilde{H}} \int_{-h}^\eta \left( \nabla \int_{-h}^z \rho dz^\prime\right) dz,
116+
%$$
117+
%
118+
%where the height of the water column is represented by $H$.
119+
%The $1/\rho_0\widetilde{H}$ factor comes vertically integrating the material derivative and expressing the resulting barotropic momentum equation in non-conservative form.
120+
%
121+
%Therefore, the barotorpic pressure gradient term is discretized as:
122+
%
123+
%$$
124+
%\overline{T}_e^p = g\left[ \frac{H_i}{\widetilde{H}_i} \right]_e\sum_{i \in CE(e)} n_{e,i}\widetilde{H}_e
125+
%$$
117126

118127
## 4 Design
119128

@@ -126,10 +135,11 @@ class PressureGrad{
126135
private:
127136
std::unique_ptr<PressureGrad> OmegaPressureGrad;
128137
PressureGradCentered CenteredPGrad;
129-
PressureGradHighOrder HighOrderPGrad; // To be implemented later
138+
PressureGradHighOrder HighOrderPGrad1; // To be implemented later
139+
PressureGradHighOrder HighOrderPGrad2; // Multiple high order options are likely in the future
130140
PressureGradType PressureGradChoice;
131141
I4 NVertLevels;
132-
I4 NChuncks;
142+
I4 NChunks;
133143
Array2DI4 CellsOnEdge;
134144
Array1DReal DvEdge;
135145
Array1DReal EdgeSignOnCell;
@@ -144,7 +154,8 @@ An `enum class` will be used to specify options for the pressure gradient used f
144154
```c++
145155
enum class PressureGradType{
146156
Centered,
147-
HighOrder
157+
HighOrder1,
158+
highOrder2
148159
}
149160
```
150161
The functions to compute the centered and high order pressure gradient terms will be implemented as functors and the pressure gradient class will have private instances of these classes.
@@ -164,12 +175,12 @@ class PressureGrad{
164175

165176
The constructor will be responsible for storing any static mesh information as private variables and handling the selection of the user-specified pressure gradient option.
166177
```c++
167-
PressureGrad::PressureGrad(const HorzMesh *Mesh, int NVertLevels, Config *Options);
178+
PressureGrad::PressureGrad(const HorzMesh *Mesh, const VertCoord *VCoord, Config *Options);
168179
```
169180
170181
#### 4.2.2 Initialization
171182
172-
The init method will create the pressure gradient and return an error code:
183+
The init method will create the default pressure gradient and return an error code:
173184
```c++
174185
int PressureGrad::init();
175186
```
@@ -193,17 +204,25 @@ void PressureGrad::computePressureGrad(const Array2DReal &Tend,
193204
const Array2DReal &SpecVol) {
194205
OMEGA_SCOPE(LocCenteredPGrad, CenteredPGrad)
195206
OMEGA_SCOPE(LocHighOrderPGrad, HighOrderPGrad)
207+
const Array1DI4 &MinLyrEdgeBot = VCoord->MinLayerEdgeBot;
208+
const Array1DI4 &MaxLyrEdgeTop = VCoord->MaxLayerEdgeTop;
196209
if (PressureGradChoice == PressureGradType::Centered){
197-
parallelFor("pgrad-centered", {NCellsAll, NChunks},
198-
KOKKOS_LAMBDA(int ICell, int KChunk) {
199-
LocCenteredPGrad(Tend, Pressure, Geopotential, SpecVol);
210+
parallelForOuter(
211+
{NEdgesAll}, KOKKOS_LAMBDA(int IEdge, const TeamMember &Team) {
212+
const int NChunks = computeNChunks(MinLyrEdgeBottom, MaxLyrEdgeTop, IEdge);
213+
parallelForInner(Team, NChunks, [=](const int KChunk) {
214+
LocCenteredPGrad(Tend, IEdge, KChunk, Pressure, Geopotential, SpecVol);
215+
});
200216
});
201217
}
202218
else if (PressureGradChoice == PressureGradType::HighOrder){
203-
parallelFor("pgrad-highorder", {NCellsAll, NChunks},
204-
KOKKOS_LAMBDA(int ICell, int KChunk) {
205-
LocHighOrderPGrad(Tend, Pressure, Geopotential, SpecVol);
206-
});
219+
parallelForOuter(
220+
{NEdgesAll}, KOKKOS_LAMBDA(int IEdge, const TeamMember &Team) {
221+
const int NChunks = computeNChunks(MinLyrEdgeBottom, MaxLyrEdgeTop, IEdge);
222+
parallelForInner(Team, NChunks, [=](const int KChunk) {
223+
LocHighOrderPGrad(Tend, IEdge, KChunk, Pressure, Geopotential, SpecVol);
224+
});
225+
});
207226
}
208227
```
209228
@@ -218,7 +237,7 @@ void PressureGrad::clear();
218237
## Verification and Testing
219238

220239
### Test: Spatial convergence to exact solution
221-
For a given analytical $v$, $h$, and $b$, the spatial convergence of the pressure gradient can be assessed by computing errors on progressively finer meshes.
240+
For a given analytical $v$, $h$, and $b$, the spatial convergence of the pressure gradient can be assessed by computing errors on progressively finer meshes.
222241

223242
### Test: Baroclinic gyre
224243
The baroclinic gyre test case will test the pressure gradient term in the full non-Boussinesq equations.

0 commit comments

Comments
 (0)