Skip to content

Support staggered grids in ArrayDiscretization - #645

Merged
ChrisRackauckas merged 1 commit into
SciML:masterfrom
utkuyilmaz1903:feature/array-staggered-grids
Aug 20, 2026
Merged

ChrisRackauckas merged 1 commit into
SciML:masterfrom
utkuyilmaz1903:feature/array-staggered-grids

Conversation

@utkuyilmaz1903

Copy link
Copy Markdown
Member

Part of #623

Staggered grids were declined wholesale by ArrayDiscretization; the interior now stays in slice form.

Each variable's alignment is fixed, so the interior stencil taps are constant across the core: CenterAlignedVar → (0, +1), EdgeAlignedVar → (-1, 0), same windmap weights as the scalar staggered path. 1D boundaries remain the existing single-point (benign) fallback.

Result

case array interior eqs total eqs (coarse / fine) sol maxdiff
1D wave, mixed BCs 2 6 / 6 0.0
1D wave, periodic BCs 2 8 / 8 0.0
StrictArrayDiscretization, mixed BCs 2 accepted (1D BCs are benign) —

Equation count is independent of grid resolution. Solutions match ScalarizedDiscretization bitwise.

Approach

  • Drop the whole-system staggered reject in discretize_equation_array_form.
  • Emit interior rules via array_staggered_rules (alignment-fixed two-tap slices).
  • Clamp the core with the same bpc branch conditions as the scalar staggered interior; leftover frame points stay pointwise.
  • Move the BC staggered guard behind the single-point check so 1D faces fallback benignly. Multi-point (≥2D) staggered faces still decline.

Fallback (same as scalar, and an error under StrictArrayDiscretization unless benign): even-order spatial derivatives, nonuniform dx, missing alignment, missing upwind operator, ≥2D staggered faces.

@utkuyilmaz1903
utkuyilmaz1903 marked this pull request as ready for review August 18, 2026 16:51
@ChrisRackauckas

Copy link
Copy Markdown
Member

Rebase

@utkuyilmaz1903
utkuyilmaz1903 force-pushed the feature/array-staggered-grids branch from 4de37a6 to 030204b Compare August 19, 2026 09:10
@utkuyilmaz1903

Copy link
Copy Markdown
Member Author

@ChrisRackauckas Rebased.

@ChrisRackauckas
ChrisRackauckas merged commit c77efef into SciML:master Aug 20, 2026
67 of 69 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants