-
Notifications
You must be signed in to change notification settings - Fork 284
Description
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
where
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
MasterSlaveConstraint=>MultifreedomConstraintLinearMasterSlaveConstraint=>LinearMultifreedomConstraint- remove
GetMasterDofsVectorandGetSlaveDofsVector - adapt processes to these changes
- have
BuilderAndSolverperform the master/slave partitioning and store the result in internal data structures - implement penalty-based imposition