Conversation
There was a problem hiding this comment.
🟡 Changes recommended
A user-facing CLI/behavior change needs an [Unreleased] entry in RELEASE-NOTES.md (and there are a couple of small correctness/cleanup issues to address).
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Adds support and coverage for EnergyMortar gap enforcement at quadrature points (vs nodal), strengthens adjoint correctness checks via finite differences, and refactors a few numerics/contact internals to support these workflows.
Changes:
- Parameterized multiple contact/Tribol tests (and an example) to run with both nodal and quadrature-point gap evaluation.
- Updated contact reference-coordinate handling to use a shape-displaced reference mesh for EnergyMortar exact Jacobians, and adjusted pressure/state handling accordingly.
- Extracted dogleg-step selection into
steihaug_toint_cgutilities and added robustness when a preconditioner is not positive-definite.
File summaries
| File | Description |
|---|---|
| src/smith/physics/tests/tribol_finite_diff.cpp | Parameterize EnergyMortar FD test by gap enforcement location. |
| src/smith/physics/tests/test_adjoint_workflow.cpp | Add finite-difference adjoint validation and expand contact test cases. |
| src/smith/physics/tests/energy_mortar_patch.cpp | Parameterize EnergyMortar patch test by gap enforcement location. |
| src/smith/physics/tests/contact_finite_diff.cpp | Parameterize 2D EnergyMortar FD test by gap enforcement location. |
| src/smith/physics/solid_mechanics_contact.hpp | Refactor/extend adjoint-load assembly for per-interaction contact-force seeds and shape sensitivity. |
| src/smith/physics/contact/contact_interaction.hpp | Update ContactInteraction API/docs for shaped-reference coordinates. |
| src/smith/physics/contact/contact_interaction.cpp | Register shaped reference coords for EnergyMortar exact Jacobian path. |
| src/smith/physics/contact/contact_data.hpp | Add stored shaped-reference coordinate field. |
| src/smith/physics/contact/contact_data.cpp | Maintain shaped reference coords, and avoid pressure-state resets/sets where EnergyMortar doesn’t expose an independent pressure state. |
| src/smith/numerics/tests/test_steihaug_toint_cg.cpp | Add tests for non-positive preconditioner fallback and dogleg selection behavior. |
| src/smith/numerics/steihaug_toint_cg.hpp | Expose doglegStep helper in numerics API. |
| src/smith/numerics/steihaug_toint_cg.cpp | Implement doglegStep and add CG fallback when the preconditioner yields non-positive inner products. |
| src/smith/numerics/equation_solver.cpp | Switch TrustRegion dogleg selection to the shared smith::doglegStep utility. |
| examples/contact/ironing_2D.cpp | Add CLI flag to select EnergyMortar gap mode and propagate to Tribol enforcement location. |
Review details
- Files reviewed: 15/15 changed files
- Comments generated: 3
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| * @param contact_opts Defines contact method, enforcement, type, and penalty | ||
| * coordinates |
There was a problem hiding this comment.
Actually, I think the stray "coordinates" was orphaned from the previous function parameter. That is, it belongs on the end of line 49. @ebchin, can you confirm?
| #include "smith/physics/materials/solid_material.hpp" | ||
| #include "smith/smith_config.hpp" | ||
| #include "smith/infrastructure/application_manager.hpp" | ||
| #include "tribol/mesh/CouplingScheme.hpp" | ||
| #include "tribol/interface/tribol.hpp" |
btalamini
left a comment
There was a problem hiding this comment.
This changes the behavior of our core solver. Please don't merge this until we've talked about it.
| * @param contact_opts Defines contact method, enforcement, type, and penalty | ||
| * coordinates |
There was a problem hiding this comment.
Actually, I think the stray "coordinates" was orphaned from the previous function parameter. That is, it belongs on the end of line 49. @ebchin, can you confirm?
fa70f4a to
2cca592
Compare
Also add FD testing to test_adjoint_workflow and finding related bugs.