Repository navigation
Conversation
…al region and add a one-shot adjoint k estimate.
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2 +/- ##
==========================================
+ Coverage 74.87% 81.49% +6.62%
==========================================
Files 10 12 +2
Lines 1190 2027 +837
==========================================
+ Hits 891 1652 +761
- Misses 299 375 +76 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…olve and its adjoints can use the exact discrete transpose, and estimate errors in normalized quantities of interest.
…ollect from the repository root.
bwhewe-13
marked this pull request as ready for review
October 17, 2026 18:20
This branch has not been deployed
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.
The per-cell polynomial fit on unstructured meshes fits each side of a material interface independently, and the two sides disagree by about the size of the scheme error. That is enough to throw off the estimate near interfaces (1.55-2.07x the true error on the triangle MMS test), and on multi-material cores the k estimate can come out with the wrong sign.
_spline_fit.pyfits one quintic tensor B-spline per connected material region, all regions and groups in one sparse least-squares solve, with weighted rows for flux and current continuity on interface faces and the Robin condition on boundary faces. Two configs:Knots are 2.5 shortest diffusion lengths apart, clipped to 2-3 cells.
API:
nearby_fixed_source/nearby_k_eigenvaluetakebc=and use the spline fit when it is given (fit="local"keeps the old one, and nothing changes for calls withoutbc).nearby_k_eigenvalue(adjoint_solver=...)addsk_error_adjointand the per-cellk_error_cells;nearby=Falseskips the nearby power iteration. Fixed-source fits use the corner config since only its interior rows can carry the source.NearbyKResultgets its new fields at the end with None defaults.Second part:
fv_operator.unstructured_operatorbuilds the unstructured solver's operator as a sparse matrix, including the deferred non-orthogonal correction, so a converged solve satisfies it to the solver tolerance. Two things use it:nearby_k_eigenvalue(method="direct")factorizes the operator once for the nearby power iteration and gets the adjoint for the k estimate from a bordered system instead of a second k solve. No fixed-source or adjoint solver needed. On 7k-15k cell meshes the whole estimate now takes about half a base solve (it was 1-2 base solves with SOR).nearby_qoiestimates the error in ratios of reaction-rate integrals (region powers, absorber rates) from a generalized adjoint, several at once off one factorization, and returns the per-cell contributions.The transpose has to be of the actual discrete operator. Running a solver on
make_adjoint_materialstransposes scatter and fission but not the least-squares gradient correction, which isn't symmetric, so on triangles and hexes adjoint-weighted estimates are off by 1-2% at every mesh size. On orthogonal quads the correction is zero and both agree.Also fixes
_xs_arraysreading a one-groupnusigfas a fission matrix, which broke one-groupnearby_k_eigenvalue.Checks: the fit is identical (to the bit) to the research version on IAEA, a curved rodded core, a slab and a disk. MMS: quads 1.000, triangles 1.04-1.07. The assembled operator matches the research version exactly and its assembly-power estimates agree to 1e-12% on IAEA triangles.
test_fv_operator.pychecks the matrix against fixed-source and k solves on regular and jittered meshes, that the one-shot QoI estimate equals a central difference of the perturbed problem, and that it tracks the nearby estimate. Full suite passes, docs build with -W.master is merged in, so this includes the round-off sweep stop from #1.