Implemented in: bc_handler.apply_essential_bcs(), methods "penalty" and "direct"
After global assembly, the meshfree structural problem is a linear system:
where K ∈ ℝ2N×2N is the global stiffness matrix, u ∈ ℝ2N is the vector of nodal displacement parameters, and f ∈ ℝ2N is the external force vector.
Essential boundary conditions (prescribed displacements) of the form ui = &ū;i must be imposed on a set of DOFs. In GearMaster, all essential BCs are currently zero-displacement constraints: &ū;i = 0. Two enforcement methods are available, implemented in apply_essential_bcs().
The penalty method is a classical regularisation approach that modifies the functional being minimised. For a linear elastic problem, the potential energy is:
To enforce ui = &ū;i approximately, a penalty term is added:
Stationarity of Πα with respect to ui yields the modified system equation at row i:
This is implemented by augmenting the diagonal: Kii ← Kii + α. For &ū;i = 0, the right-hand side is unchanged.
The penalty parameter α is chosen as a multiple of the largest diagonal stiffness:
This scaling ensures that the penalty term dominates the constrained DOF row without being sensitive to the absolute magnitude of the stiffness (which depends on material, geometry, and node spacing).
The stiffness matrix K and force vector f are modified in-place. The matrix remains symmetric if it was symmetric before (only the diagonal is modified).
The penalty method introduces an approximation: the constraint ui = &ū;i is only satisfied up to an error of order O(1/β). The displacement error at constrained DOFs is approximately:
For structural engineering applications this is generally negligible. However, a large penalty value also increases the condition number of K by a factor of roughly β, which may affect iterative solver convergence or residual accuracy. In GearMaster this is the default method as it is compatible with both symmetric (EFG) and non-symmetric (MLPG5) stiffness matrices.
"direct" method is recommended.
Direct substitution (also called the elimination method) enforces the constraint exactly by replacing the equation for constrained DOF i with the trivial equation ui = &ū;i. The system row i is replaced by:
For the non-zero prescribed displacement case (&ū;i ≠ 0), the force vector must also be corrected for column i:
followed by zeroing column i (to restore symmetry). For the zero-displacement case (&ū;i = 0), the column correction is identically zero, so it is omitted.
Note: column zeroing is omitted because &ū;i = 0 makes the correction zero. The resulting equation for DOF i is simply 1 × ui = 0, which is exact.
After direct substitution, the matrix K is no longer symmetric (the off-diagonal column entries Kji are not zeroed in the current implementation). This is intentional for the MLPG5 case, where the matrix was already non-symmetric. For EFG (symmetric stiffness), the broken symmetry has a negligible effect on direct solvers but should be noted for iterative solver selection.
| Property | Penalty ("penalty") |
Direct ("direct") |
|---|---|---|
| Constraint satisfaction | Approximate: O(1/β) error | Exact (machine precision) |
| Matrix symmetry preserved | Yes (only diagonal modified) | Partially (row zeroed, column not) |
| Conditioning impact | Condition number increases by ~β | Introduces 1 on diagonal, minimal impact |
| Works with non-symmetric K | Yes | Yes |
| Non-zero prescribed displacements | Supported (f[dof] += α × &ū;) | Supported (needs column correction) |
| Default in GearMaster | Yes | Optional |
| Recommended for EFG (symmetric) | Yes | Yes (preferred for accuracy) |
| Recommended for MLPG5 (non-symmetric) | Use with caution (high cond) | Preferred |
The default penalty multiplier is:
This value is a widely used engineering choice in meshfree implementations. It is large enough to enforce the constraint to sufficient accuracy (relative error ~10−7) while avoiding severe conditioning issues for typical structural problems with well-conditioned EFG matrices.