Repository navigation
BUG: BroydenCorrector.refresh with no B or no previous surrogate - #346
Merged
Merged
Conversation
A first refresh with a sparse surrogate Jacobian now starts a LowRankJacobian (new BroydenCorrector max_rank, passed from TraceSettings.max_rank by trace_s_curve) instead of storing a bare sparse matrix the bordered solves cannot use. A refresh with Js=None keeps a dense B rather than failing on Jn - Js. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Two edge cases in
BroydenCorrector.refresh(matscipy.fracture_mechanics.continuation), found when a downstream driver (crackcell) switched to the matscipy continuation API and had to guard around them.Jnwas stored as a barescipy.sparsematrix, whichbordered_solveandtangentcannot use. It now starts aLowRankJacobian(Jn, max_rank=self.max_rank).BroydenCorrectortakes a newmax_rankargument (default 120, asLowRankJacobian), andtrace_s_curvepassesTraceSettings.max_rank.refresh(Jn, None, "projected"|"carry")on a dense B failed onJn - Js. B now stays as it is, since there is no surrogate change to merge, and only the update span restarts."reset"still sets B = Jn.trace_s_curveitself never hit either case, because it seeds B before the first refresh. The behaviour of existing traces is unchanged.Tests
tests/test_clamped_crack.py:test_first_refresh_with_a_sparse_jacobian_gives_a_low_rank_b: the SW sparse Jacobian gives aLowRankJacobianwith the corrector's max_rank, and the bordered solve and tangent work on it.test_refresh_without_a_previous_surrogate_keeps_b[projected, carry].All three failed before the fix.
test_clamped_crack.py,test_cubic_crystal_crack.py,test_rectilinear_anisotropic_crack.pyandtest_build_3D_crack.pygive 52 passed locally.🤖 Generated with Claude Code