iMSTK
Interactive Medical Simulation Toolkit
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
imstk::FemDeformableBodyModel Class Reference

Mathematical model of the physics governing the dynamic deformable object. More...

#include <imstkFemDeformableBodyModel.h>

Inheritance diagram for imstk::FemDeformableBodyModel:
Inheritance graph
[legend]
Collaboration diagram for imstk::FemDeformableBodyModel:
Collaboration graph
[legend]

Public Types

using kinematicState = FeDeformBodyState
 
using System = NonLinearSystem< SparseMatrixd >
 
- Public Types inherited from imstk::AbstractDynamicalModel
enum  StateUpdateType {
  Displacement, Velocity, DeltaDisplacement, DeltaVelocity,
  None
}
 Type of the update of the state of the body.
 

Public Member Functions

void configure (const std::string &configFileName)
 Configure the force model from external file.
 
void configure (std::shared_ptr< FemModelConfig > config=std::make_shared< FemModelConfig >())
 
bool initialize () override
 Initialize the deformable body model.
 
void loadInitialStates ()
 Load the initial conditions of the deformable object.
 
bool loadBoundaryConditions ()
 Load the boundary conditions from external file.
 
bool initializeForceModel ()
 Initialize the force model.
 
bool initializeMassMatrix ()
 Initialize the mass matrix from the mesh. More...
 
bool initializeDampingMatrix ()
 Initialize the damping (combines structural and viscous damping) matrix.
 
bool initializeTangentStiffness ()
 Initialize the tangent stiffness matrix.
 
bool initializeGravityForce ()
 Initialize the gravity force.
 
bool initializeExplicitExternalForces ()
 Initialize explicit external forces.
 
void computeImplicitSystemRHS (kinematicState &prevState, kinematicState &newState, const StateUpdateType updateType)
 Compute the RHS of the resulting linear system.
 
void computeSemiImplicitSystemRHS (kinematicState &stateAtT, kinematicState &newState, const StateUpdateType updateType)
 Compute the RHS of the resulting linear system using semi-implicit scheme.
 
void computeImplicitSystemLHS (const kinematicState &prevState, kinematicState &newState, const StateUpdateType updateType)
 Compute the LHS of the resulting linear system.
 
void computeSemiImplicitSystemRHSAndLHS (kinematicState &prevState, kinematicState &newState, const StateUpdateType updateType)
 Compute the RHS and LHS of the resulting linear system using semi-implicit scheme.
 
void computeImplicitSystemRHSAndLHS (kinematicState &prevState, kinematicState &newState, const StateUpdateType updateType)
 Compute the RHS and LHS of the resulting linear system using fully-implicit scheme.
 
void updateDampingMatrix ()
 Update damping Matrix.
 
void applyBoundaryConditions (SparseMatrixd &M, const bool withCompliance=false) const
 Applies boundary conditions to matrix and a vector.
 
void applyBoundaryConditions (Vectord &x) const
 
void updateMassMatrix ()
 Update mass matrix Note: Not supported yet!
 
void updatePhysicsGeometry () override
 Updates the Physics geometry.
 
void updateBodyStates (const Vectord &solution, const StateUpdateType updateType)
 Update states.
 
void updateBodyIntermediateStates (const Vectord &solution, const StateUpdateType updateType)
 
void updateBodyPreviousStates ()
 Update the previous states given the current state.
 
System::VectorFunctionType getFunction ()
 Returns the "function" that evaluates the nonlinear function given the state vector.
 
System::UpdateFunctionType getUpdateFunction ()
 Get the function that updates the model given the solution.
 
System::UpdatePrevStateFunctionType getUpdatePrevStateFunction ()
 
System::MatrixFunctionType getFunctionGradient ()
 Returns the "function" that evaluates the gradient of the nonlinear function given the state vector.
 
