raisim::fem::LinearElasticity
class · #include <raisim/fem/LinearElasticity.hpp>
Small-displacement, small-strain, isotropic, linear static elasticity with four-node tetrahedra. SI units: metres, newtons, pascals, kg/m^3. Instances are single-threaded. Changing loads or prescribed values reuses the factorization; changing the support mask rebuilds it.
Nested classes
structBoltPropertiesstructBoltResultstructBoundaryFacestructConstraintTermstructCouplingPatchstructElementResultstructMaterialstructStatistics
Public types
SolverBackend
enum class SolverBackend| Enumerator |
|---|
Automatic |
SparseLDLT |
IncompleteCholeskyCG |
AlgebraicMultigridCG |
SolveStage
enum class SolveStageStage reported to the solve() progress callback.
| Enumerator |
|---|
Assembly |
Factorization |
Iteration |
Results |
Constructors & destructor
LinearElasticity
explicit LinearElasticity(TetMesh mesh)LinearElasticity(LinearElasticity &&) noexceptLinearElasticity(const LinearElasticity &) = delete~LinearElasticity
~LinearElasticity()Public member functions
operator=
LinearElasticity &operator=(LinearElasticity &&) noexceptLinearElasticity &operator=(const LinearElasticity &) = deletemesh
const TetMesh &mesh() constboundaryFaces
const std::vector<BoundaryFace> &boundaryFaces() constsetMaterial
void setMaterial(const Material &material)Restores one uniform material, replacing any per-element materials.
setElementMaterials
void setElementMaterials(const std::vector<Material> &materials)Empty resets to the uniform material. Otherwise one material per tetrahedron.
setSolverBackend
void setSolverBackend(SolverBackend backend)Automatic uses CG preconditioned by cached smoothed-aggregation algebraic multigrid for >=5000 free DOFs, sparse LDLT otherwise. Both iterative backends solve to the same relative tolerance. Bolt connectors currently use LDLT.
setProgressCallback
void setProgressCallback(std::function<void(SolveStage stage, double fraction)> callback)solve() calls this on its own thread with the current stage and the completed fraction of that stage in [0, 1]. Iteration fractions follow the logarithmic residual reduction of the iterative solver. An exception thrown by the callback stops solve() and propagates; the next solve() repeats the interrupted work. Empty disables reporting.
clearConstraints
void clearConstraints()fix
void fix(unsigned int node)prescribe
void prescribe(
unsigned int node,
unsigned int axis,
double displacement=0.0)release
void release(unsigned int node, unsigned int axis)addLinearConstraint
size_t addLinearConstraint(
const std::vector<ConstraintTerm> &terms,
double value=0.0)Exact linear multi-point constraint: sum(weight * displacement[node][axis]) = value. Redundant, consistent equations are accepted; conflicting equations are rejected by solve().
addDirectionalConstraint
size_t addDirectionalConstraint(
unsigned int node,
const Vec<3> &direction,
double displacement=0.0)setLinearConstraintValue
void setLinearConstraintValue(size_t constraint, double value)clearLinearConstraints
void clearLinearConstraints()addBolt
size_t addBolt(
const CouplingPatch &head,
const CouplingPatch &nut,
const BoltProperties &properties)Distributed, energy-consistent circular Timoshenko beam connector. Patches must have non-collinear nodes. The coupling transfers forces and moments without rigidifying either patch.
setBoltProperties
void setBoltProperties(size_t bolt, const BoltProperties &properties)clearBolts
void clearBolts()addElasticSupport
size_t addElasticSupport(
unsigned int node,
const Vec<3> &direction,
double stiffness,
double restDisplacement=0.0)Physical elastic support along a unit direction; stiffness is N/m and rest displacement is m.
setElasticSupportRestDisplacement
void setElasticSupportRestDisplacement(
size_t support,
double restDisplacement)Changing the rest displacement reuses the factorization.
clearElasticSupports
void clearElasticSupports()clearLoads
void clearLoads()Clear all applied forces, surface loads, and gravity.
addNodalForce
void addNodalForce(unsigned int node, const Vec<3> &force)setGravity
void setGravity(const Vec<3> &acceleration)addSurfaceTraction
void addSurfaceTraction(size_t boundaryFace, const Vec<3> &traction)Integrated exactly over a linear boundary triangle; traction is N/m^2.
addSurfacePressure
void addSurfacePressure(size_t boundaryFace, double pressure)Positive pressure acts inward, irrespective of the imported tetrahedron orientation.
solve
const Statistics &solve()Throws for unsupported rigid modes, singular/ill-conditioned meshes, or an inaccurate solve. The cached result is invalidated by setters; query it after a successful solve.
displacements
const std::vector<Vec<3>> &displacements() constreactions
const std::vector<Vec<3>> &reactions() constelementResults
const std::vector<ElementResult> &elementResults() constboltResults
const std::vector<BoltResult> &boltResults() conststatistics
const Statistics &statistics() constwriteVtk
void writeVtk(const std::string &path) constOriginal mesh with displacement/reaction point fields and stress/strain cell fields.