Transformation class

Used with:

Class doc

The Transformation base class
class femedu.domain.Transformation.Transformation(dir1=None, dir2=None, axis=None)

Nodal transformation class

A transformation may be attached to Nodes or to Elements.

  • When attached to a Node, the transformation applies to all fixities and all loads defined at that node.

  • When attached to an element, the user may specify a node for which that transformation shall be used. If no node is specified, the transformation will be applied at all attached nodes.

addVector(vecdef)

Register a vector to be transformed by this Transformation object.

This method is most commonly used internally, though may be used to add user-defined vector dofs to any (nodal) transformation.

Parameters:

vecdef – an array-like definitions of a vector.

Examples for vecdef

  • 2d solids use ['ux,'uy']

  • 3d solids use ['ux','uy','uz']

  • 3d Frames use ['ux','uy','uz'] and ['rx','ry','rz']

  • your own vector dofs may use ['myx','myy','myz'] if ‘myx’ represents the x-component of a my-vector. These dofs must be requested by the constructor of your element.

getT()

returns the transformation matrix that maps components from a local 3d vector to the global system

Usage

T = transform.getT()

# vectors
Uglobal = T @ Ulocal          # local to global for a vector U
Vlocal = T.T @ Vglobal        # global to local for a vector V
Vlocal = Vglobal @ T          # alternative global to local for a vector V

# matrices
Mglobal = T @ Mlocal @ T.T    # local to global
Mlocal  = T.T @ Mglobal @ T   # global to local
m2g(M, caller=None)
Parameters:

M – [ndof x ndof] matrix w/ ndof = number of dofs at Node||Element

m2l(M, caller=None)
Parameters:

M – [ndof x ndof] matrix w/ ndof = number of dofs at Node||Element

matrixToGlobal(M, dof_list=[])
Parameters:

M – [2x2] or [3x3] matrix

matrixToLocal(M, dof_list=[])
Parameters:

M – [2x2] or [3x3] matrix

refreshMaps()

Reinitialize dof-maps for vector transformations.

Note

This method shall be called every time a vector is registered for transformation and if an element is added to a node since a new element addition may change the list of locally available dofs!

The map structure is defined as

self.known_vectors = [
    # one entry per vector that needs transformation
    {
        'dofs': [ dofs_defining_this_vector ],
        'map': {
                    # one entry per client
                    Node|Element: [ idx_for_dof[0], idx_for_dof[1], ... ],
                    ...
               }
    },
    ...
]

The map for any requested vector can be obtained using

node = ...     # pointer to node of interest
elem = ...     # pointer to elem of interest

for vec in self.known_vectors:

    vector_dofs = vec['dofs']  # list of named dofs forming this vector

    if node in vec['map']:
        node_map = vec['map'][node]

    if elem in vec['map']:
        elem_map = vec['map'][elem]
registerClient(client)

Register a Node or Element object with this transformation.

Parameters:

client – pointer to the node/element to be registered

v2g(U, caller=None)
Parameters:

U – [ndof] vector w/ ndof = number of dofs at Node||Element

v2l(U, caller=None)
Parameters:

U – [ndof] vector w/ ndof = number of dofs at Node||Element

vectorToGlobal(U, dof_list=[])
Parameters:

U – 2d or 3d vector

vectorToLocal(U, dof_list=[])
Parameters:

U – 2d or 3d vector

Solid Transformation Classes
class femedu.domain.SolidTransformation.SolidTransformation(dir1=None, dir2=None, axis=None)

A Transformation including only displacement dofs (no rotational dofs)

class femedu.domain.Solid2dTransformation.Solid2dTransformation(dir1=None, axis=None)

A Transformation including only displacement dofs (no rotational dofs)

If vectors \({\bf d}_1\) is given, the local coordinate frame \(\{{\bf g}_x,{\bf g}_y\}\) is defined as follows.

Normalized base

\[{\bf g}_x = \frac{1}{||{\bf d}_1||} \: {\bf d}_1\]
\[{\bf g}_y = {\bf e}_3 \times {\bf g}_x\]

where \({\bf e}_3\) is the default out-of-plane unit vector.

If instead an angle, \(\theta\), is given, the local coordinate frame is defined as

\[{\bf g}_x = \cos\theta \: {\bf e}_x + \sin\theta \: {\bf e}_y\]
\[{\bf g}_y = \sin\theta \: {\bf e}_x + \cos\theta \: {\bf e}_y\]

where \(\{{\bf e}_x,{\bf e}_y\}\) is the global cartesian coordinate frame.

Parameters:
  • dir1 – in-plane vector, dir1 == \({\bf d}_1\), defining the local x-direction

  • angle – rotation angle, \(\theta\), in degrees

Frame Transformation Classes
class femedu.domain.FrameTransformation.FrameTransformation(dir1=None, dir2=None, axis=None)

A Transformation including displacement dofs and rotational dofs

If vectors \({\bf d}_1\) and \({\bf d}_2\) are given, the local coordinate frame \(\{{\bf g}_x,{\bf g}_y\},{\bf g}_z\}\) is defined as follows

