Connections / Joints#
Module containing joint classes to connect multiple rods together.
Description#
Available Connections/Joints
This free joint class is the base class for all joints. 

The fixed joint class restricts the relative movement and rotation between two nodes and elements by applying restoring forces and torques. 

This hinge joint class constrains the relative movement and rotation (only one axis defined by the user) between two nodes and elements (chosen by the user) by applying restoring forces and torques. 
Compatibility#
Connection / Joints 
Rod 
Rigid Body 

FreeJoint 
✅ 
❌ 
FixedJoint 
✅ 
❌ 
HingeJoint 
✅ 
❌ 
Builtin Connection / Joint#
 class elastica.joint.FreeJoint(k, nu)[source]#
This free joint class is the base class for all joints. Free or spherical joints constrains the relative movement between two nodes (chosen by the user) by applying restoring forces. For implementation details, refer to Zhang et al. Nature Communications (2019).
Notes
Every new joint class must be derived from the FreeJoint class.
 Attributes:
 k: float
Stiffness coefficient of the joint.
 nu: float
Damping coefficient of the joint.
 __init__(k, nu)[source]#
 Parameters:
 k: float
Stiffness coefficient of the joint.
 nu: float
Damping coefficient of the joint.
 apply_forces(system_one, index_one, system_two, index_two)[source]#
Apply joint force to the connected rod objects.
 Parameters:
 system_oneobject
Rod or rigidbody object
 index_oneint
Index of first rod for joint.
 system_twoobject
Rod or rigidbody object
 index_twoint
Index of second rod for joint.
 Returns:
 apply_torques(system_one, index_one, system_two, index_two)[source]#
Apply restoring joint torques to the connected rod objects.
In FreeJoint class, this routine simply passes.
 Parameters:
 system_oneobject
Rod or rigidbody object
 index_oneint
Index of first rod for joint.
 system_twoobject
Rod or rigidbody object
 index_twoint
Index of second rod for joint.
 Returns:
 class elastica.joint.FixedJoint(k, nu, kt, nut=0.0, rest_rotation_matrix=None)[source]#
The fixed joint class restricts the relative movement and rotation between two nodes and elements by applying restoring forces and torques. For implementation details, refer to Zhang et al. Nature Communications (2019).
Notes
Issue #131 : Add constraint in twisting, add rest_rotation_matrix (v0.3.0)
 Attributes:
 k: float
Stiffness coefficient of the joint.
 nu: float
Damping coefficient of the joint.
 kt: float
Rotational stiffness coefficient of the joint.
 nut: float
Rotational damping coefficient of the joint.
 rest_rotation_matrix: np.array
2D (3,3) array containing data with ‘float’ type. Rest 3x3 rotation matrix from system one to system two at the connected elements. Instead of aligning the directors of both systems directly, a desired rest rotational matrix labeled C_12* is enforced.
 __init__(k, nu, kt, nut=0.0, rest_rotation_matrix=None)[source]#
 Parameters:
 k: float
Stiffness coefficient of the joint.
 nu: float
Damping coefficient of the joint.
 kt: float
Rotational stiffness coefficient of the joint.
 nut: float = 0.
Rotational damping coefficient of the joint.
 rest_rotation_matrix: np.array
2D (3,3) array containing data with ‘float’ type. Rest 3x3 rotation matrix from system one to system two at the connected elements. If provided, the rest rotation matrix is enforced between the two systems throughout the simulation. If not provided, rest_rotation_matrix is initialized to the identity matrix, which means that a restoring torque will be applied to align the directors of both systems directly. (default=None)
 apply_forces(system_one, index_one, system_two, index_two)[source]#
Apply joint force to the connected rod objects.
 Parameters:
 system_oneobject
Rod or rigidbody object
 index_oneint
Index of first rod for joint.
 system_twoobject
Rod or rigidbody object
 index_twoint
Index of second rod for joint.
 Returns:
 apply_torques(system_one, index_one, system_two, index_two)[source]#
Apply restoring joint torques to the connected rod objects.
In FreeJoint class, this routine simply passes.
 Parameters:
 system_oneobject
Rod or rigidbody object
 index_oneint
Index of first rod for joint.
 system_twoobject
Rod or rigidbody object
 index_twoint
Index of second rod for joint.
 Returns:
 class elastica.joint.HingeJoint(k, nu, kt, normal_direction)[source]#
This hinge joint class constrains the relative movement and rotation (only one axis defined by the user) between two nodes and elements (chosen by the user) by applying restoring forces and torques. For implementation details, refer to Zhang et. al. Nature Communications (2019).
 Attributes:
 k: float
Stiffness coefficient of the joint.
 nu: float
Damping coefficient of the joint.
 kt: float
Rotational stiffness coefficient of the joint.
 normal_direction: numpy.ndarray
2D (dim, 1) array containing data with ‘float’ type. Constraint rotation direction.
 __init__(k, nu, kt, normal_direction)[source]#
 Parameters:
 k: float
Stiffness coefficient of the joint.
 nu: float
Damping coefficient of the joint.
 kt: float
Rotational stiffness coefficient of the joint.
 normal_direction: numpy.ndarray
2D (dim, 1) array containing data with ‘float’ type. Constraint rotation direction.
 apply_forces(system_one, index_one, system_two, index_two)[source]#
Apply joint force to the connected rod objects.
 Parameters:
 system_oneobject
Rod or rigidbody object
 index_oneint
Index of first rod for joint.
 system_twoobject
Rod or rigidbody object
 index_twoint
Index of second rod for joint.
 Returns:
 apply_torques(system_one, index_one, system_two, index_two)[source]#
Apply restoring joint torques to the connected rod objects.
In FreeJoint class, this routine simply passes.
 Parameters:
 system_oneobject
Rod or rigidbody object
 index_oneint
Index of first rod for joint.
 system_twoobject
Rod or rigidbody object
 index_twoint
Index of second rod for joint.
 Returns: