FhSim  3.1.0
Marine systems simulation
Loading...
Searching...
No Matches
InternalCable Class Reference
+ Inheritance diagram for InternalCable:
+ Collaboration diagram for InternalCable:

Public Member Functions

 InternalCable (ISimObjectCreator *creator, const SCableSpec &CableSpec)
 The constructor sets the pointer to the output object and the parser object.
 
virtual ~InternalCable ()
 The destructor deletes dynamically allocated memory.
 
virtual void FinalSetup (const double dT, const double *const adX, ISimObjectCreator *const creator)
 
virtual void OdeFcn (const double *const adPosA, const double *const adVelA, const double *const adPosB, const double *const adVelB, const double *const adX, double *const adXDot, double dT) const
 Calculates the state derivatives and the end forces.
 
bool HasForceOutsideJacobian () const
 
void EvaluateElementsAt (const double *adPosA, const double *adVelA, const double *adPosB, const double *adVelB, const double *adX, double dT) const
 
double EndInertia (int end) const
 
void ComputeStructuralJacobian (const double *posA, const double *velA, const double *posB, const double *velB, const double *X, double *J, int nStates, int stateOffset) const
 
void AddEndpointJacobianContributions (const double *posA, const double *velA, const double *posB, const double *velB, int globalPosIdxA, int globalVelIdxA, int globalPosIdxB, int globalVelIdxB, double endInertiaA, double endInertiaB, const double *X, double *J, int nStates, int stateOffset) const
 
virtual bool InitializeStates (const double *const adPosA, const double *const adVelA, const double *const adPosB, const double *const adVelB, double *const adX)
 Method for setting initial conditions when the input is known, which may be implemented in the individual simObjects.
 
void UpdateCable (double newLength)
 Sets the unstretched length of the cable, divided equally between its elements.
 
void AdvanceMeanTension (const double *adPosA, const double *adPosB, const double *adX, double T)
 
void TakeWakes (const double *adPosA, const double *adPosB, const double *adX, double T)
 
void AddEndForcesAndInertia (double *const adEndForceA, double *const adEndForceB, double *const pdEndInertiaA, double *const pdEndInertiaB, const double *const adPosA, const double *const adVelA, const double *const adPosB, const double *const adVelB, const double *const adX, double dT)
 Adds the end forces and inertia to the supplied data structures.
 
double GetLength ()
 Calculates the length of the cable.
 

Public Attributes

unsigned long m_numElements
 The number of elements to divide the cable into.
 
unsigned long m_numNodes
 The number of nodes of the cable.
 

Protected Member Functions

void ResetAllNodeForces () const
 
void AddAllElementForces (const double *const adPosA, const double *const adVelA, const double *const adPosB, const double *const adVelB, const double *const adX, double dT) const
 
void CalcDerivatives (const double *const adX, double *const adXDot) const
 
virtual void AddElementForce (int cableElement, const double adPosA[3], const double adVelA[3], const double adPosB[3], const double adVelB[3], double adForceA[3], double adForceB[3], double dT) const
 
virtual void AddNodeForce (const double[3], const double[3], double[3]) const
 
void MarkForceOutsideJacobian () const
 
void AddBareElementForce (int cableElement, const double posA[3], const double velA[3], const double posB[3], const double velB[3], const double waterVel[3], double forceA[3], double forceB[3]) const
 
double NodeInertia (unsigned long node) const
 
bool SegmentEndBlocks (unsigned long segment, const double *posA, const double *velA, const double *posB, const double *velB, const double *X, double dFA_dposB[9], double dFA_dvelA[9]) const
 

Protected Attributes

unsigned long * m_iStatePos
 An array of indices to the node position states.
 
unsigned long * m_iStateVel
 An array of indices to the node velocity states.
 
SCableSpec m_CableSpec
 The cable specification.
 
double m_eA
 The stiffness of the cable.
 
double m_meanTensionTime = std::numeric_limits<double>::quiet_NaN()
 The time of the last AdvanceMeanTension.
 
CableElDynStiff ** m_cableElements
 An array holding the cable elements.
 
double ** m_aadForceA
 The force on the A nodes.
 
double ** m_aadForceB
 The force on the B nodes.
 
environment::wake::ElementFlowInteraction m_flow
 The flow at the element midpoints, the other objects' wakes taken per step (MARE-0223); the Environment, from FinalSetup.
 
environment::EnvironmentProvider * m_environment = nullptr
 m_flow's Environment, from FinalSetup; null before it and without one (fhsim_fishery's tests set it by hand).
 
double m_elVelWater [3]
 
double m_elMeanPos [3]
 
double m_elMeanVel [3]
 

Member Function Documentation

◆ AddBareElementForce()

void InternalCable::AddBareElementForce ( int  cableElement,
const double  posA[3],
const double  velA[3],
const double  posB[3],
const double  velB[3],
const double  waterVel[3],
double  forceA[3],
double  forceB[3] 
) const
protected

Adds element cableElement's own force at the given end states to forceA and forceB: structure, weight and buoyancy, drag and added mass relative to waterVel, at the section's FluidRho. The element alone: no environment lookup, no surface, no seabed. For a subclass that adds a second element force (fhsim_fishery's net bin, FISH-0098).

◆ AddElementForce()

virtual void InternalCable::AddElementForce ( int  cableElement,
const double  adPosA[3],
const double  adVelA[3],
const double  adPosB[3],
const double  adVelB[3],
double  adForceA[3],
double  adForceB[3],
double  dT 
) const
protectedvirtual

Reimplemented in InternalCableWithAttractor.

◆ AddEndpointJacobianContributions()

void InternalCable::AddEndpointJacobianContributions ( const double *  posA,
const double *  velA,
const double *  posB,
const double *  velB,
int  globalPosIdxA,
int  globalVelIdxA,
int  globalPosIdxB,
int  globalVelIdxB,
double  endInertiaA,
double  endInertiaB,
const double *  X,
double *  J,
int  nStates,
int  stateOffset 
) const

Adds Jacobian contributions from boundary segments when endpoints are state variables.

ComputeStructuralJacobian treats posA/posB as frozen (no J entries for them). Call this afterwards when either endpoint belongs to the state vector (junction nodes).

Parameters
posAPosition of cable endpoint A.
velAVelocity of cable endpoint A.
posBPosition of cable endpoint B.
velBVelocity of cable endpoint B.
globalPosIdxAGlobal state index of posA; -1 if posA comes from a port.
globalVelIdxAGlobal state index of velA; -1 if velA comes from a port.
globalPosIdxBGlobal state index of posB; -1 if posB comes from a port.
globalVelIdxBGlobal state index of velB; -1 if velB comes from a port.
endInertiaAInertia of junction node A (used when globalPosIdxA >= 0).
endInertiaBInertia of junction node B (used when globalPosIdxB >= 0).
XLocal state slice (adX + stateOffset from the SimObject's perspective).
JRow-major Jacobian matrix (nStates x nStates), accumulated into.
nStatesTotal state count for this SimObject.
stateOffsetOffset of this cable's states within the SimObject's state vector.

◆ AddNodeForce()

virtual void InternalCable::AddNodeForce ( const double  [3],
const double  [3],
double  [3] 
) const
inlineprotectedvirtual

A subclass's own force on one internal node at position pos and velocity vel, added to force, the node's force from its two elements. OdeFcn calls it for every internal node, in node order, after AddAllElementForces and before CalcDerivatives. A force ComputeStructuralJacobian does not model must call MarkForceOutsideJacobian(). Does nothing here.

Reimplemented in InternalCableWithAttractor.

◆ AdvanceMeanTension()

void InternalCable::AdvanceMeanTension ( const double *  adPosA,
const double *  adPosB,
const double *  adX,
double  T 
)

Advances the elements' dynamic-stiffness mean tension once per integrator step (owner ruling R64, MARE-0357): the owner calls this from PreOdeFcn with the step's start state, and OdeFcn and the port calculations only read it. A second call at the same or an earlier time does nothing (MARE-0330).

Parameters
adPosAThe position of end A [m].
adPosBThe position of end B [m].
adXThe states of this cable.
TThe time of the step start [s].

◆ ComputeStructuralJacobian()

void InternalCable::ComputeStructuralJacobian ( const double *  posA,
const double *  velA,
const double *  posB,
const double *  velB,
const double *  X,
double *  J,
int  nStates,
int  stateOffset 
) const

Computes the structural (spring+damper) contribution to the ODE Jacobian. Fills J (row-major, nStates x nStates) with contributions from all segments. Omitted terms: hydrodynamic drag, gravity/buoyancy (constants), the wave excitation (R104). stateOffset: byte offset of this cable's states within the SimObject's global state vector.

◆ EndInertia()

double InternalCable::EndInertia ( int  end) const

The inertia this cable gives end A or B (0 or 1): the end element's share of its mass, at the state the elements were last evaluated at.

◆ EvaluateElementsAt()

void InternalCable::EvaluateElementsAt ( const double *  adPosA,
const double *  adVelA,
const double *  adPosB,
const double *  adVelB,
const double *  adX,
double  dT 
) const

Evaluates the elements at a state as OdeFcn does, without the derivatives, so that the masses the Jacobian divides by are those of that state (MARE-0359). Call it before ComputeStructuralJacobian.

Parameters
adPosAThe position of end A.
adVelAThe velocity of end A.
adPosBThe position of end B.
adVelBThe velocity of end B.
adXThe states of this cable.
dTThe time [s].

◆ HasForceOutsideJacobian()

bool InternalCable::HasForceOutsideJacobian ( ) const
inline

Whether the last OdeFcn added a force ComputeStructuralJacobian does not model (bottom contact, FISH-0086; a subclass's own force).

◆ MarkForceOutsideJacobian()

void InternalCable::MarkForceOutsideJacobian ( ) const
inlineprotected

Marks the current OdeFcn state as having a force ComputeStructuralJacobian does not model; InternalCable::OdeFcn clears it first.

◆ NodeInertia()

double InternalCable::NodeInertia ( unsigned long  node) const
protected

The inertia of internal node node: its share of the masses of its two elements, at the state the elements were last evaluated at (MARE-0325).

◆ SegmentEndBlocks()

bool InternalCable::SegmentEndBlocks ( unsigned long  segment,
const double *  posA,
const double *  velA,
const double *  posB,
const double *  velB,
const double *  X,
double  dFA_dposB[9],
double  dFA_dvelA[9] 
) const
protected

The structural end blocks of one segment, dF_A/dposB and dF_A/dvelA (3x3 row-major, from the axial law, cable_axial_law::EndBlocks); false where the segment adds nothing (no tension). Shared by ComputeStructuralJacobian and AddEndpointJacobianContributions.

◆ TakeWakes()

void InternalCable::TakeWakes ( const double *  adPosA,
const double *  adPosB,
const double *  adX,
double  T 
)

Takes the other objects' wakes at the element midpoints for the step (MARE-0223, owner ruling R-c): the owner calls this from PreOdeFcn with the step's start state; the element forces of the step read the held composition, applied to the live current at the element's position in each evaluation (fhsim_environment's ElementFlowInteraction, ExternalWakeUpdate). Does nothing without an environment.

Parameters
adPosAThe position of end A [m].
adPosBThe position of end B [m].
adXThe states of this cable.
TThe time of the step start [s].

The documentation for this class was generated from the following file: