Skip to content

Constraints & Physical Interactions

In SOFAx v2, constraints are understood as physical interactions that exchange power with the mechanical system. This perspective is more fundamental than viewing constraints as algebraic blocks: constraints define admissible kinematic relations and the associated generalized reaction forces.


1. Constraints as physical laws

Constraints are not primarily equations to satisfy, but rather:

ideal mechanical interactions that exchange power without storage or dissipation.

A constraint defines a kinematic admissible relation that restricts the system to a subspace of allowed motions. The Lagrange multipliers are the dual generalized forces associated with this restriction.


2. Dynamic formulation (continuous level)

The formulation starts from Newton's second law. Consider a mechanical system with generalized coordinates \(q \in \mathbb{R}^n\) and velocities \(v = \dot{q} \in \mathbb{R}^n\). The dynamic behavior is modeled as:

\[ M(q)\,\dot{v} = P(t) - F(q, v) + G(q)^\top \lambda \]

where:

  • \(M(q)\) is the inertia matrix
  • \(v = \dot{q}\) is the velocity vector
  • \(F(q, v)\) represents internal forces depending on the current state
  • \(P(t)\) gathers known external forces
  • \(G(q)^\top\) is the matrix containing constraint directions
  • \(\lambda \in \mathbb{R}^{n_c}\) is the vector of Lagrange multipliers containing constraint force intensities

The constraints are enforced through:

\[ \Phi(q) = 0 \]

where \(\Phi(q) \in \mathbb{R}^{n_c}\) are the constraint functions and \(G(q) = \partial \Phi / \partial q\) is the constraint Jacobian.

The coupled system structure emerges from this formulation after:

  1. choice of coordinates
  2. discretization
  3. linearization

3. Geometric decomposition: primal and dual spaces

From Christian Duriez

A key structure is:

\[ \boxed{ \mathcal{Q} \;=\; \underbrace{\ker G}_{\text{free motions}} \;\oplus\; \underbrace{\operatorname{range}(G^\top)}_{\text{constraint reactions}} } \]

where:

  • \(G = \partial \Phi / \partial q\) is the constraint Jacobian
  • \(G^\top \lambda\) are admissible reaction forces

This decomposition is more fundamental than any algebraic block structure:

  • it is independent of the solver
  • it is valid at the continuous level
  • it naturally guides projective methods in SOFA

4. Exact constraints (Lagrange formulation)

In SOFAx v2, constraints are enforced exactly via Lagrange multipliers. After discretization, the coupled system reads:

\[ \begin{cases} M \ddot q + B \dot q + f_{\text{int}}(q) + G^\top \lambda = f_{\text{ext}} \\ \Phi(q) = 0 \end{cases} \]

At a Newton iteration, the linearized system is written abstractly as:

\[ \begin{bmatrix} A & G^\top \\ G & 0 \end{bmatrix} \begin{bmatrix} \delta x \\ \delta \lambda \end{bmatrix} = - \begin{bmatrix} r_u \\ r_c \end{bmatrix}, \]

where:

  • \(x\) denotes the primal unknowns (in practice: accelerations \(a\))
  • \(A\) is the tangent operator gathering inertia, damping, and stiffness effects
  • \(G = \partial \Phi / \partial x\) is the constraint Jacobian
  • \(r_u\) is the physics residual
  • \(r_c = \Phi(u)\) is the constraint violation

This block structure is the discrete representation of a primal–dual coupling arising from Newton's second law with constraints, not a fundamental algebraic structure.

Properties:

  • exact constraint enforcement
  • compatible with implicit time integration
  • enables decoupling via Schur complement

5. Schur complement: dynamic compliance

Formally eliminating the primal increment \(\delta x\) yields a Schur complement system on the multipliers:

\[ S \, \delta \lambda = G A^{-1} G^\top \delta \lambda = r_c - G A^{-1} r_u. \]

Physical interpretation:

The Schur complement \(S = G A^{-1} G^\top\) is the dynamic compliance seen by the constraint, not a numerical trick.

It represents how the constraint "feels" the system's response: given a constraint force \(\lambda\), the constraint sees a compliance \(S\) that determines the resulting constraint violation.

This viewpoint:

  • explains why Schur-based methods are natural for constraint problems
  • motivates physics-informed approximations of \(S\)
  • enables decoupling of dynamics and constraints

Advantages of Schur-based strategies:

  • reduces the problem to constraint variables only
  • effective when \(n_c \ll n_x\)
  • allows separate solvers for dynamics and constraints

Challenges:

  • requires efficient approximation of \(A^{-1}\)
  • remains fully matrix-free
  • sensitive to the quality of inner solves

In SOFAx v2, Schur-based strategies are envisioned as iterative inner solves rather than explicit elimination or condensation.


6. Decoupling dynamics and constraints

The geometric decomposition \(\mathcal{Q} = \ker G \oplus \operatorname{range}(G^\top)\) enables decoupling the solution process:

Option 1: Schur complement (constraint space)

  1. Solve the constraint problem: \(S \, \delta \lambda = r_c - G A^{-1} r_u\). This system is typically solved using Gauss-Seidel (for bilateral constraints) or Projected Gauss-Seidel (PGS) (for unilateral constraints and friction). PGS is the standard approach in SOFA for solving this constraint coupling.
  2. Recover primal update: \(\delta x = A^{-1} (r_u - G^\top \delta \lambda)\)

This is effective when constraints are few (\(n_c \ll n_x\)).

Option 2: Separate solvers

The structure allows using:

  • one solver for the free motion space (dynamics in \(\ker G\))
  • another solver for constraint reactions (forces in \(\operatorname{range}(G^\top)\))

7. Design constraints in SOFAx v2

Any constraint handling strategy must:

  • remain matrix-free
  • be compatible with JAX automatic differentiation (JVP/VJP)
  • operate on PyTree-structured states
  • respect projective boundary conditions applied to primal variables only
  • enable decoupling of dynamics and constraints

See also