Skip to content

Add backtracking to ElementJacobianDamper#32807

Open
Andreas-Lepak wants to merge 3 commits intoidaholab:nextfrom
Andreas-Lepak:element-jacobian-damper-backtracking
Open

Add backtracking to ElementJacobianDamper#32807
Andreas-Lepak wants to merge 3 commits intoidaholab:nextfrom
Andreas-Lepak:element-jacobian-damper-backtracking

Conversation

@Andreas-Lepak
Copy link
Copy Markdown
Collaborator

refs #32806

Reason

ElementJacobianDamper already limits large element Jacobian changes on the displaced mesh, but
its probe path can still encounter a degenerate map when the full trial Newton update inverts an
element. In that case the solve falls back to a timestep cutback instead of trying a smaller
nonlinear update first.

This change adds an opt-in backtracking mode so the damper can reduce the probed update before FE
assembly reaches a DegenerateMap.

Design

  • Add optional use_backtracking, backtrack_factor, and max_backtrack_steps parameters to
    ElementJacobianDamper.
  • Refactor the damper probe into a helper that tests a damped trial update and reports the maximum
    relative JxW change.
  • Treat degenerate-map exceptions during the probe as a signal that the trial damping is too large,
    then iteratively reduce the trial damping until the probe succeeds and the Jacobian increment is
    below max_increment.
  • Always restore displaced node coordinates after a failed probe so the damper does not leave the
    displaced mesh in a modified state.
  • Add a regression test covering the new backtracking path and update the damper documentation.

Impact

This is a backward-compatible enhancement to ElementJacobianDamper.

  • Existing input files are unchanged unless they opt into use_backtracking = true.
  • The new mode improves robustness for large-displacement solves that would otherwise fail probing a
    nonlinear update due to temporary element inversion.
  • No existing APIs are removed or changed incompatibly.

Testing

  • Ran exception_handling.i without backtracking to confirm the existing negative-Jacobian path is
    preserved.
  • Ran exception_handling.i with Dampers/jac/use_backtracking=true to confirm the damper now
    reduces the update without emitting the negative-Jacobian error.
  • Ran git diff --check.

@moosebuild
Copy link
Copy Markdown
Contributor

Job Precheck, step Clang format on b97b5c9 wanted to post the following:

Your code requires style changes.

A patch was auto generated and copied here
You can directly apply the patch by running, in the top level of your repository:

curl -s https://mooseframework.inl.gov/docs/PRs/32807/clang_format/style.patch | git apply -v

Alternatively, with your repository up to date and in the top level of your repository:

git clang-format dba0fc8d126cb8a0d6b4e8eabf8b390a09e4aa91

@Andreas-Lepak Andreas-Lepak force-pushed the element-jacobian-damper-backtracking branch from b97b5c9 to 4b96447 Compare April 22, 2026 20:07
@moosebuild
Copy link
Copy Markdown
Contributor

moosebuild commented Apr 22, 2026

Job Documentation, step Docs: sync website on e46bda2 wanted to post the following:

View the site here

This comment will be updated on new commits.

@Andreas-Lepak Andreas-Lepak force-pushed the element-jacobian-damper-backtracking branch from 4b96447 to 8133965 Compare April 22, 2026 23:45
  - add opt-in backtracking parameters
  - retry damped trial updates after DegenerateMap
  - restore node coordinates after failed probes
  - add regression coverage and documentation

  refs idaholab#32806
@Andreas-Lepak Andreas-Lepak force-pushed the element-jacobian-damper-backtracking branch from 8133965 to 28794bd Compare April 23, 2026 14:31
@moosebuild
Copy link
Copy Markdown
Contributor

moosebuild commented Apr 23, 2026

Job Coverage, step Generate coverage on e46bda2 wanted to post the following:

Framework coverage

Coverage did not change

Modules coverage

Solid mechanics

5b391d #32807 e46bda
Total Total +/- New
Rate 85.38% 85.37% -0.02% 100.00%
Hits 28595 28635 +40 86
Misses 4896 4909 +13 0

Diff coverage report

Full coverage report

Full coverage reports

Reports

This comment will be updated on new commits.

@Andreas-Lepak Andreas-Lepak marked this pull request as ready for review April 23, 2026 18:09
Comment thread modules/solid_mechanics/doc/content/source/dampers/ElementJacobianDamper.md Outdated
Comment thread modules/solid_mechanics/src/dampers/ElementJacobianDamper.C Outdated
"use_backtracking",
false,
"If true, iteratively cut back the probed Newton update until the displaced mesh remains "
"nondegenerate and the Jacobian increment stays within max_increment.");
Copy link
Copy Markdown
Contributor

@GiudGiud GiudGiud Apr 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the Jacobian update will always be within max_increment if it starts within max incremenent? How would you exceed by further cutting back?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is for recovering from a trial that is either degenerate or still over the Jacobian-change limit.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isnt the "over the Jacobian-change limit" simply handled by scaling the update by the ratio of the limit to the current value?

Comment thread modules/solid_mechanics/src/dampers/ElementJacobianDamper.C Outdated
Comment thread modules/solid_mechanics/src/dampers/ElementJacobianDamper.C Outdated
Comment thread modules/solid_mechanics/src/dampers/ElementJacobianDamper.C

unsigned int has_exception = _fe_problem.hasException() ? 1 : 0;
_communicator.max(has_exception);
if (has_exception)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure I understand this
add a comment please? why is an exception ok for returning a damping factor

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added comment
// The exception flag will abort the nonlinear step after the damper returns, so return the
// last trial damping only to satisfy the interface.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and we know this exception is not one such that backtracking the damping would remove it?

Real max_difference = 0.0;
bool valid = false;

PARALLEL_TRY { valid = probe_trial(damping, max_difference, error_message); }
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

valid is a boolean but this routine can be returning "_max_jacobian_diff / max_difference;" ?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probe_trial should now return bool. The lambda ends with: return !invalid_local; and !invalid_local is a boolean expression, so probe_trial(...) cannot return _max_jacobian_diff / max_difference.

Comment on lines +184 to +188
if (!valid)
damping *= _backtrack_factor;
else
damping =
std::min(damping * _backtrack_factor, damping * _max_jacobian_diff / max_difference);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's rename valid to make it obvious it's actually a criteria for reducing the damping factor

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is now renamed trial_nondegenerate

Andreas-Lepak and others added 2 commits May 3, 2026 06:47
Co-authored-by: Guillaume Giudicelli <guillaume.giudicelli@gmail.com>
@GiudGiud GiudGiud force-pushed the element-jacobian-damper-backtracking branch from 9df72f7 to e46bda2 Compare May 3, 2026 12:48
@GiudGiud
Copy link
Copy Markdown
Contributor

GiudGiud commented May 3, 2026

Test failure is unrelated
I fixed up the commit history

@moosebuild
Copy link
Copy Markdown
Contributor

Job Test, step Results summary on e46bda2 wanted to post the following:

Framework test summary

Compared against 5b391df in job civet.inl.gov/job/3787211.

No added tests

Run time changes

Test Base (s) Head (s) +/- Base (MB) Head (MB)
problems/reference_residual_problem.zero_tolerance_ref 3.97 6.00 +51.00% 147.95 132.46

Modules test summary

Compared against 5b391df in job civet.inl.gov/job/3787211.

Added tests

Test Time (s) Memory (MB)
solid_mechanics/test:jacobian_damper.backtrack_negative_jacobian 1.25 121.30

Run time changes

Test Base (s) Head (s) +/- Base (MB) Head (MB)
stochastic_tools/test:web_server_control.stochastic_control/batch_reset_multi 2.33 3.85 +65.15% 247.32 252.97
solid_mechanics/test:smeared_cracking.rz_exponential 11.03 18.05 +63.70% 126.14 136.79
solid_mechanics/test:rate_independent_cyclic_hardening.nonlin_isokinharden_symmetric_strain_controlled 10.13 16.18 +59.68% 150.94 146.96
solid_mechanics/test:rate_independent_cyclic_hardening.linear_kinharden_nonsymmetric_stress_controlled 4.34 6.81 +56.82% 122.60 131.24
solid_mechanics/test:combined_creep_plasticity.creepWithPlasticity 5.24 8.18 +56.06% 121.92 120.96
combined/test:combined_plasticity_temperature.ad_temp_dep_yield-jac 6.55 10.17 +55.23% 173.21 179.24
stochastic_tools/test:transfers/sampler_reporter.transfer/normal 6.76 10.47 +54.88% 158.47 167.83
solid_mechanics/test:beam/static.euler_finite_rot_y 3.11 4.80 +54.22% 126.28 132.36
solid_mechanics/test:rate_independent_cyclic_hardening.nonlin_kinharden_nonsymmetric_strain_controlled 5.80 8.94 +54.19% 130.95 143.58
solid_mechanics/test:rate_independent_cyclic_hardening.1D_ratcheting_nonlin_kinharden_stress_controlled 3.73 5.72 +53.40% 116.25 120.16
solid_mechanics/test:rate_independent_cyclic_hardening.nonlin_kinharden_symmetric_strain_controlled 4.70 7.19 +53.05% 126.33 126.65
solid_mechanics/test:beam/static.euler_finite_y_with_action 3.13 4.77 +52.36% 121.64 126.71
solid_mechanics/test:combined_creep_plasticity.combined_start_time 5.72 8.70 +52.29% 118.07 126.05
solid_mechanics/test:torque_reaction.disp_about_axis_axial_motion_delayed 2.02 3.08 +52.26% 114.45 116.21
stochastic_tools/test:transfers/sampler_reporter.transfer/distributed 3.27 4.97 +52.13% 472.19 511.28
solid_mechanics/test:smeared_cracking.cracking_rotation_pres_dir_z 3.87 5.86 +51.44% 132.21 142.19
solid_mechanics/test:smeared_cracking.cracking_rotation_pres_dir_x 3.82 5.78 +51.35% 136.85 139.61
solid_mechanics/test:rate_independent_cyclic_hardening.linear_kinharden_symmetric_strain_controlled 4.83 7.30 +51.12% 144.16 132.52
solid_mechanics/test:temperature_dependent_hardening.test 2.17 3.27 +50.50% 121.70 120.73
solid_mechanics/test:rate_independent_cyclic_hardening.nonlin_isoharden_symmetric_strain_controlled 3.37 5.07 +50.33% 126.03 131.29
solid_mechanics/test:dynamics/acceleration_bc.acceleration_bc 3.47 5.21 +50.28% 135.66 137.12
solid_mechanics/test:smeared_cracking.xyz 2.82 4.24 +50.27% 129.79 137.52

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants