Skip to content

Commit c32bbb2

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

File tree

3 files changed

+101
-71
lines changed

3 files changed

+101
-71
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: 3 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
<!--
@@ -528,6 +529,7 @@ $$ (vh-momentum-reynolds1)
528529
529530
Here we have also moved the Reynolds' average through the spatial integrals given the properties of the averaging. Next we do a Reynolds' decomposition, this yields
530531
532+
(omega-v1-vh-momentum-reynolds2)=
531533
$$
532534
\frac{d}{dt} \int_A \int_{\tilde{z}_k^{\text{bot}}}^{\tilde{z}_k^{\text{top}}} \left< {\bf u} \right> \, d\tilde{z} \, dA
533535
& + \int_{\partial A} \left( \int_{\tilde{z}_k^{\text{bot}}}^{\tilde{z}^{\text{top}}} \left( \left< {\bf u} \right> \otimes \left< {\bf u} \right> + \left< {\bf u}^\prime \otimes {\bf u}^\prime \right> \right) \, d\tilde{z} \right) \cdot {\bf n}_\perp \, dl \\
@@ -726,6 +728,7 @@ In the tracer equation, we note that surface fluxes (e.g. latent heat fluxes) wi
726728
727729
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.
728730
731+
(omega-v1-momentum-eq)=
729732
$$
730733
\frac{\partial u_{e,k}}{\partial t}
731734
& + \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: 97 additions & 70 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 name "$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

@@ -33,32 +34,32 @@ The high order pressure gradient will be similar to [Adcroft et al. 2008](https:
3334
In later versions of Omega, the pressure gradient will need to be able to include tidal forcing in the geopotential term.
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.
37+
This requirement is satisfied by tidal forcing terms being included in the geopotential calculation in the `VertCoord` class.
3638

37-
### 2.5 Disired: Pressure gradient for barotropic mode
39+
### 2.5 Desired: Pressure gradient for barotropic mode
3840

3941
For split barotropic-baroclinic timestepping, the pressure gradient should provide the bottom pressure gradient tendency in the barotropic mode.
40-
This will be added in a future version when split time stepping is implemented.
41-
42-
### Desired:
42+
The details of the barotropic pressure gradient will be added in a future design document for split time stepping.
4343

4444
## 3 Algorithmic Formulation
4545
### 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,
46+
In the layered non-Boussinesq {ref}`momentum equation <omega-v1-momentum-eq>` solved in Omega, the pressure gradient tendency term for edge $e$ and layer $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:
4747

4848
$$
49-
T^p_{e,k} = -\left[ \alpha_{i,k} \right]_e \nabla p_{i,k} - \nabla \Phi_{i,k},
49+
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\}.
5050
$$
5151

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.
52+
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.
53+
In this equation, $\alpha_{i,k}$ specific volume, $p_{i,k}$ is the pressure, and $\Phi_{i,k}$ is the geopotential.
54+
These three quantities are evaluated at the mid-point of layer $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}.
5455
The discrete gradient operator at an edge is:
5556

5657
$$
5758
\nabla {(\cdot)} = \frac{1}{d_e} \sum_{i\in CE(e)} -n_{e,i} (\cdot)_i
5859
$$
5960

6061
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:
62+
The (cell-to-edge) horizontal averaging operator is:
6263

6364
$$
6465
[\cdot]_e = \frac{1}{2}\sum_{i\in CE(e)} (\cdot)_i
@@ -67,53 +68,69 @@ $$
6768
Therefore, the centered pressure gradient will be calculated as:
6869

