Repository navigation
Solvers: FEBio's line search in the Newton step - #11
Merged
Merged
Conversation
FELineSearch::DoLineSearch as written (after Bonet and Wood): a step along the Newton increment is accepted when |du . R(u + s du)| is at most lstol times |du . R(u)|; otherwise s is updated from a quadratic through the two values, at most lsiter times, after which the step with the smallest value seen is taken; a step below lsmin becomes 0.5; with ls_check_jacobians a step whose update fails is halved. The settings lstol, lsmin, lsiter and ls_check_jacobians are read from the input, with FEBio's defaults (0.9, 0.01, 5, off), so the line search is on by default as in FEBio; lstol = 0 gives full steps. The convergence norms with a shortened step follow FENewtonSolver::CheckConvergence. Checked against the FEBio test suite (stored step count, iteration count and solution norm): - sh58 (quad4 shells, dynamic, automatic time stepping): FEBio's 105 steps and 435 iterations, norm to 3e-7. Without the line search it left FEBio's path at step 15 and ended 2 percent away. On CUDA the count is 432, a rounding effect over 105 steps of threshold decisions; the test allows 5. - sh56: FEBio's 59 iterations exactly (64 before), norm to 4e-13. - di03 and sh06 now run (a negative Jacobian before) and agree on the norm to 3e-9 and 2e-7. All other comparisons are unchanged: where FEBio's line search stays at 1 it stays at 1 here. tests/test_line_search.py checks the function on scalar cases where what it should do can be stated exactly. Tested: quick tier on CPU; full tier on cuda:0 (Quadro RTX 8000). Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: Matthew Jolley <12954190+mattjolley@users.noreply.github.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.
What does this change, and why?
Adds FEBio's line search to the Newton step, as written in
FELineSearch::DoLineSearch(after Bonet and Wood). It is the piece of the nonlinear strategy that the comparisons with FEBio pointed to: suite problemsh58followed FEBio for 14 steps and left its path exactly where FEBio's line search first shortens a step, and the open mitral input stalled at leaflet closure without it. Design note: linear_solve.md (decision L6 and the settings table).Merged by the author so the work can continue, and left here as the record for review afterwards; comments on a merged pull request are welcome.
lstol,lsmin,lsiterandls_check_jacobiansare read from the input with FEBio's defaults (0.9, 0.01, 5, off), so the line search is on by default, as in FEBio.lstol0 gives full Newton steps.FENewtonSolver::CheckConvergence.Validation
tests/test_line_search.py(the function on scalar cases where its behavior can be stated exactly);tests/test_febio_suite.py(four more problems).986005f, the suite's stored step count, iteration count and solution norm.sh58(shells, dynamic, automatic time stepping): FEBio's 105 steps and 435 iterations, norm to 3e-7 (before: 106 steps, 449 iterations, norm 2 percent away).sh56: FEBio's 59 iterations (before: 64).di03andsh06: now run and agree on the norm to 3e-9 and 2e-7 (before: stopped on a negative Jacobian). All earlier comparisons are unchanged.cuda:0). On CUDAsh58takes 432 iterations where FEBio and the CPU take 435, a rounding effect over 105 steps of threshold decisions; the test allows a difference of 5 and says why. The full tier on CPU was not run for this change.Checklist
uvx pre-commit run --all-filespasses.WARP_FEBIO_TEST_LEVEL=full uv run -m unittest discover -s tests, and withWARP_FEBIO_TEST_DEVICE=cuda:0for code that runs on the device. (GPU: yes. CPU: quick tier only; the CI job runs the full tier on CPU.)git commit -s).🤖 Generated with Claude Code