Class PhysicalModalBody

Contents

Class PhysicalModalBody#

Nested Relationships#

Nested Types#

Inheritance Relationships#

Base Type#

Class Documentation#

class PhysicalModalBody : public Karana::Dynamics::PhysicalBody#

Flexible body class supporting assumed modes based small deformation.

See the Flexible body systems section for more discussion on flexible bodies.

Public Functions

PhysicalModalBody(std::string_view name, kc::ks_ptr<Multibody> mb, size_t nmodes)#

PhysicalModalBody constructor. The constructor is not meant to be called directly. Please use the create(…) method instead to create an instance.

Parameters:
  • name – the body’s name

  • mb – the Multibody instance

  • nmodes – the number of deformation modes

~PhysicalModalBody()#

Destructor.

inline virtual std::string_view typeString() const noexcept override#

Returns the type string of Base.

Returns:

The type string.

virtual void setBodyToJointTransform(const km::HomTran &t) override#

Set the the body frame to body HingePnode pnode transform.

For a deformable body, this is the transform value in the undeformed configuration. This method should only be used for body pnodes. The Node::setBodyToNodeTransform() method should be used for all other nodes.

Parameters:

T – The input transform

virtual km::HomTran getBodyToJointTransform() const override#

Return the body frame to body HingePnode pnode transform.

For a deformable body, this is the transform value in the undeformed configuration.

Returns:

the transform

virtual bool isFinalized() const override#

Checks is the params for the object have been initialized.

Returns:

True if the params have set up.

km::Vec getStiffnessVector() const#

Get the stiffness vector for the body.

Returns:

The stiffness vector for the body.

void setStiffnessVector(const km::Vec &stiffness)#

Set the stiffness vector for the body.

Parameters:

stiffness – The new stiffness vector for the body.

km::Vec getDampingVector() const#

Get the damping vector for the body.

Returns:

The new damping vector for the body.

void setDampingVector(const km::Vec &damping)#

Set the damping vector for the body.

Parameters:

damping – The new damping vector for the body.

virtual std::string dumpString(std::string_view prefix, const Karana::Core::Base::DumpOptions *options) const override#

Return a formatted string containing information about this object.

Parameters:
  • prefix – String prefix to use for formatting.

  • options – Dump options (if null, defaults will be used).

Returns:

A string representation of the object.

virtual km::Mat jacobian(const kf::Frame &target, bool oriented) const override#

placeholder implementation

virtual km::Mat66 getNodeUpsilonFromPnode(const Node &node) override#

Return the 6x6 OSCM Upsilon matrix for a body node using the pnode Upsilon.

This method is used for the scatter step for onode Upsilon computation.

Parameters:

nd – the body node

Returns:

the OSCM Upsilon matrix

virtual km::Mat66 getNodeUpsilonFromBody(const Node &node) override#

Return the 6x6 OSCM Upsilon matrix for a body node using the body’s Upsilon.

Their method is used to compute the child onode UpsilonPlus value after crossing the modal dofs.

Parameters:

node – the body node

Returns:

the OSCM Upsilon matrix

virtual km::Mat getUpsilonMatrix() override#

Get the (nU+6) square Upsilon matrix in the body frame after crossing the flex dofs

virtual void setParams(const PhysicalBodyParams &params) override#

Set the PhysicalBody parameters.

Parameters:

params – the parameters to set

inline virtual const km::Mat atbiCoordMapMatrix() const override#

Return the coordinate map matrix to be used for ATBI computations.

Returns:

coordinate map matrix

Public Static Functions

static kc::ks_ptr<PhysicalModalBody> create(std::string_view name, kc::ks_ptr<Multibody> mbs, size_t nmodes)#

Factory method to create a PhysicalModalBody instance.

Parameters:
  • name – the body’s name

  • mbs – the Multibody instance

  • nmodes – the number of deformation modes

Returns:

a new PhysicalModalBody instance

static std::vector<kc::ks_ptr<PhysicalBody>> addSerialChain(std::string_view name, size_t nbodies, PhysicalBody &root, HingeBase::HingeType htype = HingeBase::HingeType::PIN, PhysicalBodyParams *params = nullptr)#

Add a serial chain of flexible physical bodies to the multibody system.

Add a serial chain of flexible bodies to the multibody system to the specified root body with the specified mass properties, hinge type and hinge connection properties. This method is mainly used for procedurally generating large test systems.

Parameters:
  • name – prefix string to use for the new body names

  • nbodies – number of bodies

  • root – the parent body to attach the chain to

  • htype – the hinge type

  • params – the body params for each body

Returns:

the list of new flexible bodies

static std::vector<kc::ks_ptr<PhysicalBody>> addTree(std::string_view name, size_t branch_length, size_t nbranches, size_t depth, PhysicalBody &root, HingeBase::HingeType htype = HingeBase::HingeType::PIN, PhysicalBodyParams *params = nullptr)#

