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.

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 isReady() 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 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

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

This method assumes that the target frame is on, or outboard of, this body’s pnode frame.

Parameters:
  • target – the target frame

  • oriented – if true, the body is oriented with the f2f

Returns:

the Jacobian matrix

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

Compute the body node’s OSCM Upsilon matrix from the pnode’s Upsilon matrix. Also used to compute the child onode UpsilonPlus value after crossing the modal dofs. The result lhs/rhs are in the node frame.

Parameters:

node – the body node

Returns:

the node Upsilon matrix

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

Compute the body node’s OSCM Upsilon matrix from the body’s Upsilon matrix. Also used to compute the child onode UpsilonPlus value after crossing the modal dofs. The result4 lhs/rhs are in the node frame.

Parameters:

node – the body node

Returns:

the node Upsilon matrix

virtual km::Mat getUpsilonMatrix() override#

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

Returns:

the body Upsilon 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::REVOLUTE, 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::REVOLUTE, 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#

The coordinate map matrix for ATBI computations.

Returns:

the coordinate map matrix

virtual km::Mat pframeCoordMapMatrix() const override#

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

Returns:

the coord map matrix

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.

Returns:

the psi matrix

virtual km::Mat getATBID() const override#

The ATBI D matrix

Returns:

the ATBI D nU square matrix

virtual km::Mat getATBIDinv() const override#

The ATBI Dinv matrix.

Returns:

the ATBI Dinv 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.

Returns:

the ATBI G matrix

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.

Returns:

the ATBI tauper matrix

virtual km::Mat _oframe2pframePsi() const override#

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

Returns:

the psi matrix

virtual km::Mat _oframe2pframePhi() const override#

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

Returns:

the phi matrix

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

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

Parameters:

other – the other frame

Returns:

the phi matrix

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

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

Parameters:
  • node – the node

  • force_node – if true, this is a force node

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.

Returns:

the body mass matrix

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.

Returns:

the flex/flex block of the body mass matrix

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.

Returns:

the flex/rigid block of the body mass matrix

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.

Returns:

the ATBI z spatial vector

virtual km::Mat66 _getPnodeATBIMatricesP() override#

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

Returns:

the ATBI P matrix

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

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

Parameters:

ond – the onode

Returns:

the ATBI spatial acceleration

virtual void _processPnodeATBISmootherVectors() override#

Compute the subhinge and modal accels as part of the ATBI smoothing step.

virtual void _processModalATBISmootherVectors() override#

Compute the modal accels as part of the ATBI smoothing step. TODO - remove override need.

virtual km::SpatialVector _getPnodeInvDynForcesF() override#

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

Returns:

the inverse dynamics spatial force

SZNodeMatrices _computeSZMatrices(const Node &node)#

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

Parameters:

node – the node

Returns:

the SZ matrices for the node

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

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

Parameters:

node – the node

Returns:

the transform matrix

virtual kc::ks_ptr<kf::Frame> _getPnodeDeformedTransFrame() const override#

Return the pnode translational deformation frame.

Returns:

the frame

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.

Parameters:
  • node – the node

  • from_frame – the from frame

Returns:

the transform matrix

void _computeATBICoordMapMatrix(km::Mat &val) const#

Cache callback to compute the full (_nU + 6)x(_nU + hge_nU) size Hst matrix for the flex body at the pnode frame.

Parameters:

val – the data buffer for the computed value

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.

Parameters:

at_frame – the at frame

Returns:

the Hst matrix

const km::Vec _externalModalForces() const#

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

Returns:

the modal external forces

const km::Vec _constraintModalForces() const#

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

Returns:

the modal constraint forces

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

Helper method to set up the node deformation.

Parameters:

nd – the node

void _setupPnodeDeformation()#

Helper method to set up the pnode deformation.

virtual void _discardHingePnode() override#

Helper method to discard the pnode.

virtual void _discardHingeOnode(kc::ks_ptr<HingeOnode> &onode) override#

Helper method to discard an onode.

Parameters:

onode – the onode

virtual kc::ks_ptr<HingePnode> _createPnode(bool floating_frame) override#

Create a pnode with modal deformation with a nodal matrix and undeformed intermediate frame. The body will be a child of the pnode.

Parameters:

floating_frame – whether the body has a 6dof hinge or not

Returns:

the new pnode

virtual kc::ks_ptr<HingeOnode> _createOnode(std::string_view name) override#

create a onode with modal deformation with a nodal matrix and undeformed intermediate frame.

Parameters:

name – the name

Returns:

the new onode

virtual void _setBodyToNodeTransform(Node &node, const km::HomTran &t) override#

Set 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.

Parameters:
  • node – the node

  • t – the transform

virtual km::HomTran _getBodyToNodeTransform(const Node &node) const override#

Get 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.

Parameters:

node – the node

Returns:

the transform

km::Mat _getMassAtFrame(const kf::Frame &frame) const#

transform the (nU+6)x(nU+6) body flex mass properties matrix from the body frame to the specified frame (usually pnode or pnode_trans

Parameters:

frame – the target frame

Returns:

the body mass matrix

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.

Parameters:

R – the data buffer for the computed value

void _oneTimeSetupDataCaches()#

Helper method to set up the data caches.

void _oneTimeTeardownDataCaches()#

Helper method to tear down the data caches.

Protected Attributes

km::Vec _stiffness_vector#

the deformation stiffness vector

km::Vec _damping_vector#

the deformation damping vector

bool _using_modal_integrals = false#

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

ModalUpsilonMatrices _modal_upsilon_matrices#

the modal OSI 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#

Overall struct for ATBI dynamics filter quantities for an flexible body.

Public Functions

inline void resize(size_t modal_n_u)#

Resize the ATBI vectors.

Parameters:

modal_n_u – the modal dofs

void dump(std::string_view indent) const#

Dump the ATBI vector data.

Parameters:

indent – prefix to apply

Public Members

km::Vec z#

the (nodes+6) size ATBI z vector before crossing the deformation dofs.

km::SpatialVector zplus#

the zplus ATBI spatial vector after crossing the deformation dofs - about and represented in the pnode frame.

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 a deformable body.

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)#

Resize the ATBI matrices.

Parameters:
  • modal_n_u – the modal dofs

  • body_n_u – the rigid body dofs

Public Members

km::Mat P#

the (nodes+6) size square P matrix before crossing the deformation dofs

km::Mat66 Pplus#

the 6x6 Pplus matrix after crossing the deformation dofs

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#

Overall struct for ATBI dynamics smoother quantities for an flexible body.

Public Members

km::SpatialVector alpha_plus#

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

struct ModalUpsilonMatrices#

struct for the modal Upsilon matrices

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#

nUx6, the rhs is in the pnode deform translational frame

km::Mat66 Z#

6x6, the lhs & rhs are both in the pnode deform translational frame