Description
Class for assemblies of items, for example ChBody, ChLink, ChMesh, etc.
This supports component mode synthesis (CMS) to do substructuring, hence an assembly becomes a "modal body" where many "internal" DOFs of finite elements will be reduced to few modal modes that are superimposed to the motion of a floating frame (for small deflections). Some nodes can be selected as "boundary nodes" to allow connecting this modal assembly to external joints and forces.
#include <ChModalAssembly.h>
Classes | |
class | CustomForceFullCallback |
Class to be used as a callback interface for computing a custom force F applied to the full (not reduced) coordinates; when in reduced mode, this force will be applied with an automatic transformation to the reduced coordinates. More... | |
class | CustomForceModalCallback |
Class to be used as a callback interface for computing a custom force F applied to the modal coordinates. More... | |
Public Member Functions | |
ChModalAssembly (const ChModalAssembly &other) | |
virtual ChModalAssembly * | Clone () const override |
"Virtual" copy constructor (covariant return type). | |
ChModalAssembly & | operator= (ChModalAssembly other) |
Assignment operator for ChModalAssembly. | |
void | SetModalMode (bool mmodal) |
Set true to ignore the dofs of all the "internal" bodies, meshes, etc. More... | |
bool | IsModalMode () |
bool | ComputeModes (const ChModalSolveUndamped &n_modes_settings) |
Compute the undamped modes for the current assembly. More... | |
bool | ComputeModesExternalData (ChSparseMatrix &mM, ChSparseMatrix &mK, ChSparseMatrix &full_Cq, const ChModalSolveUndamped &n_modes_settings) |
Compute the undamped modes from M and K matrices. Later you can fetch results via Get_modes_V() etc. More... | |
bool | ComputeModesDamped (const ChModalSolveDamped &n_modes_settings) |
Compute the damped modes for the entire assembly. More... | |
void | SwitchModalReductionON (const ChModalSolveUndamped &n_modes_settings, const ChModalDamping &damping_model=ChModalDampingNone()) |
Perform modal reduction on this assembly, from the current "full" ("boundary"+"internal") assembly. More... | |
void | SwitchModalReductionON (ChSparseMatrix &full_M, ChSparseMatrix &full_K, ChSparseMatrix &full_Cq, const ChModalSolveUndamped &n_modes_settings, const ChModalDamping &damping_model=ChModalDampingNone()) |
Perform modal reduction on this assembly that contains only the "boundary" nodes, whereas the "internal" nodes have been modeled only in an external FEA software with the full ("boundary"+"internal") modes. More... | |
void | SetFullStateWithModeOverlay (int n_mode, double phase, double amplitude) |
For displaying modes, you can use the following function. More... | |
void | SetInternalStateWithModes (bool full_update) |
For displaying the deformation using internal nodes, you can use the following function. More... | |
void | SetFullStateReset () |
Resets the state of this subassembly (both boundary and inner items) to the state snapshot that was taken when doing the last ComputeModes() or ComputeModesDamped(). | |
void | GetStateLocal (ChStateDelta &Dx_local, ChStateDelta &v_local) |
Computes the 'local' increment of the subassembly (increment of configuration respect to the x0 snapshot configuration, in local reference), and also gets the speed in local reference. | |
void | SetInternalNodesUpdate (bool mflag) |
Optimization flag. More... | |
int | Get_n_modes_coords_w () |
Get the number of modal coordinates. Use SwitchModalReductionOn() to change it. | |
ChVectorDynamic & | Get_modal_q () |
Access the vector of modal coordinates. | |
ChVectorDynamic & | Get_modal_q_dt () |
Access the vector of time derivative of modal coordinates (speeds) | |
ChVectorDynamic & | Get_modal_q_dtdt () |
Access the vector of 2nd time derivative of modal coordinates (accelerations) | |
void | RegisterCallback_CustomForceModal (std::shared_ptr< CustomForceModalCallback > mcallback) |
Specify the optional callback object for computing a custom modal force. | |
void | RegisterCallback_CustomForceFull (std::shared_ptr< CustomForceFullCallback > mcallback) |
Specify the optional callback object for computing a custom force acting on the full (not reduced) coordinates. | |
ChVectorDynamic & | Get_custom_F_modal () |
Access the current value of vector of custom applied forces to modal coordinates. More... | |
ChVectorDynamic & | Get_custom_F_full () |
Access the current value of vector of custom applied forces to original coordinates. More... | |
const ChMatrixDynamic & | Get_modal_M () const |
Access the modal mass matrix - read only. | |
const ChMatrixDynamic & | Get_modal_K () const |
Access the modal stiffness matrix - read only. | |
const ChMatrixDynamic & | Get_modal_R () const |
Access the modal damping matrix - read only. | |
const ChMatrixDynamic & | Get_modal_Psi () const |
Access the Psi matrix as in v_full = Psi * v_reduced, also {v_boundary; v_internal} = Psi * {v_boundary; v_modes} Hence Psi contains the "static modes" and the selected "dynamic modes", as in Psi = [I, 0; Psi_s, Psi_d] where Psi_d is the matrix of the selected eigenvectors after SwitchModalReductionON(). | |
const ChVectorDynamic & | Get_assembly_x0 () const |
Access the snapshot of initial state of the full assembly just at the beginning of SwitchModalReductionON() | |
const ChMatrixDynamic< std::complex< double > > & | Get_modes_V () const |
Access the modal eigenvectors, if previously computed. More... | |
const ChVectorDynamic< std::complex< double > > & | Get_modes_eig () const |
Access the modal eigenvalues, if previously computed. More... | |
const ChVectorDynamic< double > & | Get_modes_frequencies () const |
Get a vector of (undamped) modal natural frequencies [Hz], if previously computed. More... | |
const ChVectorDynamic< double > & | Get_modes_damping_ratios () const |
Get a vector of modal damping ratios = damping/critical_damping, if previously computed. More... | |
const ChVectorDynamic & | Get_modes_assembly_x0 () const |
Access the snapshot of initial state of the assembly at the moment of the analysis. More... | |
void | Clear () |
Removes all inserted items: bodies, links, etc., both boundary and internal. | |
void | AddInternalBody (std::shared_ptr< ChBody > body) |
Attach an internal body to this assembly. | |
void | AddInternalLink (std::shared_ptr< ChLinkBase > link) |
Attach an internal link to this assembly. | |
void | AddInternalMesh (std::shared_ptr< fea::ChMesh > mesh) |
Attach an internal mesh to this assembly. | |
void | AddInternalOtherPhysicsItem (std::shared_ptr< ChPhysicsItem > item) |
Attach an internal ChPhysicsItem object that is not a body, link, or mesh. | |
void | AddInternal (std::shared_ptr< ChPhysicsItem > item) |
Attach an arbitrary internal ChPhysicsItem (e.g. More... | |
void | RemoveInternalBody (std::shared_ptr< ChBody > body) |
Remove an internal body from this assembly. | |
void | RemoveInternalLink (std::shared_ptr< ChLinkBase > link) |
Remove an internal link from this assembly. | |
void | RemoveInternalMesh (std::shared_ptr< fea::ChMesh > mesh) |
Remove an internal mesh from the assembly. | |
void | RemoveInternalOtherPhysicsItem (std::shared_ptr< ChPhysicsItem > item) |
Remove an internal ChPhysicsItem object that is not a body or a link. | |
void | RemoveInternal (std::shared_ptr< ChPhysicsItem > item) |
Remove an internal arbitrary ChPhysicsItem that was added to the assembly. | |
void | RemoveAllInternalBodies () |
Remove all internal bodies from this assembly. | |
void | RemoveAllInternalLinks () |
Remove all internal links from this assembly. | |
void | RemoveAllInternalMeshes () |
Remove all meshes from this assembly. | |
void | RemoveAllInternalOtherPhysicsItems () |
Remove all physics items not in the body, link, or mesh lists. | |
const std::vector< std::shared_ptr< ChBody > > & | Get_internal_bodylist () const |
Get the list of internal bodies. | |
const std::vector< std::shared_ptr< ChLinkBase > > & | Get_internal_linklist () const |
Get the list of internal links. | |
const std::vector< std::shared_ptr< fea::ChMesh > > & | Get_internal_meshlist () const |
Get the list of internal meshes. | |
const std::vector< std::shared_ptr< ChPhysicsItem > > & | Get_internal_otherphysicslist () const |
Get the list of internal physics items that are not in the body or link lists. | |
int | GetN_internal_bodies () const |
Get the number of internal bodies. | |
int | GetN_internal_links () const |
Get the number of internal links. | |
int | GetN_internal_meshes () const |
Get the number of internal meshes. | |
int | GetN_internal_physicsItems () const |
Get the number of other internal physics items (other than bodies, links, or meshes). | |
int | GetN_internal_coords () const |
Get the number of internal coordinates (considering 7 coords for rigid bodies because of the 4 dof of quaternions). | |
int | GetN_internal_dof () const |
Get the number of internal degrees of freedom of the assembly. | |
int | GetN_internal_doc () const |
Get the number of internal scalar constraints added to the assembly, including constraints on quaternion norms because of the 4 dof of quaternions. | |
int | GetN_internal_sysvars () const |
Get the number of internal system variables (coordinates plus the constraint multipliers, in case of quaternions). | |
int | GetN_internal_coords_w () const |
Get the number of internal coordinates (considering 6 coords for rigid bodies, 3 transl.+3rot.) | |
int | GetN_internal_doc_w () const |
Get the number of internal scalar constraints added to the assembly. | |
int | GetN_internal_doc_w_C () const |
Get the number of internal scalar constraints added to the assembly (only bilaterals). | |
int | GetN_internal_doc_w_D () const |
Get the number of internal scalar constraints added to the assembly (only unilaterals). | |
int | GetN_internal_sysvars_w () const |
Get the number of internal system variables (coordinates plus the constraint multipliers). | |
int | GetN_boundary_bodies () const |
Get the number of boundary bodies. | |
int | GetN_boundary_links () const |
Get the number of boundary links. | |
int | GetN_boundary_meshes () const |
Get the number of boundary meshes. | |
int | GetN_boundary_physicsItems () const |
Get the number of other boundary physics items (other than bodies, links, or meshes). | |
int | GetN_boundary_coords () const |
Get the number of boundary coordinates (considering 7 coords for rigid bodies because of the 4 dof of quaternions). | |
int | GetN_boundary_dof () const |
Get the number of boundary degrees of freedom of the assembly. | |
int | GetN_boundary_doc () const |
Get the number of boundary scalar constraints added to the assembly, including constraints on quaternion norms because of the 4 dof of quaternions. | |
int | GetN_boundary_sysvars () const |
Get the number of boundary system variables (coordinates plus the constraint multipliers, in case of quaternions). | |
int | GetN_boundary_coords_w () const |
Get the number of boundary coordinates (considering 6 coords for rigid bodies, 3 transl.+3rot.) | |
int | GetN_boundary_doc_w () const |
Get the number of boundary scalar constraints added to the assembly. | |
int | GetN_boundary_doc_w_C () const |
Get the number of boundary scalar constraints added to the assembly (only bilaterals). | |
int | GetN_boundary_doc_w_D () const |
Get the number of boundary scalar constraints added to the assembly (only unilaterals). | |
int | GetN_boundary_sysvars_w () const |
Get the number of boundary system variables (coordinates plus the constraint multipliers). | |
void | DumpSubassemblyMatrices (bool save_M, bool save_K, bool save_R, bool save_Cq, const char *path) |
Dump the M mass matrix, K damping matrix, R damping matrix, Cq constraint jacobian matrix (at the current configuration) for this subassembly, Assumes the rows/columns of the matrices are ordered as the ChVariable objects used in this assembly, first the all the "boundary" variables then all the "inner" variables (or modal variables if switched to modal assembly). More... | |
void | GetSubassemblyMassMatrix (ChSparseMatrix *M) |
Compute the mass matrix of the subassembly. More... | |
void | GetSubassemblyStiffnessMatrix (ChSparseMatrix *K) |
Compute the stiffness matrix of the subassembly, i.e. More... | |
void | GetSubassemblyDampingMatrix (ChSparseMatrix *R) |
Compute the stiffness matrix of the subassembly, i.e. More... | |
void | GetSubassemblyConstraintJacobianMatrix (ChSparseMatrix *Cq) |
Compute the constraint jacobian matrix of the subassembly, i.e. More... | |
virtual void | SetSystem (ChSystem *m_system) override |
Set the pointer to the parent ChSystem() and also add to new collision system / remove from old coll.system. | |
virtual void | SyncCollisionModels () override |
If this physical item contains one or more collision models, synchronize their coordinates and bounding boxes to the state of the item. | |
virtual void | Setup () override |
Counts the number of bodies, links, and meshes. More... | |
virtual void | Update (bool update_assets=true) override |
Updates all the auxiliary data and children of bodies, forces, links, given their current state. | |
virtual void | SetNoSpeedNoAcceleration () override |
Set zero speed (and zero accelerations) in state, without changing the position. | |
virtual int | GetDOF () override |
Get the number of scalar coordinates (ex. dim of position vector) | |
virtual int | GetDOF_w () override |
Get the number of scalar coordinates of variables derivatives (ex. dim of speed vector) | |
virtual int | GetDOC () override |
Get the number of scalar constraints, if any, in this item. | |
virtual int | GetDOC_c () override |
Get the number of scalar constraints, if any, in this item (only bilateral constr.) | |
virtual int | GetDOC_d () override |
Get the number of scalar constraints, if any, in this item (only unilateral constr.) | |
virtual void | IntStateGather (const unsigned int off_x, ChState &x, const unsigned int off_v, ChStateDelta &v, double &T) override |
From item's state to global state vectors y={x,v} pasting the states at the specified offsets. More... | |
virtual void | IntStateScatter (const unsigned int off_x, const ChState &x, const unsigned int off_v, const ChStateDelta &v, const double T, bool full_update) override |
From global state vectors y={x,v} to item's state (and update) fetching the states at the specified offsets. More... | |
virtual void | IntStateGatherAcceleration (const unsigned int off_a, ChStateDelta &a) override |
From item's state acceleration to global acceleration vector. More... | |
virtual void | IntStateScatterAcceleration (const unsigned int off_a, const ChStateDelta &a) override |
From global acceleration vector to item's state acceleration. More... | |
virtual void | IntStateGatherReactions (const unsigned int off_L, ChVectorDynamic<> &L) override |
From item's reaction forces to global reaction vector. More... | |
virtual void | IntStateScatterReactions (const unsigned int off_L, const ChVectorDynamic<> &L) override |
From global reaction vector to item's reaction forces. More... | |
virtual void | IntStateIncrement (const unsigned int off_x, ChState &x_new, const ChState &x, const unsigned int off_v, const ChStateDelta &Dv) override |
Computes x_new = x + Dt , using vectors at specified offsets. More... | |
virtual void | IntStateGetIncrement (const unsigned int off_x, const ChState &x_new, const ChState &x, const unsigned int off_v, ChStateDelta &Dv) override |
Computes Dt = x_new - x, using vectors at specified offsets. More... | |
virtual void | IntLoadResidual_F (const unsigned int off, ChVectorDynamic<> &R, const double c) override |
Takes the F force term, scale and adds to R at given offset: R += c*F. More... | |
virtual void | IntLoadResidual_Mv (const unsigned int off, ChVectorDynamic<> &R, const ChVectorDynamic<> &w, const double c) override |
Takes the M*v term, multiplying mass by a vector, scale and adds to R at given offset: R += c*M*w. More... | |
virtual void | IntLoadResidual_CqL (const unsigned int off_L, ChVectorDynamic<> &R, const ChVectorDynamic<> &L, const double c) override |
Takes the term Cq'*L, scale and adds to R at given offset: R += c*Cq'*L. More... | |
virtual void | IntLoadConstraint_C (const unsigned int off, ChVectorDynamic<> &Qc, const double c, bool do_clamp, double recovery_clamp) override |
Takes the term C, scale and adds to Qc at given offset: Qc += c*C. More... | |
virtual void | IntLoadConstraint_Ct (const unsigned int off, ChVectorDynamic<> &Qc, const double c) override |
Takes the term Ct, scale and adds to Qc at given offset: Qc += c*Ct. More... | |
virtual void | IntToDescriptor (const unsigned int off_v, const ChStateDelta &v, const ChVectorDynamic<> &R, const unsigned int off_L, const ChVectorDynamic<> &L, const ChVectorDynamic<> &Qc) override |
Prepare variables and constraints to accommodate a solution: More... | |
virtual void | IntFromDescriptor (const unsigned int off_v, ChStateDelta &v, const unsigned int off_L, ChVectorDynamic<> &L) override |
After a solver solution, fetch values from variables and constraints into vectors: More... | |
virtual void | InjectVariables (ChSystemDescriptor &mdescriptor) override |
Tell to a system descriptor that there are variables of type ChVariables in this object (for further passing it to a solver) Basically does nothing, but maybe that inherited classes may specialize this. | |
virtual void | InjectConstraints (ChSystemDescriptor &mdescriptor) override |
Tell to a system descriptor that there are constraints of type ChConstraint in this object (for further passing it to a solver) Basically does nothing, but maybe that inherited classes may specialize this. | |
virtual void | ConstraintsLoadJacobians () override |
Adds the current jacobians in encapsulated ChConstraints. | |
virtual void | InjectKRMmatrices (ChSystemDescriptor &mdescriptor) override |
Tell to a system descriptor that there are items of type ChKblock in this object (for further passing it to a solver) Basically does nothing, but maybe that inherited classes may specialize this. | |
virtual void | KRMmatricesLoad (double Kfactor, double Rfactor, double Mfactor) override |
Adds the current stiffness K and damping R and mass M matrices in encapsulated ChKblock item(s), if any. More... | |
virtual void | ArchiveOUT (ChArchiveOut &marchive) override |
Method to allow serialization of transient data to archives. | |
virtual void | ArchiveIN (ChArchiveIn &marchive) override |
Method to allow deserialization of transient data from archives. | |
Public Member Functions inherited from chrono::ChAssembly | |
ChAssembly (const ChAssembly &other) | |
ChAssembly & | operator= (ChAssembly other) |
Assignment operator for ChAssembly. | |
void | Clear () |
Removes all inserted items: bodies, links, etc. | |
void | AddBody (std::shared_ptr< ChBody > body) |
Attach a body to this assembly. | |
void | AddShaft (std::shared_ptr< ChShaft > shaft) |
Attach a shaft to this assembly. | |
void | AddLink (std::shared_ptr< ChLinkBase > link) |
Attach a link to this assembly. | |
void | AddMesh (std::shared_ptr< fea::ChMesh > mesh) |
Attach a mesh to this assembly. | |
void | AddOtherPhysicsItem (std::shared_ptr< ChPhysicsItem > item) |
Attach a ChPhysicsItem object that is not a body, link, or mesh. | |
void | Add (std::shared_ptr< ChPhysicsItem > item) |
Attach an arbitrary ChPhysicsItem (e.g. More... | |
void | AddBatch (std::shared_ptr< ChPhysicsItem > item) |
Items added in this way are added like in the Add() method, but not instantly, they are simply queued in a batch of 'to add' items, that are added automatically at the first Setup() call. More... | |
void | FlushBatch () |
If some items are queued for addition in the assembly, using AddBatch(), this will effectively add them and clean the batch. More... | |
void | RemoveBody (std::shared_ptr< ChBody > body) |
Remove a body from this assembly. | |
void | RemoveShaft (std::shared_ptr< ChShaft > shaft) |
Remove a shaft from this assembly. | |
void | RemoveLink (std::shared_ptr< ChLinkBase > link) |
Remove a link from this assembly. | |
void | RemoveMesh (std::shared_ptr< fea::ChMesh > mesh) |
Remove a mesh from the assembly. | |
void | RemoveOtherPhysicsItem (std::shared_ptr< ChPhysicsItem > item) |
Remove a ChPhysicsItem object that is not a body or a link. | |
void | Remove (std::shared_ptr< ChPhysicsItem > item) |
Remove arbitrary ChPhysicsItem that was added to the assembly. | |
void | RemoveAllBodies () |
Remove all bodies from this assembly. | |
void | RemoveAllShafts () |
Remove all shafts from this assembly. | |
void | RemoveAllLinks () |
Remove all links from this assembly. | |
void | RemoveAllMeshes () |
Remove all meshes from this assembly. | |
void | RemoveAllOtherPhysicsItems () |
Remove all physics items not in the body, link, or mesh lists. | |
const std::vector< std::shared_ptr< ChBody > > & | Get_bodylist () const |
Get the list of bodies. | |
const std::vector< std::shared_ptr< ChShaft > > & | Get_shaftlist () const |
Get the list of shafts. | |
const std::vector< std::shared_ptr< ChLinkBase > > & | Get_linklist () const |
Get the list of links. | |
const std::vector< std::shared_ptr< fea::ChMesh > > & | Get_meshlist () const |
Get the list of meshes. | |
const std::vector< std::shared_ptr< ChPhysicsItem > > & | Get_otherphysicslist () const |
Get the list of physics items that are not in the body or link lists. | |
std::shared_ptr< ChBody > | SearchBody (const char *name) |
Search a body by its name. | |
std::shared_ptr< ChBody > | SearchBodyID (int bodyID) |
Search a body by its ID. | |
std::shared_ptr< ChShaft > | SearchShaft (const char *name) |
Search a shaft by its name. | |
std::shared_ptr< ChLinkBase > | SearchLink (const char *name) |
Search a link by its name. | |
std::shared_ptr< fea::ChMesh > | SearchMesh (const char *name) |
Search a mesh by its name. | |
std::shared_ptr< ChPhysicsItem > | SearchOtherPhysicsItem (const char *name) |
Search from other ChPhysics items (not bodies, links, or meshes) by name. | |
std::shared_ptr< ChMarker > | SearchMarker (const char *name) |
Search a marker by its name. | |
std::shared_ptr< ChMarker > | SearchMarker (int markID) |
Search a marker by its unique ID. | |
std::shared_ptr< ChPhysicsItem > | Search (const char *name) |
Search an item (body, link or other ChPhysics items) by name. | |
int | GetNbodies () const |
Get the number of active bodies (so, excluding those that are sleeping or are fixed to ground). | |
int | GetNbodiesSleeping () const |
Get the number of bodies that are in sleeping mode (excluding fixed bodies). | |
int | GetNbodiesFixed () const |
Get the number of bodies that are fixed to ground. | |
int | GetNbodiesTotal () const |
Get the total number of bodies added to the assembly, including the grounded and sleeping bodies. | |
int | GetNshafts () const |
Get the number of shafts. | |
int | GetNshaftsSleeping () const |
Get the number of shafts that are in sleeping mode (excluding fixed shafts). | |
int | GetNshaftsFixed () const |
Get the number of shafts that are fixed to ground. | |
int | GetNshaftsTotal () const |
Get the total number of shafts added to the assembly, including the grounded and sleeping shafts. | |
int | GetNlinks () const |
Get the number of links. | |
int | GetNmeshes () const |
Get the number of meshes. | |
int | GetNphysicsItems () const |
Get the number of other physics items (other than bodies, links, or meshes). | |
int | GetNcoords () const |
Get the number of coordinates (considering 7 coords for rigid bodies because of the 4 dof of quaternions). | |
int | GetNdof () const |
Get the number of degrees of freedom of the assembly. | |
int | GetNdoc () const |
Get the number of scalar constraints added to the assembly, including constraints on quaternion norms. | |
int | GetNsysvars () const |
Get the number of system variables (coordinates plus the constraint multipliers, in case of quaternions). | |
int | GetNcoords_w () const |
Get the number of coordinates (considering 6 coords for rigid bodies, 3 transl.+3rot.) | |
int | GetNdoc_w () const |
Get the number of scalar constraints added to the assembly. | |
int | GetNdoc_w_C () const |
Get the number of scalar constraints added to the assembly (only bilaterals). | |
int | GetNdoc_w_D () const |
Get the number of scalar constraints added to the assembly (only unilaterals). | |
int | GetNsysvars_w () const |
Get the number of system variables (coordinates plus the constraint multipliers). | |
virtual void | Update (double mytime, bool update_assets=true) override |
Updates all the auxiliary data and children of bodies, forces, links, given their current state. | |
virtual void | VariablesFbReset () override |
Sets the 'fb' part (the known term) of the encapsulated ChVariables to zero. | |
virtual void | VariablesFbLoadForces (double factor=1) override |
Adds the current forces (applied to item) into the encapsulated ChVariables, in the 'fb' part: qf+=forces*factor. | |
virtual void | VariablesQbLoadSpeed () override |
Initialize the 'qb' part of the ChVariables with the current value of speeds. More... | |
virtual void | VariablesFbIncrementMq () override |
Adds M*q (masses multiplied current 'qb') to Fb, ex. More... | |
virtual void | VariablesQbSetSpeed (double step=0) override |
Fetches the item speed (ex. More... | |
virtual void | VariablesQbIncrementPosition (double step) override |
Increment item positions by the 'qb' part of the ChVariables, multiplied by a 'step' factor. More... | |
virtual void | ConstraintsBiReset () override |
Sets to zero the known term (b_i) of encapsulated ChConstraints. | |
virtual void | ConstraintsBiLoad_C (double factor=1, double recovery_clamp=0.1, bool do_clamp=false) override |
Adds the current C (constraint violation) to the known term (b_i) of encapsulated ChConstraints. | |
virtual void | ConstraintsBiLoad_Ct (double factor=1) override |
Adds the current Ct (partial t-derivative, as in C_dt=0-> [Cq]*q_dt=-Ct) to the known term (b_i) of encapsulated ChConstraints. | |
virtual void | ConstraintsBiLoad_Qc (double factor=1) override |
Adds the current Qc (the vector of C_dtdt=0 -> [Cq]*q_dtdt=Qc ) to the known term (b_i) of encapsulated ChConstraints. | |
virtual void | ConstraintsFbLoadForces (double factor=1) override |
Adds the current link-forces, if any, (caused by springs, etc.) to the 'fb' vectors of the ChVariables referenced by encapsulated ChConstraints. | |
virtual void | ConstraintsFetch_react (double factor=1) override |
Fetches the reactions from the lagrangian multiplier (l_i) of encapsulated ChConstraints. More... | |
void | ShowHierarchy (ChStreamOutAscii &m_file, int level=0) const |
Writes the hierarchy of contained bodies, markers, etc. More... | |
Public Member Functions inherited from chrono::ChPhysicsItem | |
ChPhysicsItem (const ChPhysicsItem &other) | |
ChSystem * | GetSystem () const |
Get the pointer to the parent ChSystem(). | |
void | AddVisualModel (std::shared_ptr< ChVisualModel > model) |
Add an (optional) visualization model. More... | |
std::shared_ptr< ChVisualModel > | GetVisualModel () const |
Access the visualization model (if any). More... | |
void | AddVisualShape (std::shared_ptr< ChVisualShape > shape, const ChFrame<> &frame=ChFrame<>()) |
Add the specified visual shape to the visualization model. More... | |
std::shared_ptr< ChVisualShape > | GetVisualShape (unsigned int i) const |
Access the specified visualization shape in the visualization model (if any). More... | |
void | AddVisualShapeFEA (std::shared_ptr< ChVisualShapeFEA > shapeFEA) |
Add the specified FEA visualization object to the visualization model. More... | |
std::shared_ptr< ChVisualShapeFEA > | GetVisualShapeFEA (unsigned int i) const |
Access the specified FEA visualization object in the visualization model (if any). More... | |
virtual ChFrame | GetVisualModelFrame (unsigned int nclone=0) |
Get the reference frame (expressed in and relative to the absolute frame) of the visual model. More... | |
virtual unsigned int | GetNumVisualModelClones () const |
Return the number of clones of the visual model associated with this physics item. More... | |
void | AddCamera (std::shared_ptr< ChCamera > camera) |
Attach a ChCamera to this physical item. More... | |
std::vector< std::shared_ptr< ChCamera > > | GetCameras () const |
Get the set of cameras attached to this physics item. | |
virtual bool | IsActive () const |
Return true if the object is active and included in dynamics. | |
virtual bool | GetCollide () const |
Tell if the object is subject to collision. More... | |
virtual void | AddCollisionModelsToSystem () |
If this physical item contains one or more collision models, add them to the system's collision engine. | |
virtual void | RemoveCollisionModelsFromSystem () |
If this physical item contains one or more collision models, remove them from the system's collision engine. | |
virtual void | GetTotalAABB (ChVector<> &bbmin, ChVector<> &bbmax) |
Get the entire AABB axis-aligned bounding box of the object. More... | |
virtual void | GetCenter (ChVector<> &mcenter) |
Get a symbolic 'center' of the object. More... | |
virtual void | StreamINstate (ChStreamInBinary &mstream) |
Method to deserialize only the state (position, speed) Must be implemented by child classes. | |
virtual void | StreamOUTstate (ChStreamOutBinary &mstream) |
Method to serialize only the state (position, speed) Must be implemented by child classes. | |
unsigned int | GetOffset_x () |
Get offset in the state vector (position part) | |
unsigned int | GetOffset_w () |
Get offset in the state vector (speed part) | |
unsigned int | GetOffset_L () |
Get offset in the lagrangian multipliers. | |
void | SetOffset_x (const unsigned int moff) |
Set offset in the state vector (position part) Note: only the ChSystem::Setup function should use this. | |
void | SetOffset_w (const unsigned int moff) |
Set offset in the state vector (speed part) Note: only the ChSystem::Setup function should use this. | |
void | SetOffset_L (const unsigned int moff) |
Set offset in the lagrangian multipliers Note: only the ChSystem::Setup function should use this. | |
Public Member Functions inherited from chrono::ChObj | |
ChObj (const ChObj &other) | |
int | GetIdentifier () const |
Gets the numerical identifier of the object. | |
void | SetIdentifier (int id) |
Sets the numerical identifier of the object. | |
double | GetChTime () const |
Gets the simulation time of this object. | |
void | SetChTime (double m_time) |
Sets the simulation time of this object. | |
const char * | GetName () const |
Gets the name of the object as C Ascii null-terminated string -for reading only! | |
void | SetName (const char myname[]) |
Sets the name of this object, as ascii string. | |
std::string | GetNameString () const |
Gets the name of the object as C Ascii null-terminated string. | |
void | SetNameString (const std::string &myname) |
Sets the name of this object, as std::string. | |
void | MFlagsSetAllOFF (int &mflag) |
void | MFlagsSetAllON (int &mflag) |
void | MFlagSetON (int &mflag, int mask) |
void | MFlagSetOFF (int &mflag, int mask) |
int | MFlagGet (int &mflag, int mask) |
virtual std::string & | ArchiveContainerName () |
Protected Member Functions | |
void | SetupModalData (int nmodes_reduction) |
Resize modal matrices and hook up the variables to the M K R block for the solver. More... | |
Friends | |
class | ChSystem |
class | ChSystemMulticore |
class | ChSystemDistributed |
void | swap (ChModalAssembly &first, ChModalAssembly &second) |
Swap the contents of the two provided ChAssembly objects. More... | |
Additional Inherited Members | |
Protected Attributes inherited from chrono::ChAssembly | |
std::vector< std::shared_ptr< ChBody > > | bodylist |
list of rigid bodies | |
std::vector< std::shared_ptr< ChShaft > > | shaftlist |
list of 1-D shafts | |
std::vector< std::shared_ptr< ChLinkBase > > | linklist |
list of joints (links) | |
std::vector< std::shared_ptr< fea::ChMesh > > | meshlist |
list of meshes | |
std::vector< std::shared_ptr< ChPhysicsItem > > | otherphysicslist |
list of other physics objects | |
std::vector< std::shared_ptr< ChPhysicsItem > > | batch_to_insert |
list of items to insert at once | |
int | nbodies |
number of bodies (currently active) | |
int | nbodies_sleep |
number of bodies that are sleeping | |
int | nbodies_fixed |
number of bodies that are fixed | |
int | nshafts |
number of shafts (currently active) | |
int | nshafts_sleep |
number of shafts that are sleeping | |
int | nshafts_fixed |
number of shafts that are fixed | |
int | nlinks |
number of links | |
int | nmeshes |
number of meshes | |
int | nphysicsitems |
number of other physics items | |
int | ncoords |
number of scalar coordinates (including 4th dimension of quaternions) for all active bodies | |
int | ndoc |
number of scalar constraints (including constr. on quaternions) | |
int | nsysvars |
number of variables (coords+lagrangian mult.), i.e. = ncoords+ndoc for all active bodies | |
int | ncoords_w |
number of scalar coordinates when using 3 rot. dof. per body; for all active bodies | |
int | ndoc_w |
number of scalar constraints when using 3 rot. dof. per body; for all active bodies | |
int | nsysvars_w |
number of variables when using 3 rot. dof. per body; i.e. = ncoords_w+ndoc_w | |
int | ndof |
number of degrees of freedom, = ncoords-ndoc = ncoords_w-ndoc_w , | |
int | ndoc_w_C |
number of scalar constraints C, when using 3 rot. dof. per body (excluding unilaterals) | |
int | ndoc_w_D |
number of scalar constraints D, when using 3 rot. dof. per body (only unilaterals) | |
Protected Attributes inherited from chrono::ChPhysicsItem | |
ChSystem * | system |
parent system | |
std::shared_ptr< ChVisualModelInstance > | vis_model_instance |
instantiated visualization model | |
std::vector< std::shared_ptr< ChCamera > > | cameras |
set of cameras | |
unsigned int | offset_x |
offset in vector of state (position part) | |
unsigned int | offset_w |
offset in vector of state (speed part) | |
unsigned int | offset_L |
offset in vector of lagrangian multipliers | |
Protected Attributes inherited from chrono::ChObj | |
double | ChTime |
the time of simulation for the object | |
Member Function Documentation
◆ AddInternal()
void chrono::modal::ChModalAssembly::AddInternal | ( | std::shared_ptr< ChPhysicsItem > | item | ) |
Attach an arbitrary internal ChPhysicsItem (e.g.
ChBody, ChParticles, ChLink, etc.) to the assembly. It will take care of adding it to the proper list of internal bodies, links, meshes, or generic physic item.
◆ ComputeModes()
bool chrono::modal::ChModalAssembly::ComputeModes | ( | const ChModalSolveUndamped & | n_modes_settings | ) |
Compute the undamped modes for the current assembly.
Later you can fetch results via Get_modes_V(), Get_modes_frequencies() etc. Usually done for the assembly in full mode, but can be done also SwitchModalReductionON() int as n. of lower modes to keep, or a full ChModalSolveUndamped
◆ ComputeModesDamped()
bool chrono::modal::ChModalAssembly::ComputeModesDamped | ( | const ChModalSolveDamped & | n_modes_settings | ) |
Compute the damped modes for the entire assembly.
Expect complex eigenvalues/eigenvectors if damping is used. Later you can fetch results via Get_modes_V(), Get_modes_frequencies(), Get_modes_damping_ratios() etc. Usually done for the assembly in full mode, but can be done also after SwitchModalReductionON() int as the n. of lower modes to keep, or a full ChModalSolveDamped
◆ ComputeModesExternalData()
bool chrono::modal::ChModalAssembly::ComputeModesExternalData | ( | ChSparseMatrix & | mM, |
ChSparseMatrix & | mK, | ||
ChSparseMatrix & | full_Cq, | ||
const ChModalSolveUndamped & | n_modes_settings | ||
) |
Compute the undamped modes from M and K matrices. Later you can fetch results via Get_modes_V() etc.
int as the n. of lower modes to keep, or a full ChModalSolveUndamped
◆ DumpSubassemblyMatrices()
void chrono::modal::ChModalAssembly::DumpSubassemblyMatrices | ( | bool | save_M, |
bool | save_K, | ||
bool | save_R, | ||
bool | save_Cq, | ||
const char * | path | ||
) |
Dump the M mass matrix, K damping matrix, R damping matrix, Cq constraint jacobian matrix (at the current configuration) for this subassembly, Assumes the rows/columns of the matrices are ordered as the ChVariable objects used in this assembly, first the all the "boundary" variables then all the "inner" variables (or modal variables if switched to modal assembly).
The name of the files will be [path]_M.dat [path]_K.dat [path]_R.dat [path]_Cq.dat Might throw ChException if file can't be saved.
◆ Get_custom_F_full()
|
inline |
Access the current value of vector of custom applied forces to original coordinates.
Use a CustomForceFullCallback to change it.
◆ Get_custom_F_modal()
|
inline |
Access the current value of vector of custom applied forces to modal coordinates.
Use a CustomForceModalCallback to change it.
◆ Get_modes_assembly_x0()
|
inline |
Access the snapshot of initial state of the assembly at the moment of the analysis.
Read only. Use one of the ComputeModes() functions to set it.
◆ Get_modes_damping_ratios()
|
inline |
Get a vector of modal damping ratios = damping/critical_damping, if previously computed.
Read only. Use one of the ComputeModes() functions to set it.
◆ Get_modes_eig()
|
inline |
Access the modal eigenvalues, if previously computed.
Read only. Use one of the ComputeModes() functions to set it.
◆ Get_modes_frequencies()
|
inline |
Get a vector of (undamped) modal natural frequencies [Hz], if previously computed.
Read only. Use one of the ComputeModes() functions to set it.
◆ Get_modes_V()
|
inline |
Access the modal eigenvectors, if previously computed.
Read only. Use one of the ComputeModes() functions to set it.
◆ GetSubassemblyConstraintJacobianMatrix()
void chrono::modal::ChModalAssembly::GetSubassemblyConstraintJacobianMatrix | ( | ChSparseMatrix * | Cq | ) |
Compute the constraint jacobian matrix of the subassembly, i.e.
the jacobian Cq=-dC/dq where C are constraints (the lower left part of the KKT matrix). Assumes the columns of the matrix are ordered as the ChVariable objects used in this assembly, i.e. first the all the "boundary" variables then all the "inner" variables (or modal variables if switched to modal assembly), and assumes the rows of the matrix are ordered as the constraints used in this assembly, i.e. first the boundary and then the inner. fill this system damping matrix
◆ GetSubassemblyDampingMatrix()
void chrono::modal::ChModalAssembly::GetSubassemblyDampingMatrix | ( | ChSparseMatrix * | R | ) |
Compute the stiffness matrix of the subassembly, i.e.
the jacobian -dF/dv where F are stiff loads. Assumes the rows/columns of the matrix are ordered as the ChVariable objects used in this assembly, first the all the "boundary" variables then all the "inner" variables (or modal variables if switched to modal assembly). Note that not all loads provide a jacobian, as this is optional in their implementation. fill this system damping matrix
◆ GetSubassemblyMassMatrix()
void chrono::modal::ChModalAssembly::GetSubassemblyMassMatrix | ( | ChSparseMatrix * | M | ) |
Compute the mass matrix of the subassembly.
Assumes the rows/columns of the matrix are ordered as the ChVariable objects used in this assembly, first the all the "boundary" itvariablesems then all the "inner" variables (or modal variables if switched to modal assembly). fill this system mass matrix
◆ GetSubassemblyStiffnessMatrix()
void chrono::modal::ChModalAssembly::GetSubassemblyStiffnessMatrix | ( | ChSparseMatrix * | K | ) |
Compute the stiffness matrix of the subassembly, i.e.
the jacobian -dF/dq where F are stiff loads. Assumes the rows/columns of the matrix are ordered as the ChVariable objects used in this assembly, first the all the "boundary" variables then all the "inner" variables (or modal variables if switched to modal assembly). Note that not all loads provide a jacobian, as this is optional in their implementation. fill this system stiffness matrix
◆ IntFromDescriptor()
|
overridevirtual |
After a solver solution, fetch values from variables and constraints into vectors:
- Parameters
-
off_v offset for v v vector to where the q 'unknowns' term of the variables will be copied off_L offset for L L vector to where L 'lagrangian ' term of the constraints will be copied
Reimplemented from chrono::ChAssembly.
◆ IntLoadConstraint_C()
|
overridevirtual |
Takes the term C, scale and adds to Qc at given offset: Qc += c*C.
- Parameters
-
off offset in Qc residual Qc result: the Qc residual, Qc += c*C c a scaling factor do_clamp apply clamping to c*C? recovery_clamp value for min/max clamping of c*C
Reimplemented from chrono::ChAssembly.
◆ IntLoadConstraint_Ct()
|
overridevirtual |
Takes the term Ct, scale and adds to Qc at given offset: Qc += c*Ct.
- Parameters
-
off offset in Qc residual Qc result: the Qc residual, Qc += c*Ct c a scaling factor
Reimplemented from chrono::ChAssembly.
◆ IntLoadResidual_CqL()
|
overridevirtual |
Takes the term Cq'*L, scale and adds to R at given offset: R += c*Cq'*L.
- Parameters
-
off_L offset in L multipliers R result: the R residual, R += c*Cq'*L L the L vector c a scaling factor
Reimplemented from chrono::ChAssembly.
◆ IntLoadResidual_F()
|
overridevirtual |
Takes the F force term, scale and adds to R at given offset: R += c*F.
- Parameters
-
off offset in R residual R result: the R residual, R += c*F c a scaling factor
Reimplemented from chrono::ChAssembly.
◆ IntLoadResidual_Mv()
|
overridevirtual |
Takes the M*v term, multiplying mass by a vector, scale and adds to R at given offset: R += c*M*w.
- Parameters
-
off offset in R residual R result: the R residual, R += c*M*v w the w vector c a scaling factor
Reimplemented from chrono::ChAssembly.
◆ IntStateGather()
|
overridevirtual |
From item's state to global state vectors y={x,v} pasting the states at the specified offsets.
- Parameters
-
off_x offset in x state vector x state vector, position part off_v offset in v state vector v state vector, speed part T time
Reimplemented from chrono::ChAssembly.
◆ IntStateGatherAcceleration()
|
overridevirtual |
From item's state acceleration to global acceleration vector.
- Parameters
-
off_a offset in a accel. vector a acceleration part of state vector derivative
Reimplemented from chrono::ChAssembly.
◆ IntStateGatherReactions()
|
overridevirtual |
From item's reaction forces to global reaction vector.
- Parameters
-
off_L offset in L vector L L vector of reaction forces
Reimplemented from chrono::ChAssembly.
◆ IntStateGetIncrement()
|
overridevirtual |
Computes Dt = x_new - x, using vectors at specified offsets.
By default, when DOF = DOF_w, it does just the difference of two state vectors, but in some cases (ex when using quaternions for rotations) it could do more complex stuff, and children classes might overload it.
- Parameters
-
off_x offset in x state vector x_new state vector, final position part x state vector, initial position part off_v offset in v state vector Dv state vector, increment. Here gets the result
Reimplemented from chrono::ChAssembly.
◆ IntStateIncrement()
|
overridevirtual |
Computes x_new = x + Dt , using vectors at specified offsets.
By default, when DOF = DOF_w, it does just the sum, but in some cases (ex when using quaternions for rotations) it could do more complex stuff, and children classes might overload it.
- Parameters
-
off_x offset in x state vector x_new state vector, position part, incremented result x state vector, initial position part off_v offset in v state vector Dv state vector, increment
Reimplemented from chrono::ChAssembly.
◆ IntStateScatter()
|
overridevirtual |
From global state vectors y={x,v} to item's state (and update) fetching the states at the specified offsets.
- Parameters
-
off_x offset in x state vector x state vector, position part off_v offset in v state vector v state vector, speed part T time full_update perform complete update
Reimplemented from chrono::ChAssembly.
◆ IntStateScatterAcceleration()
|
overridevirtual |
From global acceleration vector to item's state acceleration.
- Parameters
-
off_a offset in a accel. vector a acceleration part of state vector derivative
Reimplemented from chrono::ChAssembly.
◆ IntStateScatterReactions()
|
overridevirtual |
From global reaction vector to item's reaction forces.
- Parameters
-
off_L offset in L vector L L vector of reaction forces
Reimplemented from chrono::ChAssembly.
◆ IntToDescriptor()
|
overridevirtual |
Prepare variables and constraints to accommodate a solution:
- Parameters
-
off_v offset for v and R v vector copied into the q 'unknowns' term of the variables R vector copied into the F 'force' term of the variables off_L offset for L and Qc L vector copied into the L 'lagrangian ' term of the constraints Qc vector copied into the Qb 'constraint' term of the constraints
Reimplemented from chrono::ChAssembly.
◆ KRMmatricesLoad()
|
overridevirtual |
Adds the current stiffness K and damping R and mass M matrices in encapsulated ChKblock item(s), if any.
The K, R, M matrices are added with scaling values Kfactor, Rfactor, Mfactor. NOTE: signs are flipped respect to the ChTimestepper dF/dx terms: K = -dF/dq, R = -dF/dv
Reimplemented from chrono::ChAssembly.
◆ SetFullStateWithModeOverlay()
void chrono::modal::ChModalAssembly::SetFullStateWithModeOverlay | ( | int | n_mode, |
double | phase, | ||
double | amplitude | ||
) |
For displaying modes, you can use the following function.
It sets the state of this subassembly (both boundary and inner items) using the n-th eigenvector multiplied by a "amplitude" factor * sin(phase). If you increment the phase during an animation, you will see the n-ht mode oscillating on the screen. It works also if in IsModalMode(). The mode shape is added to the state snapshot that was taken when doing the last ComputeModes() or ComputeModesDamped().
◆ SetInternalNodesUpdate()
void chrono::modal::ChModalAssembly::SetInternalNodesUpdate | ( | bool | mflag | ) |
Optimization flag.
Default true: when in modal reduced mode, during simulations the internal (discarded) nodes are updated anyway by superposition of modal shapes etc., for visualization or postprocessing reasons. In sake of high CPU performance, if no interest in visualization/postprocessing, one can disable this setting to false.
◆ SetInternalStateWithModes()
void chrono::modal::ChModalAssembly::SetInternalStateWithModes | ( | bool | full_update | ) |
For displaying the deformation using internal nodes, you can use the following function.
Works only if IsModalMode(). It sets the state of the internal nodes of this subassembly using the current state of the modal coordinates q given the computed eigenvalues: x=V*q , then it overlays s to the state snapshot x0 stored last time one called a modal analysis. This is not necessary, but useful during animations, in fact the internal nodes would be completely neglected if IsModalMode() ; but calling this function one can update their changing positions for visualization, stress recovery, etc.
◆ SetModalMode()
|
inline |
Set true to ignore the dofs of all the "internal" bodies, meshes, etc.
(those added with AddInternal() ) and just use the "boundary" bodies, meshes, etc. (those normally added via Add() ). Set false to consider all internal bodies, meshes etc. as normal items in a normal assembly.
◆ Setup()
|
overridevirtual |
Counts the number of bodies, links, and meshes.
Computes the offsets of object states in the global state. Assumes that this->offset_x this->offset_w this->offset_L are already set as starting point for offsetting all the contained sub objects.
Reimplemented from chrono::ChAssembly.
◆ SetupModalData()
|
protected |
Resize modal matrices and hook up the variables to the M K R block for the solver.
To be used all times the n. of modes of modal reduction (n_modes_coords_w) is changed.
◆ SwitchModalReductionON() [1/2]
void chrono::modal::ChModalAssembly::SwitchModalReductionON | ( | ChSparseMatrix & | full_M, |
ChSparseMatrix & | full_K, | ||
ChSparseMatrix & | full_Cq, | ||
const ChModalSolveUndamped & | n_modes_settings, | ||
const ChModalDamping & | damping_model = ChModalDampingNone() |
||
) |
Perform modal reduction on this assembly that contains only the "boundary" nodes, whereas the "internal" nodes have been modeled only in an external FEA software with the full ("boundary"+"internal") modes.
- with an external FEA software, the full assembly is modeled with "boundary"+"internal" nodes.
- with an external FEA software, the M mass matrix and the K stiffness matrix are saved to disk.
- in Chrono, M and K and Cq constraint jacobians (if any) are load from disk and stored in ChSparseMatrix objects
- in Chrono, only boundary nodes are added to a ChModalAssembly
- in Chrono, run this function passing such M and K matrices: a modal analysis will be done on K and M Note that the size of M (and K) must be at least > n_boundary_coords_w.
a damping model to use for the reduced model
- Parameters
-
n_modes_settings int as the n. of lower modes to keep, or a full ChModalSolveUndamped
◆ SwitchModalReductionON() [2/2]
void chrono::modal::ChModalAssembly::SwitchModalReductionON | ( | const ChModalSolveUndamped & | n_modes_settings, |
const ChModalDamping & | damping_model = ChModalDampingNone() |
||
) |
Perform modal reduction on this assembly, from the current "full" ("boundary"+"internal") assembly.
- An undamped modal analysis will be done on the full assembly with nodes.
- The "internal" nodes will be replaced by n_modes modal coordinates. a damping model to use for the reduced model
- Parameters
-
n_modes_settings int as the n. of lower modes to keep, or a full ChModalSolveUndamped
Friends And Related Function Documentation
◆ swap
|
friend |
Swap the contents of the two provided ChAssembly objects.
Implemented as a friend (as opposed to a member function) so classes with a ChModalAssembly member can use ADL when implementing their own swap.
The documentation for this class was generated from the following files:
- /builds/uwsbel/chrono/src/chrono_modal/ChModalAssembly.h
- /builds/uwsbel/chrono/src/chrono_modal/ChModalAssembly.cpp