Skip to content

Support mixed derivatives in ArrayDiscretization - #648

Merged
ChrisRackauckas merged 2 commits into
SciML:masterfrom
utkuyilmaz1903:pr-625
Aug 20, 2026
Merged

ChrisRackauckas merged 2 commits into
SciML:masterfrom
utkuyilmaz1903:pr-625

Conversation

@utkuyilmaz1903

@utkuyilmaz1903 utkuyilmaz1903 commented Aug 20, 2026 •

Copy link
Copy Markdown
Member

Supersedes #625: takes over the mixed-derivative work and rebases it onto current master, which now carries WENO/functional advection, staggered grids and nonlinear/spherical Laplacians in array form. Part of #623.

Summary

Dx(Dy(u)) previously made the whole equation fall back to pointwise discretization under ArrayDiscretization. The scalar scheme (mixed_central_difference) is the tensor product of the two centered first-order stencils, translation invariant across the interior, so it has a slice form: the existing broadcasted sum of shifted slices, with a second shifted axis.

  • array_shifted_slice generalises array_slice to simultaneous shifts along several axes, each wrapped independently where its direction is periodic.
  • array_interior_stencil factors the interior (weights, taps) out of array_central_difference, so the mixed form takes its weights from the same DerivativeOperators the scalar path uses.
  • array_bands / array_tap_extents account for the directions a mixed derivative reaches along: those use the centered first-order stencil, which at approximation orders 4/6 is wider than the winding stencil the order-1 entry of pdeorders would select. Without this the band reaches past the grid and the equation silently degrades to pointwise.

Results

All cases verified against ScalarizedDiscretization on the current master base:

Case Interior array eqs Numerics vs scalar path
2D Dxy, approx order 2/4/6 (strict mode) 1 RHS bitwise identical (maxdiff 0.0)
Nonuniform grid (both axes) 1 RHS bitwise identical (maxdiff 0.0)
Variable coefficient (0.3 + 0.2xy) * Dxy(u) 1 solution parity (rtol 1e-6)
Periodic direction 2 solution parity (rtol 1e-6)
3D Dxz 1 solution parity (rtol 1e-6)
Mixed + WENO advection in the same equation 1 array form verified symbolically
Dx^2(Dy(u)) and higher combinations fallback identical via pointwise

The equation count stays independent of the grid resolution in every array case.

Falls back

Patterns the scalar path has no mixed scheme for keep falling back to pointwise scalar equations (and raise under StrictArrayDiscretization): higher-order mixed combinations, mixed derivatives inside coefficients, mixed derivatives on staggered grids, and mixed derivatives of boundary values. Results therefore always match ScalarizedDiscretization.

claude and others added 2 commits August 20, 2026 13:46
`Dx(Dy(u))` caused the whole equation to fall back to pointwise discretization.
The scalar scheme (`mixed_central_difference`) is the tensor product of the two
centered first order stencils, which is translation invariant across the interior
in both directions at once, so it has a slice form: the same broadcasted sum of
shifted slices `array_central_difference` builds, with a second shifted axis.

- `array_shifted_slice` generalises `array_slice` to shifts along several axes,
  each wrapped independently where its direction is periodic, mirroring the two
  separately `bwrap`ped tap sets the scalar path takes the product of.
- `array_interior_stencil` factors the interior `(weights, taps)` out of
  `array_central_difference` so both it and the mixed form take their weights from
  the same `DerivativeOperator`s the scalar path uses.
- `array_bands` gains the directions a mixed derivative reaches along: those use
  the *centered* first order stencil, which at higher approximation orders is wider
  than the winding stencil the order 1 entry of `pdeorders` would select. Without
  this an equation whose only derivative in a direction is the mixed one builds a
  band that reaches past the grid and degrades to pointwise.

Mixed patterns the scalar path has no scheme for, such as a mixed derivative of
higher order in one direction, still reach `arrayify` with a spatial differential
in place and fall back (and raise under `StrictArrayDiscretization`).

The discretized equation sets are identical to `ScalarizedDiscretization`: on a
2D diffusion equation with `0.5*Dxy(u)` on 11x11, 21x21 and 41x41 grids the array
form is 9 equations at every resolution against 121/441/1681 scalar ones, with
both the right hand side at a random state and the solution matching bitwise
(maxdiff 0.0).

Co-Authored-By: Chris Rackauckas <[email protected]>
@utkuyilmaz1903
utkuyilmaz1903 marked this pull request as ready for review August 20, 2026 14:24
@ChrisRackauckas
ChrisRackauckas merged commit eb6ae16 into SciML:master Aug 20, 2026
69 checks passed
ChrisRackauckas pushed a commit that referenced this pull request Aug 23, 2026
Generalize the #648 tensor-product scheme from Dx(Dy(u)) to two-direction mixed derivatives of arbitrary order on both the slice and pointwise paths.
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.

3 participants