Skip to content

[ToDo] [Core] Revamp Multifreedom Constraints #12787

@matekelemen

Description

@matekelemen

Motivation

As things stand right now, multifreedom constraints are handled in a rather rigid manner. They are assumed to be imposed using master-slave elimination (hence the name: MasterSlaveConstraint) and give off the impression that the constraint object is responsible for the imposition itself.

In reality, BuilderAndSolver alone is responsible for modifying the linear system to impose these conditions, and it alone can choose what method to use (for example, ResidualBasedBlockBuilderAndSolver can choose between a weird version of master-slave elimination and Lagrange multipliers). This leads to confusing setups in which "MasterSlaveConstraint"s are imposed using Lagrange multipliers ¯\_(ツ)_/¯.

Things get more complicated as I have to implement penalty-based constraint imposition, so I was thinking of refactoring the system a bit.

Proposal

First of all, rename the misleading MasterSlaveConstraint to MultifreedomConstraint.

At their core, multifreedom constraints represent linear equations of the form

$$a^i_0 u_0 + ... + a^i_j u_j + ... + a^i_n u_n + b^i = 0$$

where $u_j$ is the $j$-th DoF, $a^i_j$ refers to the coefficient of the $j$-th DoF in the $i$-th constraint equation, and $b^i$ stands for the constraint gap of the $i$-th constraint equation.

It stands to reason that MultifreedomConstraint should then only represent the (nonzero) coefficients, related DoFs and the constraint gap. @sunethwarna tells me that some types of constraints (especially in fluid dynamics) share coefficients between different equations, so MultifreedomConstraint should represent a set of equations. This is exactly how the interface is defined right now, so no changes there.

The first change would be getting rid of GetMasterDofsVector and GetSlaveDofsVector, since BuilderAndSolver decides on what imposition to perform, and how to partition DoFs into masters or slaves if master-slave imposition is chosen.

Then, we could get completely rid of the MASTER and SLAVE flags, and no longer flag any Nodes during constraint imposition. BuilderAndSolver would store an internal data structure that identifies masters and slaves.

Tasks

  1. MasterSlaveConstraint => MultifreedomConstraint
  2. LinearMasterSlaveConstraint => LinearMultifreedomConstraint
  3. remove GetMasterDofsVector and GetSlaveDofsVector
  4. adapt processes to these changes
  5. have BuilderAndSolver perform the master/slave partitioning and store the result in internal data structures
  6. implement penalty-based imposition

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions