Skip to content

Conversation

@thartland
Copy link
Contributor

@thartland thartland commented Sep 8, 2025

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.

  • create a contact NLMCProblem and pass it to the HomotopySolver.
  • 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
  • More verbose function defs for serac wrapper of problems so things are more easily understood by others.
  • 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.
  • 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.
  • 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 thartland added the WIP Work in progress label Sep 8, 2025
@codecov-commenter
Copy link

codecov-commenter commented Sep 9, 2025

Codecov Report

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

Files with missing lines Patch % Lines
src/serac/physics/contact_constraint.hpp 1.38% 71 Missing ⚠️
src/serac/physics/constraint.hpp 0.00% 2 Missing ⚠️
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%) ⬇️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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

// note: Tribol does not use cycle.
int cycle = 0;
contact_.update(cycle, time, dt);
if (new_point) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

what does point mean in this context? Is this checking if we need to updating things in Tribol again because contact interactions may have changed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Precisely. Like is the point that we are doing such and such computations at a "new_point" or was it "seen" in the previous call. This flag is intended to allow caching contact mechanics computations.

Copy link
Member

Choose a reason for hiding this comment

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

Thanks for the explanation. Can you make the name more clear and specific? new_point is too vague. "point" makes me think of points in space. It might help to make the name an imperative statement, like "refresh_contact_search" or something like that.

Copy link
Contributor Author

@thartland thartland Dec 19, 2025

Choose a reason for hiding this comment

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

@btalamini I used "fresh_evaluation" to not be so vague as "point"/"new_point". I didn't want to use "refresh_contact_search" as this language is specific for contact but caching constraint evaluations/constraint Jacobian evaluations can be done in applications other than contact.

@tupek2 tupek2 requested a review from btalamini December 5, 2025 20:33
// note: Tribol does not use cycle.
int cycle = 0;
contact_.update(cycle, time, dt);
if (new_point) {
Copy link
Member

Choose a reason for hiding this comment

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

Thanks for the explanation. Can you make the name more clear and specific? new_point is too vague. "point" makes me think of points in space. It might help to make the name an imperative statement, like "refresh_contact_search" or something like that.

@white238
Copy link
Member

Approved after minor nitpicks but there is a conflict.

thartland and others added 10 commits December 19, 2025 08:54
… specifically limited to contact mechanics applications, ^T --> ^Transpose to also be more descriptive/clear/specific
…smith into hartland1/feature/contact-homotopy
…smith into hartland1/feature/contact-homotopy
…stent for both inertia relief and two block contact. However, tribol and weak_form have different call strutures. Constraint conforms to Tribol and we use accessor functions time() and dt() from TimeInfo struct to tribol call structure via constraint class
@thartland thartland requested a review from btalamini December 19, 2025 21:54
@btalamini btalamini merged commit 31b6466 into develop Dec 22, 2025
10 checks passed
chapman39 pushed a commit that referenced this pull request Dec 29, 2025
chapman39 pushed a commit that referenced this pull request Dec 29, 2025
chapman39 pushed a commit that referenced this pull request Dec 29, 2025
chapman39 pushed a commit that referenced this pull request Dec 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready for review Ready for active inspection by reviewers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants