9 #include "imstkDynamicalModel.h" 10 #include "imstkInternalForceModelTypes.h" 11 #include "imstkVectorizedState.h" 12 #include "imstkNonLinearSystem.h" 14 #include <sparseMatrix.h> 23 class InternalForceModel;
27 template<
typename T,
int N>
class VecDataArray;
36 FeMethodType m_femMethod = FeMethodType::Invertible;
40 std::string m_fixedDOFFilename;
41 std::vector<std::size_t> m_fixedNodeIds;
43 double m_dampingMassCoefficient = 0.1;
44 double m_dampingStiffnessCoefficient = 0.01;
45 double m_dampingLaplacianCoefficient = 0.0;
46 double m_deformationCompliance = 1.0;
47 double m_compressionResistance = 500.0;
48 double m_inversionThreshold = -std::numeric_limits<double>::max();
49 double m_gravity = 9.81;
73 void configure(
const std::string& configFileName);
74 void configure(std::shared_ptr<FemModelConfig> config = std::make_shared<FemModelConfig>());
79 bool initialize()
override;
85 std::shared_ptr<FemModelConfig> getForceModelConfiguration()
const {
return m_FEModelConfig; }
92 std::shared_ptr<InternalForceModel> getInternalForceModel()
const {
return m_internalForceModel; }
98 void setTimeIntegrator(std::shared_ptr<TimeIntegrator> timeIntegrator) { this->m_timeIntegrator = timeIntegrator; }
99 std::shared_ptr<TimeIntegrator> getTimeIntegrator()
const {
return m_timeIntegrator; }
105 void loadInitialStates();
110 bool loadBoundaryConditions();
115 bool initializeForceModel();
120 bool initializeMassMatrix();
125 bool initializeDampingMatrix();
130 bool initializeTangentStiffness();
135 bool initializeGravityForce();
140 bool initializeExplicitExternalForces();
145 static void initializeEigenMatrixFromVegaMatrix(
const vega::SparseMatrix& vegaMatrix, SparseMatrixd& eigenMatrix);
175 void updateDampingMatrix();
180 void applyBoundaryConditions(SparseMatrixd& M,
const bool withCompliance =
false)
const;
181 void applyBoundaryConditions(Vectord& x)
const;
187 void updateMassMatrix();
192 void updatePhysicsGeometry()
override;
197 void updateBodyStates(
const Vectord& solution,
const StateUpdateType updateType);
198 void updateBodyIntermediateStates(
const Vectord& solution,
const StateUpdateType updateType);
203 void updateBodyPreviousStates();
209 System::VectorFunctionType getFunction();
214 System::UpdateFunctionType getUpdateFunction();
215 System::UpdatePrevStateFunctionType getUpdatePrevStateFunction();
221 System::MatrixFunctionType getFunctionGradient();
227 System::VectorMatrixFunctionType getFunctionAndGradient();
253 virtual void setTimeStep(
const double timeStep);
258 virtual double getTimeStep()
const;
263 void setFixedSizeTimeStepping();
269 void disableFixedBC() { m_implementFixedBC =
false; };
270 bool isFixedBCImplemented()
const {
return m_implementFixedBC; };
272 std::shared_ptr<TaskNode> getSolveNode()
const {
return m_solveNode; }
277 std::shared_ptr<SolverBase>
getSolver()
const {
return m_solver; }
278 void setSolver(std::shared_ptr<SolverBase> solver) { this->m_solver = solver; }
285 void initGraphEdges(std::shared_ptr<TaskNode> source, std::shared_ptr<TaskNode> sink)
override;
287 std::shared_ptr<SolverBase> m_solver =
nullptr;
288 std::shared_ptr<InternalForceModel> m_internalForceModel =
nullptr;
289 std::shared_ptr<TimeIntegrator> m_timeIntegrator =
nullptr;
290 std::shared_ptr<NonLinearSystem<SparseMatrixd>> m_nonLinearSystem =
nullptr;
292 std::shared_ptr<FemModelConfig> m_FEModelConfig =
nullptr;
307 std::shared_ptr<vega::VolumetricMesh> m_vegaPhysicsMesh =
nullptr;
308 std::shared_ptr<vega::SparseMatrix> m_vegaMassMatrix =
nullptr;
309 std::shared_ptr<vega::SparseMatrix> m_vegaTangentStiffnessMatrix =
nullptr;
310 std::shared_ptr<vega::SparseMatrix> m_vegaDampingMatrix =
nullptr;
316 bool m_damped =
false;
320 bool m_implementFixedBC =
true;
323 std::shared_ptr<TaskNode> m_solveNode =
nullptr;
SparseMatrixd m_K
Tangent (derivative of internal force w.r.t displacements) stiffness matrix.
Vectord m_Fcontact
Vector of contact forces.
Base class for a multi-variable nonlinear system.
Vectord m_Feff
Vector of effective forces.
SparseMatrixd m_Keff
Effective stiffness matrix (dependent on internal force model and time integrator) ...
Vectord & getContactForce()
Get the contact force vector.
std::vector< std::size_t > & getFixNodeIds()
Returns the unknown vectors.
SparseMatrixd m_M
Matrices typical to a elastodynamics and 2nd order analogous systems.
This class stores the state of the unknown field variable in vectorized form.
void setTimeIntegrator(std::shared_ptr< TimeIntegrator > timeIntegrator)
Get/Set time integrator.
Vectord m_Fgravity
Vector of gravity forces.
Vectord m_Finternal
Vector of internal forces.
Parameters for finite element model.
Vectord m_qSol
Vector to maintain solution at each iteration of nonlinear solver.
void enableFixedBC()
Set the fixed BC implementation state.
std::vector< std::size_t > m_fixedNodeIds
Nodal IDs of the nodes that are fixed.
StateUpdateType
Type of the update of the state of the body.
void setInternalForceModel(std::shared_ptr< InternalForceModel > fm)
Get/Set internal force model.
Base class for mathematical model of the physics governing the dynamic object.
Vectord m_FexplicitExternal
Vector of explicitly defined external forces.
std::shared_ptr< SolverBase > getSolver() const
Get/Set the solver pointer.
void setForceModelConfiguration(std::shared_ptr< FemModelConfig > fmConfig)
Get/Set force model configuration.
Mathematical model of the physics governing the dynamic deformable object.
SparseMatrixd m_C
Damping coefficient matrix.
void setUpdateType(const StateUpdateType &updateType)
Get/Set the update type.
Vectord & getUnknownVec()
Returns the unknown vectors.