Skip to content

Enable coupled dof equation condition in 3d#1751

Open
m-frey wants to merge 1 commit into4C-multiphysics:mainfrom
m-frey:Enable-coupled-dof-equation-condition-in-3d
Open

Enable coupled dof equation condition in 3d#1751
m-frey wants to merge 1 commit into4C-multiphysics:mainfrom
m-frey:Enable-coupled-dof-equation-condition-in-3d

Conversation

@m-frey
Copy link
Contributor

@m-frey m-frey commented Feb 11, 2026

Description and Context

This PR enables PointLinearCoupledEquation constraints for 3D displacement coupling by adding support for the dispz degree of freedom. There are no additional test as the underlying functionality is already tested in 3d.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Enables PointLinearCoupledEquation constraints for 3D displacement coupling by introducing support for the dispz degree of freedom in both input validation and MPC assembly.

Changes:

  • Allow ADD: "dispz" in the DESIGN POINT COUPLED DOF EQUATION CONDITIONS input schema.
  • Map dispz to the third displacement DOF index when building linear MPC equations.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
src/constraint_framework/4C_constraint_framework_submodelevaluator_mpc.cpp Adds dispz DOF mapping for linear coupled equation MPC construction.
src/constraint_framework/4C_constraint_framework_input.cpp Extends the allowed ADD selection list to include dispz.
Comments suppressed due to low confidence (1)

src/constraint_framework/4C_constraint_framework_submodelevaluator_mpc.cpp:643

  • The exception message still says linear coupled equations are only implemented for 2D (dispx/dispy), but dispz is now accepted above. Update the error text to reflect the actual supported DOFs and (ideally) mention that dispz requires a 3D problem/RVE.
      FOUR_C_THROW(
          "Linear coupled equations (MPCs) are only implemented for 2D (dispx or dispy DOFs)");
    }

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +635 to +638
else if (dofStr == "dispz")
{
dofPos = 2;
}
Copy link

Copilot AI Feb 11, 2026

Choose a reason for hiding this comment

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

dispz is now mapped to dofPos = 2, but there is no guard that the current problem/RVE actually has a third displacement DOF. In a 2D setup, this will likely index discret_ptr_->dof(node)[2] out of range. Add a dimension/DOF-count check (e.g., based on rve_dim_ or discret_ptr_->dof(node).size()) and throw a clear error when dispz is used in 2D.

Copilot uses AI. Check for mistakes.
Comment on lines 110 to +114
Core::Conditions::PointLinearCoupledEquation, false, Core::Conditions::geometry_type_point);

linear_ce.add_component(parameter<int>("EQUATION", {.description = "EQUATION"}));
linear_ce.add_component(deprecated_selection<std::string>("ADD", {"dispx", "dispy", "undefined"},
{.description = "degrees of freedom", .default_value = "undefined"}));
linear_ce.add_component(
deprecated_selection<std::string>("ADD", {"dispx", "dispy", "dispz", "undefined"},
Copy link

Copilot AI Feb 11, 2026

Choose a reason for hiding this comment

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

The condition definition text right above still describes the coupled DOF equation as being for "2d", but the allowed DOFs now include dispz (3D). Please update the human-readable description so the input schema matches the actual capabilities and doesn't mislead users.

Copilot uses AI. Check for mistakes.
Comment on lines +113 to +115
linear_ce.add_component(
deprecated_selection<std::string>("ADD", {"dispx", "dispy", "dispz", "undefined"},
{.description = "degrees of freedom", .default_value = "undefined"}));
Copy link

Copilot AI Feb 11, 2026

Choose a reason for hiding this comment

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

Adding dispz changes supported input behavior, but there is no regression test covering a 3D DESIGN POINT COUPLED DOF EQUATION CONDITIONS term with ADD: "dispz". Consider adding a 3D integration test input (similar to tests/input_files/rve3d_periodic_bcs.4C.yaml, but including a PointLinearCoupledEquation section with dispz) and registering it in tests/list_of_tests.cmake (there is already a 2D MPC test: rve2d_periodic_bcs_with_mpcs.4C.yaml).

Copilot uses AI. Check for mistakes.
Copy link
Contributor

@isteinbrecher isteinbrecher left a comment

Choose a reason for hiding this comment

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

Looks good to me, can you add a small test case for this feature?

Copy link
Contributor

@maxfirmbach maxfirmbach left a comment

Choose a reason for hiding this comment

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

@m-frey I just have a small remark. I would also like to see a test that explicitly uses the new feature e.g. ADD: "dispz" somewhere.

else
{
FOUR_C_THROW(
"Linear coupled equations (MPCs) are only implemented for 2D (dispx or dispy DOFs)");
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this error message also has to be adapted right?

Copy link
Contributor

@ischeider ischeider left a comment

Choose a reason for hiding this comment

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

Just asking for some more documentation ;-)

@@ -110,8 +110,9 @@
Core::Conditions::PointLinearCoupledEquation, false, Core::Conditions::geometry_type_point);

linear_ce.add_component(parameter<int>("EQUATION", {.description = "EQUATION"}));
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you please also change the description of EQUATION to something more useful? What kind of equation is possible, with which dependencies? See also comment to COEFFICIENT.
If it refers to a function, then shouldn't we redefine the parameter to FUNCT, which is the name that we use in general? Even though it is a breaking change then.

linear_ce.add_component(
deprecated_selection<std::string>("ADD", {"dispx", "dispy", "dispz", "undefined"},
{.description = "degrees of freedom", .default_value = "undefined"}));
linear_ce.add_component(parameter<double>("COEFFICIENT"));
Copy link
Contributor

Choose a reason for hiding this comment

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

The coefficient does not have a description at all. Since there is also EQUATION available, I don't know what an additional coefficient could do (maybe I fully misunderstand the parameters). If it is a factor added to the function/equation, I recommend to make it optional with 1 as a default value.

/*----------------------------------------------------------------------*/
Core::Conditions::ConditionDefinition linear_ce("DESIGN POINT COUPLED DOF EQUATION CONDITIONS",
"PointLinearCoupledEquation",
"definition of the term of a linear couple equation coupling different degrees of "
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
"Definition of the term of a linear couple equation coupling specified degrees of "

Copy link
Contributor

@isteinbrecher isteinbrecher left a comment

Choose a reason for hiding this comment

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

Can we add a test case for this feature?

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.

5 participants