serac icon indicating copy to clipboard operation
serac copied to clipboard

Contact-Homotopy

Open thartland opened this issue 4 months ago • 2 comments

The purpose of this PR is to add the ability to solve (tied) contact problems with the homotopy solver.

Tribol calls are wrapped in a constraint object which will define a NLMCProblem which is the object that the homotopy solver acts on.

Another addition of this PR is the complete avoidance of delete and replacing usage of raw pointers with std::unique_ptr in inertia relief and tied contact problem EqualityConstrainedHomotopyProblem's

Removing finite difference check task as such a check will only pass if we compile with enzyme and enable exact derivatives.

  • [X] create a contact NLMCProblem and pass it to the HomotopySolver.
  • [X] Have complementarity problems return Operator* instead of HypreParMatrix* to support a wider range of applications wherein the Operators are not assembled. Caveat: more work is needed for the HomotopySolver to fully support other operator types
  • [X] More verbose function defs for serac wrapper of problems so things are more easily understood by others.
  • [X] ~~Utilize exceptions from Tribol compuations to signal bad contact computations to the solver and to reduce solver step length parameters. (Currently via a branch of Tribol)~~. While exceptions are now in place they are not being explicitly used in this PR as with "milder" homotopy solver parameters the nonlinear iterates do not vary so wildly as to require the exceptions that are only available via a specific Tribol branch.
  • [X] Given updates to algorithmic parameters to the HomotopySolver is it still necessary to catch contact mechanics computation errors for the contact mechanics application problem? This will potentially impact the PR making it being able to merge into master dependent on if we update Tribol. Answer: it is not strictly necessary to catch Tribol contact mechanics errors for the two_block example that runs with the Homotopy solver.
  • [X] Hide the infastructure needed to utilize "fixed" and "displacement" ess_tdof_list's. That is the "user" need just pass the ess_tdof_list's and the ContinuationSolver problem class should just take care of things. As is the "user" shouldn't need to construct prolongation_ and restriction_ mfem::HypreParMatrix's as in the current implementation of examples/contact/homotopy/two_blocks.cpp.

For a future PR: (1) finish work begun here to cache contact mechanics function calls and (2) update the manner in which we do Dirichlet BC's. Currently we eliminate essential/displacement dofs and only expose the reduced linear system to the Homotopy solver. This has implications for the linear solvers used, such as AMG with SystemsOptions.

thartland avatar Sep 08 '25 20:09 thartland

Codecov Report

:x: Patch coverage is 1.35135% with 73 lines in your changes missing coverage. Please review. :white_check_mark: Project coverage is 91.82%. Comparing base (db9409c) to head (604d8f7). :warning: Report is 15 commits behind head on develop.

Files with missing lines Patch % Lines
src/serac/physics/contact_constraint.hpp 1.38% 71 Missing :warning:
src/serac/physics/constraint.hpp 0.00% 2 Missing :warning:
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1463      +/-   ##
===========================================
- Coverage    92.03%   91.82%   -0.21%     
===========================================
  Files          199      200       +1     
  Lines        25212    25277      +65     
===========================================
+ Hits         23203    23210       +7     
- Misses        2009     2067      +58     
Flag Coverage Δ
unittests 91.82% <1.35%> (-0.21%) :arrow_down:

Flags with carried forward coverage won't be shown. Click here to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

codecov-commenter avatar Sep 09 '25 03:09 codecov-commenter

Approved after minor nitpicks but there is a conflict.

white238 avatar Dec 16 '25 01:12 white238