6970
$$
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-
$$
71+
T^p_{e,k} = \frac{1}{d_e}\sum_{i\in CE(e)} n_{e,i} \Phi_{i,k} + \frac{2}{d_e\sum_{i \in CE(e)}\tilde{h}_{i,k}}\left(\sum_{i \in CE(e)} n_{e,i} \tilde{h}_{i,k}\alpha_{i,k}p_{i,k}\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),
72+
$$
73+
where $k-1/2$ and $k+1/2$ refer to the top and bottom of layer $k$, respectively.
74+
75+
76+
### 3.2 High-order Pressure Gradient
77+
The high order pressure gradient will be based on the {ref}`full volume integral form <omega-v1-vh-momentum-reynolds2>` of the geopotential and pressure terms:
78+
$$
79+
T^p &= - \int_A \int_{\tilde{z}_k^{\text{bot}}}^{\tilde{z}_k^{\text{top}}} \rho_0 \, \left( \nabla \left<\Phi\right> \right) \, d\tilde{z} \, dA \\
80+
& - \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 \\
81+
& - \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 \\
82+
& + \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.
83+
$$
84+
To obtain the expression that will be used, we neglect the turblent correlations and drop the Reynold's average notation for single variables:
85+
$$
86+
T^p &= - \int_A \int_{\tilde{z}_k^{\text{bot}}}^{\tilde{z}_k^{\text{top}}} \rho_0 \, \left( \nabla \Phi \right) \, d\tilde{z} \, dA \\
87+
& - \int_{\partial A} \left( \int_{\tilde{z}_k^{\text{bot}}}^{\tilde{z}_k^{\text{top}}} \rho_0 \left(\alpha p \right) \, d\tilde{z} \right) dl \\
88+
& - \int_A \rho_0 \left[ \alpha \left<p \nabla \tilde{z}_k^{\text{top}} \right> \right]_{\tilde{z} = \tilde{z}_k^{\text{top}}} \, dA \\
89+
& + \int_A \rho_0 \left[ \alpha \left<p \nabla \tilde{z}_k^{\text{bot}} \right> \right]_{\tilde{z} = \tilde{z}_k^{\text{bot}}} \, dA.
90+
$$
91+
These volume and area integrals will be computed using quadrature to account for the variablity of $\alpha$ with the recontructed values of temperature, salinity, and pressure atthe quadrature points.
92+
The complete details for the high-order pressure gradient will be the subject of a future design document.
93+
94+
%### 3.3 Barotropic Pressure Gradient
95+
%
96+
%When split baroclinic-barotropic time stepping is implemented in the future, the barotropic pressure gradient will be calculated by the pressure gradient class.
97+
%The barotropic pressure gradient is found by depth integrating the pressure gradient.
98+
%The pressure is
99+
%
100+
%$$
101+
%p(z) = p_b - g \int^z_{-h} \rho dz^\prime,
102+
%$$
103+
%
104+
%where $p_b$ is the bottom pressure.
105+
%The bottom pressure is the sum of the atmospheric surface pressure, $p_s$, and the pressure contribution of the water column:
106+
%
107+
%$$
108+
%p(z) &= p_s + g\int_{-h}^\eta \rho dz - g \int^z_{-h} \rho dz^\prime, \\
109+
% &= p_s + g\rho_0\widetilde{H} - g \int^z_{-h} \rho dz^\prime,
110+
%$$
111+
%
112+
%where the total water column pseudo height is expressed by
113+
%
114+
%$$
115+
%\widetilde{H} = \int_{-h}^\eta \frac{\rho}{\rho_0} dz.
116+
%$$
117+
%
118+
%$\widetilde{H}$ is the prognositc variable in the barotropic continuity equation.
119+
%The vertical integral of the pressure gradient is
120+
%
121+
%$$
122+
%\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, \\
123+
% &= \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,
124+
%$$
125+
%
126+
%where the height of the water column is represented by $H$.
127+
%The $1/\rho_0\widetilde{H}$ factor comes vertically integrating the material derivative and expressing the resulting barotropic momentum equation in non-conservative form.
128+
%
129+
%Therefore, the barotorpic pressure gradient term is discretized as:
130+
%
131+
%$$
132+
%\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
133+
%$$
117134