Add a sub-tree of flexible physical bodies to the multibody system.

Add a sub-tree of flexible bodies to the multibody system to the specified root body with the specified mass properties, hinge type and hinge connection properties. This method is mainly used for procedurally generating large test systems.

Parameters:
  • name – prefix string to use for the new body names

  • branch_length – the number of bodies in a branch

  • nbranches – the number of children branches

  • depth – the number of branching levels to create

  • root – the parent body to attach the chain to

  • htype – the hinge type

  • params – the body params for each body

Returns:

the list of new rigid bodies

Protected Functions

inline const km::Mat &_atbiCoordMapMatrix() const#
virtual km::Mat pframeCoordMapMatrix() const override#

same as the (6+nU, 6) _computeHst_Mfl(*this), so the lhs is in the body frame.

virtual km::Mat getATBIMatPsi() const override#

Return the (6, nU+6) psi transformation matrix between the pnode and the body. The lhs is in the pnode frame and the rhs in the body frame. This method should only be called for bodies whose pnode is not a floating frame. This method is used by both _oframe2pframePsi() and _oframe2pframePsi.

virtual km::Mat getATBID() const override#

nU square matrix

virtual km::Mat getATBIDinv() const override#

nU square matrix

virtual km::Mat getATBIG() const override#

Return (nU+6)xnU matrix with upper rows padded in for Minv computations. lhs is in the body frame. Note that this differs from _atbi_mats.G whose rhs is in the pnode deformed translational frame. This version is used in the Minv computations.

virtual km::Mat getATBITauper() const override#

Return (nU+6) square matrix with upper rows padded in for Minv computations. lhs is in the body frame, and the bottom right in the body frame. Note that this differs from _atbi_mats.tauper whose rhs is in the pnode deformed translational frame. This version is used in the Minv computations.

virtual km::Mat _oframe2pframePsi() const override#

Returns the (6, nU+6) size pnode to body frame Psi

virtual km::Mat _oframe2pframePhi() const override#

Returns the (6, nU+6) size pnode to body frame Phi

virtual km::Mat _pframe2otherPhi(const kf::Frame &other) const override#

Returns the (nU+6, 6) size body frame to body node connected frame Phi

virtual void _setupNode(Node &nd, bool force_node) override#

Helper method to create a node. This method is specialized by bodies that are deformable

virtual void _detachNode(kc::ks_ptr<Node> &node) override#

Discard the provided node.

Parameters:

node – The node to discard.

km::Mat _getM() const#

Get the (nU+6) size square body mass properties M matrix - value can vary with configuration when using modal integrals

km::Mat _getMff() const#

Get the nU size square flex/flex sub-block of the body’s mass properties M - non-identity when using modal integrals

km::Mat _getMfr() const#

Get the nUx6 size flex/rigidly sub-block of the body’s mass properties M - non-zero when using modal integrals

void _discardNodeDeformationProvider(kc::ks_ptr<Node> nd)#

Discard the node’s deformation provider.

Parameters:

nd – The node whose deformation provider we want to discard.

void _discardPnodeDeformationProvider()#

Discard the pnode’s deformation provider.

virtual km::SpatialVector _getPnodeATBIFilterZ() override#

Compute the z ATBI filter spatial vector at the pnode after crossing the flex dofs

virtual km::Mat66 _getPnodeATBIMatricesP() override#

Compute the P ATBI matrix at the pnode after crossing the flex dofs

virtual km::SpatialVector _getOnodeATBISmootherAlphaPlus(const HingeOnode &ond) override#

Compute the alpha^+ ATBI smoothing spatial accel vector at the onode

virtual void _processPnodeATBISmootherVectors() override#

Compute the modal accels as part of the ATBI smoothing step

virtual km::SpatialVector _getPnodeInvDynForcesF() override#

Compute the inter-body spatial force at the pnode from the inverse dynamics computations

SZNodeMatrices _computeSZMatrices(const Node &node)#

Compute and cache the S (nUx6) and Z (6x6) matrices for computing pnode to body node transformations.

virtual km::Mat66 _pnodeToChildNodeTransform(const Node &node) override#

Return the pnode to body node 6x6 transformation matrix - this takes into account Z matrix

virtual km::Mat _bodyToChildNodeTransform(const Node &node, const kf::Frame &from_frame) const override#

Return the (nU+6, 6) A_fl(node) matrix - transformed to the “from_frame” via phi(from_frame, body_frame). The A_fl(node) matrix by itself is

