Public Member Functions | Protected Member Functions | Protected Attributes | Private Types | List of all members
SurgSim::Physics::Fem2DElementTriangle Class Reference

2D FemElement based on a triangle with a constant thickness More...

#include <SurgSim/Physics/Fem2DElementTriangle.h>

Inheritance diagram for SurgSim::Physics::Fem2DElementTriangle:
SurgSim::Physics::FemElement

Public Member Functions

 Fem2DElementTriangle (std::array< size_t, 3 > nodeIds)
 Constructor. More...
 
void setThickness (double thickness)
 Sets the triangle's thickness. More...
 
double getThickness () const
 Gets the triangle's thickness. More...
 
virtual void initialize (const SurgSim::Math::OdeState &state) override
 Initializes the FemElement once everything has been set. More...
 
virtual double getVolume (const SurgSim::Math::OdeState &state) const override
 Gets the element's volume based on the input state. More...
 
virtual void addForce (const SurgSim::Math::OdeState &state, SurgSim::Math::Vector *F, double scale=1.0) override
 Adds the element's force (computed for a given state) to a complete system force vector F (assembly) More...
 
virtual void addMass (const SurgSim::Math::OdeState &state, SurgSim::Math::Matrix *M, double scale=1.0) override
 Adds the element's mass matrix M (computed for a given state) to a complete system mass matrix M (assembly) More...
 
virtual void addDamping (const SurgSim::Math::OdeState &state, SurgSim::Math::Matrix *D, double scale=1.0) override
 Adds the element's damping matrix D (= -df/dv) (computed for a given state) to a complete system damping matrix D (assembly) More...
 
virtual void addStiffness (const SurgSim::Math::OdeState &state, SurgSim::Math::Matrix *K, double scale=1.0) override
 Adds the element's stiffness matrix K (= -df/dx) (computed for a given state) to a complete system stiffness matrix K (assembly) More...
 
virtual void addFMDK (const SurgSim::Math::OdeState &state, SurgSim::Math::Vector *F, SurgSim::Math::Matrix *M, SurgSim::Math::Matrix *D, SurgSim::Math::Matrix *K) override
 Adds the element's force vector, mass, stiffness and damping matrices (computed for a given state) into a complete system data structure F, M, D, K (assembly) More...
 
virtual void addMatVec (const SurgSim::Math::OdeState &state, double alphaM, double alphaD, double alphaK, const SurgSim::Math::Vector &x, SurgSim::Math::Vector *F)
 Adds the element's matrix-vector contribution F += (alphaM.M + alphaD.D + alphaK.K).x (computed for a given state) into a complete system data structure F (assembly) More...
 
virtual SurgSim::Math::Vector computeCartesianCoordinate (const SurgSim::Math::OdeState &state, const SurgSim::Math::Vector &naturalCoordinate) const
 Computes a given natural coordinate in cartesian coordinates. More...
 
virtual SurgSim::Math::Vector computeNaturalCoordinate (const SurgSim::Math::OdeState &state, const SurgSim::Math::Vector &cartesianCoordinate) const override
 Computes a natural coordinate given a global coordinate. More...
 
- Public Member Functions inherited from SurgSim::Physics::FemElement
 FemElement ()
 Constructor. More...
 
virtual ~FemElement ()
 Virtual destructor. More...
 
size_t getNumDofPerNode () const
 Gets the number of degree of freedom per node. More...
 
size_t getNumNodes () const
 Gets the number of nodes connected by this element. More...
 
size_t getNodeId (size_t elementNodeId) const
 Gets the elementNodeId-th node id. More...
 
const std::vector< size_t > & getNodeIds () const
 Gets the node ids for this element. More...
 
void setYoungModulus (double E)
 Sets the Young modulus (in N.m-2) More...
 
double getYoungModulus () const
 Gets the Young modulus (in N.m-2) More...
 
void setPoissonRatio (double nu)
 Sets the Poisson ratio (unitless) More...
 
double getPoissonRatio () const
 Gets the Poisson ratio (unitless) More...
 