\[{\bf g}_x = \frac{1}{||{\bf d}_1||} \: {\bf d}_1\]
\[\hat{\bf g}_y = {\bf d}_2 - ({\bf d}_2\cdot{\bf g}_x) {\bf g}_x\]
\[{\bf g}_y = \frac{1}{||\hat{\bf g}_y||} \: \hat{\bf g}_y\]
\[{\bf g}_z = {\bf g}_y \times {\bf g}_y\]

If instead an axial vector, \({\boldsymbol\omega}\), is given, the local coordinate frame is defined as

\[{\bf g}_i = {\boldsymbol\Lambda} \: {\bf e}_i \qquad i=x,y,z\]

where \(\{{\bf e}_x,{\bf e}_y,{\bf e}_z\}\) is the global cartesian coordinate frame and

\[{\boldsymbol\Lambda} := \exp[{\boldsymbol\Omega}]\]

is the rotation tensor, generated as the matrix exponent of the skew-symmetric tensor \({\boldsymbol\Omega}\). The latter is uniquely defined by the following equivalence.

\[{\boldsymbol\Omega} \cdot {\bf h} \equiv {\boldsymbol\omega} \times {\bf h} \qquad\text{for all}\quad {\bf h}\in\mathbb{R}^3\]
Parameters:
  • dir1 – in-plane vector, dir1 == \({\bf d}_1\), defining the local x-direction

  • dir2 – in-plane vector, dir2 == \({\bf d}_2\), used to define the local y-direction

  • axis – axial vector, \({\boldsymbol\omega}\), in degrees

class femedu.domain.Frame2dTransformation.Frame2dTransformation(dir1=None, angle=None)

A Transformation including displacement dofs and rotational dofs

If vectors \({\bf d}_1\) is given, the local coordinate frame \(\{{\bf g}_x,{\bf g}_y\}\) is defined as follows.

Normalized base

\[{\bf g}_x = \frac{1}{||{\bf d}_1||} \: {\bf d}_1\]
\[{\bf g}_y = {\bf e}_3 \times {\bf g}_x\]

where \({\bf e}_3\) is the default out-of-plane unit vector.

If instead an angle, \(\theta\), is given, the local coordinate frame is defined as

\[{\bf g}_x = \cos\theta \: {\bf e}_x + \sin\theta \: {\bf e}_y\]
\[{\bf g}_y = \sin\theta \: {\bf e}_x + \cos\theta \: {\bf e}_y\]

where \(\{{\bf e}_x,{\bf e}_y\}\) is the global cartesian coordinate frame.

Parameters:
  • dir1 – in-plane vector, dir1 == \({\bf d}_1\), defining the local x-direction

  • angle – rotation angle, \(\theta\), in degrees

Beam Transformation Classes
class femedu.domain.BeamTransformation.BeamTransformation(dir1=None, dir2=None, axis=None)

This is an alias for FrameTransformation()

class femedu.domain.Beam2dTransformation.Beam2dTransformation(dir1=None, dir2=None, angle=None)

This is an alias for Frame2dTransformation(). See documentation for the Frame2dTransformation() class for further detail.

Parameters:
  • dir1 – in-plane vector defining the local x-direction

  • dir2 – in-plane vector used to define the local y-direction

  • angle – rotation angle in degrees