Grid quality
SHORE measures grids with a small, fixed set of metrics in shore.quality. They are frozen: the acceptance specs under tests/spec/ state their thresholds in these metrics, so the definitions cannot change without a deliberate re-freeze (ADR 0005). Every function takes one block's node array (ni, nj, nk, 3) and assumes the marcher's orientation: a valid cell is right-handed, $(\mathbf{e}_i \times \mathbf{e}_j) \cdot \mathbf{e}_k
0$, with
pointing away from the wall.
The metrics
Scaled Jacobian
scaled_jacobian(nodes), shape (ni-1, nj-1, nk-1): per cell, the minimum over its 8 corners of
with


Wall orthogonality
k_orthogonality_deg(nodes, k=0), shape (ni, nj): the angle between the k-segment from layer
The one-sided tangents bias it on block-edge nodes, where the true surface normal spans the seam: unsmoothed normal extrusion, exactly orthogonal in the interior, scored 9.4° mean / 13.9° max on a coarse cubed sphere's edge nodes. k_angle_deg(nodes, directions, k=0) measures the same angle against given directions instead; with the body's surface normals at the wall it is unbiased, and it is what the marching specs use (taken orientation-free,
Wall-normal spacing and growth
k_spacing(nodes), shape(ni, nj, nk-1):along every k-line. Its first layer is the first cell height, to compare with the requested ds.k_growth(nodes), shape(ni, nj, nk-2): the ratio of consecutive k-segments. A geometric law withgrowth = 1.15reads 1.15.
Aspect ratio
aspect_ratio(nodes), shape (ni-1, nj-1, nk-1): longest over shortest of each cell's 12 edges; infinite for a cell with a zero-length edge. Boundary layers are stretched by design (wall cells of
Summary
summary(blocks) reduces a block list (objects with .nodes, or arrays) to extremes:
| Key | Value |
|---|---|
scaled_jacobian_min | minimum |
folded_cells | cells with |
wall_orthogonality_max_deg, wall_orthogonality_mean_deg | k_orthogonality_deg at |
aspect_ratio_max | maximum aspect ratio |
k_growth_max | maximum k-growth (NaN when no block has nk > 2) |
An example
The same cubed-sphere grid, marched with the default algebraic scheme and with the hyperbolic scheme:
import math
import warnings
from shore import quality
from shore.exceptions import MarchingError
from shore.project import Project
from shore.shapes import sphere
warnings.simplefilter("ignore", UserWarning) # the cap/equator C1 fallback notice
sphere(radius=1.0, subdivisions=4).export("ball.stl")
for scheme in ("algebraic", "hyperbolic"):
p = Project()
p.load_geometry("ball.stl")
p.build_topology("cubed_sphere", nk=21, ds=0.005, growth=1.15, ni=33, nj=64,
theta_cap=math.radians(9)) # the default before ADR 0054
try:
p.march(march_scheme=scheme)
except MarchingError as err:
print(f"{scheme:10s} refused: {str(err).split(' Cubed')[0]}")
continue
s = quality.summary(p.mesh.blocks)
print(f"{scheme:10s} min SJ {s['scaled_jacobian_min']:.3f} folded {s['folded_cells']}"
f" wall angle mean/max {s['wall_orthogonality_mean_deg']:.2f}"
f"/{s['wall_orthogonality_max_deg']:.2f}")algebraic refused: Folded cell (scaled Jacobian -0.089) in cap_north at layer k=19, cell (15, 15), 4 folded in the layer.
hyperbolic min SJ 0.488 folded 0 wall angle mean/max 0.40/4.22With a 9° cap (the default before ADR 0054; now 30°) the algebraic march folds the corner cells of the polar caps (the 3-block junctions) in its outer layers. Since ADR 0052 the cubed-sphere march judges every new cell by its scaled Jacobian, corner cells included, and refuses the grid; before, its one-corner guard left those cells out and returned 16 folded cells here. A larger cap (theta_cap 30° or more) or the hyperbolic scheme marches this body cleanly. The O-grid and C-grid marches run the same check (ADR 0056); grids that are not marched (primitives, blockings, collars) are not guarded this way: run summary on every grid you hand to a solver.
What the acceptance specs require
Thresholds are set per case, before implementation, from measured references. They are not universal targets, but they show what the algorithms are held to (measured values in brackets where the ADR gives them):
| Grid (spec) | Required |
|---|---|
Hyperbolic march, cubed sphere 60 × 60 × 10 (test_hyperbolic_marching.py, H2) | min |
| Hyperbolic march, coarse sphere (H1) | wall-angle mean ≤ 1.15 × pure normal extrusion (3.49°), max ≤ 10°; first cell within 5 % of ds |
| Hyperbolic march, concave prism (H3) | 15 layers, 0 folded cells |
Collar block (test_collar.py) | 0 folded cells, min |
Collar volume at corners (test_collar_volume.py) | min |
Blocking premesh (test_blocking.py) | a split box: |
O-grid insertion (test_ogrid.py) | |
Orthogonalize and wall layer, sphere and wing blockings (test_orthogonalize.py, test_wall_layer.py) | min |
Phase-7 wing–body, 90 blocks (test_wing_body.py) | min |
The wing–body values are honest for an interactive blocking around a wing–body junction: sharp edges (trailing edge, tip) keep wall angles near 45°, and the minimum
shore check
shore check FILE.geo [--warn-threshold 1e-6] validates one .geo block layer by layer, and exits with code 1 if any layer has a non-positive Jacobian. It uses the marcher's guard, not the frozen metrics: the dimensional triple product --warn-threshold is an absolute cell volume, and a fold at another corner can pass. Mesh.check() does the same per block in memory. For the corner-wise metrics, call shore.quality on the blocks (Check grid quality).
See also
- ADR 0005 (the frozen metrics and the re-freeze of wall orthogonality), ADR 0051
- API:
shore.quality,summary,shore.volume.jacobian - Check grid quality,
shore check, A sphere, end to end - Marching schemes, Block model