System::VectorMatrixFunctionType getFunctionAndGradient ()
 Returns the "function" that evaluates the nonlinear function and its gradient function given the state vector.
 
Vectord & getContactForce ()
 Get the contact force vector.
 
Vectord & getUnknownVec ()
 Returns the unknown vectors.
 
std::vector< std::size_t > & getFixNodeIds ()
 Returns the unknown vectors.
 
virtual void setTimeStep (const double timeStep)
 Set the time step size.
 
virtual double getTimeStep () const
 Returns the time step size.
 
void setFixedSizeTimeStepping ()
 Set the time step size to fixed size.
 
void enableFixedBC ()
 Set the fixed BC implementation state.
 
void disableFixedBC ()
 
bool isFixedBCImplemented () const
 
std::shared_ptr< TaskNodegetSolveNode () const
 
void setForceModelConfiguration (std::shared_ptr< FemModelConfig > fmConfig)
 Get/Set force model configuration.
 
std::shared_ptr< FemModelConfiggetForceModelConfiguration () const
 
void setInternalForceModel (std::shared_ptr< InternalForceModel > fm)
 Get/Set internal force model.
 
std::shared_ptr< InternalForceModelgetInternalForceModel () const
 
void setTimeIntegrator (std::shared_ptr< TimeIntegrator > timeIntegrator)
 Get/Set time integrator.
 
std::shared_ptr< TimeIntegratorgetTimeIntegrator () const
 
void setUpdateType (const StateUpdateType &updateType)
 Get/Set the update type.
 
const StateUpdateTypegetUpdateType () const
 
std::shared_ptr< SolverBasegetSolver () const
 Get/Set the solver pointer.
 
void setSolver (std::shared_ptr< SolverBase > solver)
 
- Public Member Functions inherited from imstk::DynamicalModel< FeDeformBodyState >
 DynamicalModel (DynamicalModelType type=DynamicalModelType::None)
 
std::shared_ptr< FeDeformBodyStategetInitialState () const
 Return the initial state of the problem.
 
std::shared_ptr< FeDeformBodyStategetCurrentState () const
 Return the current state of the problem.
 
std::shared_ptr< FeDeformBodyStategetPreviousState () const
 Return the previous state of the problem.
 
void resetToInitialState () override
 Reset the current state to the initial state.
 
- Public Member Functions inherited from imstk::AbstractDynamicalModel
std::shared_ptr< TaskGraphgetTaskGraph () const
 
const DynamicalModelTypegetType () const
 Get the type of the object.
 
void setModelGeometry (std::shared_ptr< Geometry > geometry)
 Sets the model geometry.
 
bool isGeometryValid (const std::shared_ptr< Geometry > geometry)
 Checks if the given geometry is a valid geometry type for the model.
 
std::shared_ptr< GeometrygetModelGeometry () const
 Gets the model geometry.
 
void initGraphEdges ()
 Initializes the edges of the graph.
 
std::size_t getNumDegreeOfFreedom () const
 Get/Set the number of degrees of freedom.
 
void setNumDegreeOfFreedom (const size_t nDof)
 
virtual void setTimeStepSizeType (const TimeSteppingType type)
 Get/Set the type of approach used to update the time step size after every frame.
 
TimeSteppingType getTimeStepSizeType () const
 

Static Public Member Functions

static void initializeEigenMatrixFromVegaMatrix (const vega::SparseMatrix &vegaMatrix, SparseMatrixd &eigenMatrix)
 Initialize the Eigen matrix with data inside vega sparse matrix.
 

Protected Member Functions

void initGraphEdges (std::shared_ptr< TaskNode > source, std::shared_ptr< TaskNode > sink) override
 Setup the computational graph of FEM.
 
- Protected Member Functions inherited from imstk::AbstractDynamicalModel
 AbstractDynamicalModel (DynamicalModelType type=DynamicalModelType::None)
 

Protected Attributes

std::shared_ptr< SolverBasem_solver = nullptr
 