void setMassDensity (double rho)
 Sets the mass density (in Kg.m-3) More...
 
double getMassDensity () const
 Gets the mass density (in Kg.m-3) More...
 
double getMass (const SurgSim::Math::OdeState &state) const
 Gets the element mass based on the input state (in Kg) More...
 
virtual bool update (const SurgSim::Math::OdeState &state)
 Update the element based on a given state. More...
 
bool isValidCoordinate (const SurgSim::Math::Vector &naturalCoordinate) const
 Determines whether a given natural coordinate is valid. More...
 

Protected Member Functions

void computeInitialRotation (const SurgSim::Math::OdeState &state)
 Computes the triangle element's initial rotation. More...
 
void computeStiffness (const SurgSim::Math::OdeState &state, Eigen::Matrix< double, 18, 18 > *k)
 Computes the triangle's stiffness matrix. More...
 
void computeMass (const SurgSim::Math::OdeState &state, Eigen::Matrix< double, 18, 18 > *m)
 Computes the triangle's mass matrix. More...
 
void computeShapeFunctionsParameters (const SurgSim::Math::OdeState &restState)
 Compute the various shape functions (membrane and plate deformations) parameters. More...
 
std::array< double, 9 > batozDhxDxi (double xi, double neta) const
 Batoz derivative dHx/dxi. More...
 
std::array< double, 9 > batozDhxDneta (double xi, double neta) const
 Batoz derivative dHx/dneta. More...
 
std::array< double, 9 > batozDhyDxi (double xi, double neta) const
 Batoz derivative dHy/dxi. More...
 
std::array< double, 9 > batozDhyDneta (double xi, double neta) const
 Batoz derivative dHy/dneta. More...
 
Matrix39Type batozStrainDisplacement (double xi, double neta) const
 Batoz strain displacement matrix evaluated at a given point. More...
 
- Protected Member Functions inherited from SurgSim::Physics::FemElement
void setNumDofPerNode (size_t numDofPerNode)
 Sets the number of degrees of freedom per node. More...
 

Protected Attributes

Eigen::Matrix< double, 18, 1 > m_x0
 The element's rest state. More...
 
SurgSim::Math::Matrix33d m_initialRotation
 Initial rotation matrix for the element. More...
 
Eigen::Matrix< double, 18, 18 > m_M
 Mass matrix (in global coordinate frame) More...
 
Eigen::Matrix< double, 18, 18 > m_MLocal
 Stiffness matrix (in local coordinate frame) More...
 
Eigen::Matrix< double, 18, 18 > m_K
 Stiffness matrix (in global coordinate frame) More...
 
Eigen::Matrix< double, 18, 18 > m_KLocal
 Stiffness matrix (in local coordinate frame) More...
 
double m_restArea
 The triangle rest area. More...
 
double m_thickness
 Thickness of the element. More...
 
SurgSim::Math::Matrix33d m_membraneShapeFunctionsParameters
 Membrane (in-plane) deformation. More...
 
SurgSim::Math::Vector3d m_xij
 Thin-plate (bending/twisting) specific data structure DOF simulated: (z, thetaX, thetaY) "A Study Of Three-Node Triangular Plate Bending Elements", Jean-Louis Batoz Numerical Methods in Engineering, vol 15, 1771-1812 (1980) Indices are as follow: 0 1 2 denotes triangle's points ABC: 4 (mid-edge 12) 5 (mid-edge 20) 6 (mid-edge 01) denotes mid-edge points Data structures having only mid-edge information are 0 based (0->4 (mid-egde 12) ; 1->5 ; 2->6) More...
 
SurgSim::Math::Vector3d m_yij
 
SurgSim::Math::Vector3d m_lij_sqr
 
SurgSim::Math::Vector3d m_ak
 
SurgSim::Math::Vector3d m_bk
 
SurgSim::Math::Vector3d m_ck
 
SurgSim::Math::Vector3d m_dk
 
SurgSim::Math::Vector3d m_ek
 
SurgSim::Math::Vector3d m_Pk
 
