Problems¶
Compliant mechanism synthesis problems using topology optimization.
Base Problem¶
-
class
topopt.mechanisms.problems.
MechanismSynthesisProblem
(bc, penalty)[source]¶ Topology optimization problem to generate compliant mechanisms.
\(\begin{aligned} \max_{\boldsymbol{\rho}} \quad & \{u_{\text{out}}=\mathbf{l}^{T} \mathbf{u}\}\\ \textrm{subject to}: \quad & \mathbf{K}\mathbf{u} = \mathbf{f}_\text{in}\\ & \sum_{e=1}^N v_e\rho_e \leq V_\text{frac}, \quad 0 < \rho_\min \leq \rho_e \leq 1, \quad e=1, \dots, N.\\ \end{aligned}\)
where \(\mathbf{l}\) is a vector with the value 1 at the degree(s) of freedom corresponding to the output point and with zeros at all other places.
-
spring_stiffnesses
¶ The spring stiffnesses of the actuator and output displacement.
Type: numpy.ndarray
-
__init__
(bc, penalty)[source]¶ Create the topology optimization problem.
Parameters: - nelx – Number of elements in the x direction.
- nely – Number of elements in the x direction.
- penalty (
float
) – Penalty value used to penalize fractional densities in SIMP. - bc (
MechanismSynthesisBoundaryConditions
) – Boundary conditions of the problem.
-
build_K
(xPhys, remove_constrained=True)[source]¶ Build the stiffness matrix for the problem.
Parameters: Returns: Return type: The stiffness matrix for the mesh.
-
compute_objective
(xPhys, dobj)[source]¶ Compute the objective and gradient of the mechanism synthesis problem.
The objective is \(u_{\text{out}}=\mathbf{l}^{T} \mathbf{u}\) where \(\mathbf{l}\) is a vector with the value 1 at the degree(s) of freedom corresponding to the output point and with zeros at all other places. The gradient of the objective is
\(\begin{align} u_\text{out} &= \mathbf{l}^T\mathbf{u} = \mathbf{l}^T\mathbf{u} + \boldsymbol{\lambda}^T(\mathbf{K}\mathbf{u} - \mathbf{f})\\ \frac{\partial u_\text{out}}{\partial \rho_e} &= (\mathbf{K}\boldsymbol{\lambda} + \mathbf{l})^T \frac{\partial \mathbf u}{\partial \rho_e} + \boldsymbol{\lambda}^T\frac{\partial \mathbf K}{\partial \rho_e} \mathbf{u} = \boldsymbol{\lambda}^T\frac{\partial \mathbf K}{\partial \rho_e} \mathbf{u} \end{align}\)
where \(\mathbf{K}\boldsymbol{\lambda} = -\mathbf{l}\).
Parameters: Returns: Return type: The objective of the compliant mechanism synthesis problem.
-