Repository navigation
Add a symbolic_discretize driver for optimization-system discretizations - #120
Merged
ChrisRackauckas merged 1 commit intoSep 12, 2026
Merged
Conversation
`AbstractOptimizationSystemDiscretization` existed but shared the finite-difference driver, which selects an equation variable per PDE, derives the coordinate map from it and parses a boundary map that requires every condition to sit on a domain boundary. Mesh-free discretizations (physics-informed neural networks, SciML/NeuralPDE.jl#1161) lower every equation and boundary condition independently on its own residual domain, so give them their own driver: after the shared normalization (`handle_complex`, `cardinalize_eqs!`, `make_pdesys_compatible`, `VariableMap`, `interface_errors`) it calls `construct_disc_state`, `construct_discrete_space(v, pdesys, disc)`, `construct_differential_discretizer`, `discretize_equation!(state, eq, kind, s, derivweights, disc)` for each PDE and boundary condition, `generate_metadata` and `generate_system`. New hook defaults forward to the existing ones. Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Claude Fable 5.1 <[email protected]> Agent-Harness: 2.1.269 (Claude Code) Agent-Model: claude-fable-5-1 Agent-Session: https://claude.ai/code/session_01WYPUXLxE9jVu2jXLFRd8ax Claude-Session: https://claude.ai/code/session_01WYPUXLxE9jVu2jXLFRd8ax
This was referenced Sep 12, 2026
ChrisRackauckas
marked this pull request as ready for review
September 12, 2026 21:03
ChrisRackauckas
added a commit
that referenced
this pull request
Sep 23, 2026
Ships #126: complex equation normalization preserves the real/imaginary coupling in already-split equation pairs, distributes complex arithmetic across dependent fields, and declares the generated component fields real. Patch — a correctness fix, no API change. (#120's symbolic_discretize driver was already released in 0.1.36; that commit carried the bump.) Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Claude <[email protected]> Agent-Harness: Claude Code 2.1.273 Agent-Model: claude-opus-5[1m] Agent-Session: 6a01e420-3436-4518-83cc-6cd853283cfb (local transcript; this harness publishes no conversation URL)
Merged
ChrisRackauckas
added a commit
that referenced
this pull request
Sep 23, 2026
Ships #126: complex equation normalization preserves the real/imaginary coupling in already-split equation pairs, distributes complex arithmetic across dependent fields, and declares the generated component fields real. Patch — a correctness fix, no API change. (#120's symbolic_discretize driver was already released in 0.1.36; that commit carried the bump.) Agent-Harness: Claude Code 2.1.273 Agent-Model: claude-opus-5[1m] Agent-Session: 6a01e420-3436-4518-83cc-6cd853283cfb (local transcript; this harness publishes no conversation URL) Co-authored-by: Claude <[email protected]>
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.
What changed and why
AbstractOptimizationSystemDiscretizationexisted but had no driver of its own: it shared the finite-differencesymbolic_discretize, which selects an equation variable per PDE, derives the coordinate map from it, loops only over PDEs and hands boundary conditions to the equation discretizer through a boundary map whose parser asserts that every condition sits on a domain boundary. Mesh-free discretizations lower every equation and boundary condition independently on its own residual domain and accept interior conditions, so the NeuralPDE parser rewrite (SciML/NeuralPDE.jl#1161, review item 7) needs a generalized driver to be shared infrastructure rather than a parallel parser.This adds
symbolic_discretize(pdesys, ::AbstractOptimizationSystemDiscretization)insrc/symbolic_discretize.jl. After the shared normalization (handle_complex,cardinalize_eqs!,make_pdesys_compatible,VariableMap,interface_errors) it callsconstruct_disc_state(disc);construct_discrete_space(v, pdesys, disc)— new 3-argument hook (the space may depend on the boundary conditions, e.g. to keep interior collocation points off the boundaries); the default forwards to the existing 2-argument method;construct_differential_discretizer(pdesys, s, disc, orders);discretize_equation!(disc_state, eq, kind, s, derivweights, disc)— new 6-argument hook, called for every PDE (kind = :pde) and then every boundary condition (kind = :bc);generate_metadata(s, disc, pdesys, nothing, complexmap, [])andgenerate_system(disc_state, s, nothing, nothing, metadata, disc; checks), whose return value is returned as is.The equation-system driver is untouched (its method is now restricted to
AbstractEquationSystemDiscretization, which was the only concrete case). NeuralPDE implements these hooks in its rewrite PR. Version 0.1.35 → 0.1.36.Verification
New
test/optimization_driver.jlwith a minimal recording discretization, including an interior conditionu(0.5, x) ~ 0that the boundary-map parser would reject.GROUP=Core julia --project -e 'using Pkg; Pkg.test()'on Julia 1.11.9:Before the change the same test errors because
symbolic_discretizeruns the equation-system driver on the optimization discretization (get_eqvarreturnsnothingandivs(nothing, v)fails), and the interior condition trips the boundary assertion inparse_bcs.Not verified
QA group, Julia 1.10 and downstream (MethodOfLines) were not run locally; the equation-system path is unchanged apart from the method signature restriction.
🤖 Generated with Claude Code (model: claude-fable-5-1)
https://claude.ai/code/session_01WYPUXLxE9jVu2jXLFRd8ax