115 bool use_prescribed_vx,
bool use_prescribed_vy,
116 bool use_prescribed_vz);
164 void Solve(
double dt);
217 void SaveAsVTK(std::string
const &file_name);
A Finite Element Method (FEM) simulator used for simulating the deformation of objects.
Definition fem_simulator.hpp:18
VecXT< VecNT< double, 6 > > elemental_stress
The stress values of each element in the tetrahedral mesh.
Definition fem_simulator.hpp:54
double timestep
The time step used in the simulation.
Definition fem_simulator.hpp:36
VecXT< Vec3d > nodal_vels
The velocity of each node in the tetrahedral mesh.
Definition fem_simulator.hpp:59
void SetNodalVels(double v_x, double v_y, double v_z)
Sets the nodal velocities for all nodes on the boundary of the object.
Definition fem_simulator.cpp:45
VecXT< VecNT< double, 6 > > bc_nodal_vels
The prescribed velocities for each node on the boundary of the object.
Definition fem_simulator.hpp:65
double neo_k
The bulk modulus of the material being simulated.
Definition fem_simulator.hpp:21
void SetBCNodalVelocity(int nid, double vx, double vy, double vz, bool use_prescribed_vx, bool use_prescribed_vy, bool use_prescribed_vz)
Sets the prescribed velocity for a certain node on the boundary of the object.
Definition fem_simulator.cpp:26
VecXT< Vec3d > nodes
The nodal positions of the tetrahedral mesh.
Definition fem_simulator.hpp:39
VecXT< double > nodal_vols
The volume of each node in the tetrahedral mesh.
Definition fem_simulator.hpp:57
VecXT< Vec3d > nodal_vels_ave
Definition fem_simulator.hpp:227
Mat3d GetCauchyStress(Mat3d const &def_grad)
Calculates the Cauchy stress tensor for a given deformation gradient.
Definition fem_simulator.cpp:374
void ClearBoundaryCondition()
Clears all boundary conditions from the object.
Definition fem_simulator.cpp:51
VecXT< Vec3d > nodes_ref
The reference nodal positions of the tetrahedral mesh.
Definition fem_simulator.hpp:44
void Init()
Initializes the FEM simulator object for this object.
Definition fem_simulator.cpp:24
double damp_coef
The damping coefficient used in the simulation.
Definition fem_simulator.hpp:30
VecXT< double > elemental_vol
The volume of each element in the tetrahedral mesh.
Definition fem_simulator.hpp:52
Vec3d gravity_coef
The gravitational force acting on the object.
Definition fem_simulator.hpp:33
Mat3d GetDeformationGradient(Vec3d const &v0_new, Vec3d const &v1_new, Vec3d const &v2_new, Vec3d const &v3_new, Vec3d const &v0_ref, Vec3d const &v1_ref, Vec3d const &v2_ref, Vec3d const &v3_ref)
Calculates the deformation gradient of a tetrahedral element.
Definition fem_simulator.cpp:357
double GetElementVolume(Vec3d const &v0, Vec3d const &v1, Vec3d const &v2, Vec3d const &v3)
Calculates the volume of a tetrahedral element.
Definition fem_simulator.cpp:352
VecXT< Vec3d > nodal_forces_int
< The internal forces acting on each node.
Definition fem_simulator.hpp:221
VecXT< Vec3d > nodal_forces_ext
The average nodal velocities used in the simulation.
Definition fem_simulator.hpp:224
FEMSimulator()
Constructs a new FEMSimulator object.
Definition fem_simulator.cpp:10
VecXT< Vec3i > bound_facets
The facets of the object that define its bounding surface.
Definition fem_simulator.hpp:47
VecXT< Vec3d > GetNodalDisps(VecXT< int > nids)
Gets the displacements of a set of nodes in the tetrahedral mesh.
Definition fem_simulator.cpp:198
VecXT< Vec3d > bc_facet_forces
The forces applied to each facet on the boundary of the object.
Definition fem_simulator.hpp:62
double neo_mu
The shear modulus of the material being simulated.
Definition fem_simulator.hpp:24
void InitInitialCondition()
Initializes the initial condition for the FEM simulator.
Definition fem_simulator.cpp:310
VecXT< int > bound_nodes
The IDs of the nodes on the bounding surface.
Definition fem_simulator.hpp:49
void Solve(double dt)
Solves for the motion and deformation of the object at each time step.
Definition fem_simulator.cpp:61
void SaveAsVTK(std::string const &file_name)
Saves the object as a VTK file.
Definition fem_simulator.cpp:216
VecXT< Vec3d > GetNodalPositions(VecXT< int > nids)
Gets the positions of a set of nodes in the tetrahedral mesh.
Definition fem_simulator.cpp:189
void Advance(double dt)
Advances the object by one time step.
Definition fem_simulator.cpp:73
VecXT< Vec3d > GetNodalVels(VecXT< int > nids)
Gets the velocities of a set of nodes in the tetrahedral mesh.
Definition fem_simulator.cpp:207
void AddBCFacetForce(int bc_fid, double fx, double fy, double fz)
Adds a force to a facet on the surface of the object.
Definition fem_simulator.cpp:38
void SetMesh(TetMesh const &tetmesh)
Sets the tetrahedral mesh used in the simulation.
Definition fem_simulator.cpp:12
MatNd< 4, 3 > GetInternalForces(Mat3d const &cauchy_stress, Vec3d const &v0, Vec3d const &v1, Vec3d const &v2, Vec3d const &v3)
Calculates the internal forces acting on each node of a tetrahedral element.
Definition fem_simulator.cpp:404
double density
The density of the material being simulated.
Definition fem_simulator.hpp:27
VecXT< Vec4i > elements
The elements of the tetrahedral mesh.
Definition fem_simulator.hpp:41
A class that represents a tetrahedral mesh.
Definition tetmesh.hpp:17
Definition bond_entry.hpp:7
std::array< std::array< double, 3 >, 3 > Mat3d
Definition utils_macros.hpp:22
std::vector< T > VecXT
Definition utils_macros.hpp:31
std::array< double, 3 > Vec3d
Definition utils_macros.hpp:18
std::array< std::array< double, Nc >, Nr > MatNd
Definition utils_macros.hpp:27