B&S2026 Figure 2 backend comparison
Please start work on TASK-024.
TASK-024 is now In Progress and assigned to @pi.
It already has an implementation plan. I’ll proceed with that plan unless you want changes:
- Validate curated Python/AUTO/LOCA Figure 2 outputs and provenance.
- Define canonical log-w comparison grid while preserving raw backend grids.
- Compute backend differences, Hopf estimates, three-real intervals, regime/stability counts.
- Attempt or explicitly defer Figure 2 digitization with uncertainty notes.
- Generate headline Figure 2 reproduction plot.
- Update Episode 5 README and run repository tests.
Go ahead please.
Completed TASK-024 and marked it Done.
Key changes:
- Added
episodes/005-figure2-eigenvalues/scripts/compare_figure2_eigenvalues.py - Generated integrated artifacts in:
episodes/005-figure2-eigenvalues/outputs/figure2_backend_comparison/- Added tests:
tests/test_episode5_backend_comparison.py- Updated Episode 5 README with final commands, artifact paths, methods, limitations, and digitization deferral notes.
Show remaining 3 lines
Verification:
uv run pytest -q- Result:
72 passed, with 1 existing overflow warning in the Python Figure 2 smoke test.
OK, looks good. Please commit the changes.
Committed changes.
Commit:
7b337fb Produce integrated Figure 2 backend comparison
Working tree is clean.
A question: the LOCA code doesn't seem to be using any LOCA or NOX features at all. Is that because the model is just too simple to justify it?
Yes — that’s basically right, with one important caveat.
The current “LOCA” backend is really a Trilinos-side C++ backend, not a full LOCA/NOX continuation implementation. It uses:
Sacadofor backend-side physical Jacobian derivatives:loca/include/.../model.hppTeuchos::LAPACKfor dense eigenvalues via GEEV:loca/src/model_cli.cpp- Trilinos build/link plumbing:
loca/CMakeLists.txt
But it does not appear to use LOCA continuation objects or NOX nonlinear-solver abstractions.
Show remaining 12 lines
Why that’s reasonable here:
- The model state is only 3D:
(n, q, s). - Figure 2 is a prescribed sweep over
w, not a hard fold-following continuation problem. - A simple Newton solve on each log-
wgrid point is enough. - The scientific comparison target is the physical ODE Jacobian eigenvalues, not LOCA’s internal continuation machinery.
- Using full LOCA/NOX would add a lot of interface code without changing the numerical result much for this case.
But the caveat: calling it “LOCA” is slightly misleading if we mean “uses LOCA/NOX features.” A more precise description is:
“C++/Trilinos backend using Sacado and Teuchos/LAPACK, structured as future LOCA infrastructure.”
If the goal is to genuinely exercise LOCA, a follow-up task would need to wrap the residual in NOX/LOCA interfaces and use LOCA parameter continuation in log_w. For the current Figure 2 artifact, though, the simpler Trilinos-side implementation is justified.
OK, I think that makes sense. What we're going to do is work through some more tasks using Python, AUTO and this sort of "Trilinos-side C++ backend", and then after that, redo the C++ things as a "full NOX/LOCA" implementation to see how that looks. Does that seem like a reasonable approach? I'm interesting in seeing how LOCA looks for a simple understandable problem before trying to scale it up to something bigger.
Yes, that’s a very reasonable approach.
I’d frame it as a staged backend maturation plan:
- Python backend
- Fastest to inspect, debug, and validate scientific semantics.
- Best source of truth for model equations, plotting, diagnostics, and regression tests.
- AUTO backend
- Independent continuation-oriented check.
Show remaining 25 lines
- Useful for branch structure, folds/Hopf landmarks, and comparison against a mature continuation tool.
- Trilinos-side C++ backend
- C++ model port with Sacado Jacobians and Teuchos/LAPACK eigenvalues.
- Keeps the problem simple while validating C++ equations, units, state conventions, and eigenvalue semantics.
- Good bridge between Python/AUTO and real Trilinos infrastructure.
- Full NOX/LOCA implementation
- Once outputs are trusted, wrap the same simple problem in NOX/LOCA.
- Then you can compare:
- API complexity
- parameter-continuation setup
- Jacobian/residual interfaces
- diagnostics
- reproducibility
- what LOCA buys you versus hand-rolled continuation for a 3-variable model.
That’s especially sensible because the current model is small enough that LOCA is not “needed,” which makes it ideal pedagogically: if the full NOX/LOCA version becomes hard to understand, that difficulty is from the framework/interface, not the science.
I’d recommend being explicit in the docs/backlog terminology:
- Current backend: “Trilinos-side C++ backend” or “C++/Trilinos Sacado backend”
- Future backend: “full NOX/LOCA continuation backend”
That avoids overclaiming while preserving the current work as a useful stepping stone.
OK. Please update documentation to reflect that, and add a placeholder backlog issue for adding the full NOX/LOCA backend later on.
Updated documentation to distinguish:
- current backend: lightweight Trilinos-side C++ backend using Sacado + Teuchos/LAPACK
- future backend: full NOX/LOCA continuation implementation
Changed:
docs/REPRODUCTION_NOTES.mdepisodes/005-figure2-eigenvalues/README.mdepisodes/005-figure2-eigenvalues/docs/planning-decisions.md
Show remaining 5 lines
Created placeholder backlog task:
TASK-025 - Implement full NOX/LOCA backend for validated C++ model
I did not run tests since this was documentation/backlog-only.
Please commit the changes.
Committed.
Commits:
f422738 Create task TASK-025— created by Backlog CLI25d23fc Clarify Trilinos C++ backend staging— documentation updates
Working tree is clean.