Handler Module¶
- class ammorph.handler.RotationDeformationHandler(handle_nodes, csys_ref, csys)¶
RotationDeformationHandler applies a rigid body rotation to the deformed configuration.
The rotation axis is the z axis of the coordinate system passed to the constructor.
- Parameters
handle_nodes (array_like) – array of dtype int32 containing the indices of the handle nodes that are to be set by the deformation handler
csys_ref (CoordSys3D) – sympy coordinate system describing a reference system. Usually you pass study.csys as this argument.
csys (CoordSys3D) – sympy coordinate system that is related to csys_ref. The z-axis of this system should point into the direction of the desired rotation axis.
- deform(parameters, x0, d0, delta_d)¶
Writes displacements into delta_d describing the deformation.
- Parameters
parameters (array_like) – Array dtype float containing the parameter values of the desired deformation. This handler expects just one parameter at parameters[0]. This parameter is the angle of rotation around the z-axis in radiant.
x0 (array_like) – Array dtype float containing the node coordinates of all nodes in reference configuration.
d0 (array_like) – Array dtype float containing the nodal displacement at the beginning of the deformation
delta_d (array_like) – Array to write the result into. The result is added to delta_d. Thus, you need to zero this array before you call this method, if you want the effect of the DeformationHandler only.
- class ammorph.handler.ShiftDeformationHandler(handle_nodes, csys_ref, csys)¶
ShiftDeformationHandler.
Adds a parametric shift into z-direction of a given sympy coordinate system.
Examples
>>> handle_nodes = np.array([0, 1, 2], dtype=np.int32) >>> x0 = np.random.rand(9).reshape(3,3) >>> d0 = np.zeros_like(x0) >>> delta_d = np.zeros_like(x0) >>> # Get initial coordinate system >>> csys_ref = study.csys >>> # Rotate 90 degree around initial x axis: >>> csys_new = csys_ref.orient_new_axis('B', sympy.pi/2.0, csys_ref.i) >>> # Create deformation handler >>> dh = ShiftDeformationHandler(handle_nodes, csys_ref, csys_new) >>> # Apply shift of amplitude 2.0 >>> dh.deform(np.array([2.0]), x0, d0, delta_d)
- Parameters
handle_nodes (array_like) – array of dtype int32 containing the indices of the handle nodes that are to be set by the deformation handler
csys_ref (CoordSys3D) – sympy coordinate system describing a reference system. Usually you pass study.csys as this argument.
csys (CoordSys3D) – sympy coordinate system that is related to csys_ref. The z-axis of this system should point into the direction of the desired shift deformation.
- deform(parameters, x0, d0, delta_d)¶
Writes displacements into delta_d describing the deformation.
- Parameters
parameters (array_like) – Array dtype float containing the parameter values of the desired deformation. This handler expects just one parameter at parameters[0]. This parameter is the amplitude of the displacement.
x0 (array_like) – Array dtype float containing the node coordinates of all nodes in reference configuration.
d0 (array_like) – Array dtype float containing the nodal displacement at the beginning of the deformation
delta_d (array_like) – Array to write the result into. The result is added to delta_d. Thus, you need to zero this array before you call this method, if you want the effect of the DeformationHandler only.
- class ammorph.handler.VectorDeformationHandler(handle_nodes, deformation)¶
VectorDeformationHandler.
Adds a deformation where the displacement of each coordinate is prescribed by the coordinates of a vector.
Examples
>>> handle_nodes = np.array([0, 1, 2], dtype=np.int32) >>> deformation = np.random.rand(9).reshape(3,3)*0.1 >>> x0 = np.random.rand(9).reshape(3,3) >>> d0 = np.zeros_like(x0) >>> delta_d = np.zeros_like(x0) >>> # Create deformation handler >>> dh = VectorDeformationHandler(handle_nodes, deformation) >>> dh.deform(np.array([]), x0, d0, delta_d)
- Parameters
handle_nodes (array_like) – array of dtype int32 containing the indices of the handle nodes that are to be set by the deformation handler
deformation (array_like) – array of dtype float64 dimension (handle_nodes, 3) containing the displacement of the prescribed deformation
- deform(parameters, x0, d0, delta_d)¶
Writes displacements into delta_d describing the deformation.
- Parameters
parameters (array_like) – Array dtype float containing the parameter values of the desired deformation. This handler expects just one parameter at parameters[0]. This parameter is the amplitude of the displacement.
x0 (array_like) – Array dtype float containing the node coordinates of all nodes in reference configuration.
d0 (array_like) – Array dtype float containing the nodal displacement at the beginning of the deformation
delta_d (array_like) – Array to write the result into. The result is added to delta_d. Thus, you need to zero this array before you call this method, if you want the effect of the DeformationHandler only.