SurgSim::Math::Vector3d m_qk
 
SurgSim::Math::Vector3d m_tk
 
SurgSim::Math::Vector3d m_rk
 
- Protected Attributes inherited from SurgSim::Physics::FemElement
size_t m_numDofPerNode
 Number of degree of freedom per node for this element. More...
 
std::vector< size_t > m_nodeIds
 Node ids connected by this element. More...
 
double m_rho
 Mass density (in Kg.m-3) More...
 
double m_E
 Young modulus (in N.m-2) More...
 
double m_nu
 Poisson ratio (unitless) More...
 

Private Types

typedef Eigen::Matrix< double, 3, 3 > Matrix33Type
 
typedef Eigen::Matrix< double, 3, 6 > Matrix36Type
 
typedef Eigen::Matrix< double, 6, 6 > Matrix66Type
 
typedef Eigen::Matrix< double, 3, 9 > Matrix39Type
 
typedef Eigen::Matrix< double, 9, 9 > Matrix99Type
 

Detailed Description

2D FemElement based on a triangle with a constant thickness

The triangle is modelled as a shell (6DOF) which is decomposed into a membrane (in-plane 2DOF (X,Y)) and a plate (bending/twisting 3DOF (Z, ThetaX,ThetaY)). The thin-plate assumption does not consider the drilling dof (ThetaZ). The system includes the DOF for completeness but does not assign any mass or stiffness to it.

The membrane (in-plane) equations (mass and stiffness) are following "Theory of Matrix Structural Analysis" from J.S. Przemieniecki.

The thin-plate (bending) equations (mass and stiffness) are following "A Study Of Three-Node Triangular Plate Bending Elements", Jean-Louis Batoz Numerical Methods in Engineering, vol 15, 1771-1812 (1980)

Note
The plate mass matrix is not detailed in the above paper, but the analytical equations
have been derived from it.
The element is considered to have a constant thickness.

Member Typedef Documentation

typedef Eigen::Matrix<double, 3, 3> SurgSim::Physics::Fem2DElementTriangle::Matrix33Type
private
typedef Eigen::Matrix<double, 3, 6> SurgSim::Physics::Fem2DElementTriangle::Matrix36Type
private
typedef Eigen::Matrix<double, 3, 9> SurgSim::Physics::Fem2DElementTriangle::Matrix39Type
private
typedef Eigen::Matrix<double, 6, 6> SurgSim::Physics::Fem2DElementTriangle::Matrix66Type
private
typedef Eigen::Matrix<double, 9, 9> SurgSim::Physics::Fem2DElementTriangle::Matrix99Type
private

Constructor & Destructor Documentation

SurgSim::Physics::Fem2DElementTriangle::Fem2DElementTriangle ( std::array< size_t, 3 >  nodeIds)
explicit

Constructor.

Parameters
nodeIdsAn array of 3 node ids (A, B, C) defining this triangle element with respect to a DeformableRepresentaitonState which is passed to the initialize method.

Member Function Documentation

void SurgSim::Physics::Fem2DElementTriangle::addDamping ( const SurgSim::Math::OdeState state,
SurgSim::Math::Matrix D,
double  scale = 1.0 
)
overridevirtual

Adds the element's damping matrix D (= -df/dv) (computed for a given state) to a complete system damping matrix D (assembly)

Parameters
stateThe state to compute the damping matrix with
[in,out]DThe complete system damping matrix to add the element damping matrix into
scaleA factor to scale the added damping matrix with
Note
The element's damping matrix is a square matrix of size getNumDofPerNode() x getNumNodes().
This method supposes that the incoming state contains information with the same number of dof per node as getNumDofPerNode().
The beam uses linear elasticity (not visco-elasticity), so it does not have any damping.

Implements SurgSim::Physics::FemElement.

void SurgSim::Physics::Fem2DElementTriangle::addFMDK ( const SurgSim::Math::OdeState state,
SurgSim::Math::Vector F,
SurgSim::Math::Matrix M,
SurgSim::Math::Matrix D,
SurgSim::Math::Matrix K 
)
overridevirtual

