Skip to content

shore primitive

Build a parametric structured-grid primitive: a Cartesian box, an annular cylinder, or a 5-block flat-caps cylinder.

shore primitive is a sub-app with three commands:

shore primitive box [OPTIONS]
shore primitive annulus [OPTIONS]
shore primitive flat-caps [OPTIONS]

Every command accepts the same -c / --config flag for TOML-driven invocation and follows the same precedence rule as shore mesh: explicit CLI flag → config-file value → built-in default.

See Primitives for the conceptual overview and use cases.

shore primitive box

Cartesian axis-aligned box, single block.

Synopsis

shore primitive box [OPTIONS]

Options

OptionDefaultDescription
-c / --config PATHTOML primitive config (type = "box")
-o / --output PATHbox.geoOutput .geo file
--min FLOAT FLOAT FLOAT0 0 0Minimum corner of the box
--max FLOAT FLOAT FLOAT1 1 1Maximum corner; each component must strictly exceed the corresponding --min component
--ni INTEGER40Node count along i (x-axis)
--nj INTEGER40Node count along j (y-axis)
--nk INTEGER30Node count along k (z-axis)
--i-spacing TEXTuniformSpacing along i: uniform / tanh / tanh2
--j-spacing TEXTuniformSpacing along j
--k-spacing TEXTuniformSpacing along k
--i-beta FLOAT3.0Clustering strength for tanh / tanh2 along i
--j-beta FLOAT3.0Clustering strength for tanh / tanh2 along j
--k-beta FLOAT3.0Clustering strength for tanh / tanh2 along k

Examples

bash
# Cubic background, uniform spacing
shore primitive box --min 0 0 0 --max 10 10 10 --ni 40 --nj 40 --nk 40 -o bg.geo

# Boundary-layer-style cluster near the inflow plane
shore primitive box --min 0 0 0 --max 10 5 3 \
                    --i-spacing tanh --i-beta 4.0 \
                    --ni 80 --nj 30 --nk 20 -o channel.geo

shore primitive annulus

Annular cylinder, optionally a partial sector. Single block.

Synopsis

shore primitive annulus [OPTIONS]

Options

OptionDefaultDescription
-c / --config PATHTOML primitive config (type = "annulus")
-o / --output PATHannulus.geoOutput .geo file
--r-in FLOAT0.5Inner radius
--r-out FLOAT2.0Outer radius (must exceed --r-in)
--z0 FLOAT0.0Axial start along --axis
--z1 FLOAT1.0Axial end along --axis
--axis TEXTzCylinder axis: x / y / z or "vx vy vz"
--center FLOAT FLOAT FLOAT0 0 0World-space anchor of the axis
--theta-start FLOAT0.0Sector start in radians
--theta-end FLOATSector end in radians; omit for a full annulus
--ni INTEGER20Radial node count
--nj INTEGER64Azimuthal node count
--nk INTEGER30Axial node count
--i-spacing / --j-spacing / --k-spacinguniformPer-axis spacing law
--i-beta / --j-beta / --k-beta3.0Per-axis clustering strength

Full annulus → uniform j-spacing

For a full annulus the azimuthal direction is periodic and the distribution must be uniform. --j-spacing tanh / tanh2 is rejected; use a partial sector instead.

Examples

bash
# Full annulus around a near-body sphere mesh
shore primitive annulus --r-in 1.5 --r-out 5.0 --z0 -2 --z1 2 \
                        --ni 30 --nj 64 --nk 40 -o buffer.geo

# Half-pipe sector with non-uniform azimuthal spacing
shore primitive annulus --r-in 1.5 --r-out 5.0 --z0 -2 --z1 2 \
                        --theta-start 0 --theta-end 3.14159 \
                        --j-spacing tanh2 --j-beta 3.0 \
                        --ni 24 --nj 32 --nk 40 -o halfpipe.geo

# Cylinder along x-axis instead of z
shore primitive annulus --axis x --r-in 0.5 --r-out 2 --z0 0 --z1 4 \
                        -o axis_x.geo

shore primitive flat-caps

5-block flat-caps cylinder. The disk interior at every axial slice is decomposed into a central square + 4 trapezoidal sub-blocks. Writes five .geo files.

Synopsis

shore primitive flat-caps [OPTIONS]

Options

OptionDefaultDescription
-c / --config PATHTOML primitive config (type = "flat_caps")
-o / --output PATHflat_capsOutput stem; writes <stem>_center.geo + <stem>_sub_e.geo / _sub_n.geo / _sub_w.geo / _sub_s.geo
--r-out FLOAT2.0Outer radius
--z0 / --z1 FLOAT0 / 1Axial extent along --axis
--axis TEXTzCylinder axis: x / y / z or "vx vy vz"
--center FLOAT FLOAT FLOAT0 0 0World-space anchor of the axis
--inner-frac FLOAT0.5Central square corner radius / outer radius. Must lie in (0,1).
--ni INTEGER20Radial node count for each sub-block (square edge → outer circle)
--nc INTEGER20Side node count of the central square (shared between center and sub-blocks)
--nk INTEGER30Axial node count
--i-spacing / --c-spacing / --k-spacinguniformPer-axis spacing law
--i-beta / --c-beta / --k-beta3.0Per-axis clustering strength

The --c-spacing controls the distribution along the central-square sides and the matching arc on the outer circle (it is shared between the center block and every sub-block to guarantee SHARED conformity at every seam).

The sub-block radial direction has its first cell pinned per-j to the central square's local tangential cell at column j, giving aspect-ratio-1 cells at the central / sub-block seam regardless of --c-spacing. When the pin would produce a non-monotone distribution (extreme inner_frac or mismatched ni / nc), SHORE falls back to the unpinned distribution and emits a UserWarning.

Examples

bash
# 5-block conforming cylindrical background
shore primitive flat-caps --r-out 5.0 --z0 -2 --z1 2 \
                          --ni 24 --nc 32 --nk 40 -o bg

# x-aligned, with axial clustering at the inflow plane
shore primitive flat-caps --axis x --r-out 5.0 --z0 0 --z1 10 \
                          --k-spacing tanh --k-beta 4.0 \
                          --ni 24 --nc 32 --nk 50 -o tunnel

shore primitive h-grid-rect

Rectangular-duct H-grid: a single hex block filling a Cartesian box, default BCs streamwise=FREE / cross-section=WALL. Use case: prismatic ducts, internal flow without an internal body. See H-grid topology for the conceptual overview.

Synopsis

shore primitive h-grid-rect [OPTIONS]

Options

OptionDefaultDescription
-o / --output PATHh_grid_rect.geoOutput .geo file
--length FLOAT1.0Duct length along the streamwise axis
--width FLOAT0.1Cross-section width (along block j)
--height FLOAT0.1Cross-section height (along block k)
--ni INTEGER40Streamwise node count
--nj INTEGER20Cross-section width node count
--nk INTEGER20Cross-section height node count
--streamwise-axis TEXTxWorld axis the duct is aligned with: x / y / z
--i-spacing / --j-spacing / --k-spacinguniformPer-axis spacing law (uniform / tanh / tanh2)
--i-beta / --j-beta / --k-beta3.0Clustering strength for tanh / tanh2
--adjacency-json PATHAlso write a .adjacency.json sidecar (single block, no SHARED)

Examples

bash
# 1m-long square duct, BL clustering on both cross-section axes:
shore primitive h-grid-rect \
    --length 1.0 --width 0.1 --height 0.2 \
    --ni 80 --nj 20 --nk 24 \
    --streamwise-axis x \
    --j-spacing tanh2 --j-beta 4.0 \
    --k-spacing tanh2 --k-beta 4.0 \
    -o duct

shore primitive h-grid-tube

