Skip to content

A Chimera assembly ​

You build the two grids of a minimal overset (Chimera) case: a six-block cubed-sphere near-body grid around a sphere and a five-block cylindrical background grid, generated independently in the same coordinates. You keep them as two components of one SHORE project, measure how well the background resolves the overlap, and look at the pair in ParaView. The next tutorial turns this project into the files the Xall solver reads.

You need

GridTopologyBlocksExtent
Near-bodycubed sphere6sphere of radius 0.5, marched to r ≈ 0.7
Backgroundflat-caps cylinder5r ≤ 10, −10 ≤ z ≤ 50, no hole

SHORE generates the grids and the solver files. Hole cutting, fringe identification and donor search are done by the overset pre-processor of the solver, guided by the marker boxes and boundary codes of the next tutorial (Chimera grids).

1. Make the body ​

bash
shore body sphere --radius 0.5 --subdivisions 4 -o sphere.stl
python
import shore.shapes

shore.shapes.sphere(radius=0.5, subdivisions=4).export("sphere.stl")

2. Build the near-body grid ​

A cubed sphere marched 12 cells off the wall with a geometric law (ds = 0.01, growth = 1.1): total thickness about 0.21, outer layer at r ≈ 0.7. The 30° caps keep the cap and equator spacings within the 2x window for C1 pinning (cap step 0.524/10=0.052 rad, equator step (π−1.047)/29=0.072 rad).

bash
shore mesh sphere.stl --ni 30 --nj 40 --nk 13 --ds 0.01 --growth 1.1 \
    --theta-cap-deg 30 -o wall --adjacency-json wall.adjacency.json -v
python
from shore.project import Project  # noqa: E402

p = Project()
p.use_component("sphere")  # a named component: one grid of the assembly
p.load_geometry("sphere.stl", name="sphere")
p.build_topology(
    "cubed_sphere",
    nk=13,
    ds=0.01,
    growth=1.1,
    geometry="sphere",
    ni=30,
    nj=40,
    theta_cap=math.radians(30.0),
)
p.march()
p.write_geo("wall")  # wall_sub0..3.geo, wall_cap_north.geo, wall_cap_south.geo
p.write_adjacency("wall.adjacency.json")
✓ Wrote 6 .geo files  (sub: 30x11x13, caps: 11x11x13)
✓ Wrote wall.adjacency.json

The .adjacency.json sidecar records every face's boundary condition and its partner: WALL at the sphere (k_lo), FREE at the outer layer (k_hi), SHARED or DIRICHLET at the block seams. shore cc-par reads it in the next tutorial.

3. Build the background grid ​

The flat-caps cylinder is a central square block and four blocks that fill the ring between the square and the outer circle, extruded along z. There is no hole: the background covers the body too, and the solver blanks the cells inside it.

bash
shore primitive flat-caps --r-out 10 --z0 -10 --z1 50 --inner-frac 0.4 \
    --ni 16 --nc 24 --nk 60 -o background --adjacency-json background.adjacency.json
python
p.use_component("background")
p.build_primitive(
    "flat_caps",
    r_out=10.0,  # cylinder radius
    z0=-10.0,  # axial extent along z
    z1=50.0,
    inner_frac=0.4,  # corner radius of the central square / r_out
    ni=16,  # radial nodes of the four outer blocks
    nc=24,  # side nodes of the central square
    nk=60,  # axial nodes
)
p.write_geo("background")  # background_center.geo, background_sub_{e,n,w,s}.geo
p.write_adjacency("background.adjacency.json")
wrote background_center.geo
wrote background_sub_e.geo
wrote background_sub_n.geo
wrote background_sub_w.geo
wrote background_sub_s.geo
wrote background.adjacency.json

--inner-frac 0.4 puts the corners of the central square at r = 4: the whole near-body grid sits inside the center block. The CLI and the script write the same bytes for every .geo and sidecar.

4. Keep both grids in one project ​

A project holds several named components, each with its own grid, and saves them with the journal that built them. On the command line, --project DIR --component NAME adds the result of shore mesh or shore primitive to the project in DIR (created if missing):