Adds the element's force vector, mass, stiffness and damping matrices (computed for a given state) into a complete system data structure F, M, D, K (assembly)

Parameters
stateThe state to compute everything with
[in,out]FThe complete system force vector to add the element force into
[in,out]MThe complete system mass matrix to add the element mass matrix into
[in,out]DThe complete system damping matrix to add the element damping matrix into
[in,out]KThe complete system stiffness matrix to add the element stiffness matrix into
Note
This method supposes that the incoming state contains information with the same number of dof per node as getNumDofPerNode().

Implements SurgSim::Physics::FemElement.

void SurgSim::Physics::Fem2DElementTriangle::addForce ( const SurgSim::Math::OdeState state,
SurgSim::Math::Vector F,
double  scale = 1.0 
)
overridevirtual

Adds the element's force (computed for a given state) to a complete system force vector F (assembly)

Parameters
stateThe state to compute the force with
[in,out]FThe complete system force vector to add the element's force into
scaleA factor to scale the added force with
Note
The element's force is of size (getNumDofPerNode() x getNumNodes()).
This method supposes that the incoming state contains information with the same number of dof per node as getNumDofPerNode().

Implements SurgSim::Physics::FemElement.

void SurgSim::Physics::Fem2DElementTriangle::addMass ( const SurgSim::Math::OdeState state,
SurgSim::Math::Matrix M,
double  scale = 1.0 
)
overridevirtual

Adds the element's mass matrix M (computed for a given state) to a complete system mass matrix M (assembly)

Parameters
stateThe state to compute the mass matrix with
[in,out]MThe complete system mass matrix to add the element's mass-matrix into
scaleA factor to scale the added mass matrix with
Note
The element's mass matrix is a square matrix of size getNumDofPerNode() x getNumNodes().
This method supposes that the incoming state contains information with the same number of dof per node as getNumDofPerNode()

Implements SurgSim::Physics::FemElement.

void SurgSim::Physics::Fem2DElementTriangle::addMatVec ( const SurgSim::Math::OdeState state,
double  alphaM,
double  alphaD,
double  alphaK,
const SurgSim::Math::Vector x,
SurgSim::Math::Vector F 
)
virtual

Adds the element's matrix-vector contribution F += (alphaM.M + alphaD.D + alphaK.K).x (computed for a given state) into a complete system data structure F (assembly)

Parameters
stateThe state to compute everything with
alphaMThe scaling factor for the mass contribution
alphaDThe scaling factor for the damping contribution
alphaKThe scaling factor for the stiffness contribution
xA complete system vector to use as the vector in the matrix-vector multiplication
[in,out]FThe complete system force vector to add the element matrix-vector contribution into
Note
This method supposes that the incoming state contains information with the same number of dof per node as getNumDofPerNode().

Implements SurgSim::Physics::FemElement.

void SurgSim::Physics::Fem2DElementTriangle::addStiffness ( const SurgSim::Math::OdeState state,
SurgSim::Math::Matrix K,
double  scale = 1.0 
)
overridevirtual

Adds the element's stiffness matrix K (= -df/dx) (computed for a given state) to a complete system stiffness matrix K (assembly)

Parameters
stateThe state to compute the stiffness matrix with
[in,out]KThe complete system stiffness matrix to add the element stiffness matrix into
scaleA factor to scale the added stiffness matrix with
Note
The element stiffness matrix is square of size getNumDofPerNode() x getNumNodes().
This method supposes that the incoming state contains information with the same number of dof per node as getNumDofPerNode()

Implements SurgSim::Physics::FemElement.

std::array< double, 9 > SurgSim::Physics::Fem2DElementTriangle::batozDhxDneta ( double  xi,
double  neta 
) const
protected

Batoz derivative dHx/dneta.

Parameters
xi,netaThe parametric coordinate (in [0 1] and xi+neta<1.0)
Returns
The vector dHx/dneta evaluated at (xi, neta)
std::array< double, 9 > SurgSim::Physics::Fem2DElementTriangle::batozDhxDxi ( double  xi,
double  neta 
) const
protected

