Skip to content

Support boundary values in interior equations for ArrayDiscretization - #626

Merged
ChrisRackauckas merged 1 commit into
SciML:masterfrom
utkuyilmaz1903:feature/array-boundary-values
Aug 18, 2026
Merged

ChrisRackauckas merged 1 commit into
SciML:masterfrom
utkuyilmaz1903:feature/array-boundary-values

Conversation

@utkuyilmaz1903

@utkuyilmaz1903 utkuyilmaz1903 commented Aug 9, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Interior boundary values (u(t, 1), u(t, 0, y), …) stay in array form via element/face-slice substitution (Refs Tracking: discretization patterns that still use pointwise equations #623), on every emitted equation: array boxes, size-1 wrap boxes, and frame points.
  • Where the scalar path can express the same substitution, results match ScalarizedDiscretization (bitwise where asserted). The array path additionally substitutes periodic-face and free-standing-corner references that scalar boundaryvalfuncs leave symbolic.
  • Fallback (clean, and an error under StrictArrayDiscretization): bval derivatives, time-literals (u(0, x)), edge-aligned grids, off-edge samples, stationary.

Result

case array eqs check
+ u(t,0) - u(t,1) 1 sol maxdiff 0.0
2D Dirichlet face + u(t,0,y) 1 sol maxdiff 0.0
coupled + v(t,1) 2 sol maxdiff 0.0
nonuniform + u(t,1) 1 sol maxdiff 0.0
nonzero Dirichlet 1 f(u0,p,0) bitwise + live forcing
periodic + u(t,0) 1 no leftover symbolic bval; solve OK
doubly periodic face + u(t,0,y) 5 no leftover on wrap points; solve OK, both modes
corner + u(t,0,0) 1 runnable (no scalar parity)
upwind coef u(t,1)*Dx(u) 1 no leftover; solve OK (no scalar parity)

Approach

Equation-level validation accepts a reference or throws the named fallback that
StrictArrayDiscretization surfaces as an error. Accepted references become substitution
rules ordered ahead of the core variable rules: an array element when every spatial
argument is fixed, a singleton-range face slice that broadcasts against the core box
otherwise. The pointwise equations at size-1 wrap boxes and frame points substitute scalar
elements keyed on the grid-valued form valmaps leaves behind (u(t, 0, y) appears there
as u(t, 0, 0.2)). Winding coefficients are arrayified with the same rules, so references
inside upwind coefficients substitute before the wind rule fires.

Verification

Array_Discretization group: 32 testsets, 201/201 locally. Parity cases assert
maxdiff == 0.0 on solutions or a bitwise-identical RHS; non-parity cases (periodic
faces, corners) assert no leftover symbolic reference and a successful solve in both
modes.

Not in this PR

  • Dx(u(t, 1)), edge-aligned grids
  • Stationary array NonlinearSystem (PDEBase)
  • Time-literal interior refs (u(0, x)) — clean fallback only

@utkuyilmaz1903
utkuyilmaz1903 marked this pull request as ready for review August 10, 2026 12:44
@utkuyilmaz1903
utkuyilmaz1903 marked this pull request as draft August 10, 2026 13:00
@utkuyilmaz1903
utkuyilmaz1903 marked this pull request as ready for review August 11, 2026 21:47
Interior references like u(t, 1) or u(t, 0, y) substitute the matching array element or face slice on every emitted equation: array boxes, size-1 wrap boxes, and frame points (keyed on the grid-valued form valmaps leaves there). Winding coefficients take the same rules, so u(t, 1)*Dx(u) stays in array form. Patterns with no slice form (bval derivatives, time literals, edge-aligned grids, off-edge samples) fall back cleanly and error under StrictArrayDiscretization.
@utkuyilmaz1903
utkuyilmaz1903 force-pushed the feature/array-boundary-values branch from fc323e9 to 256c658 Compare August 15, 2026 07:34
@utkuyilmaz1903

Copy link
Copy Markdown
Member Author

@ChrisRackauckas I believe this PR is good to go. Travel took up most of my time this week, but I'll dive back into the rest of the tasks on Monday.

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