chrono::ChConstraintThreeBBShaft Class Reference

Description

A class for representing a constraint between two bodies (2x6dof in space) and a 1D dof (a shaft)

#include <ChConstraintThreeBBShaft.h>

Inheritance diagram for chrono::ChConstraintThreeBBShaft:
Collaboration diagram for chrono::ChConstraintThreeBBShaft:

Public Member Functions

 ChConstraintThreeBBShaft ()
 Default constructor.
 
 ChConstraintThreeBBShaft (ChVariablesBody *mvariables_a, ChVariablesBody *mvariables_b, ChVariables *mvariables_c)
 Construct and immediately set references to variables.
 
 ChConstraintThreeBBShaft (const ChConstraintThreeBBShaft &other)
 Copy constructor.
 
virtual ChConstraintThreeBBShaftClone () const override
 "Virtual" copy constructor (covariant return type).
 
ChConstraintThreeBBShaftoperator= (const ChConstraintThreeBBShaft &other)
 Assignment operator: copy from other object.
 
virtual ChMatrix< double > * Get_Cq_a () override
 Access jacobian matrix.
 
virtual ChMatrix< double > * Get_Cq_b () override
 Access jacobian matrix.
 
virtual ChMatrix< double > * Get_Cq_c () override
 Access jacobian matrix.
 
virtual ChMatrix< double > * Get_Eq_a () override
 Access auxiliary matrix (ex: used by iterative solvers)
 
virtual ChMatrix< double > * Get_Eq_b () override
 Access auxiliary matrix (ex: used by iterative solvers)
 
virtual ChMatrix< double > * Get_Eq_c () override
 Access auxiliary matrix (ex: used by iterative solvers)
 
void SetVariables (ChVariables *mvariables_a, ChVariables *mvariables_b, ChVariables *mvariables_c) override
 Set references to the constrained objects, If first two variables aren't from ChVariablesBody class, an assert failure happens. More...
 
virtual void Update_auxiliary () override
 This function updates the following auxiliary data: More...
 
virtual double Compute_Cq_q () override
 This function must computes the product between the row-jacobian of this constraint '[Cq_i]' and the vector of variables, 'v'. More...
 
virtual void Increment_q (const double deltal) override
 This function must increment the vector of variables 'v' with the quantity [invM]*[Cq_i]'deltal,that is v+=[invM][Cq_i]'*deltal or better: v+=[Eq_i]*deltal This is used for some iterative solvers. More...
 
virtual void MultiplyAndAdd (double &result, const ChMatrix< double > &vect) const override
 Computes the product of the corresponding block in the system matrix by 'vect', and add to 'result'. More...
 