Batoz derivative dHx/dxi.

Parameters
xi,netaThe parametric coordinate (in [0 1] and xi+neta<1.0)
Returns
The vector dHx/dxi evaluated at (xi, neta)
std::array< double, 9 > SurgSim::Physics::Fem2DElementTriangle::batozDhyDneta ( double  xi,
double  neta 
) const
protected

Batoz derivative dHy/dneta.

Parameters
xi,netaThe parametric coordinate (in [0 1] and xi+neta<1.0)
Returns
The vector dHy/dneta evaluated at (xi, neta)
std::array< double, 9 > SurgSim::Physics::Fem2DElementTriangle::batozDhyDxi ( double  xi,
double  neta 
) const
protected

Batoz derivative dHy/dxi.

Parameters
xi,netaThe parametric coordinate (in [0 1] and xi+neta<1.0)
Returns
The vector dHy/dxi evaluated at (xi, neta)
Fem2DElementTriangle::Matrix39Type SurgSim::Physics::Fem2DElementTriangle::batozStrainDisplacement ( double  xi,
double  neta 
) const
protected

Batoz strain displacement matrix evaluated at a given point.

Parameters
xi,netaThe parametric coordinate (in [0 1] and xi+neta<1.0)
Returns
The 3x9 strain displacement matrix evaluated at (xi, neta)
SurgSim::Math::Vector SurgSim::Physics::Fem2DElementTriangle::computeCartesianCoordinate ( const SurgSim::Math::OdeState state,
const SurgSim::Math::Vector naturalCoordinate 
) const
virtual

Computes a given natural coordinate in cartesian coordinates.

Parameters
stateThe state at which to transform coordinates
naturalCoordinateThe coordinates to transform
Returns
The resultant cartesian coordinates

Implements SurgSim::Physics::FemElement.

void SurgSim::Physics::Fem2DElementTriangle::computeInitialRotation ( const SurgSim::Math::OdeState state)
protected

Computes the triangle element's initial rotation.

Parameters
stateThe state to compute the rotation from
Note
This method stores the result in m_initialRotation
void SurgSim::Physics::Fem2DElementTriangle::computeMass ( const SurgSim::Math::OdeState state,
Eigen::Matrix< double, 18, 18 > *  m 
)
protected

Computes the triangle's mass matrix.

Parameters
stateThe state to compute the stiffness matrix from
[out]mThe mass matrix to store the result into
SurgSim::Math::Vector SurgSim::Physics::Fem2DElementTriangle::computeNaturalCoordinate ( const SurgSim::Math::OdeState state,
const SurgSim::Math::Vector cartesianCoordinate 
) const
overridevirtual

Computes a natural coordinate given a global coordinate.

Parameters
stateThe state at which to transform coordinates
cartesianCoordinateThe coordinates to transform
Returns
The resultant natural coordinates

Implements SurgSim::Physics::FemElement.

void SurgSim::Physics::Fem2DElementTriangle::computeShapeFunctionsParameters ( const SurgSim::Math::OdeState restState)
protected

Compute the various shape functions (membrane and plate deformations) parameters.

Parameters
restStatethe rest state to compute the shape functions paramters from
void SurgSim::Physics::Fem2DElementTriangle::computeStiffness ( const SurgSim::Math::OdeState state,
Eigen::Matrix< double, 18, 18 > *  k 
)
protected

Computes the triangle's stiffness matrix.

Parameters
stateThe state to compute the stiffness matrix from
[out]kThe stiffness matrix to store the result into
double SurgSim::Physics::Fem2DElementTriangle::getThickness ( ) const

Gets the triangle's thickness.

Returns
The thickness of the triangle
double SurgSim::Physics::Fem2DElementTriangle::getVolume ( const SurgSim::Math::OdeState state) const
overridevirtual

Gets the element's volume based on the input state.

Parameters
stateThe state to compute the volume with
Returns
The element's volume

Implements SurgSim::Physics::FemElement.