bash
shore mesh sphere.stl --ni 30 --nj 40 --nk 13 --ds 0.01 --growth 1.1 \
    --theta-cap-deg 30 --project assembly --component sphere
shore primitive flat-caps --r-out 10 --z0 -10 --z1 50 --inner-frac 0.4 \
    --ni 16 --nc 24 --nk 60 --project assembly --component background
python
p.save("assembly")  # project.toml, journal.py, inputs/, grids/<component>/
print(p.journal())
✓ Saved project assembly (component 'sphere')
✓ Saved project assembly (component 'background')

The project directory holds project.toml, journal.py, a copy of the STL under inputs/ (with its SHA-256) and the grids under grids/<component>/. The CLI also writes the blocks as .geo files in the working directory, under the default stems (sphere_*.geo, flat_caps_*.geo). The journal of the CLI run:

python
p = Project()
p.use_component('sphere')
p.load_geometry('inputs/00_sphere.stl', name='sphere')
p.build_topology('cubed_sphere', nk=13, ds=0.01, growth=1.1, geometry='sphere', ni=30, nj=40,
                 theta_cap=0.5235987755982988, i_spacing='uniform', ...)
p.march()
p.use_component('background')
p.build_primitive('flat_caps', r_out=10.0, z0=-10.0, z1=50.0, ni=16, nc=24, nk=60,
                  inner_frac=0.4, axis='z', ...)

See 6. Projects and replay for loading, undo and replay.

5. Measure the overlap ​

The solver interpolates between the grids where they overlap. The donor cells of the background should be about the size of the near-body cells they serve. The script measures both:

python
sphere = p.components["sphere"].blocks
background = p.components["background"].blocks
outer = np.concatenate([b.nodes[:, :, -1].reshape(-1, 3) for b in sphere])
r_outer = np.linalg.norm(outer, axis=1)
print(f"near-body outer layer: r = {r_outer.min():.3f} .. {r_outer.max():.3f}")
last = max(np.linalg.norm(b.nodes[:, :, -1] - b.nodes[:, :, -2], axis=-1).max() for b in sphere)
along = max(
    np.linalg.norm(np.diff(b.nodes[:, :, -1], axis=a), axis=-1).max()
    for b in sphere
    for a in (0, 1)
)
print(f"near-body outer cells: normal {last:.3f}, along the layer up to {along:.3f}")
centre = next(b for b in background if b.label == "center").nodes
dx = np.linalg.norm(np.diff(centre, axis=0), axis=-1).max()
dz = np.linalg.norm(np.diff(centre, axis=2), axis=-1).max()
print(f"background centre block: {centre.shape[:3]} nodes, cells {dx:.3f} across, {dz:.3f} along z")
near-body outer layer: r = 0.686 .. 0.714
near-body outer cells: normal 0.029, along the layer up to 0.122
background centre block: (24, 24, 60) nodes, cells 0.246 across, 1.017 along z

A background cell here is 2x the largest near-body outer cell across and 8x along z; one background cell along z is longer than the near-body grid's diameter (1.43). This layout shows the workflow, not a grid to run on: for a real case refine the background around the body (more --nk and --nc, a shorter domain, or an intermediate refined box as a third component) until the cell sizes match in the overlap.

6. Look at it ​

bash
shore export wall_*.geo -o wall.vtm
shore export background_*.geo -o background.vtm

Open both .vtm files in ParaView. A slice at z = 0 shows the near-body grid inside the center block of the background; the cell Jacobian is attached as cell data.

The sphere's near-body grid inside the cylindrical background, cut away.The sphere's near-body grid inside the cylindrical background, cut away.
The sphere's near-body grid inside the cylindrical background, cut away.

What you learned ​

  • An overset case is a set of grids built independently in one coordinate system; SHORE builds them, the solver's pre-processor connects them.
  • --adjacency-json writes the face graph the solver files are made from.
  • --project DIR --component NAME (or Project.use_component) keeps several grids in one project with one journal.
  • The overlap needs comparable cell sizes on both sides; measure them before writing solver files.

Next ​

Released under the MIT License.