← Explainer · Markdown · Source on GitHub

# Align the existing data model with AMReX concepts

**Design proposal, 2026-09-26.** Effort: AMR-02; prerequisite design: AMR-01.
Status and owner: [work board](/docs/WORKBOARD). No runtime implementation is
delivered by this document. Naming, responsibility and performance-first GPU requirements
updated 2026-09-26; practical AMReX naming, inclusive bounds and boundary-role separation adopted as the design direction. Conservative transport belongs to
[TRN-01](/docs/amrex-alignment/SINGLE_LEVEL_TRANSPORT); S2/S3 behavior belongs to the [separate plan](/docs/amrex-alignment/S2_S3_PLAN).
Apply the [GPU execution policy](/docs/plans/gpu-resident-processing); completing the
separate GPU-01 migration is not a prerequisite to accepting this structural refactor.

## Outcome and strict boundary

Represent every currently supported simulation using explicit domain geometry,
index bounds, field placement and patch ownership. A running simulation still has
**one physical resolution level and one patch covering the domain**, on one GPU.
Existing moving geometry, boundary conditions, advection choices and measurements
remain supported within their current limits. This effort adds no new scientific case,
mesh arrangement, user option or numerical method.

The benefit is a precise vocabulary and one current representation that S2 can extend.
This is more than renaming `GridBlock`: consumers must use the new source of truth
for extents, placement and coordinates. It is less than implementing a general AMR library.

Align with AMReX concepts without sacrificing the existing GPU throughput or memory
behavior. Working fields and repeated numerical work stay on the device. Target
reductions finish on-device, and their numerical consumers use resident results;
bulk fields or partial reductions must not be downloaded to finish numerical work
on the CPU. Bounded, documented and measured control/status/layout metadata may
cross the boundary for host orchestration. Input preparation and one-time setup,
such as building and uploading a static mesh acceleration structure, may run on the
host when that is the practical choice. There is no CPU simulation fallback.

AMR-02 introduces no new bulk readbacks or CPU field-processing paths. Record unchanged
legacy reduction, solver and geometry gaps separately under GPU-01; closing them all
is not part of this structural refactor's acceptance. Changes to those paths can share
ownership work with AMR-02, but need their own numerical and performance evidence.
Neither structural alignment nor a renamed type establishes GPU-01 completion.

Keep transport equations, limiting and timestep/projection coupling unchanged here.
TRN-01 subsequently measures and improves single-grid transport with separate
conservation, accuracy and cost gates. It uses the aligned representation; AMR-02
acceptance neither depends on a new advection method nor establishes numerical improvement.
The [boundary-condition plan](/docs/plans/boundary-condition-alignment) separately
tracks shared input validation (BC-01) and numerical boundary qualification (BC-02).
Do not hide a boundary-formula or stage-semantics correction inside this equivalence refactor.
TRN-01 will extend the existing choice with one qualified conservative method, a
small host-side dispatch contract and explicit capability/timestep requirements.
AMR-02 preserves both existing choices; it does not introduce that selection API,
new scratch buffers or speculative algorithm stages. See the
[algorithm review guide](/docs/amrex-alignment/ALGORITHMS) and [numerical explainer](/algorithms.html).

Keep C#/.NET and ILGPU. Do not add a C++ AMReX dependency, MPI, device distribution,
new precision modes, arbitrary centering, generic field algebra or alternate storage
backends. Do not add same-level exchange, coarse/fine interpolation, composite
projection, refinement, adaptation or time subcycling. Do not turn an internal
descriptor's ability to represent bounds into an advertised simulation capability.

## Current implementation and fit

Inspection baseline: source tree reviewed 2026-09-26; recheck it when work starts.

