Skip to content

Fix real-imaginary coupling in complex PDEs - #126

Merged
ChrisRackauckas merged 3 commits into
SciML:masterfrom
ChrisRackauckas-Claude:agent/125-complex-coupling
Sep 23, 2026
Merged

ChrisRackauckas merged 3 commits into
SciML:masterfrom
ChrisRackauckas-Claude:agent/125-complex-coupling

Conversation

@ChrisRackauckas-Claude

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

Copy link
Copy Markdown
Member

Complex equation normalization now preserves the real/imaginary coupling in already split equation pairs, distributes complex arithmetic across dependent fields, and declares the generated component fields real. A two-field PDEBase regression covers complex coefficients, field products, and boundary conditions; a scratch MethodOfLines phase test confirms the resulting Schrödinger evolution.

Verification

  • Before the fix, after adding the regression: GROUP=Core /home/crackauc/.juliaup/bin/julia +1.11 --project=. -e 'using Pkg; Pkg.test()' failed: Core/complex_splitting.jl | 1 pass 2 fail 3 total (exit 1).
  • With the fix: same Core command passed; tail: Core/complex_splitting.jl | 3 3 12.3s and Testing PDEBase tests passed.
  • GROUP=QA /home/crackauc/.juliaup/bin/julia +1.11 --project=. -e 'using Pkg; Pkg.test()': QA/qa.jl | 20 20 1m25.4s; Testing PDEBase tests passed.
  • Scratch MethodOfLines exact-phase reproducer with PDEBase master: Schroedinger phase and amplitude | 1 pass 1 fail 2 total (exit 1). With this branch: Schroedinger phase and amplitude | 2 2 1m43.7s.
  • Scratch MethodOfLines GROUP=Complex ... Pkg.test() with this branch: Complex | 47 pass 57 fail 104; the phase test passed 2/2 and complex-BC test passed 1/1, but the older Schrödinger magnitude test failed in 57 saved slices. The same group against PDEBase master had 103 pass and only the newly added phase assertion failed. Round 1 review confirmed that the old fixture’s loose default solver tolerance causes these failures; the recommended phase-sensitive fixture update belongs in MethodOfLines and is out of scope here.
  • Runic --check, typos src/make_pdesys_compatible.jl test/complex_splitting.jl, and git diff --check passed.
  • GitHub CI completed with all checks passing: Core on Julia 1/LTS/pre and x86, QA, docs, downgrade tests, formatting, spelling, both benchmarks, MethodOfLines downstream groups, and PDESystemLibrary Core.

Not verified

The PDEBase Everything group and a local docs build were not run. The GitHub docs build passed; docs were not changed. I did not modify or open a PR in MethodOfLines; its proposed test diff is in the job report.

Reviewer pushback

Round 1 review confirmed the 57 MethodOfLines legacy magnitude failures are caused by the fixture’s loose default solver tolerance. The separate MethodOfLines fixture update was not made in this PR. No test was weakened.

Round 1 N5/N6 follow-up: #129

Closes #125

Please ignore this draft until reviewed by @ChrisRackauckas.

🤖 Generated with Codex CLI 0.156.0 (model: gpt-6-luna); transcript: /home/crackauc/sandbox/agent-jobs/PDEBase.jl/jobs/125-codex/log.txt on amdci2.julia.csail.mit.edu

ChrisRackauckas and others added 3 commits September 23, 2026 00:12
Test complex coefficients, products between dependent fields, and duplicated real/imaginary boundary equations. The regression fails against the current normalization before the fix.

Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Codex <[email protected]>
Agent-Harness: Codex CLI 0.156.0
Agent-Model: gpt-6-luna
Agent-Session: local session, transcript at /home/crackauc/sandbox/agent-jobs/PDEBase.jl/jobs/125-codex/log.txt on amdci2.julia.csail.mit.edu
Retain ModelingToolkit's equation-pair grouping, reconstruct each complex residual, substitute real and imaginary dependent variables, then expand derivatives and complex products before splitting. Generate real-valued component variables and use the same residual split for complex boundary equations.

Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Codex <[email protected]>
Agent-Harness: Codex CLI 0.156.0
Agent-Model: gpt-6-luna
Agent-Session: local session, transcript at /home/crackauc/sandbox/agent-jobs/PDEBase.jl/jobs/125-codex/log.txt on amdci2.julia.csail.mit.edu
Split each side of complex equations independently so downstream symbolic consumers retain the equation form they expect.

Co-Authored-By: Chris Rackauckas <[email protected]>

Co-Authored-By: Codex <[email protected]>

Agent-Harness: Codex CLI 0.156.0

Agent-Model: gpt-6-luna

Agent-Session: local session, transcript at /home/crackauc/sandbox/agent-jobs/PDEBase.jl/jobs/125-codex/log.txt on amdci2.julia.csail.mit.edu
@ChrisRackauckas
ChrisRackauckas marked this pull request as ready for review September 23, 2026 05:46
@ChrisRackauckas
ChrisRackauckas merged commit c9f1da8 into SciML:master Sep 23, 2026
26 checks passed
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)
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]>
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.

Complex-valued PDE splitting drops the real/imaginary coupling (im*Dt(ψ) ~ Dxx(ψ) becomes 0 ~ Dxx(Reψ), Dt(Imψ) ~ 0)

2 participants