118135
## 4 Design
119136

@@ -126,10 +143,11 @@ class PressureGrad{
126143
private:
127144
std::unique_ptr<PressureGrad> OmegaPressureGrad;
128145
PressureGradCentered CenteredPGrad;
129-
PressureGradHighOrder HighOrderPGrad; // To be implemented later
146+
PressureGradHighOrder HighOrderPGrad1; // To be implemented later
147+
PressureGradHighOrder HighOrderPGrad2; // Multiple high order options are likely in the future
130148
PressureGradType PressureGradChoice;
131149
I4 NVertLevels;
132-
I4 NChuncks;
150+
I4 NChunks;
133151
Array2DI4 CellsOnEdge;
134152
Array1DReal DvEdge;
135153
Array1DReal EdgeSignOnCell;
@@ -144,7 +162,8 @@ An `enum class` will be used to specify options for the pressure gradient used f
144162
```c++
145163
enum class PressureGradType{
146164
Centered,
147-
HighOrder
165+
HighOrder1,
166+
HighOrder2
148167
}
149168
```
150169
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 +183,12 @@ class PressureGrad{
164183

165184
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.
166185
```c++
167-
PressureGrad::PressureGrad(const HorzMesh *Mesh, int NVertLevels, Config *Options);
186+
PressureGrad::PressureGrad(const HorzMesh *Mesh, const VertCoord *VCoord, Config *Options);
168187
```
169188
170189
#### 4.2.2 Initialization
171190
172-
The init method will create the pressure gradient and return an error code:
191+
The init method will create the default pressure gradient and return an error code:
173192
```c++
174193
int PressureGrad::init();
175194
```
@@ -193,17 +212,25 @@ void PressureGrad::computePressureGrad(const Array2DReal &Tend,
193212
const Array2DReal &SpecVol) {
194213
OMEGA_SCOPE(LocCenteredPGrad, CenteredPGrad)
195214
OMEGA_SCOPE(LocHighOrderPGrad, HighOrderPGrad)
215+
const Array1DI4 &MinLyrEdgeBot = VCoord->MinLayerEdgeBot;
216+
const Array1DI4 &MaxLyrEdgeTop = VCoord->MaxLayerEdgeTop;
196217
if (PressureGradChoice == PressureGradType::Centered){
197-
parallelFor("pgrad-centered", {NCellsAll, NChunks},
198-
KOKKOS_LAMBDA(int ICell, int KChunk) {
199-
LocCenteredPGrad(Tend, Pressure, Geopotential, SpecVol);
218+
parallelForOuter(
219+
{NEdgesAll}, KOKKOS_LAMBDA(int IEdge, const TeamMember &Team) {
220+
const int NChunks = computeNChunks(MinLyrEdgeBottom, MaxLyrEdgeTop, IEdge);
221+
parallelForInner(Team, NChunks, [=](const int KChunk) {
222+
LocCenteredPGrad(Tend, IEdge, KChunk, Pressure, Geopotential, SpecVol);
223+
});
200224
});
201225
}
202226
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-
});
227+
parallelForOuter(
228+
{NEdgesAll}, KOKKOS_LAMBDA(int IEdge, const TeamMember &Team) {
229+
const int NChunks = computeNChunks(MinLyrEdgeBottom, MaxLyrEdgeTop, IEdge);
230+
parallelForInner(Team, NChunks, [=](const int KChunk) {
231+
LocHighOrderPGrad(Tend, IEdge, KChunk, Pressure, Geopotential, SpecVol);
232+
});
233+
});
207234
}
208235
```
209236
@@ -218,7 +245,7 @@ void PressureGrad::clear();
218245
## Verification and Testing
219246

220247
### 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.
248+
For given analytical functions of $\alpha$, $h$, and $z$, the spatial convergence of the pressure gradient can be assessed by computing errors on progressively finer meshes.
222249

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

0 commit comments

Comments
 (0)