Skip to content

Add get_system_unknowns so discretizers can keep array-valued unknowns - #124

Merged
ChrisRackauckas merged 1 commit into
SciML:masterfrom
ChrisRackauckas-Claude:agent/mol-695-system-unknowns
Sep 23, 2026
Merged

ChrisRackauckas merged 1 commit into
SciML:masterfrom
ChrisRackauckas-Claude:agent/mol-695-system-unknowns

Conversation

@ChrisRackauckas-Claude

@ChrisRackauckas-Claude ChrisRackauckas-Claude commented Sep 23, 2026 •

Copy link
Copy Markdown
Member

Note: Please ignore this draft until reviewed by @ChrisRackauckas.

What changed and why

generate_system built the unknown list of the generated System by flattening get_discvars(s) into its scalar entries, which forces one unknown per grid point. This adds the hook get_system_unknowns(s::AbstractDiscreteSpace), whose default is exactly that flattening, and makes generate_system use it. A discretizer that represents each dependent variable as one array variable (u(t)[1:n]) can override the hook to return those arrays, so unknowns(sys) no longer grows with the grid; the scalar entries of get_discvars keep indexing into them for stencils and boundary/initial conditions. MethodOfLines does this in SciML/MethodOfLines.jl#695 (companion PR linked below). Version 0.1.36 → 0.1.37; the ModelingToolkitBase lower bound moves 1.69 → 1.72 because the new test builds a problem from a completed system with an array unknown, which needs SciML/ModelingToolkit.jl#5131.

The name is public (@public), documented in docs/src/interface.md and docs/src/api.md, and covered by test/public_api.jl and the new test/system_unknowns.jl (default hook flattens; an overriding space yields one unknown; ODEProblem from both completed systems gives the same u0 and RHS).

Verification

Julia 1.11.9, ModelingToolkitBase 1.76.0, SciMLBase 3.55.0, Symbolics 7.40.1 (amdci2).

$ GROUP=Core julia +1.11 --project=. -e 'using Pkg; Pkg.instantiate(); Pkg.test()'
Test Summary:       | Pass  Total   Time
Core/alloc_tests.jl |   12     12  20.3s
Core/array_variables.jl |   11     11  5.8s
Core/discrete_initialization.jl |   18     18  7.7s
Core/docs_project.jl |    1      1  0.0s
Core/interface.jl |   25     25  11.4s
Core/optimization_driver.jl |   11     11  0.9s
Core/public_api.jl |   49     49  2.2s
Core/system_tspan.jl |    5      5  1m11.7s
Core/system_unknowns.jl |    7      7  6.6s
     Testing PDEBase tests passed
$ GROUP=QA julia +1.11 --project=. -e 'using Pkg; Pkg.test()'
Test Summary: | Pass  Total     Time
QA/qa.jl      |   20     20  1m27.4s
     Testing PDEBase tests passed

Docs (julia +1.11 --project=docs -e 'using Pkg; Pkg.develop(path="."); Pkg.instantiate(); include("docs/make.jl")') build to completion with checkdocs = :exports and doctest = true; the only warning is Documenter skipping deployment outside CI. Runic and typos are clean on the changed files.

Not verified

  • Julia LTS / pre and 32-bit CI legs (only 1.11 x86_64 run locally).
  • Any downstream package other than MethodOfLines (verified in the companion PR).

For the reviewer

  • Naming: get_system_unknowns sits next to get_discvars; a different name is a one-line change in both PRs.
  • The MTKBase compat bump to 1.72 is driven by the test, not by PDEBase's own code.

Companion PR: MethodOfLines implements the hook in SciML/MethodOfLines.jl#701.

Part of SciML/MethodOfLines.jl#695.

🤖 Generated with Claude Code 2.1.280 (model: claude-fable-5-1); local session, transcript at /home/crackauc/sandbox/agent-jobs/MethodOfLines.jl/jobs/695-claude/log.txt on amdci2.julia.csail.mit.edu

`generate_system` built the unknown list by flattening `get_discvars` into
its scalar entries, which forced one unknown per grid point. The new
`get_system_unknowns(s)` hook returns the unknowns of the generated
system; its default is the old flattening, and a discretizer that
represents each dependent variable as one array variable can override it
to return those arrays.

Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Claude <[email protected]>
Agent-Harness: Claude Code 2.1.280
Agent-Model: claude-fable-5-1
Agent-Session: local session, transcript at /home/crackauc/sandbox/agent-jobs/MethodOfLines.jl/jobs/695-claude/log.txt on amdci2.julia.csail.mit.edu
@ChrisRackauckas
ChrisRackauckas marked this pull request as ready for review September 23, 2026 22:52
@ChrisRackauckas
ChrisRackauckas merged commit 7853500 into SciML:master Sep 23, 2026
26 checks passed
ChrisRackauckas referenced this pull request Sep 24, 2026
* Support Complex-typed dependent variables in PDE splitting

Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Codex <[email protected]>
Agent-Harness: Codex CLI 0.156.1
Agent-Model: gpt-6-sol
Agent-Session: local session, transcript at /home/crackauc/sandbox/agent-jobs/PDEBase.jl/jobs/130-codex/log.txt on amdci2.julia.csail.mit.edu

* Document Complex field declarations and bump patch version

Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Codex <[email protected]>
Agent-Harness: Codex CLI 0.156.1
Agent-Model: gpt-6-sol
Agent-Session: local session, transcript at /home/crackauc/sandbox/agent-jobs/PDEBase.jl/jobs/130-codex/log.txt on amdci2.julia.csail.mit.edu

* Clarify mixed field limitation and test production split order

Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Codex <[email protected]>
Agent-Harness: Codex CLI 0.156.1
Agent-Model: gpt-6-sol
Agent-Session: local session, transcript at /home/crackauc/sandbox/agent-jobs/PDEBase.jl/jobs/130-codex/log.txt on amdci2.julia.csail.mit.edu

---------

Co-authored-by: ChrisRackauckas-Claude <[email protected]>
Co-authored-by: Codex <[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.

2 participants