[Pi^* // phi(bd, node_trans)] * phi(node_trans, node)

We apply the phi(from_frame, bd) to the bottom row to transform it to the from_frame.

This also works for floating base systems (where the pnode is no longer a physical point) because we do not allow any offsets between the pnode and the body frame for such bodies. Otherwise, we would have to use phi(pnode, node_trans) because the P value is at the pnode, not the body frame.

void _computeATBICoordMapMatrix(km::Mat&) const#
km::Mat _computeHst_Mfl(const kf::Frame &at_frame) const#

Compute the (nU+6)xnU Hst_Mfl matrix transformed from the (lhs) pnode deformed trans frame to the specified (rhs) at_frame (often the body frame). This is the left block of the full Hst matrix when the “at_frame” is the body frame (per the book). Note however that the pnode is the at_frame when working with the full Hst matrix.

const km::Vec _externalModalForces() const#

Process the external spatial forces on the body force nodes and return the overall nU sized vector

const km::Vec _constraintModalForces() const#

Process the constraint spatial forces on the body constraint nodes and return the overall nU sized vector

void _setupNodeDeformation(kc::ks_ptr<Node> nd)#
void _setupPnodeDeformation()#
virtual void _discardHingePnode() override#
virtual void _discardHingeOnode(kc::ks_ptr<HingeOnode> &onode) override#
virtual kc::ks_ptr<HingePnode> _createPnode(bool floating_frame) override#

Methods to create and discard nodes

virtual kc::ks_ptr<HingeOnode> _createOnode(std::string_view name) override#
virtual void _setBodyToNodeTransform(Node &node, const km::HomTran &t) override#

Get/set the the transform to a body node. For a deformable body, this is the transform value in the undeformed configuration. This method should be used for all nodes, except for the pnode for whom the get/setBodyToJointTransform() method should be used. These methods are protected to allow them to specialized for rigid and deformable bodies.

virtual km::HomTran _getBodyToNodeTransform(const Node &node) const override#
km::Mat _getMassAtFrame(const kf::Frame &frame) const#
virtual void _getPnodeCRBInertiaMatrix(km::Mat &R) override#

Update the full (nU+6)x(nU+6) flex input R matrix with contributions from the child onodes and the body itself transformed to the pnode.

void _oneTimeSetupDataCaches()#
void _oneTimeTeardownDataCaches()#

Protected Attributes

km::Vec _stiffness_vector#
km::Vec _damping_vector#
bool _using_modal_integrals = false#

set to true if modal integrals have been set up for this body

ModalUpsilonMatrices _modal_upsilon_matrices#
kc::ks_ptr<kc::DataCache<km::Mat>> _atbi_coord_map_matrix_cache = nullptr#

the (6*nU)xNU joint map matrix data cache e for ATBI computations for the subhinge.

struct ATBIFilterVectors : public Karana::Dynamics::CoordBase::ATBIFilterVectors#

Public Functions

inline void resize(size_t modal_n_u)#

Constructor

void dump(std::string_view indent) const#

Public Members

km::Vec z#
km::SpatialVector zplus#
km::Vec epsilon#

Residual hinge force (nU)

eps = T - H * (zR + PR*a)

km::Vec nu#

Residual hinge acceleration (nU)

nu = Dinv * eps

struct ATBIMatrices : public Karana::Dynamics::CoordBase::ATBIMatrices#

Overall struct for ATBI dynamics matrix quantities for an articulation subhinge which includes the fixed and subhinge dof size matrices.

HP (6, nU) - the lhs is in the pnode deformed translational frame G (6, nU) - the lhs is in the pnode deformed translational frame tauper (6, nU+6) - lhs is in the pnode deformed translational frame, while the bottom part of the right is in the body frame

psi (6, nU+6) - lhs is in the pnode frame, while the bottom part of the right is in the body frame

Public Functions

inline void resize(size_t modal_n_u, size_t body_n_u)#

Public Members

km::Mat P#
km::Mat66 Pplus#
km::Mat HP#

HP = H*P (nU x body_nU)

For a subhinge the lhs is in the pframe, while it in the pnode deformed translational frame for a flex body.

km::Mat D#

D = H*P*HT (nU x nU)

km::Mat Dinv#

Dinv = inverse(D) (nU x nU)

km::Mat G#

G = P*H*Dinv (body_nU x nU)

For a subhinge the lhs is in the pframe, while it in the pnode deformed translational frame for a flex body.

km::Mat tauper#

tauper = I - GH (body_nU x body_nU)

For a subhinge the lhs is in the pframe, while it in the pnode deformed translational frame for a flex body.

km::Mat psi#

psi = phi * tauper (body_nU x body_nU)

For a subhinge, the left is in the oframe, right in the pframe. For a flex body, the lefts is in the pnode frame and the right in the body frame.

struct ATBISmootherVectors#

Public Members

km::SpatialVector alpha_plus#

alpha+ vector at the onode and represented in the onode frame.

struct ModalUpsilonMatrices#

Public Members

km::Mat Upsilon#

OSI (nmodes+6) Upsilon matrix for the body about and in the body frame

struct SZNodeMatrices#

matrices for computing the pnode to body node psi and Upsilon values for a flex body

Public Members

km::Mat S#
km::Mat66 Z#