Skip to content

Spacing laws ​

A spacing law places n nodes on an interval. SHORE uses the same small set of laws for every direction: the surface i and j directions of the body-fitted topologies, the wall-normal step schedule, the primitives, the channel blocks of the hybrids, and edge redistribution. The 1D kernels are in shore.volume.spacing (pure numpy); Spacing1D is the object every block edge carries.

Node distributions of uniform, tanh, tanh2 and geometric on one axis, with the cell size along the axis below.Node distributions of uniform, tanh, tanh2 and geometric on one axis, with the cell size along the axis below.
Node distributions of uniform, tanh, tanh2 and geometric on one axis, with the cell size along the axis below.

The laws ​

Write τ=i/(n−1)∈[0,1] and map t(τ)∈[0,1] onto [x0,x1] as x=x0+(x1−x0)t.

uniform ​

t=τ. Equal cells; the default for the surface directions and the primitives.

tanh (one-sided Roberts) ​

Cells cluster toward the start of the interval:

t(τ)=1−tanh⁡(β(1−τ))tanh⁡β.

β>0 sets the strength (default 3.0): about 1 is mild, 5 is aggressive.

tanh2 (two-sided Roberts) ​

Cells cluster toward both ends:

t(τ)=12(1+tanh⁡(β(τ−12))tanh⁡(β/2)).

With cluster_at set to an interior point c, the law instead builds one dense band at c: two one-sided tanh segments, [x0,c] dense at its right end and [c,x1] dense at its left end, with the nodes split in proportion to the two lengths (at least 2 each). A cluster_at on an end point reduces to one-sided clustering at that end.

geometric ​

Wall-normal only: step sizes Δsk=Δs0rk, k=0…n−2. The total thickness follows from Δs0, r and n; it is not prescribed.

pinned ​

The first and last intervals are fixed to given lengths and the interior n−2 nodes follow an interior law (uniform, tanh or tanh2) on [x0+Δsfirst, x1−Δslast]:

x1−x0=Δsfirst,xn−1−xn−2=Δslast.

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 n<2, non-positive steps, or two pins that do not fit in the interval.

python
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.10

Which law where ​

Directionshore mesh flagLawsDefault
Surface i (meridian, cubed sphere and O-grid)--surface-i-spacing, --surface-i-betauniform, tanh, tanh2uniform, 3.0
Surface j (cap edge / longitude)--surface-j-spacing, --surface-j-betauniform, tanh2uniform, 3.0
Wall-normal k--volume-k-spacing, --volume-k-beta, --volume-k-thicknessgeometric, tanh, tanh2geometric, 3.0
Channel blocks (OH, CH)--k-law-channel, --k-beta-channeluniform, tanh, tanh2uniform, 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 [−tan⁡θcap, +tan⁡θcap], and the equator inherits it through the seam. 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.

LawFine cellsFixesNeeds
geometricat the wallthe first cell--ds (0.001), --growth (1.15)
tanhat the wallthe total thickness--volume-k-thickness
tanh2at the wall and the outer layerthe 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 y+ target) matters most and 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:

t(i,j,k)=(1−η)(1−ζ)t00(i)+η(1−ζ)t10(i)+(1−η)ζt01(i)+ηζt11(i),

η=j/(nj−1), ζ=k/(nk−1). With four equal edges this is the plain 1D distribution.

Wherei / jk
BoxMesh (edge_pins=)TFITFI
AnnularCylinderMesh (edge_pins=)TFI on r; on θ only for a partial sectorTFI
FlatCapsCylinderno (the radial and arc directions are fixed by the construction)no
O-gridno (j is periodic)k-edge override read by Mesh.march
Cubed sphereno (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–2mild clustering
3 (default)moderate
4–5strong: the cells at the coarse end grow large
> 5usually 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 β is too large.

See also ​

Released under the MIT License.