Skip to content

Stack scalar inputs with field slices in ArrayDiscretization - #682

Merged
utkuyilmaz1903 merged 1 commit into
SciML:masterfrom
utkuyilmaz1903:stack-scalar-inputs
Sep 6, 2026
Merged

utkuyilmaz1903 merged 1 commit into
SciML:masterfrom
utkuyilmaz1903:stack-scalar-inputs

Conversation

@utkuyilmaz1903

Copy link
Copy Markdown
Member

Follow-up to #680. A vector input to a callable can now mix field slices with scalars: f([u, t], θ), f([u, k], θ) with a scalar parameter, f([u, S(t)], θ) with a time-only dependent, or a number. Scalars and lower-dimensional arrays (the 2D coordinate arrays, a 1D field in a 2D equation) are broadcast onto the core slice with array_broadcast_onto, already used for scalar equation sides, before stacking. f([u, x], θ) already worked, since x arrayifies to the coordinate vector; it is now covered by tests.

interior array eqs
f([u, x], θ), f([u, t], θ), f([u, k], θ), f([u, 1.0], θ) 1 each matches its symbolic form (θ[1] u x, ...) to 1e-8
f([u, t], θ) through mtkcompile scalarized 1e-6
f([u, S(t)], θ), S a time-only dependent 1 1e-8
2D, f([u, x], θ) and f([u, w], θ) with w(t, x) 2 (nx, 1) broadcast onto (nx, ny), 1e-8
NN([u, x], θ)[1], NN([u, t], θ)[1] 1 batched; matches the point-by-point evaluation to 1e-8
f([u, θ], θ), array parameter in the literal 0 falls back

No new functions: the existing array_broadcast_onto and array_stack are reused. An input with no field slice at all, such as f([t], θ), still falls back.

@utkuyilmaz1903
utkuyilmaz1903 marked this pull request as ready for review September 6, 2026 22:58
@utkuyilmaz1903
utkuyilmaz1903 merged commit 2e3ad37 into SciML:master Sep 6, 2026
72 checks passed
@utkuyilmaz1903
utkuyilmaz1903 deleted the stack-scalar-inputs branch September 6, 2026 23:00
ChrisRackauckas added a commit that referenced this pull request Sep 7, 2026
- Trim the array-form capability list from MOLFiniteDifference. (#673)
- Stop infinite expansion when a PDE unknown is missing from the system. (#674)
- Support vector-valued functions in ArrayDiscretization (#675)
- Test ModelingToolkitNeuralNets terms and fix the compiled ODE path (#678)
- Add a tutorial on training a neural network term in a PDE (#679)
- Stack vector field inputs and batch network calls in ArrayDiscretization (#680)
- Add a tutorial on learning the Brusselator reaction with a neural network (#681)
- Stack scalar inputs with field slices in ArrayDiscretization (#682)
- Test callable diffusion coefficients (#683)
- Reconstruct array observables once per PDE field (#676)



Agent-Harness: Claude Code
Agent-Model: claude-opus-5[1m]
Claude-Session: https://claude.ai/code/session_014FEzNTLFutCmTEAZ3zBg5R

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
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.

1 participant