UniformMass
This component belongs to the category of Masses. The UniformMass is a very simplistic mass component since it does not compute the volume integration of a density term. The mass is equally spread over the number of points, thus resulting in the following diagonal mass matrix:
Each diagonal term equals the nodal mass where
is the total mass of the objet and
is the number of nodes of the object. Spreading the mass over the nodes without considering their connectivity results in this diagonal mass matrix
.
As all mass components, the UniformMass will contribute to the main matrix
in the system
. Depending on the type of LinearSolver used:
- for iterative solvers, the result of the multiplication between the mass matrix
and an approximated solution is computed by the function:
template <class DataTypes, class MassType>
void UniformMass<DataTypes, MassType>::addMDx ( const core::MechanicalParams*, DataVecDeriv& vres, const DataVecDeriv& vdx, SReal factor)
{
helper::WriteAccessor<DataVecDeriv> res = vres;
helper::ReadAccessor<DataVecDeriv> dx = vdx;
int> > > indices = d_indices;
WriteAccessor<Data<vector<
MassType m = d_vertexMass.getValue();if ( factor != 1.0 )
typename DataTypes::Real ) factor;
m *= (
for ( unsigned int i=0; i<indices.size(); i++ )
res[indices[i]] += dx[indices[i]] * m; }
- for direct solvers, the mass matrix
is built by the function:
/// Add Mass contribution to global Matrix assembling
template <class DataTypes, class MassType>
void UniformMass<DataTypes, MassType>::addMToMatrix (const MechanicalParams *mparams, const MultiMatrixAccessor* matrix)
{const MassType& m = d_vertexMass.getValue();
const size_t N = DataTypeInfo<Deriv>::size();
AddMToMatrixFunctor<Deriv,MassType> calc;
MultiMatrixAccessor::MatrixRef r = matrix->getMatrix(mstate);
this->rayleighMass.getValue());
Real mFactor = (Real)mparams->mFactorIncludingRayleighDamping(
int> > > indices = d_indices;
ReadAccessor<Data<vector<for ( unsigned int i=0; i<indices.size(); i++ )
calc ( r.matrix, m, r.offset + N*indices[i], mFactor); }
Data
Since the UniformMass equally spread the total mass over all the nodes of the object, the component can be initialized using:
- either the vertexMass data: corresponding to the nodal mass
, set equally at each node
- or the totalMass data: corresponding to the total mass
of the object
Usage
The UniformMass only requires a MechanicalObject to store the degrees of freedom associated to the nodes. An integration scheme and a solver are also necessary to solve the linear system at each time step.
Since the UniformMass only set a constant mass at each node without considering their connectivity, no topology is needed for the UniformMass. For this reason, the UniformMass is suitable for rigid frames.
However, the UniformMass should be carefully used if accuracy is a criterion, especially when using surface or volumetric physical models. As written above, the UniformMass does not take into account the geometry and the topology of the object since no space integration is computed.
Example
This component is used as follows in XML format:
<UniformMass totalMass="10" />
or using SofaPython3:
'UniformMass', totalMass='10') node.addObject(
An example scene involving a UniformMass is available in examples/Components/mass/UniformMass.scn
Last modified: 15 May 2023