| Current structure | Reusable foundation | Alignment work / later boundary |
| --- | --- | --- |
| [GridBlock](https://github.com/hankbeasley/polycfd/blob/b7f5b9ba6f52355d9b196b586e4a6c8719d8feea/src/PolyCfd.Core/Core/GridBlock.cs), [GridDescriptor](https://github.com/hankbeasley/polycfd/blob/b7f5b9ba6f52355d9b196b586e4a6c8719d8feea/src/PolyCfd.Gpu/Core/GridDescriptor.cs) | Cartesian sizes, spacing and efficient kernel values | Separate physical domain from a patch's global index box and local array strides. No new nonzero-origin simulation support in AMR-02. |
| [DeviceMacState](https://github.com/hankbeasley/polycfd/blob/b7f5b9ba6f52355d9b196b586e4a6c8719d8feea/src/PolyCfd.Gpu/Core/DeviceMacState.cs), [halo layouts](https://github.com/hankbeasley/polycfd/blob/b7f5b9ba6f52355d9b196b586e4a6c8719d8feea/docs/halo-layout.md) | Dense cell/face arrays; explicit device owners | Describe valid samples and actual stored halo topology accurately. GPU velocity has no persistent halos; pressure has packed face halos without corners. Preserve that layout initially. |
| [SimulationDefinition](https://github.com/hankbeasley/polycfd/blob/b7f5b9ba6f52355d9b196b586e4a6c8719d8feea/src/PolyCfd.Gpu/Integration/SimulationDefinition.cs), [SimulationSession](https://github.com/hankbeasley/polycfd/blob/b7f5b9ba6f52355d9b196b586e4a6c8719d8feea/src/PolyCfd.Gpu/Integration/SimulationSession.cs) | Independent runtime, one numerical owner, selective capture | Bind the session to a one-level/one-patch layout and route existing fields through it. No independent per-patch timesteppers. |
| [AdvectionGpu](https://github.com/hankbeasley/polycfd/blob/b7f5b9ba6f52355d9b196b586e4a6c8719d8feea/src/PolyCfd.Gpu/Advection/AdvectionGpu.cs), [PatchBcSet](https://github.com/hankbeasley/polycfd/blob/b7f5b9ba6f52355d9b196b586e4a6c8719d8feea/src/PolyCfd.Core/BC/Patches/PatchBcSet.cs) | Current validated boundary and sampling behavior | Make the current patch-equals-domain precondition explicit. Preserve clamping/wrapping; replacing it with interpatch sampling belongs to S2. A BC patch is a boundary region, not a mesh patch. |
| [IGeometryDescriptor](https://github.com/hankbeasley/polycfd/blob/b7f5b9ba6f52355d9b196b586e4a6c8719d8feea/src/PolyCfd.Core/Geometry/IGeometryDescriptor.cs), [GpuMgHierarchy](https://github.com/hankbeasley/polycfd/blob/b7f5b9ba6f52355d9b196b586e4a6c8719d8feea/src/PolyCfd.Gpu/Multigrid/GpuMgHierarchy.cs) | Rebuildable solids and distinct solver-coarse geometry | Distinguish coordinate geometry from embedded-boundary metrics, and physical levels from solver levels. Preserve current geometry sampling and coarse construction. |
| [Shared PcgIteration](https://github.com/hankbeasley/polycfd/blob/b7f5b9ba6f52355d9b196b586e4a6c8719d8feea/src/PolyCfd.Gpu/PcgIteration.cs), [pressure contract](/src/PolyCfd.Gpu/Projection/README), [diffusion contract](/src/PolyCfd.Gpu/Diffusion/README) | One pressure recurrence with borrowed finest-level views and separate preconditioners; explicit diffusion phases | Bind existing solver seams to the aligned layout. Preserve regional compatibility/gauges and selected methods; migrate their remaining host numerical work under GPU-01 without duplicating solver loops. |
| [ResultGrid](https://github.com/hankbeasley/polycfd/blob/b7f5b9ba6f52355d9b196b586e4a6c8719d8feea/src/PolyCfd.Core/Results/ResultPlanes.cs), [result bundles](https://github.com/hankbeasley/polycfd/blob/b7f5b9ba6f52355d9b196b586e4a6c8719d8feea/src/PolyCfd.Core/Results/ResultBundle.cs), [HDF5](https://github.com/hankbeasley/polycfd/blob/b7f5b9ba6f52355d9b196b586e4a6c8719d8feea/docs/HDF5_FIELD_FORMAT.md) | Explicit centering, physical coordinates, units and selected products | Derive current single-grid descriptors from the canonical runtime layout. Keep existing wire meanings and versions; native patch output is later work. |

MAC staggering, matrix-free operators, device residency, Half geometry, float fields
and double weighted reductions fit this direction. The major adaptation risk is the
assumption that every block edge is a physical or periodic domain boundary. AMR-02
names and guards that restriction; it does not claim to remove it.

Current `GridMetrics` combines Cartesian spacing with embedded-boundary fractions,
and can own buffers or borrow them from `CellGeometry`. The BC types use "patch"
for domain boundary regions, while future mesh patches are volumes of cells. Neither
`GridBlock` nor `GridDescriptor` currently provides the authoritative global box and
per-level mapping needed by the aligned model. These are responsibility boundaries
to clarify, not evidence that a cosmetic rename supplies missing behavior.

## Proposed contracts

The following are agreed target responsibilities and names for implementation, not
a shipped API or schema. Migrate maintained consumers together and remove replaced
names; do not add compatibility aliases solely to preserve the old vocabulary.

### Naming and responsibility migration

**Approved direction, 2026-09-26:** prefer AMReX conventions and names when the
responsibilities match. Use idiomatic C# spelling, such as `SmallEnd` and `BigEnd`
for AMReX's `smallEnd` and `bigEnd`. A different language or an existing half-open
loop is not by itself a reason to choose different canonical box semantics.
Keep a descriptive PolyCFD name when ownership, supported behavior or domain meaning
differs; record the corresponding AMReX concept and concrete reason in the tables
below. Do not imply API compatibility or add unused features merely to earn a name.

| Current name | Target name / responsibility | Required semantic change |
| --- | --- | --- |
| `BoundaryPatch`, GPU `DevicePatch` | `BoundaryRegion`, `DeviceBoundaryRegion` | A physical domain boundary region and its resolved boundary samples; reserve mesh patch terminology for a box of cells. Preserve the existing six-face layout and partial-velocity/whole-face-pressure restrictions. |
| `PatchBcSet`, `DevicePatchBcSet` | `DomainBoundaryConditions`, `DeviceDomainBoundaryConditions` | Physical domain BC declarations and their device binding, separate from mesh-neighbor exchange. Periodic domain topology is canonical in domain geometry; validate paired BC compatibility against it. |
| `IGeometryDescriptor`, `SdfGeometryDescriptor` | `IEmbeddedBoundarySource`, `SdfEmbeddedBoundarySource` | The solid description/source and its rebuild policy, distinct from the coordinate map and discretized data. Separate host input/setup preparation from device field sampling and repeated rebuild work; renaming does not establish GPU-01 completion. |
| `CellGeometry`, `DeviceCellGeometry` | `EmbeddedBoundaryData`, `DeviceEmbeddedBoundaryData` | Cell and face fractions, classification, normals and stabilization data for one patch/revision. Preserve owned/borrowed lifetimes and distinct current, previous-motion and solver-coarse data. |
| `GridBlock` | `MeshPatch` | One box within a physical level, referring to canonical coordinate/layout metadata and its embedded-boundary data. Rename after separating domain, patch and storage responsibilities, rather than treating a whole-domain block as a new mesh abstraction. |
| `GridDescriptor` | `PatchKernelDescriptor` | A compact, derived value passed to kernels, containing the indexing/spacing facts they actually need. It is not the authoritative domain, patch layout or field-storage contract. |
| `GridMetrics` | Canonical Cartesian metrics plus borrowed `EmbeddedBoundaryMetricsView` | Derive spacing, geometric areas and cell volumes from the level mapping; borrow fractions from the embedded-boundary owner. Retain zero-copy access without a second independent owner or duplicate metadata that can drift. |

Keep `SimulationSession`, `MacState`/`DeviceMacState`, `PressureWorkspace` and
`GpuMgHierarchy`: their domain-specific names remain useful. Bind state and workspaces
to the aligned layout instead of renaming everything to AMReX classes. A host
`MacState` may represent explicit input/output and prepared initial data; retaining
that type does not authorize a second CPU simulation workspace or repeated field downloads.
Preserve `PressureWorkspace`'s pressure-only scratch role and keep multigrid internal
to the pressure solve. No `MultiFab` clone, C++ binding or general field framework is required.

### Canonical concepts

| Proposed concept | Meaning | AMReX reference concept |
| --- | --- | --- |
| `IntVect` | Three integer index components for the current 3D runtime; compact value type | `IntVect` |
| `Box` | Inclusive `SmallEnd`/`BigEnd` bounds plus associated index type; no field storage | `Box` |
| `IndexType` | Canonical per-axis cell/node interpretation, restricted to cell and X/Y/Z faces in this effort | Relevant subset of `IndexType` |
| `DomainGeometry` | One physical level's mapping: global physical bounds, level-domain index bounds, spacing and periodic axes | Per-level `Geometry` |
| `LevelLayout` | Ordered patch boxes at a single physical resolution | `BoxArray` and per-level mesh metadata |
| `MeshPatch` | One box and its level/layout identity; not a physical domain boundary region | One mesh box |
| `PatchFieldView` | Borrowed typed data, placement, valid extents, storage strides and available ghosts | Per-box array view |
| `LevelFields` | Field owners/views bound to one layout | Relevant subset of `MultiFab` semantics |
| Session layout | Physical levels and ownership; initially exactly one of each | Hierarchy organization |

AMReX gives each axis cell or node placement; a face field is node-based along its
normal and cell-based along the other axes. Collections of boxes describe a level;
field collections bind arrays to that layout. These are the concepts being borrowed,
not its exact memory organization. [AMReX basics](https://amrex-codes.github.io/amrex/docs_html/Basics.html)

`Box` and `IndexType` replace the earlier proposed names `IndexBox` and
`FieldPlacement`; those were design labels, not shipped types needing aliases.
The remaining differences are intentional:

| PolyCFD name | Why retain it / when to adopt the AMReX name |
| --- | --- |
| `DomainGeometry` | Makes coordinate mapping unambiguous beside PolyCFD's existing solid-geometry namespace and embedded-boundary sources; follows AMReX `Geometry` responsibilities. |
| `LevelLayout` | Includes level/patch identities and layout metadata, beyond an ordered box collection. Prefer `BoxArray` if a separate box-only collection becomes necessary; do not introduce an extra wrapper just for the name. |
| `LevelFields`, `PatchFieldView` | Preserve the current staggered owners, borrowed views and packed halo storage. Use `MultiFab` or `Array4` only if an implemented type actually offers the corresponding field-collection or indexed-view contract; these names do not justify new buffers or a framework. |
| `MeshPatch`, `BoundaryRegion`, embedded-boundary types | Describe application ownership and physical responsibilities rather than claiming to duplicate an AMReX class. Keep the migration table above. |
| Session, MAC state, pressure workspace and multigrid hierarchy | Existing application/solver roles remain useful; physical AMR levels and solver levels retain distinct identities. |

### Bounds and placement

Adopt AMReX's **inclusive** integer endpoints as the canonical `Box` contract.
`SmallEnd` is the first included index and `BigEnd` is the last included index.
An eight-cell axis beginning at zero has bounds `[0, 7]`, not `[0, 8]`.
Convert once when binding to existing half-open loops or storage descriptors;
do not scatter implicit `+1` adjustments through callers. A clearly named derived
`EndExclusive` may expose `BigEnd + 1` for `i < end` loops, with checked representability.
It is not a second independently stored box convention. Existing loop syntax may
remain where it preserves the same samples and measured performance. For a cell box
`[lo, hi]`, the cell count on an axis is `hi - lo + 1`; an X-face box has upper
X endpoint `hi.x + 1`. Check overflow before computing allocations. Define an empty
intersection explicitly rather than treating reversed endpoints as a valid patch.

Define `IndexType` in a neutral Core numerical/grid namespace, with only the
current four placements: cell, X-face, Y-face and Z-face. Runtime kernels and layout
code must not depend on result-format types such as `Results.SampleLocation`.
Derive result descriptors from this canonical meaning and map the existing wire
values explicitly; do not maintain independent centering definitions or silently
change result formats during the migration.

Use AMReX operation names and meanings where an operation is actually needed:
`Length`, `Grow`, `SurroundingNodes` and `EnclosedCells`, with C# spelling and
signatures. Support only the axis conversions needed for the declared MAC placements;
do not imply general edge or all-node field support. Changing a box's index type must consistently change the represented
endpoints; it is not a metadata-only relabel. Describe valid regions, ghost cells,
and cell-/face-centered data using the same vocabulary in APIs, tests and guides.
Later S2/S3 operations should follow AMReX's centering-aware `Refine`/`Coarsen`
semantics, including negative indices; integer truncation toward zero is not a
general substitute for floor-based index coarsening. No unused operations or new
mesh capabilities are required in AMR-02.

Each physical level maps its own domain indices and spacing to the same physical
domain. Patches borrow that mapping; they do not invent independent physical origins.
There is still exactly one level in AMR-02. For a global
level index `i`, its physical sample coordinate on an axis is
`domainMin + (i - domainIndexMin + offset) * spacing`, where `offset` is zero
on a face's normal axis and one-half on cell-centered axes. A local buffer index
first adds the patch lower index. Preserve the existing float evaluation in numerical
kernels; existing double result-coordinate arithmetic is a separate contract.

Descriptor tests should cover nonzero and negative integer boxes to catch hidden
zero-based assumptions. Executable simulations retain current supported coordinate
and extent restrictions. The session must reject an unsupported layout before
allocating fields; descriptor expressiveness is not runtime acceptance.

### Valid regions, ghosts and memory

Valid field extents describe physical samples. Allocated storage describes where the
samples and any ghosts live. Neither one implies a padded rectangular allocation.
In particular, packed pressure face halos must not be represented as a fully grown
box with available edge/corner values. Mark actual halo topology and availability.
Record which field, stage/time and geometry revision those values serve; allocated
storage alone is not evidence that a ghost value is current. In AMR-02 this documents
and checks existing pressure fills and inline velocity boundary sampling, not an
unimplemented general ghost-exchange service.

Preserve the current dense field buffers and specialized kernel views. Do not allocate
velocity halos or gather/scatter full fields merely to resemble a `MultiFab` layout.
TRN-01 will establish per-method transport stencil/flux requirements; S2 will choose the
interpatch storage and sampling policy required by the accepted operators and prove
the cost. AMR-02 only needs metadata/views actually consumed by today's runtime.
Field placement and storage views must remain independent of a particular advection
algorithm. Later method-owned scratch and capability checks consume these views;
they do not require separate state representations for each method.

One session owns the layout and device state; views borrow from those owners.
Preserve disposal order, completed-step capture identity and capture masks. A topology
revision mechanism is unnecessary while topology cannot change; design its later
invalidation responsibilities without adding unused caches or schedulers now.

Keep layout independent of execution placement. AMReX's `DistributionMapping` maps
boxes to MPI ranks; it is not a GPU-thread layout. PolyCFD initially uses the session's
single accelerator owner. Do not add fake ranks or a distribution service to imitate
that API, and do not encode CUDA-specific device identity into an index box.

### Domain and embedded geometry

Keep physical coordinates/periodicity distinct from solid descriptions and cut-cell
fractions. Embedded-boundary data belongs to a patch and geometry revision. Current,
previous-motion and solver-coarse metrics must remain separate owners or explicitly
borrowed views. Do not change SDF quadrature, solid thickening, classification,
small-volume treatment or precision as part of a structural migration.
The source describes the physical solid and build policy; per-level domain mapping
and the patch box determine where it is sampled. GPU geometry builders produce
`DeviceEmbeddedBoundaryData`, and operator views borrow the required metrics.
Preserve the mathematical sampling policy. Host asset preparation, including a
one-time BVH build and upload, is allowed; repeated field sampling and geometry
work belong on the GPU. Do not introduce geometry downloads to rebuild coefficients
or connectivity on the CPU. Inventory legacy paths under GPU-01 without requiring
their full migration as part of the naming and ownership changes.

AMReX likewise has a separate embedded-boundary geometric database and field data
support; adopting that separation does not require changing PolyCFD's cut-cell method.
[AMReX embedded boundaries](https://amrex-codes.github.io/amrex/docs_html/EB.html)

### Physical levels and solver levels

A physical level holds simulation state at a spatial resolution. A multigrid level
holds the auxiliary state used to solve an equation. They need distinct identities
and types even when both use box/placement descriptors. Keep `GpuMgHierarchy` as a
solver concern. Do not wrap its coarse buffers as additional simulated levels.
Do not pass an unqualified level integer between these roles: use explicit physical
level versus multigrid-level identity in the relevant APIs. This distinction does not
require a physical multilevel scheduler while only one physical level is supported.
AMReX's linear-operator API distinguishes AMR and MG level indices as well.
[AMReX linear solvers](https://amrex-codes.github.io/amrex/docs_html/LinearSolvers.html)

### Level coordination and boundary roles

The session owns advancement of one coupled solution. A level coordinates operator
application; compact patch kernels perform the local work using borrowed field and
geometry views. Pressure, diffusion, compatibility/gauges and reductions remain
coordinated operations, not independent patch simulations. With one patch, reuse the
existing launches and equations; do not add a scheduler or many unused abstractions.
Operator coordination describes mathematical scope and device work dependencies.
It may use bounded completion/status metadata to schedule work; the target reduction
finalization and recurrence coefficients remain device operations.
The existing `PcgIteration` already separates the pressure recurrence from the
Jacobi and multigrid preconditioners; retain that boundary and its borrowed
`PressureLevelView`. Its finest solver-level view is not a physical AMR hierarchy.
The [projection](/src/PolyCfd.Gpu/Projection/README),
[multigrid](/src/PolyCfd.Gpu/Multigrid/README) and
[diffusion](/src/PolyCfd.Gpu/Diffusion/README) guides remain the homes of
implemented solver contracts; this plan specifies only their layout alignment.

Separate these responsibilities in naming and APIs:

- Physical domain BC application uses `DomainBoundaryConditions` at actual domain
  boundary regions. Resolve physical choices into per-component mathematical
  descriptors for transport, diffusion and projection; use AMReX `BCRec` and
  `LinOpBCType` naming only where the responsibilities match. A physical no-slip
  choice does not give every component and operator the same stencil.
  Embedded-wall conditions use the embedded-boundary data and their own physical rules.
- Same-level exchange obtains neighboring valid samples across mesh-patch edges;
  it must not apply a wall BC there. It is future S2 behavior.
- Coarse/fine filling reconstructs samples at the requested level, placement and
  time with the selected numerical policy. It is future S3 behavior and is distinct
  from pressure-solver multigrid transfer.

All future fills/exchanges must define required stencil reach, stage/time and
geometry/layout identity before an operator consumes them. AMR-02 makes the current
patch-equals-domain assumption explicit and rejects unsupported layouts; it does not
implement either exchange path or advertise the resulting capabilities.

Keep compact constant descriptors, existing inline velocity stencils and pressure
halo storage; representation alignment does not require velocity ghost arrays or
field-sized BC arrays. Preserve physical pressure values separately from the
homogeneous correction conditions used by the static incremental projection.
The [boundary guide](/docs/BOUNDARY_CONDITIONS_HALOS) owns implemented formulas;
the [algorithm review](/docs/amrex-alignment/ALGORITHMS#boundary-conditions) explains their correspondence.

Domain geometry owns canonical periodicity. BC-01 must close the current difference
between scenario and general typed-API validation: check velocity/pressure topology
together and ensure opposite periodic samples correspond by coordinate, not just
list position. This is a separately tracked setup correction, not evidence that
the current runtime already enforces the target contract. BC-02 qualifies physical
boundary and transport-stage changes independently of AMR-02. Position-dependent
mixed BCs and Robin projection support remain deferred, with no prerequisite claim
for this effort, basic S2 or S3.

### GPU computation, control and output boundaries

[GPU-01](/docs/plans/gpu-resident-processing) is the canonical policy and migration
plan. Keep fields, embedded metrics and repeated numerical work on the GPU. Complete
reductions there and retain results for coefficient, gauge, timestep and update
kernels. Convergence evaluation belongs with those device results; the host may
read a bounded completion/failure flag between iteration batches to schedule more
work. This is distinct from downloading partials or computing PCG coefficients on
the host. A fully device-controlled iterative loop is a later optimization to prove
with measurements, not a requirement to launch every iteration up to the cap.

Host input/setup preparation, metadata validation, resource allocation and launch/I/O
orchestration remain appropriate. For each control/status/layout transfer, document
the consumer, payload bound, cadence and synchronization cost. Small does not mean
free or automatically acceptable: avoid frequent feedback that stalls the solver.
Keep field-derived measurements and sampling on-device before requested output;
downloaded output must not become a CPU numerical workspace. No CPU simulation fallback.

Audit transfer bytes **and calls** at actual backend/library boundaries, including
direct `GetAsArray`, scalar reads and other paths outside convenience wrappers.
Separate control metadata, requested output and existing migration gaps. AMR-02
must not add bulk fields or partial-reduction readbacks for CPU numerical work, or
increase transfer/synchronization costs merely to introduce the aligned abstraction.
Cover retained methods, setup, stepping, geometry/motion updates, failure and capture.
Report unchanged legacy paths under GPU-01; they do not prevent independently
accepting an equivalent, performance-preserving structural refactor.

## Migration sequence

These are ordered steps within AMR-02, not independently completed capabilities.

1. **Capture the existing contract.** Inventory descriptor consumers, BC dispatch,
   geometry builders, source terms, probes, resource estimates and output adapters.
   Select representative uniform, cut-cell, periodic and moving cases with the
   currently accepted settings. Record the accepted revision and baseline identities.
   Inventory all D2H paths with GPU-01, including direct backend reads. Separate
   permitted setup/control/output boundaries from legacy bulk/partial readbacks and
   CPU numerical work; record transfer and synchronization costs before the refactor.
   Pin the AMReX reference revision, review the naming/correspondence tables and
   record reasons for any additional departures. Inclusive bounds are the accepted
   direction; this review checks implementation correctness and cost.
2. **Introduce the canonical descriptors.** Implement bounds, placement and domain
   mapping, then use them to derive the existing kernel descriptors and result
   metadata. Keep fast value-type kernel parameters; avoid virtual dispatch in kernels.
   Test inclusive/half-open round trips, one-cell and negative-origin boxes, shared
   endpoints, centering counts, coordinates, empty intersections and allocation/end
   overflow. Establish `IntVect`, `Box`, the neutral Core `IndexType` and coordinate source before
   migrating `MeshPatch` and the derived `PatchKernelDescriptor`.
3. **Migrate ownership and consumers.** Make the session's one-patch level real in
   its runtime path. Move geometry/BC responsibilities to their appropriate owners.
   Apply the naming table alongside the semantic changes, split Cartesian metadata
   from borrowed embedded metrics, and preserve discrete equations and field storage.
   Keep changes free of new bulk readbacks or CPU field processing. Coordinate any
   overlapping GPU-01 work separately; do not add a CPU simulation fallback.
   Migrate maintained callers and remove superseded representations and compatibility
   aliases in the same change.
4. **Prove equivalence and document the boundary.** Exercise all maintained execution,
   measurement, capture, replay and viewer paths. Update component guides and runtime
   contracts. Retain unsupported-layout rejection and measure the cost of the refactor.
   Prove no performance or transfer regression from alignment, and hand unchanged
   migration gaps to GPU-01. AMR-02 acceptance does not imply GPU-01 completion.

**Context:** `src/PolyCfd.Core/Core`, `src/PolyCfd.Gpu/Core`,
`src/PolyCfd.Gpu/Integration`, `src/PolyCfd.Gpu/Advection`,
`src/PolyCfd.Gpu/Multigrid`, `src/PolyCfd.Core/Results`,
`docs/RUNTIME_CONTRACTS.md`, `docs/MAC_GRID_CONVENTIONS.md`, `docs/halo-layout.md`.

## Acceptance

- Current supported scenarios and typed API callers preserve their resolved physical
  inputs, field placement, resolved advection selection, solver options, source/stage ordering, measurements and
  capture semantics. Existing limitations remain explicit. Multi-patch/multilevel
  requests are rejected before device allocation, even if internal descriptors can express them.
- Target names reflect the actual responsibilities above. Runtime and results derive
  placement/coordinates from the canonical Core model; physical boundaries, mesh
  patches, embedded data and multigrid levels cannot be confused by a shared type or
  unqualified ID. No result-format dependency enters numerical layout/kernel code.
- AMReX conventions and names are used wherever the responsibilities match; each
  retained difference has a documented reason. Verify inclusive endpoints and derived
  half-open loop bounds against the exact same valid cell/face samples, including
  negative origins, empty boxes, one-cell extents and integer limits. Centering-aware
  box operations match the pinned AMReX reference for the implemented subset.
- Existing scientific gates pass without changed references, windows or tolerances.
  Compare preserved and candidate builds on representative fields and measurements.
  Expect unchanged indexing and values where arithmetic is unchanged; diagnose every
  difference rather than requiring bitwise equality of unrelated parallel reductions.
- No new bulk field or partial-reduction readbacks for CPU numerical work, no CPU
  simulation fallback and no transfer/synchronization regression caused by alignment.
  Account for direct/indirect backend reads as well as audited wrappers; an empty
  wrapper counter alone is insufficient. Bound and measure control/status/layout
  metadata separately from output; preserve and identify unchanged GPU-01 gaps.
- Requested completed outputs keep their selective capture semantics. New output
  sampling/reductions finish on the GPU before explicit, separately accounted
  readback; existing output-processing gaps remain in the GPU-01 inventory.
  No duplicate capture, full-volume download for scalar/plane demand, steady-state
  geometry upload or new field-sized allocation solely for the abstraction.
  Follow [architecture performance acceptance](/docs/PERFORMANCE_VALIDATION#architecture-change-acceptance),
  including per-workload measurements on an idle machine. Unresolved regressions block acceptance.
- Run `py -3.12 tools/verify static fast gpu` on the Windows checkout. Run affected
  Workbench tests in WSL with Linux-local artifacts as required by [AGENTS.md](https://github.com/hankbeasley/polycfd/blob/b7f5b9ba6f52355d9b196b586e4a6c8719d8feea/AGENTS.md).
  Run affected viewer tests/build/lint. If a wire contract must change, use the official
  generators and update all consumers; do not invent an AMR wire format in this effort.
- For runtime/indexing/operator integration, run the appropriate CUDA `verify-all`
  coverage from [validation selection](/docs/COMPLETE_VALIDATION#choose-coverage-for-the-change),
  and the full suite before broad numerical acceptance. Record receipt paths, counts,
  `notRun` entries, reference limitations and timing conditions. CPU backend not run
  (user directive). Isolate build artifacts if another campaign owns binaries.

The plan completes only after these gates pass; writing types or documentation alone
does not complete it. Move lasting contracts into current runtime/geometry/result
guides and retire this plan with links updated when implementation is accepted.

## Decisions before implementation

Adopt the naming/responsibility table, single-patch constraint and GPU performance
boundary described above. Prefer practical AMReX naming and semantics, including
inclusive `Box` bounds, `IntVect` and `IndexType`. Resolve detailed C# signatures
and whether a one-level wrapper earns its cost against real callers in step 1;
avoid unused generic layers. Review the conversion of existing half-open loops for
off-by-one errors, overflow and measured cost. The convention is decided; implementation
review verifies the migration and records any evidence-backed departure.
GPU-01 is a separate migration, not a prerequisite to AMR-02
acceptance. Preserve equations and scientific scope during alignment; any overlapping
change to reduction order or processing placement needs appropriate evidence, and any
numerical-formula change needs separate review and its own scientific evidence.

Native AMReX integration would reuse more code, but changes the retained language,
backend and ownership architecture. Copying the complete AMReX API would create
unsupported surface area. Both are outside this effort. Data-model alignment saves
structural design work; it does not implement or validate AMR numerical algorithms.