Repository navigation
Support mixed derivatives in ArrayDiscretization - #625
Closed
ChrisRackauckas-Claude wants to merge 1 commit into
Closed
ChrisRackauckas-Claude wants to merge 1 commit into
ChrisRackauckas-Claude wants to merge 1 commit into
Conversation
`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]>
ChrisRackauckas-Claude
force-pushed
the
array-mixed-derivs
branch
from
August 20, 2026 13:59
fd8e678 to
a3fcfc9
Compare
Member
Author
|
Closing as superseded by #648, which @ChrisRackauckas merged as eb6ae16 while this draft's CI was running. This branch was rebased onto The merged PR contains the equivalent mixed-derivative implementation plus its cleanup and additional tests, so no unique feature change remains to rebase from this draft. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note
Draft — please ignore until reviewed by @ChrisRackauckas.
What changed and why
This adds mixed first-derivative support such as
Dx(Dy(u))toArrayDiscretization. The implementation builds a tensor-product centered stencil, applies simultaneous shifted slices with per-axis periodic wrapping, and accounts for the centered mixed stencil when determining array-interior bands. Unsupported higher combinations continue to use the existing scalar fallback.The branch is rebased onto
masterat483d2b90. The previously stacked periodic-boundary commit was already present upstream and was dropped during the rebase; the mixed-derivative implementation was integrated with the newer nonlinear/spherical Laplacian, staggered-grid, and functional WENO array paths.Result
For
Dt(u) ~ Dxx(u) + Dyy(u) + 0.5Dx(Dy(u))with Dirichlet boundaries, the array form remains at nine equations for 11×11, 21×21, and 41×41 grids, while the scalar form grows from 121 to 1,681 equations. The tests cover uniform and nonuniform grids, variable coefficients, 3D derivatives, periodic directions, approximation orders 2/4/6, band width, and fallback behavior.Regression evidence
The exact new band-width assertion was run against clean
master(483d2b90) before applying this commit:The same script against this branch passes:
Local verification
GROUP=Array_Discretization julia +release --startup-file=no --project=. -e 'using Pkg; Pkg.test()'GROUP=Mixed_Derivatives julia +release --startup-file=no --project=. -e 'using Pkg; Pkg.test()'GROUP=QA julia +release --startup-file=no --project=. -e 'using Pkg; Pkg.test()'Runic 1.9.0 check over all changed Julia files: exit 0, no diff.
typosover added diff lines: exit 0, no findings.After developing the checkout into the docs environment,
julia +release --startup-file=no --project=docs docs/make.jlexecuted every example and resolved all cross-references. It then failed only on unauthenticated GitHub link checks returning HTTP 429; no example, doctest, or source-reference error occurred. A separate strict one-page API build exited 0.GitHub CI on this rebased head: 69/69 checks successful.
Not verified locally
GROUP=EverythingRemaining ArrayDiscretization gaps are tracked at #623.
The feature was merged through #648 as eb6ae16 while this draft's CI was running. This draft is therefore superseded.