void SurgSim::Physics::Fem2DElementTriangle::initialize ( const SurgSim::Math::OdeState state)
overridevirtual

Initializes the FemElement once everything has been set.

Parameters
stateThe state to initialize the FemElement with
Note
We use the theory of linear elasticity, so this method pre-computes the stiffness and mass matrices

Reimplemented from SurgSim::Physics::FemElement.

void SurgSim::Physics::Fem2DElementTriangle::setThickness ( double  thickness)

Sets the triangle's thickness.

Parameters
thicknessThe thickness of the triangle

Member Data Documentation

SurgSim::Math::Vector3d SurgSim::Physics::Fem2DElementTriangle::m_ak
protected
SurgSim::Math::Vector3d SurgSim::Physics::Fem2DElementTriangle::m_bk
protected
SurgSim::Math::Vector3d SurgSim::Physics::Fem2DElementTriangle::m_ck
protected
SurgSim::Math::Vector3d SurgSim::Physics::Fem2DElementTriangle::m_dk
protected
SurgSim::Math::Vector3d SurgSim::Physics::Fem2DElementTriangle::m_ek
protected
SurgSim::Math::Matrix33d SurgSim::Physics::Fem2DElementTriangle::m_initialRotation
protected

Initial rotation matrix for the element.

Eigen::Matrix<double, 18, 18> SurgSim::Physics::Fem2DElementTriangle::m_K
protected

Stiffness matrix (in global coordinate frame)

Eigen::Matrix<double, 18, 18> SurgSim::Physics::Fem2DElementTriangle::m_KLocal
protected

Stiffness matrix (in local coordinate frame)

SurgSim::Math::Vector3d SurgSim::Physics::Fem2DElementTriangle::m_lij_sqr
protected
Eigen::Matrix<double, 18, 18> SurgSim::Physics::Fem2DElementTriangle::m_M
protected

Mass matrix (in global coordinate frame)

SurgSim::Math::Matrix33d SurgSim::Physics::Fem2DElementTriangle::m_membraneShapeFunctionsParameters
protected

Membrane (in-plane) deformation.

DOF simulated: (x, y) "Theory of Matrix Structural Analysis" from J.S. Przemieniecki Shape functions fi(x, y) = ai + bi.x + ci.y

Eigen::Matrix<double, 18, 18> SurgSim::Physics::Fem2DElementTriangle::m_MLocal
protected

Stiffness matrix (in local coordinate frame)

SurgSim::Math::Vector3d SurgSim::Physics::Fem2DElementTriangle::m_Pk
protected
SurgSim::Math::Vector3d SurgSim::Physics::Fem2DElementTriangle::m_qk
protected
double SurgSim::Physics::Fem2DElementTriangle::m_restArea
protected

The triangle rest area.

SurgSim::Math::Vector3d SurgSim::Physics::Fem2DElementTriangle::m_rk
protected
double SurgSim::Physics::Fem2DElementTriangle::m_thickness
protected

Thickness of the element.

SurgSim::Math::Vector3d SurgSim::Physics::Fem2DElementTriangle::m_tk
protected
Eigen::Matrix<double, 18, 1> SurgSim::Physics::Fem2DElementTriangle::m_x0
protected

The element's rest state.

SurgSim::Math::Vector3d SurgSim::Physics::Fem2DElementTriangle::m_xij
protected

Thin-plate (bending/twisting) specific data structure DOF simulated: (z, thetaX, thetaY) "A Study Of Three-Node Triangular Plate Bending Elements", Jean-Louis Batoz Numerical Methods in Engineering, vol 15, 1771-1812 (1980) Indices are as follow: 0 1 2 denotes triangle's points ABC: 4 (mid-edge 12) 5 (mid-edge 20) 6 (mid-edge 01) denotes mid-edge points Data structures having only mid-edge information are 0 based (0->4 (mid-egde 12) ; 1->5 ; 2->6)

SurgSim::Math::Vector3d SurgSim::Physics::Fem2DElementTriangle::m_yij
protected

The documentation for this class was generated from the following files: