Spacing laws
A spacing law places shore.volume.spacing (pure numpy); Spacing1D is the object every block edge carries.
The laws
Write
uniform
tanh (one-sided Roberts)
Cells cluster toward the start of the interval:
tanh2 (two-sided Roberts)
Cells cluster toward both ends:
With cluster_at set to an interior point tanh segments, cluster_at on an end point reduces to one-sided clustering at that end.
geometric
Wall-normal only: step sizes
pinned
The first and last intervals are fixed to given lengths and the interior uniform, tanh or tanh2) on
This is the construction behind C1 spacing across block seams: the cubed-sphere equator pins each meridian's end intervals to the cap edge (k=0 construction). ParameterError is raised for
from shore.mesh.spacing import Spacing1D
sp = Spacing1D(law="pinned", first_step=0.05, last_step=0.10, interior="tanh", beta=4.0)
x = sp.build(8, start=0.0, stop=1.0) # x[1] - x[0] == 0.05, x[-1] - x[-2] == 0.10Which law where
| Direction | shore mesh flag | Laws | Default |
|---|---|---|---|
| Surface i (meridian, cubed sphere and O-grid) | --surface-i-spacing, --surface-i-beta | uniform, tanh, tanh2 | uniform, 3.0 |
| Surface j (cap edge / longitude) | --surface-j-spacing, --surface-j-beta | uniform, tanh2 | uniform, 3.0 |
| Wall-normal k | --volume-k-spacing, --volume-k-beta, --volume-k-thickness | geometric, tanh, tanh2 | geometric, 3.0 |
| Channel blocks (OH, CH) | --k-law-channel, --k-beta-channel | uniform, tanh, tanh2 | uniform, 3.0 |
Surface i
The meridian runs from the south cap seam (i = 0) to the north cap seam (i = ni − 1) in colatitude. tanh clusters toward the south seam only; tanh2 toward both seams. On the cubed sphere the end intervals are pinned to the cap edge when the steps are compatible, and the law shapes the interior.
Surface j
On the cubed sphere the j law sets the distribution along the cap edges on tanh2 clusters toward the cap corners (the 3-block junctions). tanh is not offered: the law must be symmetric across the four quadrants. (--j-cluster-lon is deprecated and ignored.)
Wall-normal k
k = 0 is the wall, k = nk − 1 the outer layer.
| Law | Fine cells | Fixes | Needs |
|---|---|---|---|
geometric | at the wall | the first cell | --ds (0.001), --growth (1.15) |
tanh | at the wall | the total thickness | --volume-k-thickness |
tanh2 | at the wall and the outer layer | the total thickness | --volume-k-thickness |
With tanh/tanh2 the first cell follows from nk, the thickness and --ds and --growth are ignored. Choose geometric when the first cell (the tanh when the outer distance must be fixed. All blocks of a mesh share one k schedule (Marching). Recipes: Set the wall spacing.
Per-edge spacing
By default a block applies one law per axis to its four parallel edges. Each of the twelve edges of a HexBlock can instead carry its own Spacing1D. The block stamps the same instance on the four edges of an axis, so an override is detected by identity (edge.spacing is not block._default_spacing_*).
When the four parallel edges of axis i disagree, the primitives blend them by transfinite interpolation over the transverse face:
| Where | i / j | k |
|---|---|---|
BoxMesh (edge_pins=) | TFI | TFI |
AnnularCylinderMesh (edge_pins=) | TFI on r; on θ only for a partial sector | TFI |
FlatCapsCylinder | no (the radial and arc directions are fixed by the construction) | no |
| O-grid | no (j is periodic) | k-edge override read by Mesh.march |
| Cubed sphere | no (the seam pin is geometric, not user-driven) | k-edge override read by Mesh.march, one schedule for all 6 blocks |
edge_pins is a Python-API feature; the CLI does not expose it. For existing grids, Project.redistribute resamples the lines along one edge with any law and carries the change through connected faces (ADR 0041). Worked examples: Per-edge spacing.
Choosing
| Effect | |
|---|---|
| 1–2 | mild clustering |
| 3 (default) | moderate |
| 4–5 | strong: the cells at the coarse end grow large |
| > 5 | usually too strong: coarse cells degenerate |
Check the result with shore check and the quality metrics: a sharp drop in the scaled Jacobian where fine and coarse cells meet means
See also
shore mesh: every spacing flag- k=0 construction: how the i and j laws meet at the cap seam
- Marching: the step schedule in use
shore.volume.spacing,Spacing1D