Fem1DElementBeam.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_FEM1DELEMENTBEAM_H
#define SURGSIM_PHYSICS_FEM1DELEMENTBEAM_H
#include <array>
#include "SurgSim/Physics/FemElement.h"
namespace SurgSim
{
namespace Physics
{
SURGSIM_STATIC_REGISTRATION(Fem1DElementBeam);
class Fem1DElementBeam : public FemElement
{
public:
Fem1DElementBeam();
explicit Fem1DElementBeam(std::array<size_t, 2> nodeIds);
explicit Fem1DElementBeam(std::shared_ptr<FemElementStructs::FemElementParameter> elementData);
SURGSIM_CLASSNAME(SurgSim::Physics::Fem1DElementBeam)
void setRadius(double radius);
double getRadius() const;
void initialize(const SurgSim::Math::OdeState& state) override;
double getVolume(const SurgSim::Math::OdeState& state) const override;
bool getShearingEnabled() const;
void setShearingEnabled(bool enabled);
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;
SurgSim::Math::Matrix33d getInitialRotation() const;
protected:
void initializeMembers();
void computeInitialRotation(const SurgSim::Math::OdeState& state);
void computeStiffness(const SurgSim::Math::OdeState& state);
void computeMass(const SurgSim::Math::OdeState& state);
void doUpdateFMDK(const Math::OdeState& state, int options) override;
Eigen::Matrix<double, 12, 1> m_x0;
Eigen::Matrix<double, 12, 12> m_R0;
Eigen::Matrix<double, 12, 12> m_MLocal;
Eigen::Matrix<double, 12, 12> m_KLocal;
double m_G;
double m_restLength;
double m_radius;
double m_A;
bool m_haveShear;
double m_shearFactor;
double m_Asy, m_Asz;
double m_Phi_y, m_Phi_z;
double m_Iy, m_Iz;
double m_J;
};
} // namespace Physics
} // namespace SurgSim
#endif // SURGSIM_PHYSICS_FEM1DELEMENTBEAM_H
FemElement.h
SurgSim::Physics::Fem1DElementBeam::initializeMembers
void initializeMembers()
Initializes variables needed before Initialize() is called.
Definition: Fem1DElementBeam.cpp:92
SurgSim::Physics::Fem1DElementBeam::computeMass
void computeMass(const SurgSim::Math::OdeState &state)
Computes the beam&#39;s mass matrix.
Definition: Fem1DElementBeam.cpp:143
SurgSim
Definition: CompoundShapeToGraphics.cpp:29
SurgSim::Physics::Fem1DElementBeam::m_J
double m_J
Polar moment of inertia.
Definition: Fem1DElementBeam.h:141
SurgSim::Physics::Fem1DElementBeam::setRadius
void setRadius(double radius)
Sets the beam&#39;s circular cross-section radius.
Definition: Fem1DElementBeam.cpp:61
SurgSim::Physics::Fem1DElementBeam::m_R0
Eigen::Matrix< double, 12, 12 > m_R0
Initial rotation matrix for the element.
Definition: Fem1DElementBeam.h:112
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::Math::Vector
Eigen::Matrix< double, Eigen::Dynamic, 1 > Vector
A dynamic size column vector.
Definition: Vector.h:68
SurgSim::Physics::Fem1DElementBeam::m_haveShear
bool m_haveShear
Does this beam element have shear.
Definition: Fem1DElementBeam.h:129
SurgSim::Physics::Fem1DElementBeam::m_restLength
double m_restLength
Rest length.
Definition: Fem1DElementBeam.h:123
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::Fem1DElementBeam::computeStiffness
void computeStiffness(const SurgSim::Math::OdeState &state)
Computes the beam&#39;s stiffness matrix.
Definition: Fem1DElementBeam.cpp:209
SurgSim::Physics::Fem1DElementBeam::m_KLocal
Eigen::Matrix< double, 12, 12 > m_KLocal
Stiffness matrix (in local coordinate frame)
Definition: Fem1DElementBeam.h:117
SurgSim::Physics::Fem1DElementBeam::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: Fem1DElementBeam.cpp:348
SurgSim::Physics::Fem1DElementBeam::Fem1DElementBeam
Fem1DElementBeam()
Constructor.
Definition: Fem1DElementBeam.cpp:36
SurgSim::Physics::Fem1DElementBeam
1D FemElement based on a beam volume discretization with a fixed cross section
Definition: Fem1DElementBeam.h:37
SurgSim::Physics::Fem1DElementBeam::m_Iy
double m_Iy
Cross sectional moment of inertia.
Definition: Fem1DElementBeam.h:139
SurgSim::Physics::Fem1DElementBeam::m_shearFactor
double m_shearFactor
Shear factor (usually 5/8)
Definition: Fem1DElementBeam.h:131
SurgSim::Physics::Fem1DElementBeam::getRadius
double getRadius() const
Gets the beam&#39;s circular cross-section radius.
Definition: Fem1DElementBeam.cpp:69
SurgSim::Physics::Fem1DElementBeam::initialize
void initialize(const SurgSim::Math::OdeState &state) override
Initialize the FemElement once everything has been set.
Definition: Fem1DElementBeam.cpp:112
SurgSim::Physics::Fem1DElementBeam::m_radius
double m_radius
radius for a circular Beam
Definition: Fem1DElementBeam.h:125
SurgSim::Physics::Fem1DElementBeam::m_Asz
double m_Asz
Definition: Fem1DElementBeam.h:133
SurgSim::Physics::Fem1DElementBeam::m_Asy
double m_Asy
The shear area in the y and z directions (=0 => no shear) http://en.wikipedia.org/wiki/Timoshenko_bea...
Definition: Fem1DElementBeam.h:133
SurgSim::Physics::Fem1DElementBeam::setShearingEnabled
void setShearingEnabled(bool enabled)
Enables or disables shearing for the element.
Definition: Fem1DElementBeam.cpp:79
SurgSim::Physics::Fem1DElementBeam::getShearingEnabled
bool getShearingEnabled() const
Gets whether shearing is enabled for the element.
Definition: Fem1DElementBeam.cpp:74
SurgSim::Physics::Fem1DElementBeam::m_Phi_z
double m_Phi_z
Definition: Fem1DElementBeam.h:137
SurgSim::Physics::Fem1DElementBeam::computeInitialRotation
void computeInitialRotation(const SurgSim::Math::OdeState &state)
Computes the beam element&#39;s initial rotation.
Definition: Fem1DElementBeam.cpp:291
SurgSim::Physics::Fem1DElementBeam::m_MLocal
Eigen::Matrix< double, 12, 12 > m_MLocal
Stiffness matrix (in local coordinate frame)
Definition: Fem1DElementBeam.h:115
SurgSim::Physics::Fem1DElementBeam::getVolume
double getVolume(const SurgSim::Math::OdeState &state) const override
Gets the element volume based on the input state (in m-3)
Definition: Fem1DElementBeam.cpp:84
SurgSim::Physics::Fem1DElementBeam::m_x0
Eigen::Matrix< double, 12, 1 > m_x0
The element&#39;s rest state.
Definition: Fem1DElementBeam.h:109
SurgSim::Physics::Fem1DElementBeam::m_G
double m_G
Physical shear modulus G = E/( 2(1+mu) )
Definition: Fem1DElementBeam.h:120
SurgSim::Physics::Fem1DElementBeam::getInitialRotation
SurgSim::Math::Matrix33d getInitialRotation() const
Definition: Fem1DElementBeam.cpp:138
SurgSim::Math::Matrix33d
Eigen::Matrix< double, 3, 3, Eigen::RowMajor > Matrix33d
A 3x3 matrix of doubles.
Definition: Matrix.h:51
SurgSim::Physics::Fem1DElementBeam::doUpdateFMDK
void doUpdateFMDK(const Math::OdeState &state, int options) override
Update the FemElement based on the given state.
Definition: Fem1DElementBeam.cpp:334
SurgSim::Physics::Fem1DElementBeam::m_A
double m_A
Cross sectional area = PI.radius.radius if circular.
Definition: Fem1DElementBeam.h:127
SurgSim::Physics::Fem1DElementBeam::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: Fem1DElementBeam.cpp:316
SurgSim::Physics::Fem1DElementBeam::m_Phi_y
double m_Phi_y
Shear deformation parameters Phi_y=12.E.Iz/(G.Asy.L^2) or 0 if As?=0 Phi_z=12.E.Iy/(G.Asz.L^2) or 0 if As?=0.
Definition: Fem1DElementBeam.h:137
SurgSim::Physics::Fem1DElementBeam::m_Iz
double m_Iz
Definition: Fem1DElementBeam.h:139