forked from E3SM-Project/E3SM
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #48 from sbrus89/sbrus89/omega/mesh-class
Add Mesh class
- Loading branch information
Showing
10 changed files
with
1,706 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
(omega-dev-horz-mesh)= | ||
|
||
## Horizontal Mesh | ||
|
||
The OMEGA horizontal mesh uses the [MPAS Mesh | ||
Specification](https://mpas-dev.github.io/files/documents/MPAS-MeshSpec.pdf). | ||
A mesh object is created by the `init` method, which assumes that `Decomp` has | ||
already been initialized. | ||
```c++ | ||
Err = OMEGA::Decomp::init(); | ||
Err = OMEGA::HorzMesh::init(); | ||
``` | ||
The constructor replicates the subdomain mesh cell/edge/vertex counts and | ||
connectivity information from Decomp so this information can be passed among the | ||
computational routines, alongside the other local mesh information. It then | ||
creates several parallel I/O decompositions and reads in the remaining subdomain | ||
mesh information. Finally, any mesh information needed on the device is copied | ||
from the host to a device YAKL array. Arrays such as the coordinate variables, | ||
which are not involved in tendency calculations, are not transferred to the | ||
device. These tasks are organized into several private methods. Eventually, | ||
dependent mesh variables will be computed from the minimum set of required mesh | ||
information. | ||
|
||
After initialization, the default mesh object can be retrieved via: | ||
``` | ||
OMEGA::HorzMesh *HMesh = OMEGA::HorzMesh::getDefault(); | ||
``` | ||
Once this retrieval has been performed, public member variables can be accessed | ||
using: | ||
``` | ||
OMEGA::I4 NCellsOwned = HMesh->NCellsOwned; | ||
OMEGA::Array1DR8 AreaCell = HMesh->AreaCell; | ||
``` | ||
|
||
The HorzMesh is meant to be a container that allows the mesh information to be | ||
passed to the PDE solver routines: | ||
``` | ||
void computeFluxTendency(OMEGA::HorzMesh *HMesh, ...) { | ||
yakl::c::parallel_for(yakl::c::Bounds<2>(HMesh->NCellsOwned,HMesh->MaxEdges), | ||
YAKL_LAMBDA (int Cell, int Edge) { | ||
if (Edge < HMesh->NEdgesOnCell(Cell)) { | ||
Var(Cell) = Var(Cell) + Flux(Cell,Edge); | ||
} | ||
} | ||
``` | ||
|
||
For member variables that are host arrays, variable names are appended with an | ||
`H`. Array variable names not ending in `H` are device arrays. The copy from | ||
host to device array is performed in the constructor via: | ||
```c++ | ||
AreaCell = AreaCellH.createDeviceCopy(); | ||
``` | ||
|
||
The device arrays are deallocated by the `HorzMesh::clear()` method, which is | ||
necessary before calling `yakl::finalize`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
(omega-user-horz-mesh)= | ||
|
||
## Horizontal Mesh | ||
|
||
OMEGA uses the MPAS mesh specification found | ||
[here](https://mpas-dev.github.io/files/documents/MPAS-MeshSpec.pdf). The names | ||
of the mesh variables have been retained, with the caveat that they now begin | ||
with a capital letter. | ||
|
||
The Mesh class is meant to be a container for all mesh variables local to a | ||
decomposed sub-domain that can be easily passed among the dycore routines. It | ||
depends on a given [Decomp](#omega-user-decomp) and reproduces the | ||
cell/edge/vertex totals and connectivity information from that class. The Mesh | ||
class also creates parallel I/O decompositions that are used to read in the | ||
additional mesh variables, which are not required for Decomp. | ||
|
||
Currently, the Mesh class reads in all variables from the MPAS mesh | ||
specification except those read by [Decomp](#omega-dev-decomp). | ||
This includes the following variables: | ||
|
||
| Variable Name | Description | Units | | ||
| ------------- | ----------- | ----- | | ||
| XCell, YCell, ZCell | Cartesian coordinates of cell centers | m | | ||
| XEdge, YEdge, ZEdge | Cartesian coordinates of edge centers | m | | ||
| XVertex, YVertex, ZVertex | Cartesian coordinates of vertices | m | | ||
| BottomDepth | Depth of the bottom of the ocean at cell centers | m | | ||
| FCell, FEdge, FVertex | Coriolis parameter at cell centers/edges/vertices | radians/s | | ||
| LonCell, LatCell | Longitude/latitude coordinates of cell centers | radians | | ||
| LonEdge, LatEdge | Longitude/latitude coordinates of edge centers | radians | | ||
| LonVertex, LatVertex | Longitude/latitude coordinates of vertices | radians | | ||
| AreaCell | Area of each cell | m^2 | | ||
| AreaTriangle | Area of each triangle in the dual grid | m^2 | | ||
| KiteAreasOnVertex | Area of the portions of each dual cell that are part of each cellsOnVertex | m^2 | | ||
| DvEdge | Length of each edge, computed as the distance between verticesOnEdge | m | | ||
| DcEdge | Length of each edge, computed as the distance between CellsOnEdge | m | | ||
| AngleEdge | Angle the edge normal makes with local eastward direction | radians | | ||
| MeshDensity | Value of density function used to generate a particular mesh at cell centers | - | | ||
| WeightsOnEdge | Reconstruction weights associated with each of the edgesOnEdge | - | | ||
|
||
In the future, the Mesh class will optionally compute the mesh variables that | ||
are dependent on the Cartesian mesh coordinates internally. | ||
This includes the various areas, lengths, angles, and weights needed for the | ||
TRiSK discretization (e.g. rows 5-11 in the table above). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.