Skip to content

[GeoMechanicsApplication] geomechanics_residual_criteria - #14910

Open
markelov208 wants to merge 5 commits into
masterfrom
geo/14823-master-slave-constraints-workaround
Open

markelov208 wants to merge 5 commits into
masterfrom
geo/14823-master-slave-constraints-workaround

Conversation

@markelov208

Copy link
Copy Markdown
Contributor

created geomechanics_residual_criteria to avoid using kratos/utilities/constraint_utilities.cpp

@markelov208 markelov208 self-assigned this Oct 21, 2026
@markelov208
markelov208 requested a review from a team as a code owner October 21, 2026 09:57
@markelov208
markelov208 requested a balanced review from Copilot October 21, 2026 09:58

Copilot AI left a comment

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.

🟡 Changes recommended

Counting unreduced master residuals can prevent Newton–Raphson convergence at constrained equilibrium.

1 open issue
What changed in this PR

Introduces a GeoMechanics-specific residual criterion to replace the core constraint utility’s active-DOF masking.

Changes:

  • Keeps master DOFs active while excluding fixed and active slave DOFs.
  • Switches the convergence factory to the new criterion.
  • Adds a focused masking test.
File Description
applications/​GeoMechanicsApplication/​tests/​cpp_tests/​custom_utilities/​test_geomechanics_residual_criteria.cpp Tests fixed, master, and active/inactive slave masking.
applications/​GeoMechanicsApplication/​custom_utilities/​geomechanics_residual_criteria.hpp Implements application-specific residual masking.
applications/​GeoMechanicsApplication/​custom_utilities/​convergence_criteria_factory.hpp Selects the new residual criterion.

Review effort: Balanced

Copilot AI left a comment

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.

🟢 Approval recommended

The focused implementation and regression tests have no identified blocking issues; tests were not executed.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

@markelov208 markelov208 linked an issue Oct 21, 2026 that may be closed by this pull request

@WPK4FEM WPK4FEM left a comment

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.

Hi Gennady,
This indeed overrules the function that causes the zero count of D.o.F., but still marks master D.o.F. as inactive. That leads to the same ( in my eyes wrong ) behaviour.
Regards, Wijtze Pieter

for (const auto& r_constraint : rModelPart.MasterSlaveConstraints()) {
if (r_constraint.IsActive()) {
for (const auto& p_master_dof : r_constraint.GetMasterDofsVector()) {
this->mActiveDofs[p_master_dof->EquationId()] = 0;

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.

This marks the master D.o.F. as inactive, just like currently the Kratos::ConstraintUtilities::ComputeActiveDofs( ) and Kratos::ConstraintUtilities::DistributedComputeActiveDofs( ) do. With this I still end up with an empty list of active D.o.F. where I try to reduce a system to only active master D.o.F. and all other D.o.F. marked as slave D.o.F. As a result of that on line 200 of residual_criteria.h size_residual will become 0 and line 210 will be a division by zero.

@markelov208 markelov208 Oct 21, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thank you very much for the review. These lines are added due to the Copilot review on GeoMechanicsNewtonRaphsonStrategy. Now it is getting more clear. The updated version considers quasi_newton as constraint-reduced residual and keeps the original logic for raw RHS.

@markelov208
markelov208 requested a review from WPK4FEM October 21, 2026 13:28

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Core] Masters of Constraints are active D.o.F

3 participants