Fem2DElementTriangle.h
Go to the documentation of this file.
// This file is a part of the OpenSurgSim project.
// Copyright 2013, SimQuest Solutions Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef SURGSIM_PHYSICS_FEM2DELEMENTTRIANGLE_H
#define SURGSIM_PHYSICS_FEM2DELEMENTTRIANGLE_H
#include <array>
#include "SurgSim/Physics/Fem.h"
#include "SurgSim/Physics/FemElement.h"
namespace SurgSim
{
namespace Physics
{
SURGSIM_STATIC_REGISTRATION(Fem2DElementTriangle);
class Fem2DElementTriangle : public FemElement
{
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;
public:
Fem2DElementTriangle();
explicit Fem2DElementTriangle(std::array<size_t, 3> nodeIds);
explicit Fem2DElementTriangle(std::shared_ptr<FemElementStructs::FemElementParameter> elementData);
SURGSIM_CLASSNAME(SurgSim::Physics::Fem2DElementTriangle)
void setThickness(double thickness);
double getThickness() const;
void initialize(const SurgSim::Math::OdeState& state) override;
double getVolume(const SurgSim::Math::OdeState& state) const override;
SurgSim::Math::Vector computeCartesianCoordinate(const SurgSim::Math::OdeState& state,
const SurgSim::Math::Vector& naturalCoordinate) const override;
SurgSim::Math::Vector computeNaturalCoordinate(const SurgSim::Math::OdeState& state,
const SurgSim::Math::Vector& cartesianCoordinate) const override;
protected:
void initializeMembers();
SurgSim::Math::Matrix33d computeRotation(const SurgSim::Math::OdeState& state);
virtual void computeLocalStiffness(const SurgSim::Math::OdeState& state,
Eigen::Matrix<double, 18, 18>* localStiffnessMatrix);
void computeStiffness(const SurgSim::Math::OdeState& state, SurgSim::Math::Matrix* stiffnessMatrix);
virtual void computeLocalMass(const SurgSim::Math::OdeState& state,
Eigen::Matrix<double, 18, 18>* localMassMatrix);
void computeMass(const SurgSim::Math::OdeState& state, SurgSim::Math::Matrix* massMatrix);
void doUpdateFMDK(const Math::OdeState& state, int options) override;
Eigen::Matrix<double, 18, 1> m_x0;
SurgSim::Math::Matrix33d m_initialRotation;
Eigen::Matrix<double, 18, 18> m_MLocal;
Eigen::Matrix<double, 18, 18> m_KLocal;
double m_restArea;
double m_thickness;
void computeShapeFunctionsParameters(const SurgSim::Math::OdeState& restState);
SurgSim::Math::Matrix33d m_membraneShapeFunctionsParameters;
// 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 m_xij;
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;
SurgSim::Math::Matrix m_integral_dT_d;
SurgSim::Math::Matrix m_integralHyiHyj;
SurgSim::Math::Matrix m_integralHxiHxj;
std::array<double, 9> batozDhxDxi(double xi, double eta) const;
std::array<double, 9> batozDhxDeta(double xi, double eta) const;
std::array<double, 9> batozDhyDxi(double xi, double eta) const;
std::array<double, 9> batozDhyDeta(double xi, double eta) const;
Matrix39Type batozStrainDisplacement(double xi, double eta) const;
private:
void computeLocalMembraneMass(const SurgSim::Math::OdeState& state,
Eigen::Matrix<double, 18, 18>* localMassMatrix);
void computeLocalPlateMass(const SurgSim::Math::OdeState& state,
Eigen::Matrix<double, 18, 18>* localMassMatrix);
void computeIntegral_dTd();
void computeIntegral_HxHxT();
void computeIntegral_HyHyT();
};
} // namespace Physics
} // namespace SurgSim
#endif // SURGSIM_PHYSICS_FEM2DELEMENTTRIANGLE_H
FemElement.h
SurgSim::Physics::Fem2DElementTriangle::Matrix99Type
Eigen::Matrix< double, 9, 9 > Matrix99Type
Definition: Fem2DElementTriangle.h:59
SurgSim::Physics::Fem2DElementTriangle::computeShapeFunctionsParameters
void computeShapeFunctionsParameters(const SurgSim::Math::OdeState &restState)
Compute the various shape functions (membrane and plate deformations) parameters. ...
Definition: Fem2DElementTriangle.cpp:701
SurgSim
Definition: CompoundShapeToGraphics.cpp:29
SurgSim::Physics::Fem2DElementTriangle::batozStrainDisplacement
Matrix39Type batozStrainDisplacement(double xi, double eta) const
Batoz strain displacement matrix evaluated at a given point.
Definition: Fem2DElementTriangle.cpp:902
SurgSim::Physics::Fem2DElementTriangle::computeIntegral_HyHyT
void computeIntegral_HyHyT()
Computes the integral terms Hx.Hx^T over the parametrized triangle area.
Definition: Fem2DElementTriangle.cpp:591
SurgSim::Physics::Fem2DElementTriangle::getVolume
double getVolume(const SurgSim::Math::OdeState &state) const override
Gets the element volume based on the input state (in m-3)
Definition: Fem2DElementTriangle.cpp:82
SurgSim::Physics::Fem2DElementTriangle::m_MLocal
Eigen::Matrix< double, 18, 18 > m_MLocal
Stiffness matrix (in local coordinate frame)
Definition: Fem2DElementTriangle.h:136
SurgSim::Physics::Fem2DElementTriangle::computeStiffness
void computeStiffness(const SurgSim::Math::OdeState &state, SurgSim::Math::Matrix *stiffnessMatrix)
Computes the triangle&#39;s stiffness matrix.
Definition: Fem2DElementTriangle.cpp:253
SurgSim::Physics::Fem2DElementTriangle::batozDhxDeta
std::array< double, 9 > batozDhxDeta(double xi, double eta) const
Batoz derivative dHx/deta.
Definition: Fem2DElementTriangle.cpp:841
SurgSim::Physics::Fem2DElementTriangle::computeCartesianCoordinate
SurgSim::Math::Vector computeCartesianCoordinate(const SurgSim::Math::OdeState &state, const SurgSim::Math::Vector &naturalCoordinate) const override
Computes a given natural coordinate in cartesian coordinates.
Definition: Fem2DElementTriangle.cpp:307
SurgSim::Physics::Fem2DElementTriangle::Matrix39Type
Eigen::Matrix< double, 3, 9 > Matrix39Type
Definition: Fem2DElementTriangle.h:58
SurgSim::Physics::Fem2DElementTriangle::computeMass
void computeMass(const SurgSim::Math::OdeState &state, SurgSim::Math::Matrix *massMatrix)
Computes the triangle&#39;s mass matrix.
Definition: Fem2DElementTriangle.cpp:165
SurgSim::Physics::Fem2DElementTriangle::m_thickness
double m_thickness
Thickness of the element.
Definition: Fem2DElementTriangle.h:144
SurgSim::Physics::Fem2DElementTriangle::m_ek
SurgSim::Math::Vector3d m_ek
Batoz variable .
Definition: Fem2DElementTriangle.h:172
SurgSim::Physics::Fem2DElementTriangle::computeIntegral_dTd
void computeIntegral_dTd()
Computes the integral terms d^T.d over the parametrized triangle area.
Definition: Fem2DElementTriangle.cpp:347
SurgSim::Physics::Fem2DElementTriangle::m_restArea
double m_restArea
The triangle rest area.
Definition: Fem2DElementTriangle.h:141
SurgSim::Physics::Fem2DElementTriangle::setThickness
void setThickness(double thickness)
Sets the triangle&#39;s thickness.
Definition: Fem2DElementTriangle.cpp:69
SurgSim::Math::Matrix
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > Matrix
A dynamic size matrix.
Definition: Matrix.h:65
SurgSim::Physics::Fem2DElementTriangle::m_membraneShapeFunctionsParameters
SurgSim::Math::Matrix33d m_membraneShapeFunctionsParameters
Membrane (in-plane) deformation.
Definition: Fem2DElementTriangle.h:153
SurgSim::Physics::Fem2DElementTriangle::getThickness
double getThickness() const
Gets the triangle&#39;s thickness.
Definition: Fem2DElementTriangle.cpp:77
SurgSim::Physics::Fem2DElementTriangle
2D FemElement based on a triangle with a constant thickness
Definition: Fem2DElementTriangle.h:51
SurgSim::Physics::Fem2DElementTriangle::computeLocalMembraneMass
void computeLocalMembraneMass(const SurgSim::Math::OdeState &state, Eigen::Matrix< double, 18, 18 > *localMassMatrix)
Computes the triangle&#39;s local membrane part mass matrix.
Definition: Fem2DElementTriangle.cpp:123
SurgSim::Physics::Fem2DElementTriangle::m_lij_sqr
SurgSim::Math::Vector3d m_lij_sqr
Batoz variable .
Definition: Fem2DElementTriangle.h:167
SurgSim::Physics::Fem2DElementTriangle::batozDhxDxi
std::array< double, 9 > batozDhxDxi(double xi, double eta) const
Batoz derivative dHx/dxi.
Definition: Fem2DElementTriangle.cpp:819
SurgSim::Math::OdeState
The state of an ode of 2nd order of the form with boundary conditions.
Definition: OdeState.h:38
SurgSim::Physics::FemElement
Base class for all Fem Element (1D, 2D, 3D) It handles the node ids to which it is connected and requ...
Definition: FemElement.h:45
SurgSim::Physics::Fem2DElementTriangle::m_yij
SurgSim::Math::Vector3d m_yij
Batoz variable .
Definition: Fem2DElementTriangle.h:166
SurgSim::Physics::Fem2DElementTriangle::computeLocalStiffness
virtual void computeLocalStiffness(const SurgSim::Math::OdeState &state, Eigen::Matrix< double, 18, 18 > *localStiffnessMatrix)
Computes the triangle&#39;s local stiffness matrix.
Definition: Fem2DElementTriangle.cpp:183
SurgSim::Physics::Fem2DElementTriangle::m_integralHyiHyj
SurgSim::Math::Matrix m_integralHyiHyj
Plate mass matrix: integral terms related to the dof .
Definition: Fem2DElementTriangle.h:184
SurgSim::Math::Vector
Eigen::Matrix< double, Eigen::Dynamic, 1 > Vector
A dynamic size column vector.
Definition: Vector.h:68
SurgSim::Physics::Fem2DElementTriangle::batozDhyDxi
std::array< double, 9 > batozDhyDxi(double xi, double eta) const
Batoz derivative dHy/dxi.
Definition: Fem2DElementTriangle.cpp:862
SURGSIM_CLASSNAME
#define SURGSIM_CLASSNAME(ClassName)
Declare the class name of a class with the appropriate function header, do not use quotes...
Definition: Macros.h:21
SurgSim::Physics::Fem2DElementTriangle::m_bk
SurgSim::Math::Vector3d m_bk
Batoz variable .
Definition: Fem2DElementTriangle.h:169
SurgSim::Physics::Fem2DElementTriangle::m_KLocal
Eigen::Matrix< double, 18, 18 > m_KLocal
Stiffness matrix (in local coordinate frame)
Definition: Fem2DElementTriangle.h:138
SurgSim::Physics::Fem2DElementTriangle::computeLocalMass
virtual void computeLocalMass(const SurgSim::Math::OdeState &state, Eigen::Matrix< double, 18, 18 > *localMassMatrix)
Computes the triangle&#39;s local mass matrix.
Definition: Fem2DElementTriangle.cpp:157
SurgSim::Physics::Fem2DElementTriangle::m_tk
SurgSim::Math::Vector3d m_tk
Batoz variable .
Definition: Fem2DElementTriangle.h:178
SurgSim::Physics::Fem2DElementTriangle::Matrix66Type
Eigen::Matrix< double, 6, 6 > Matrix66Type
Definition: Fem2DElementTriangle.h:56
SurgSim::Physics::Fem2DElementTriangle::computeRotation
SurgSim::Math::Matrix33d computeRotation(const SurgSim::Math::OdeState &state)
Computes the triangle element&#39;s rotation given a state.
Definition: Fem2DElementTriangle.cpp:271
SurgSim::Physics::Fem2DElementTriangle::m_integral_dT_d
SurgSim::Math::Matrix m_integral_dT_d
Plate mass matrix: integral terms related to the dof .
Definition: Fem2DElementTriangle.h:183
SurgSim::Physics::Fem2DElementTriangle::Matrix33Type
Eigen::Matrix< double, 3, 3 > Matrix33Type
Definition: Fem2DElementTriangle.h:53
SurgSim::Physics::Fem2DElementTriangle::m_initialRotation
SurgSim::Math::Matrix33d m_initialRotation
Initial rotation matrix for the element.
Definition: Fem2DElementTriangle.h:133
SurgSim::Physics::Fem2DElementTriangle::m_qk
SurgSim::Math::Vector3d m_qk
Batoz variable .
Definition: Fem2DElementTriangle.h:177
SurgSim::Physics::Fem2DElementTriangle::m_x0
Eigen::Matrix< double, 18, 1 > m_x0
The element&#39;s rest state.
Definition: Fem2DElementTriangle.h:130
SurgSim::Physics::Fem2DElementTriangle::computeLocalPlateMass
void computeLocalPlateMass(const SurgSim::Math::OdeState &state, Eigen::Matrix< double, 18, 18 > *localMassMatrix)
Computes the triangle&#39;s local plate part mass matrix.
Definition: Fem2DElementTriangle.cpp:139
SurgSim::Physics::Fem2DElementTriangle::batozDhyDeta
std::array< double, 9 > batozDhyDeta(double xi, double eta) const
Batoz derivative dHy/deta.
Definition: Fem2DElementTriangle.cpp:882
SurgSim::Physics::Fem2DElementTriangle::m_dk
SurgSim::Math::Vector3d m_dk
Batoz variable .
Definition: Fem2DElementTriangle.h:171
SurgSim::Physics::Fem2DElementTriangle::computeIntegral_HxHxT
void computeIntegral_HxHxT()
Computes the integral terms Hy.Hy^T over the parametrized triangle area.
Definition: Fem2DElementTriangle.cpp:481
SurgSim::Physics::Fem2DElementTriangle::Matrix36Type
Eigen::Matrix< double, 3, 6 > Matrix36Type
Definition: Fem2DElementTriangle.h:55
SurgSim::Physics::Fem2DElementTriangle::m_integralHxiHxj
SurgSim::Math::Matrix m_integralHxiHxj
Plate mass matrix: integral terms related to the dof .
Definition: Fem2DElementTriangle.h:185
SurgSim::Physics::Fem2DElementTriangle::m_rk
SurgSim::Math::Vector3d m_rk
Batoz variable .
Definition: Fem2DElementTriangle.h:179
SurgSim::Physics::Fem2DElementTriangle::initializeMembers
void initializeMembers()
Initializes variables needed before Initialize() is called.
Definition: Fem2DElementTriangle.cpp:91
SurgSim::Math::Matrix33d
Eigen::Matrix< double, 3, 3, Eigen::RowMajor > Matrix33d
A 3x3 matrix of doubles.
Definition: Matrix.h:51
SurgSim::Physics::Fem2DElementTriangle::m_ck
SurgSim::Math::Vector3d m_ck
Batoz variable .
Definition: Fem2DElementTriangle.h:170
SurgSim::Physics::Fem2DElementTriangle::m_ak
SurgSim::Math::Vector3d m_ak
Batoz variable .
Definition: Fem2DElementTriangle.h:168
SurgSim::Physics::Fem2DElementTriangle::Fem2DElementTriangle
Fem2DElementTriangle()
Constructor.
Definition: Fem2DElementTriangle.cpp:45
SurgSim::Physics::Fem2DElementTriangle::initialize
void initialize(const SurgSim::Math::OdeState &state) override
Initialize the FemElement once everything has been set.
Definition: Fem2DElementTriangle.cpp:100
SurgSim::Physics::Fem2DElementTriangle::doUpdateFMDK
void doUpdateFMDK(const Math::OdeState &state, int options) override
Update the FemElement based on the given state.
Definition: Fem2DElementTriangle.cpp:333
SurgSim::Physics::Fem2DElementTriangle::m_Pk
SurgSim::Math::Vector3d m_Pk
Batoz variable .
Definition: Fem2DElementTriangle.h:176
SurgSim::Math::Vector3d
Eigen::Matrix< double, 3, 1 > Vector3d
A 3D vector of doubles.
Definition: Vector.h:57
Fem.h
SurgSim::Physics::Fem2DElementTriangle::computeNaturalCoordinate
SurgSim::Math::Vector computeNaturalCoordinate(const SurgSim::Math::OdeState &state, const SurgSim::Math::Vector &cartesianCoordinate) const override
Computes a natural coordinate given a global coordinate.
Definition: Fem2DElementTriangle.cpp:325
SurgSim::Physics::Fem2DElementTriangle::m_xij
SurgSim::Math::Vector3d m_xij
Batoz variable .
Definition: Fem2DElementTriangle.h:165