Description
Added mass for hydrodynamic loads.
The added mass is an inertia added to the system due to accelerating bodies having to displace some volume of surrounding fluid. The additional system-wide mass matrix term is a block-sparse matrix with non-zero blocks corresponding to all bodies that interact with fluid. For each of these n bodies (not necessarily all bodies included in the Chrono system), a dense 6 x 6n block of hydrodynamic coefficients must be provided (see ChBodyAddedMassBlocks). The 6 x 6 blocks for each of these bodies is distributed at the appropriate location in the system mass matrix.
The coefficients of each body refer to the velocity of the origin of the body reference frame (the COM frame for a ChBody, the auxiliary reference frame for a ChBodyAuxRef) and to the body angular velocity, both expressed either in the inertial (absolute) axes or in the axes of the body reference frame (see AddedMassFrame). Coefficients computed about a different point must be shifted to the origin of the body reference frame before they are passed to this load (see ComputeShiftTransformation). Since Chrono uses the COM velocity in absolute axes and the angular velocity in the axes of the COM frame as velocity coordinates, the coefficients are transformed accordingly, using the current orientation of the bodies. The added mass is therefore constant in the selected axes and, in general, varies with the body orientation in the Chrono velocity coordinates. The velocity-dependent terms arising from the time variation of the added mass (e.g., the Munk moment) are not included, which is consistent with the small-rotation assumptions under which hydrodynamic coefficients are typically computed.
Note that, with a solver that needs the inverse of the total mass matrix (APGD or Barzilai-Borwein), that inverse is recomputed whenever a hydrodynamic body rotates, which requires the inversion of a dense system-size matrix.
#include <ChLoadHydrodynamics.h>


Public Types | |
| enum | AddedMassFrame { AddedMassFrame::INERTIAL, AddedMassFrame::BODY } |
| Axes in which the added mass coefficients are expressed (and in which they are constant). More... | |
Public Types inherited from chrono::ChPhysicsItem | |
| enum | InitPhase { InitPhase::NONE = 0, InitPhase::STRUCTURE = 1, InitPhase::STATE = 2 } |
| Initialization phases of a physics item. More... | |
Public Member Functions | |
| ChLoadHydrodynamics (const ChBodyAddedMassBlocks &body_blocks) | |
| ChLoadHydrodynamics (const ChLoadHydrodynamics &other) | |
| virtual bool | SupportsCheckpoint () const override |
| Return true: the internal state of this item is restored from a checkpoint (see ChPhysicsItem). | |
| virtual ChLoadHydrodynamics * | Clone () const override |
| "Virtual" copy constructor (covariant return type). | |
| void | SetVerbose (bool verbose) |
| Enable/disable verbose terminal output (default: false). | |
| void | SetAddedMassFrame (AddedMassFrame frame) |
| Set the axes in which the added mass coefficients are expressed (default: AddedMassFrame::INERTIAL). | |
| AddedMassFrame | GetAddedMassFrame () const |
| Get the axes in which the added mass coefficients are expressed. | |
| void | SetBodyAddedMassBlocks (const std::vector< ChMatrixDynamic<>> &blocks) |
| Modify the added mass blocks. More... | |
| void | UpdateBodyAddedMassBlocks (const std::vector< ChMatrix66d > &blocks) |
| Modify the added mass block. More... | |
| virtual void | Setup () override |
| Perform setup operations at the beginning of a step. | |
| virtual void | Update (double time, UpdateFlags update_flags) override |
| Perform any updates necessary at the current phase during the solution process. More... | |
| virtual void | IntLoadResidual_Mv (const unsigned int off, ChVectorDynamic<> &R, const ChVectorDynamic<> &w, const double c) override |
| Increment the given residual vector R with the term c * M * w (for the entire system). More... | |
| virtual void | InjectKRMMatrices (ChSystemDescriptor &descriptor) override |
| Register with the given system descriptor any ChMBlock objects associated with this item. | |
| virtual void | LoadKRMMatrices (double Kfactor, double Rfactor, double Mfactor) override |
| Compute and load current mass matrices in encapsulated ChMBlock objects. More... | |
Public Member Functions inherited from chrono::ChPhysicsItem | |
| ChPhysicsItem (const ChPhysicsItem &other) | |
| ChSystem * | GetSystem () const |
| Get the pointer to the parent ChSystem(). | |
| virtual void | SetSystem (ChSystem *m_system) |
| Set the pointer to the parent ChSystem(). More... | |
| virtual bool | IsActive () const |
| Return true if the object is active and included in dynamics. | |
| virtual bool | IsCollisionEnabled () const |
| Tell if the object is subject to collision. More... | |
| virtual void | AddCollisionModelsToSystem (ChCollisionSystem *coll_sys) const |
| Add to the provided collision system any collision models managed by this physics item. More... | |
| virtual void | RemoveCollisionModelsFromSystem (ChCollisionSystem *coll_sys) const |
| Remove from the provided collision system any collision models managed by this physics item. More... | |
| virtual void | SyncCollisionModels () |
| Synchronize the position and bounding box of any collision models managed by this physics item. | |
| virtual ChAABB | GetTotalAABB () const |
| Get the axis-aligned bounding box (AABB) of this object. More... | |
| virtual ChVector3d | GetCenter () const |
| Get a symbolic 'center' of the object. More... | |
| bool | IsInitialized () const |
| Return true if both initialization phases ran for this item. | |
| void | InitializePhase (InitPhase phase) |
| Run the specified initialization phase on this item (if not already done) and then on its children. More... | |
| virtual void | ResetInitialization () |
| Mark this item (and its children, if any) as not initialized. More... | |
| virtual void | SaveInternalState (ChCheckpointWriter &writer) const |
| Save the internal state of this item. More... | |
| virtual void | LoadInternalState (ChCheckpointReader &reader) |
| Load the internal state of this item, as saved by SaveInternalState. More... | |
| virtual void | ForceToRest () |
| Set zero speed (and zero accelerations) in state, without changing the position. More... | |
| virtual unsigned int | GetNumCoordsPosLevel () |
| Get the number of coordinates at the position level. More... | |
| virtual unsigned int | GetNumCoordsVelLevel () |
| Get the number of coordinates at the velocity level. More... | |
| virtual unsigned int | GetNumConstraints () |
| Get the number of scalar constraints. | |
| virtual unsigned int | GetNumConstraintsBilateral () |
| Get the number of bilateral scalar constraints. | |
| virtual unsigned int | GetNumConstraintsUnilateral () |
| Get the number of unilateral scalar constraints. | |
| 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 Lagrange 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 Lagrange multipliers Note: only the ChSystem::Setup function should use this. | |
| virtual void | IntStateGather (const unsigned int off_x, ChState &x, const unsigned int off_v, ChStateDelta &v, double &T) |
| 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, UpdateFlags update_flags) |
| 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) |
| From item's state acceleration to global acceleration vector. More... | |
| virtual void | IntStateScatterAcceleration (const unsigned int off_a, const ChStateDelta &a) |
| From global acceleration vector to item's state acceleration. More... | |
| virtual void | IntStateGatherReactions (const unsigned int off_L, ChVectorDynamic<> &L) |
| From item's reaction forces to global reaction vector. More... | |
| virtual void | IntStateScatterReactions (const unsigned int off_L, const ChVectorDynamic<> &L) |
| From global reaction vector to item's reaction forces. More... | |
| virtual void | IntStateOnEndStep (double T) |
| Called at the end of a step, after the state has been updated. More... | |
| virtual void | IntStateIncrement (const unsigned int off_x, ChState &x_new, const ChState &x, const unsigned int off_v, const ChStateDelta &Dv) |
| 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) |
| Computes Dt = x_new - x, using vectors at specified offsets. More... | |
| virtual void | IntLoadResidual_F (const unsigned int off, ChVectorDynamic<> &R, const double c) |
| Takes the F force term, scale and adds to R at given offset: R += c*F. More... | |
| virtual void | IntLoadResidual_F_applied (const unsigned int off, ChVectorDynamic<> &R, const double c) |
| Takes only the externally applied loads, scale and adds to R at given offset: R += c*F_applied Applied loads are loads set or accumulated by the user (e.g., accumulator loads, ChForce objects, node forces). More... | |
| virtual void | IntLoadLumpedMass_Md (const unsigned int off, ChVectorDynamic<> &Md, double &err, const double c) |
| Adds the lumped mass to a Md vector, representing a mass diagonal matrix. More... | |
| virtual void | IntLoadResidual_CqL (const unsigned int off_L, ChVectorDynamic<> &R, const ChVectorDynamic<> &L, const double c) |
| 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, const double c_vel, bool do_clamp, double recovery_clamp) |
| 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, const double c_vel) |
| 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) |
| 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) |
| After a solver solution, fetch values from variables and constraints into vectors: More... | |
| virtual void | InjectVariables (ChSystemDescriptor &descriptor) |
| Register with the given system descriptor any ChVariable objects associated with this item. | |
| virtual void | InjectConstraints (ChSystemDescriptor &descriptor) |
| Register with the given system descriptor any ChConstraint objects associated with this item. | |
| virtual void | LoadConstraintJacobians () |
| Compute and load current Jacobians in encapsulated ChConstraint objects. | |
| virtual void | VariablesFbReset () |
| Sets the 'fb' part (the known term) of the encapsulated ChVariables to zero. | |
| virtual void | VariablesFbLoadForces (double factor=1) |
| Adds the current forces (applied to item) into the encapsulated ChVariables, in the 'fb' part: qf+=forces*factor. | |
| virtual void | VariablesQbLoadSpeed () |
| Initialize the 'qb' part of the ChVariables with the current value of speeds. More... | |
| virtual void | VariablesFbIncrementMq () |
| Adds M*q (masses multiplied current 'qb') to Fb, ex. More... | |
| virtual void | VariablesQbSetSpeed (double step=0) |
| Fetches the item speed (ex. More... | |
| virtual void | VariablesQbIncrementPosition (double step) |
| Increment item positions by the 'qb' part of the ChVariables, multiplied by a 'step' factor. More... | |
| virtual void | ConstraintsBiReset () |
| 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) |
| Adds the current C (constraint violation) to the known term (b_i) of encapsulated ChConstraints. | |
| virtual void | ConstraintsBiLoad_Ct (double factor=1) |
| 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) |
| 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) |
| 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) |
| Fetches the reactions from the lagrangian multiplier (l_i) of encapsulated ChConstraints. More... | |
| virtual void | ArchiveOut (ChArchiveOut &archive_out) override |
| Method to allow serialization of transient data to archives. | |
| virtual void | ArchiveIn (ChArchiveIn &archive_in) override |
| Method to allow deserialization of transient data from archives. More... | |
Public Member Functions inherited from chrono::ChObj | |
| ChObj (const ChObj &other) | |
| int | GetIdentifier () const |
| Get the unique integer identifier of this object. More... | |
| void | SetTag (int tag) |
| Set an object integer tag (default: -1). More... | |
| int | GetTag () const |
| Get the tag of this object. | |
| void | SetName (const std::string &myname) |
| Set the name of this object. | |
| const std::string & | GetName () const |
| Get the name of this object. | |
| double | GetChTime () const |
| Gets the simulation time of this object. | |
| void | SetChTime (double m_time) |
| Sets the simulation time of this object. | |
| 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... | |
| virtual ChFrame | GetVisualModelFrame (unsigned int nclone=0) const |
| 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 object. More... | |
| void | AddCamera (std::shared_ptr< ChCamera > camera) |
| Attach a camera to this object. More... | |
| std::vector< std::shared_ptr< ChCamera > > | GetCameras () const |
| Get the set of cameras attached to this object. | |
| void | UpdateVisualModel () |
| Utility function to update only the associated visual assets (if any). | |
| virtual std::string & | ArchiveContainerName () |
Static Public Member Functions | |
| static ChMatrix66d | ComputeShiftTransformation (const ChBody &body, const ChVector3d &point, AddedMassFrame frame) |
| Compute the transformation that shifts added mass coefficients to the origin of the body reference frame. More... | |
| static void | ShiftBlocks (std::vector< ChMatrixDynamic<>> &blocks, const std::vector< ChMatrix66d > &shifts) |
| Shift added mass blocks with the given transformations (see ComputeShiftTransformation). More... | |
Protected Member Functions | |
| bool | NeedsMassInverse () const |
| Return true if the current solver needs the inverse of the total mass matrix. | |
| void | OnBlocksModified () |
| Recompute the mass inverse right away if the blocks were modified and a mass inverse is in use. | |
| void | ComputeMassInverse () |
| Assemble the total mass matrix (including added mass), invert it, and pass it to the system descriptor. | |
| bool | BodiesRotated () const |
| Return true if any hydrodynamic body rotated since the mass inverse was last computed. | |
| ChMatrix66d | ComputeTransformation (const ChBodyAddedMassBlock &b) const |
| Compute the transformation from Chrono velocity coordinates to the velocities the coefficients refer to. More... | |
| void | ComputeAddedMassMatrix () |
| Compute the added mass matrix in Chrono velocity coordinates at the current body configuration. More... | |
Protected Member Functions inherited from chrono::ChPhysicsItem | |
| virtual void | InitializeChildren (InitPhase phase) |
| Run the specified initialization phase on the children of this item. More... | |
| void | SetInitializationPending () |
| Notify the parent system that some items need initialization. | |
Protected Member Functions inherited from chrono::ChObj | |
| int | GenerateUniqueIdentifier () |
Protected Attributes | |
| bool | m_verbose |
| AddedMassFrame | m_frame |
| axes in which the added mass coefficients are expressed | |
| ChBodyAddedMassBlocks | m_body_blocks |
| added mass blocks for hydrodynamic bodies | |
| ChMatrixDynamic | m_M |
| added mass matrix in Chrono velocity coordinates (in block order) | |
| ChKRMBlock | m_KRM |
| scaled added mass matrix (6*num_bodies square, in block order) | |
| unsigned int | m_system_size |
| system size for which the mass inverse was last computed | |
| bool | m_blocks_modified |
| added mass blocks changed since the mass inverse was last computed | |
| std::vector< ChQuaterniond > | m_inverse_rotations |
| body orientations for which the mass inverse was last computed | |
Protected Attributes inherited from chrono::ChPhysicsItem | |
| ChSystem * | system |
| parent system | |
| 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 Lagrange multipliers | |
Protected Attributes inherited from chrono::ChObj | |
| double | ChTime |
| object simulation time | |
| std::string | m_name |
| object name | |
| int | m_identifier |
| object unique identifier | |
| int | m_tag |
| user-supplied tag | |
| std::shared_ptr< ChVisualModelInstance > | vis_model_instance |
| instantiated visualization model | |
| std::vector< std::shared_ptr< ChCamera > > | cameras |
| set of cameras | |
Member Enumeration Documentation
◆ AddedMassFrame
|
strong |
Member Function Documentation
◆ ComputeAddedMassMatrix()
|
protected |
Compute the added mass matrix in Chrono velocity coordinates at the current body configuration.
The block coupling bodies i and j is T_i^T * A_ij * T_j, where A_ij is the corresponding 6 x 6 block of coefficients.
◆ ComputeShiftTransformation()
|
static |
Compute the transformation that shifts added mass coefficients to the origin of the body reference frame.
The coefficients A are given about a point fixed on the body, with the specified location in the body reference frame, and are expressed in the axes of the given frame convention. If S_i is the transformation for body i, the coefficients about the origins of the body reference frames are S_i^T * A_ij * S_j. With the inertial convention, S depends on the body orientation: the transformation computed at the current orientation applies exactly only at that orientation.
◆ ComputeTransformation()
|
protected |
Compute the transformation from Chrono velocity coordinates to the velocities the coefficients refer to.
For body i, the velocity of the origin of its reference frame and its angular velocity (in the axes given by the frame convention) are T_i * [v; w], where v is the COM velocity in absolute axes and w the angular velocity in the axes of the COM frame.
◆ IntLoadResidual_Mv()
|
overridevirtual |
Increment the given residual vector R with the term c * M * w (for the entire system).
- Parameters
-
off offset in R residual R updated residual R += c*M*v w w vector c scaling factor
Reimplemented from chrono::ChPhysicsItem.
◆ LoadKRMMatrices()
|
overridevirtual |
Compute and load current mass matrices in encapsulated ChMBlock objects.
The resulting M block contains Mfactor * M (Kfactor and Rfactor are ignored here).
Reimplemented from chrono::ChPhysicsItem.
◆ SetBodyAddedMassBlocks()
| void chrono::ChLoadHydrodynamics::SetBodyAddedMassBlocks | ( | const std::vector< ChMatrixDynamic<>> & | blocks | ) |
Modify the added mass blocks.
In this case, each given block is assumed to have size 6 x 6n and is expressed in the current frame convention. If any block changes, the inverse of the total mass matrix (if needed by the solver) is recomputed.
◆ ShiftBlocks()
|
static |
Shift added mass blocks with the given transformations (see ComputeShiftTransformation).
Each block, of size 6 x 6n, is replaced in place with the blocks S_i^T * A_ij * S_j.
◆ Update()
|
overridevirtual |
Perform any updates necessary at the current phase during the solution process.
This function is called at least once per step to update auxiliary data, internal states, etc. If a problem size is detected, resize the underlying KRM block.
Reimplemented from chrono::ChPhysicsItem.
◆ UpdateBodyAddedMassBlocks()
| void chrono::ChLoadHydrodynamics::UpdateBodyAddedMassBlocks | ( | const std::vector< ChMatrix66d > & | blocks | ) |
Modify the added mass block.
In this case, each given block is assumed to have size 6 x 6, is expressed in the current frame convention, and overwrites the diagonal block of the added mass matrix. If any block changes, the inverse of the total mass matrix (if needed by the solver) is recomputed.
The documentation for this class was generated from the following files:
- /builds/uwsbel/chrono/src/chrono/physics/ChLoadHydrodynamics.h
- /builds/uwsbel/chrono/src/chrono/physics/ChLoadHydrodynamics.cpp
Public Types inherited from