std::shared_ptr< InternalForceModelm_internalForceModel = nullptr
 Mathematical model for intenal forces.
 
std::shared_ptr< TimeIntegratorm_timeIntegrator = nullptr
 Time integrator.
 
std::shared_ptr< NonLinearSystem< SparseMatrixd > > m_nonLinearSystem = nullptr
 Nonlinear system resulting from TI and force model.
 
std::shared_ptr< FemModelConfigm_FEModelConfig = nullptr
 
SparseMatrixd m_M
 Matrices typical to a elastodynamics and 2nd order analogous systems. More...
 
SparseMatrixd m_C
 Damping coefficient matrix.
 
SparseMatrixd m_K
 Tangent (derivative of internal force w.r.t displacements) stiffness matrix.
 
SparseMatrixd m_Keff
 Effective stiffness matrix (dependent on internal force model and time integrator)
 
Vectord m_Finternal
 Vector of internal forces.
 
Vectord m_Feff
 Vector of effective forces.
 
Vectord m_Fcontact
 Vector of contact forces.
 
Vectord m_Fgravity
 Vector of gravity forces.
 
Vectord m_FexplicitExternal
 Vector of explicitly defined external forces.
 
Vectord m_qSol
 Vector to maintain solution at each iteration of nonlinear solver.
 
std::shared_ptr< vega::VolumetricMesh > m_vegaPhysicsMesh = nullptr
 Mesh used for Physics.
 
std::shared_ptr< vega::SparseMatrix > m_vegaMassMatrix = nullptr
 Vega mass matrix.
 
std::shared_ptr< vega::SparseMatrix > m_vegaTangentStiffnessMatrix = nullptr
 Vega Tangent stiffness matrix.
 
std::shared_ptr< vega::SparseMatrix > m_vegaDampingMatrix = nullptr
 Vega Laplacian damping matrix.
 
std::vector< std::size_t > m_fixedNodeIds
 Nodal IDs of the nodes that are fixed.
 
StateUpdateType m_updateType = StateUpdateType::DeltaVelocity
 Update type of the model.
 
bool m_damped = false
 Viscous or structurally damped system.
 
bool m_implementFixedBC = true
 
- Protected Attributes inherited from imstk::DynamicalModel< FeDeformBodyState >
std::shared_ptr< FeDeformBodyStatem_initialState
 Initial state.
 
std::shared_ptr< FeDeformBodyStatem_currentState
 Current state.
 
std::shared_ptr< FeDeformBodyStatem_previousState
 Previous state.
 
- Protected Attributes inherited from imstk::AbstractDynamicalModel
DynamicalModelType m_type
 Mathematical model type.
 
std::size_t m_numDof
 Total number of degree of freedom.
 
std::shared_ptr< Geometrym_geometry = nullptr
 Physics geometry of the model.
 
std::set< std::string > m_validGeometryTypes
 Valid geometry types of this model.
 
TimeSteppingType m_timeStepSizeType = TimeSteppingType::Fixed
 
std::shared_ptr< TaskGraphm_taskGraph = nullptr
 

Detailed Description

Mathematical model of the physics governing the dynamic deformable object.

Note
Vega specifics will removed in future when the inertial and damping calculations are done with in-house code

Definition at line 59 of file imstkFemDeformableBodyModel.h.

Member Function Documentation

◆ initializeMassMatrix()

bool imstk::FemDeformableBodyModel::initializeMassMatrix ( )

Initialize the mass matrix from the mesh.

Todo:
Add option to save mass matrix to file

Definition at line 318 of file imstkFemDeformableBodyModel.cpp.

Member Data Documentation

◆ m_M

SparseMatrixd imstk::FemDeformableBodyModel::m_M
protected

Matrices typical to a elastodynamics and 2nd order analogous systems.

Mass matrix

Definition at line 295 of file imstkFemDeformableBodyModel.h.


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