virtual void MultiplyTandAdd (ChMatrix< double > &result, double l) override
 Computes the product of the corresponding transposed blocks in the system matrix (ie. More...
 
virtual void Build_Cq (ChSparseMatrix &storage, int insrow) override
 Puts the jacobian parts into the 'insrow' row of a sparse matrix, where both portions of the jacobian are shifted in order to match the offset of the corresponding ChVariable. More...
 
virtual void Build_CqT (ChSparseMatrix &storage, int inscol) override
 Same as Build_Cq, but puts the transposed jacobian row as a column.
 
virtual void StreamIN (ChStreamInBinary &mstream) override
 Method to allow deserializing a persistent binary archive (ex: a file) into transient data. More...
 
virtual void StreamOUT (ChStreamOutBinary &mstream) override
 Method to allow serializing transient data into a persistent binary archive (ex: a file). More...
 
- Public Member Functions inherited from chrono::ChConstraintThree
 ChConstraintThree ()
 Default constructor.
 
 ChConstraintThree (const ChConstraintThree &other)
 Copy constructor.
 
ChConstraintThreeoperator= (const ChConstraintThree &other)
 Assignment operator: copy from other object.
 
ChVariablesGetVariables_a ()
 Access the first variable object.
 
ChVariablesGetVariables_b ()
 Access the second variable object.
 
ChVariablesGetVariables_c ()
 Access the second variable object.
 
- Public Member Functions inherited from chrono::ChConstraint
 ChConstraint ()
 Default constructor.
 
 ChConstraint (const ChConstraint &other)
 Copy constructor.
 
ChConstraintoperator= (const ChConstraint &other)
 Assignment operator: copy from other object.
 
bool operator== (const ChConstraint &other) const
 Comparison (compares anly flags, not the jacobians etc.)
 
virtual bool IsValid () const
 Tells if the constraint data is currently valid.
 
virtual void SetValid (bool mon)
 Use this function to set the valid state (child class Children classes must use this function depending on the result of their implementations of RestoreReference();.
 
virtual bool IsDisabled () const
 Tells if the constraint is currently turned on or off by the user.
 
virtual void SetDisabled (bool mon)
 User can use this to enable/disable the constraint as desired.
 
virtual bool IsRedundant () const
 Tells if the constraint is redundant or singular.
 
virtual void SetRedundant (bool mon)
 Solvers may use the following to mark a constraint as redundant.
 
virtual bool IsBroken () const
 Tells if the constraint is broken, for eccess of pulling/pushing.
 
virtual void SetBroken (bool mon)
 3rd party software can set the 'broken' status via this method (by default, constraints never break);
 
virtual bool IsUnilateral () const
 Tells if the constraint is unilateral (typical complementarity constraint). More...
 
virtual bool IsLinear () const
 Tells if the constraint is linear (if non linear, returns false).
 
eChConstraintMode GetMode () const
 Gets the mode of the constraint: free / lock / complementary A typical constraint has 'lock = true' by default. More...
 
void SetMode (eChConstraintMode mmode)
 Sets the mode of the constraint: free / lock / complementary.
 
virtual bool IsActive () const
 A VERY IMPORTANT function! Tells if the constraint is currently active, in general, that is tells if it must be included into the system solver or not. More...
 
virtual void SetActive (bool isactive)
 Set the status of the constraint to active.
 
virtual double Compute_c_i ()
 Compute the residual of the constraint using the LINEAR expression c_i= [Cq_i]*q + cfm_i*l_i + b_i . More...
 
double Get_c_i () const
 Return the residual 'c_i' of this constraint. // CURRENTLY NOT USED.
 
void Set_b_i (const double mb)
 Sets the known term b_i in [Cq_i]*q + b_i =0, where: c_i = [Cq_i]*q + b_i = 0.
 
double Get_b_i () const
 Return the known term b_i in [Cq_i]*q + b_i =0, where: c_i= [Cq_i]*q + b_i = 0.
 
void Set_cfm_i (const double mcfm)
 Sets the constraint force mixing term (default=0). More...
 
double Get_cfm_i () const
 Returns the constraint force mixing term.
 
virtual void Set_l_i (double ml_i)
 Sets the 'l_i' value (constraint reaction, see 'l' vector)
 
virtual double Get_l_i () const
 Return the 'l_i' value (constraint reaction, see 'l' vector)
 
double Get_g_i () const
 Return the 'g_i' product , that is [Cq_i]*[invM_i]*[Cq_i]' (+cfm)
 
void Set_g_i (double m_g_i)
 Usually you should not use the Set_g_i function, because g_i should be automatically computed during the Update_auxiliary() . More...
 
virtual void Project ()
 For iterative solvers: project the value of a possible 'l_i' value of constraint reaction onto admissible orthant/set. More...
 
virtual double Violation (double mc_i)
 Given the residual of the constraint computed as the linear map mc_i = [Cq]*q + b_i + cfm*l_i , returns the violation of the constraint, considering inequalities, etc. More...
 
void SetOffset (int moff)
 Set offset in global q vector (set automatically by ChSystemDescriptor)
 
int GetOffset () const
 Get offset in global q vector.
 

Protected Attributes

ChMatrixNM< double, 1, 6 > Cq_a
 The [Cq_a] jacobian of the constraint.
 
ChMatrixNM< double, 1, 6 > Cq_b
 The [Cq_b] jacobian of the constraint.
 
ChMatrixNM< double, 1, 1 > Cq_c
 The [Cq_c] jacobian of the constraint.
 
ChMatrixNM< double, 6, 1 > Eq_a
 The [Eq_a] product [Eq_a]=[invM_a]*[Cq_a]'.
 
ChMatrixNM< double, 6, 1 > Eq_b
 The [Eq_b] product [Eq_b]=[invM_b]*[Cq_b]'.
 
ChMatrixNM< double, 1, 1 > Eq_c
 The [Eq_c] product [Eq_c]=[invM_c]*[Cq_c]'.
 
- Protected Attributes inherited from chrono::ChConstraintThree
ChVariablesvariables_a
 The first constrained object.
 
ChVariablesvariables_b
 The second constrained object.
 
ChVariablesvariables_c
 The third constrained object.
 
- Protected Attributes inherited from chrono::ChConstraint
double c_i
 The 'c_i' residual of the constraint (if satisfied, c must be =0)
 
double l_i
 The 'l_i' lagrangian multiplier (reaction)
 
double b_i
 The 'b_i' right term in [Cq_i]*q+b_i=0 , note: c_i= [Cq_i]*q. More...
 
double cfm_i
 The constraint force mixing, if needed (usually is zero) to add some numerical 'compliance' in the constraint, that is the equation becomes: c_i= [Cq_i]*q + b_i + cfm*l_i =0; Example, it could be cfm = [k * h^2](^-1) where k is stiffness.
 
eChConstraintMode mode
 mode of the constraint: free / lock / complementar
 
double g_i
 'g_i' product [Cq_i]*[invM_i]*[Cq_i]' (+cfm)
 
int offset
 offset in global "l" state vector (needed by some solvers)
 

Member Function Documentation

void chrono::ChConstraintThreeBBShaft::Build_Cq ( ChSparseMatrix storage,
int  insrow 
)
overridevirtual

Puts the jacobian parts into the 'insrow' row of a sparse matrix, where both portions of the jacobian are shifted in order to match the offset of the corresponding ChVariable.

Implements chrono::ChConstraint.

double chrono::ChConstraintThreeBBShaft::Compute_Cq_q ( )
overridevirtual

This function must computes the product between the row-jacobian of this constraint '[Cq_i]' and the vector of variables, 'v'.

that is CV=[Cq_i]*v This is used for some iterative solvers.

Implements chrono::ChConstraint.

void chrono::ChConstraintThreeBBShaft::Increment_q ( const double  deltal)
overridevirtual

This function must increment the vector of variables 'v' with the quantity [invM]*[Cq_i]'deltal,that is v+=[invM][Cq_i]'*deltal or better: v+=[Eq_i]*deltal This is used for some iterative solvers.

Implements chrono::ChConstraint.

void chrono::ChConstraintThreeBBShaft::MultiplyAndAdd ( double &  result,
const ChMatrix< double > &  vect 
) const
overridevirtual

Computes the product of the corresponding block in the system matrix by 'vect', and add to 'result'.

NOTE: the 'vect' vector must already have the size of the total variables&constraints in the system; the procedure will use the ChVariable offsets (that must be already updated) to know the indexes in result and vect;

Implements chrono::ChConstraint.

void chrono::ChConstraintThreeBBShaft::MultiplyTandAdd ( ChMatrix< double > &  result,
double  l 
)
overridevirtual

Computes the product of the corresponding transposed blocks in the system matrix (ie.

the TRANSPOSED jacobian matrix C_q') by 'l', and add to 'result'. NOTE: the 'result' vector must already have the size of the total variables&constraints in the system; the procedure will use the ChVariable offsets (that must be already updated) to know the indexes in result and vect;

Implements chrono::ChConstraint.

void chrono::ChConstraintThreeBBShaft::SetVariables ( ChVariables mvariables_a,
ChVariables mvariables_b,
ChVariables mvariables_c 
)
overridevirtual

Set references to the constrained objects, If first two variables aren't from ChVariablesBody class, an assert failure happens.

Implements chrono::ChConstraintThree.

void chrono::ChConstraintThreeBBShaft::StreamIN ( ChStreamInBinary mstream)
overridevirtual

Method to allow deserializing a persistent binary archive (ex: a file) into transient data.

Reimplemented from chrono::ChConstraintThree.

void chrono::ChConstraintThreeBBShaft::StreamOUT ( ChStreamOutBinary mstream)
overridevirtual

Method to allow serializing transient data into a persistent binary archive (ex: a file).

Reimplemented from chrono::ChConstraintThree.

void chrono::ChConstraintThreeBBShaft::Update_auxiliary ( )
overridevirtual

This function updates the following auxiliary data:

  • the Eq_a and Eq_b and Eq_c matrices
  • the g_i product This is often called by solvers at the beginning of the solution process. Most often, inherited classes won't need to override this.

Reimplemented from chrono::ChConstraint.