BeamAdapter
Loading...
Searching...
No Matches
AdaptiveBeamForceFieldAndMass< DataTypes > Class Template Reference

AdaptiveBeamForceFieldAndMass Class. More...

#include <AdaptiveBeamForceFieldAndMass.h>

Inheritance diagram for AdaptiveBeamForceFieldAndMass< DataTypes >:

Classes

class  BeamLocalMatrices
 BeamLocalMatrices Class. More...

Public Types

using Coord = typename DataTypes::Coord
using VecCoord = typename DataTypes::VecCoord
using Real = typename Coord::value_type
using Deriv = typename DataTypes::Deriv
using VecDeriv = typename DataTypes::VecDeriv
using DataVecCoord = Data<VecCoord>
using DataVecDeriv = Data<VecDeriv>
using Vec3 = sofa::type::Vec<3, Real>
using Vec6 = sofa::type::Vec<6, Real>
using Vec6NoInit = sofa::type::VecNoInit<6, Real>
using Matrix6x6 = sofa::type::Mat<6, 6, Real>
using Matrix6x6NoInit = sofa::type::MatNoInit<6, 6, Real>
using Transform = sofa::type::Transform<Real>
using SpatialVector = sofa::type::SpatialVector<Real>
using BInterpolation = BaseBeamInterpolation<DataTypes>

Public Member Functions

 SOFA_CLASS (SOFA_TEMPLATE(AdaptiveBeamForceFieldAndMass, DataTypes), SOFA_TEMPLATE(core::behavior::Mass, DataTypes))
void init () override
 This is inhereted from BaseComponent.
void reinit () override
void draw (const sofa::core::visual::VisualParams *vparams) override
 Visualization.
void addMDx (const sofa::core::MechanicalParams *mparams, DataVecDeriv &f, const DataVecDeriv &dx, SReal factor) override
 Mass Interface.
void addMToMatrix (const sofa::core::MechanicalParams *mparams, const sofa::core::behavior::MultiMatrixAccessor *matrix) override
void addMBKToMatrix (const sofa::core::MechanicalParams *mparams, const sofa::core::behavior::MultiMatrixAccessor *matrix) override
void buildMassMatrix (sofa::core::behavior::MassMatrixAccumulator *matrices) override
void buildStiffnessMatrix (core::behavior::StiffnessMatrix *matrix) override
void buildDampingMatrix (core::behavior::DampingMatrix *matrices) override
void accFromF (const sofa::core::MechanicalParams *mparams, DataVecDeriv &, const DataVecDeriv &) override
SReal getKineticEnergy (const sofa::core::MechanicalParams *mparams, const DataVecDeriv &) const override
 < vMv/2 using dof->getV()
void addGravityToV (const sofa::core::MechanicalParams *mparams, DataVecDeriv &) override
bool isDiagonal () const override
void addForce (const sofa::core::MechanicalParams *mparams, DataVecDeriv &f, const DataVecCoord &x, const DataVecDeriv &v) override
 ForceField Interface.
void addDForce (const sofa::core::MechanicalParams *mparams, DataVecDeriv &datadF, const DataVecDeriv &datadX) override
SReal getPotentialEnergy (const sofa::core::MechanicalParams *mparams, const DataVecCoord &) const override
void addKToMatrix (const sofa::core::MechanicalParams *mparams, const sofa::core::behavior::MultiMatrixAccessor *matrix) override
void computeStiffness (const sofa::Index beamID, BeamLocalMatrices &beamLocalMatrices)
void computeMass (const sofa::Index beamID, BeamLocalMatrices &beamMatrices)

Public Attributes

Data< bool > d_computeMass
 if false, only compute the stiff elastic model
Real m_defaultMassDensity
Data< type::vector< Real > > d_massDensity
 Density of the mass.
Data< bool > d_useShearStressComputation
 if false, suppress the shear stress in the computation
Data< bool > d_reinforceLength
 if true, perform a separate computation to evaluate the elongation

Protected Member Functions

void applyMassLarge (VecDeriv &df, const VecDeriv &dx, const sofa::Index beamID, const sofa::Index nd0Id, const sofa::Index nd1Id, const SReal factor)
void applyGravityLarge (VecDeriv &df, const sofa::Index beamID, const sofa::Index nd0Id, const sofa::Index nd1Id, const SReal factor)
void applyStiffnessLarge (VecDeriv &df, const VecDeriv &dx, const sofa::Index beamID, const sofa::Index nd0Id, const sofa::Index nd1Id, const SReal factor)
void computeGravityVector ()

Protected Attributes

SingleLink< AdaptiveBeamForceFieldAndMass< DataTypes >, BInterpolation, BaseLink::FLAG_STOREPATH|BaseLink::FLAG_STRONGLINK > l_interpolation

Detailed Description

Member Function Documentation

◆ addForce()

template<class DataTypes>
void addForce ( const sofa::core::MechanicalParams * mparams,
DataVecDeriv & f,
const DataVecCoord & x,
const DataVecDeriv & v )
override

ForceField Interface.

TODO:

  • Redimentionner _localBeamMatrices
  • Calculer les rotation et les transformations
  • Calculer la matrice "locale"
  • Calculer la force exercée par chaque beam
  • Calculer la force exercée par la gravité

find the indices of the nodes

find the beamMatrices:

  1. get the current transform of the beam:
  1. Computes the frame of the beam based on the spline interpolation:
  1. Computes the transformation from the DOF (in global frame) to the node's local frame DOF0global_H_Node0local and DOF1global_H_Node1local
  1. Computes the adequate transformation
  • rotation due to the optional transformation

compute Adjoint Matrices:

Update Interpolation & geometrical parameters with current positions

material parameters

compute the local mass matrices

IF RIGIDIFICATION: no stiffness forces:

compute the local stiffness matrices

COMPUTATION OF THE STIFFNESS FORCE compute the current local displacement of the beam (6dofs)

  1. get the rest transformation from local to 0 and local to 1
  1. computes the local displacement of 0 and 1 in frame local:
  1. put the result in a Vec6

TEST ////////////////////// test: correction due to spline computation;

compute the force in the local frame:

compute the force in the global frame

Add this force to vector f

add the gravity force M*g directly using m_gravity:

◆ addMToMatrix()

template<class DataTypes>
void addMToMatrix ( const sofa::core::MechanicalParams * mparams,
const sofa::core::behavior::MultiMatrixAccessor * matrix )
override

matrices in global frame

◆ applyGravityLarge()

template<class DataTypes>
void applyGravityLarge ( VecDeriv & df,
const sofa::Index beamID,
const sofa::Index nd0Id,
const sofa::Index nd1Id,
const SReal factor )
protected

gravity acceleration expressed in the beam local frame

gravity force in local frame

force in global frame

put the result in df

◆ applyMassLarge()

template<class DataTypes>
void applyMassLarge ( VecDeriv & df,
const VecDeriv & dx,
const sofa::Index beamID,
const sofa::Index nd0Id,
const sofa::Index nd1Id,
const SReal factor )
protected

Real mass-vector product: df += factor * M * dx (in the beam local frame).

displacement in local frame

inertial force in local frame

force in global frame

put the result in df

◆ applyStiffnessLarge()

template<class DataTypes>
void applyStiffnessLarge ( VecDeriv & df,
const VecDeriv & dx,
const sofa::Index beamID,
const sofa::Index nd0Id,
const sofa::Index nd1Id,
const SReal factor )
protected

Return in case of rigidification

displacement in local frame

internal force in local frame

force in global frame

put the result in df

◆ buildMassMatrix()

template<class DataTypes>
void buildMassMatrix ( sofa::core::behavior::MassMatrixAccumulator * matrices)
override

matrices in global frame

◆ computeMass()

template<class DataTypes>
void computeMass ( const sofa::Index beamID,
BeamLocalMatrices & beamMatrices )

diagonal values

diagonal blocks

lower non-diagonal blocks

Make a symetric matrix with diagonal blocks

upper non-diagonal block : set k_loc10 as the transposed matrix of k_loc01

◆ computeStiffness()

template<class DataTypes>
void computeStiffness ( const sofa::Index beamID,
BeamLocalMatrices & beamLocalMatrices )

material parameters

Find shear-deformation parameters

diagonal values

diagonal blocks

lower non-diagonal blocks

Make a symetric matrix with diagonal blocks

upper non-diagonal block : set k_loc10 as the transposed matrix of k_loc01

◆ draw()

template<class DataTypes>
void draw ( const sofa::core::visual::VisualParams * vparams)
override

Visualization.

rigidification case