Circular-bore H-grid: a single hex block with a 2D polar cross-section (j-periodic circumferential + radial), default BCs streamwise=FREE / k_lo=k_hi=WALL. Use case: straight cylindrical ducts, simple SRM chambers. See H-grid topology — circular tube for the polar singular axis caveat.

Synopsis

shore primitive h-grid-tube [OPTIONS]

Options

OptionDefaultDescription
-o / --output PATHh_grid_tube.geoOutput .geo file
--length FLOAT1.0Tube length along the streamwise axis
--radius FLOAT0.05Outer-wall radius
--n-axial INTEGER40Streamwise node count (block i)
--n-circ INTEGER32Circumferential node count (block j, periodic)
--n-radial INTEGER8Radial node count (block k: 0 = centerline, last = wall)
--streamwise-axis TEXTxWorld axis the tube is aligned with
--i-spacing / --k-spacinguniformStreamwise / radial spacing law (uniform / tanh / tanh2)
--i-beta / --k-beta3.0Clustering strength
--adjacency-json PATHAlso write a .adjacency.json sidecar (single block, j-periodic)

The circumferential direction (j) is uniform by construction — clustering on a periodic axis is unsupported.

Examples

bash
# 0.5m-long tube, radial clustering toward the centerline:
shore primitive h-grid-tube \
    --length 0.5 --radius 0.05 \
    --n-axial 60 --n-circ 32 --n-radial 10 \
    --streamwise-axis x \
    --k-spacing tanh --k-beta 3.0 \
    -o tube

TOML schema (primitive configs)

Primitive configs are identified by kind = "primitive" at the top level. Mesh and primitive configs share version = 1 but otherwise have disjoint schemas — feeding a mesh config to shore primitive (or vice versa) is rejected with a clear error.

toml
version = 1
kind    = "primitive"

[geometry]
type   = "box"            # box | annulus | flat_caps

# Box-only:
vmin = [0.0, 0.0, 0.0]
vmax = [10.0, 5.0, 3.0]

# Annulus / flat_caps shared:
# axis   = "z"
# center = [0.0, 0.0, 0.0]
# z0     = 0.0
# z1     = 4.0

# Annulus-only:
# r_in        = 0.5
# r_out       = 2.0
# theta_start = 0.0
# theta_end   = 3.14159   # omit for full annulus

# Flat-caps-only:
# r_out, z0, z1 from above
# inner_frac = 0.5            # central square corner radius / r_out (in (0, 1))

[grid]
ni = 40
nj = 40                   # for flat_caps this maps to --nc
nk = 30

[spacing]
i_law = "uniform"
j_law = "uniform"         # for flat_caps this maps to --c-spacing
k_law = "uniform"
i_beta = 3.0
j_beta = 3.0
k_beta = 3.0

# output = "background.geo"   # optional

Unknown keys raise ParameterError. Run shore config validate (planned for primitive configs) or just invoke the subcommand — the loader runs first.

Per-edge spacing (Python API)

BoxMesh.build and AnnularCylinderMesh.build accept an edge_pins keyword to override individual edges:

python
from shore.mesh.spacing import Spacing1D
from shore.primitive import BoxMesh

box = BoxMesh.build(
    vmin=(0, 0, 0), vmax=(10, 5, 3),
    ni=40, nj=30, nk=20,
    edge_pins={
        "j_lo_k_lo": Spacing1D(law="tanh", beta=4.0),
        "j_lo_k_lo": Spacing1D(law="pinned", first_step=0.05, last_step=0.10),
    },
)

FlatCapsCylinder.build also accepts the kwarg for API symmetry but raises if any edge is supplied — its radial / tangential / axial distributions are all geometrically pinned and have no degree of freedom for per-edge control. See Per-edge spacing for the support table and TFI mechanism.

The CLI does not expose edge_pins today; per-edge spacing is a Python-API feature.

See also

Released under the MIT License.