Terrain-following coordinates
Over hills the ground is not flat, so a regular box-shaped grid does not fit it. STEER uses a terrain-following mesh instead: the grid lines run parallel to the ground near the surface and become flat higher up. The grid is still regular in computational space, which keeps the solver simple and fast. An alternative in progress keeps a flat mesh and represents the ground by immersed forcing (Immersed terrain).
A uniform computational grid \((\xi, \eta, \zeta)\) is mapped to physical space \((x, y, z(\xi, \eta,
\zeta))\). Only the heights follow the ground; the horizontal coordinates are not distorted. The mapping code is
ERF’s, copied into extern_erf/ (Code from other projects).
Vertical levels
Over flat ground the node heights are the reference levels \(0 = z_{(0)} < z_{(1)} < \dots < z_{(n_z)}\). In
the formulas below \(z_k\) stands for \(z_{(k)}\); it is not the roughness length \(z_0\). They are set by
the mesh inputs:
Inputs |
Levels |
|---|---|
none (default) |
Uniform: \(z_k = k\,\Delta\zeta\), with \(\Delta\zeta = z_\mathrm{top}/n_z\). |
|
Geometric: \(z_k - z_{k-1} = \Delta z_0\,r^{k-1}\), with the ratio \(r\) chosen so that the top is at
|
|
Geometric with the given \(r\); the top is where the layers end. |
|
The \(n_z + 1\) heights listed in the file. |
Stretched levels put thin cells near the ground, where the wind changes fastest, and thick cells aloft.
Terrain-following mapping
Let \(h(x, y)\) be the ground height and \(z_\mathrm{top}\) the top of the domain. terrain.smoothing
selects one of ERF’s three mappings:
BTF (basic terrain following) shrinks every column linearly; the terrain is felt up to the top. STEER evaluates it as \(z = z_k + h\,(z_\mathrm{top} - z_k)/z_\mathrm{top}\), ERF’s formula rearranged so that no product feeds a sum: gcc fuses such a sum into a multiply-add differently in a vectorised loop and its scalar remainder, so with ERF’s form the node heights changed in the last bits with
mesh.max_grid_size.STF (smoothed terrain following, Klemp 2011) smooths the terrain imprint \(h_s\) level by level, so the coordinate surfaces become flat above the height \(z_H\). A smoothing pass that would make a layer thinner than the fraction \(\gamma_m\) (
terrain.gamma_m, 0.5) of its flat thickness is rejected, so STF never folds a cell.Sullivan decays the terrain imprint with the cube of the distance to the top.
The run stops if the ground reaches the top or a layer has zero or negative thickness.
terrain.type sets \(h\):
flat;agnesi: a Witch of Agnesi ridge or round hill;xyz: a point cloud, interpolated by inverse-distance weighting as in FastWindTerrain;erf_grid: ERF’s terrain file, interpolated as ERF does.
Metric terms
The mapping is described by the slopes and the stretching of the coordinate surfaces, computed from the node heights:
\(z_x, z_y\): slopes of a coordinate surface.
\(J\): the Jacobian, the cell volume divided by \(\Delta x\,\Delta y\,\Delta\zeta\). The area factors \(a_x, a_y\) of the x- and y-faces are \(z_\zeta\) on those faces.
Physical derivatives follow from the chain rule:
Ghost nodes outside the domain copy a domain node: the periodic image across a periodic side, or the edge node of the same row across any other side. Below the ground and above the top the heights are extrapolated (\(2z_{(0)} - z_{(1)}\) below the ground).
Equations in conservation form
In the new coordinates the divergence of any flux \(\mathbf G\) is
The vectors \(\mathbf A\) are the face areas per unit index area. The x- and y-faces are vertical; the z-faces follow the terrain. The flux of the velocity through a z-face is the contravariant velocity
and continuity becomes
The momentum, \(\theta\) and \(k\) equations take the same form, with the convective flux \(\mathbf u\,q\) and the diffusive flux \(\gamma\nabla q\) (or the stress \(\boldsymbol\tau\)) as \(\mathbf G\). The solution keeps the Cartesian velocity components \((u, v, w)\); only the fluxes are contravariant.
Two properties follow:
Free-stream preservation. The metrics satisfy the geometric conservation law: a uniform wind has zero discrete divergence on any terrain.
Flat-ground limit. With \(z_x = z_y = 0\), \(\Omega = w\) and the equations reduce to the Cartesian ones.
Mesh quality report
Every run prints a mesh-quality summary:
the smallest cell and layer thickness relative to flat ground;
the largest ground slope and coordinate-surface slope;
the largest cell aspect ratio;
the largest step of the ground between two neighbouring columns, in units of the thinner of their two first layers;
the lowest first-cell centre and the largest displacement of the top nodes;
the number of STF levels limited by \(\gamma_m\).
The ground step counts how many first layers the ground rises or falls from one node column to the next (in x or
in y). Above 64 the report prints a warning. That value is the largest of the runs of
Tests/Canonical_RANS/Rampart_2D that reached the steady verdict within a few thousand iterations (a 900 m cliff
with a 67° slope under 8 m first layers, 2570 iterations); the same cliff under 2 m layers (255) needed 15383
iterations. The number marks a mesh outside the range of that case. It is not
a limit and it does not predict the iteration count: at the same value a 31° cliff converges ten times faster than
the 67° one, the 67° butte of Tests/Canonical_RANS/Terrain_Shapes_3D settles at its probes at 209, and the
gentle ridge of Tests/Canonical_RANS/Aspect_Ratio_Hill_2D reaches the verdict with first layers of 0.05 m,
which the report flags too. Thicker
first layers or finer horizontal cells lower it. The layer is the mesh’s own first layer, not mesh.dz0: BTF
thins it by \(1 - h/z_{top}\), and STF (terrain.smoothing = 1) thins it further at a convex edge, down to
about terrain.gamma_m times the BTF value. The 67° butte of Terrain_Shapes_3D under 8 m layers has 33 with
BTF and 53 with STF (a first layer of 4 m at the crest’s edge). The value of 64 comes from BTF runs.
The ground step is the ratio of Mahrer’s (1984) consistency condition for terrain-following coordinates (the
ground should not change by more than a layer between neighbouring columns: a ratio of 1 at most). In the neutral
runs made here a larger ratio is a discretisation error, not a failure: on the 31° cliff of Rampart_2D the wind
at a ratio of 16 (200 m cells) is within 0.14 m/s of the wind at a ratio of 2 (25 m cells). A stratified run was
not made.
On restart, the node heights rebuilt from the inputs are checked against the checkpoint.