Allow the use of substeps for CRAM#3908
Conversation
Splitting a CRAM step into identical substeps and reusing LU
factorizations improves accuracy for nuclides with large λ·dt
while adding negligible computational cost.
This particularly improves accuracy for nuclides approaching zero,
where a single-step CRAM can undershoot to negative atom densities,
and then oscillate about zero.
- IPFCramSolver accepts substeps parameter (default 1)
- substeps=1 uses original spsolve path (bitwise identical)
- substeps>1 pre-computes LU via splu, reuses across substeps
- Integrator/SIIntegrator accept substeps parameter
- 4 new unit tests: default, bitwise match, two-half-steps,
CRAM16 self-convergence
Reference: Isotalo & Pusa, "Improving the Accuracy of the
Chebyshev Rational Approximation Method Using Substeps,"
Nucl. Sci. Eng., 183:1, 65-77 (2016).
paulromano
left a comment
There was a problem hiding this comment.
Thanks a lot for proposing this @yrrepy. I'm in favor of adding the ability to use substeps since it is well backed by the paper you mentioned and I see it is an option in Serpent. The PR conflates two changes right now though: adding substeps but also switching from spsolve to splu. This was originally proposed in #2703 and I think everyone was mostly on board. So I'd suggest we try to resolve any remaining issues with #2703 and get that merged first and then consider the substeps separately.
|
To riposte, the switch to To frame it another way: Rather than a conflation, a different goal, substeps, which happens to benefit from a similar strategy. An alternative: proceed with this PR, and afterwards refactor the below to |
|
Understood, I did see that the use of |
|
Quick update: see my comment on #2703 (review) regarding the use of |
paulromano
left a comment
There was a problem hiding this comment.
@yrrepy I did some refactoring here, mostly to change how substeps was passed through. To the user, it looks the same (as an argument on Integrator) but internally it is passed directly to the IFPCramSolver.__call__ method (rather than its constructor) to avoid having to create a separate instance for the sake of using different substeps. If you're good with the changes I made, I'd say we're good to merge!
|
Looks good to Perry, thanks for towing this across Paul! It'd be great if we could get some others to test this and confirm for their cases that it reduces negatives (with and without the zero clip). And that performance impact is negligible. |
Description
As part of my continuing battle against OpenMC deplete producing negative atom results and oscillations about zero.
This PR adds a substeps parameter to Integrator and SIIntegrator that subdivides each depletion interval into identical sub-intervals, reusing LU factorizations across them. This improves CRAM accuracy for nuclides with large λ·dt products — particularly those depleting toward zero, where single-step CRAM can undershoot to negative atom densities.
The implementation follows:
Isotalo & Pusa (2016), "Improving the Accuracy of the Chebyshev Rational Approximation Method Using Substeps," Nucl. Sci. Eng., 183:1, 65-77. https://doi.org/10.13182/NSE15-67
This addresses the same problem as #3879, but does it through improvements to solver numerical accuracy (step approximation error).
The two are complementary. Clip would be a safety net, and a nice cleanup of low atoms.
Substeps is invoked with:
The default is left as substeps=1 (no substeps).
Personally, in future workflows with both PRs in, I would likely use both
substeps=2, clip_min_atom_density=1e-20. As an improvement in numerical accuracy and a full-guard against negative atoms.Similar script to #3879
demo.py
Here with substeps=2
Attached in a zip (actually a .xz) are two further synthetic benchmarks that demonstrate the improvements.
substeps_synthetic-benchmarks.zip
They also demonstrate the near zero impact on calculation performance (with an MC inspired FOM).
The error is with respect to the case with fine explicit steps.
One can see from these results, despite improved behaviour, negatives that persist and could be cleaned up with the clip.
Checklist