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

Classes

struct  SegmentJacobian
 Derivatives of one segment's node forces FA and FB, each a row-major [3 x 3] matrix. More...
 
struct  SegmentSample
 

Public Member Functions

 CCable (const std::string &simObjectName, ISimObjectCreator *const creator)
 Reads parameters, registers states, input/output ports and shared resources.
 
void OdeFcn (const double T, const double *const X, double *const XDot) const
 free allocated memory
 
void InitialConditionSetup (const double T, const double *const currentIC, double *const updatedIC, ISimObjectCreator *const creator)
 Sets initial conditions based on the value of input ports.
 
void FinalSetup (const double T, const double *const X, ISimObjectCreator *const creator)
 
void PreOdeFcn (const double T, const double *const X, IStateUpdater *const updater) override
 retrieves pointer to environment object
 
const double * ForceA (const double T, const double *const X)
 
const double * ForceB (const double T, const double *const X)
 output port. See PortDefs.h. Returns force at point A
 
void computeEndForces (const double T, const double *const X) const
 output port. See PortDefs.h. Returns force at point B
 
void computeEndpoints (const double T, const StateFrame &frame) const
 computes free nodes and both end forces
 
bool HasJacobians () const override
 
void OdeJacobian (double T, const double *X, double *J, int nStates) override
 
int GetJacobianSparsity (int nStates, int *rowPtr, int *colIdx) override
 

Protected Member Functions

void computeSegmentForces (const double T, int segment, const double *X, const double *pA, const double *pB, const double *vA, const double *vB, double *FA, double *FB, double waveBound, double *wetOut=nullptr, bool *inSeabedContactOut=nullptr) const
 Computes all forces acting on an element.
 
double nodeMass (double wetHalves) const
 
double waveInertiaCoefficient () const
 (1 + Ca) rho A L of a segment, the factor of the wave excitation on the normal particle acceleration (R67).
 
std::optional< double > surfaceElevation (const double T, const double *pA, const double *pB, double waveBound) const
 
double wetFraction (const double *pA, const double *pB, std::optional< double > seaElevation, double *dWet_dpA=nullptr, double *dWet_dpB=nullptr) const
 
void computeVirtualPoint (const double *const target, const double *const point, const double *const targetVel, const double *const pointVel, double *virtualPoint, double *virtualPointVel, double residual, double dResidual) const
 Computes position and velocity of the virtual point.
 
void testPositiveParam (double value, ISimObjectCreator *creator, std::string valueName)
 
SegmentSample sampleSegment (const double T, int segment, const double *pA, const double *pB, double waveBound, bool withWetDerivatives) const
 
void segmentForces (const SegmentSample &sample, const double *pA, const double *pB, const double *vA, const double *vB, double *FA, double *FB, double *wetOut=nullptr, bool *inSeabedContactOut=nullptr) const
 computeSegmentForces of a segment already sampled; pA and pB are the positions it was sampled at.
 
void computeSegmentJacobian (const double T, int segment, const double *pA, const double *pB, const double *vA, const double *vB, SegmentJacobian &jac, double waveBound) const
 Computes the derivatives of all forces computeSegmentForces differentiates: structural and drag.
 
void segmentJacobian (const SegmentSample &sample, const double *pA, const double *pB, const double *vA, const double *vB, SegmentJacobian &jac) const
 computeSegmentJacobian of a segment sampled with the wetted fraction's derivatives.
 
void addSegmentHydrodynamicJacobian (const SegmentSample &sample, const double *vA, const double *vB, SegmentJacobian &jac) const
 

Protected Attributes

double m_cableLength
 
double m_cableWeight
 total cable length [m]
 
double m_Emodulus
 cable weight [kg/m]
 
double m_tensileCrossSectionArea
 Young's modulus of load bearing material [Pa].
 
double m_displacementCrossSectionArea
 cross section area of load bearing material [m^2]
 
double m_diameter
 displaced fluid volume per meter cable [m^2]
 
double m_hydrodynamicDiameter
 cable diameter [m]
 
double m_submergedWeight
 effective hydrodynamic diameter [m]
 
double m_waterDensity
 weight of cable underwater [kg/m]
 
double m_internalDamping
 water density, the parameter Rho [kg/m^3]
 
int m_numElements
 structural axial damping. [N*s/m]
 
double m_elementMass
 number of elements in the cable [#]
 
double m_segmentMass
 mass of each free node: its two half-segments, one segment's mass (R96) [kg]
 
double m_segmentSubmergedMass
 mass of each segment [kg]
 
double m_segmentLength
 submerged weight of each element [kg]
 
double m_segmentStiffness
 length of spring between elements [m]
 
int * m_elementPositionIndex
 spring stiffness [N/m]
 
int * m_elementVelocityIndex
 The relative index of the position state in the state array for each element [#].
 
int m_stateBase = 0
 The relative index of the velocity state in the state array for each element [#].
 
ISignalPort * m_PositionA
 
ISignalPort * m_PositionB
 input port. Position of point A [m]
 
ISignalPort * m_VelocityA
 input port. Position of point B [m]
 
ISignalPort * m_VelocityB
 input port. Velocity of point A [m/s]
 
ISignalPort * m_retractedLengthPortA
 input port. Velocity of point B [m/s]
 
ISignalPort * m_retractedLengthPortB
 amount of retracted cable at endpoint A [m]
 
ISignalPort * m_retractedSpeedPortA
 amount of retracted cable at endpoint B [m]
 
ISignalPort * m_retractedSpeedPortB
 retraction rate at endpoint A [m/s]
 
double m_endForceA [3]
 retraction rate at endpoint B [m/s]
 
double m_endForceB [3]
 reactive force at endpoint A [N]
 
double m_nodeForceA [3]
 reactive force at endpoint A [N]
 
double m_nodeForceB [3]
 force on first free node at endpoint A [N]
 
double m_wetEndA = 1.0
 force on first free node at endpoint A [N]
 
double m_wetEndB = 1.0
 wetted fraction of the segment from virtual point A to the first free node
 
std::vector< double > m_nodeWetHalves
 wetted fraction of the segment from the last free node to virtual point B
 
double m_retractedLengthA
 per node, the summed wetted fractions of its two half-segments
 
double m_retractedLengthB
 amount of retracted cable at endpoint A [m]
 
int m_retractedNodesA
 amount of retracted cable at endpoint B [m]
 
int m_retractedNodesB
 number of nodes currently on winch A
 
double m_virtualPointA [3]
 number of nodes currently on winch B
 
double m_virtualPointB [3]
 when cable is winched, the closest free node is attracted towards a ghost point "beyond" the actual endpoint [m]
 
double m_virtualPointVelocityA [3]
 when cable is winched, the closest free node is attracted towards a ghost point "beyond" the actual endpoint [m]
 
double m_virtualPointVelocityB [3]
 when cable is winched, the closest free node is attracted towards a ghost point "beyond" the actual endpoint [m/s]
 
double m_residualA
 when cable is winched, the closest free node is attracted towards a ghost point "beyond" the actual endpoint [m/s]
 
double m_residualB
 free length of closest free node [m]
 
ICommonComputation * m_computeEndForces
 free length of closest free node [m]
 
const double * m_posA
 computation node for endpoint reaction forces
 
const double * m_posB
 Position of point A [m].
 
const double * m_velA
 Position of point B [m].
 
const double * m_velB
 Velocity of point A [m].
 
environment::wake::ElementFlowInteraction m_flow
 Velocity of point B [m].
 
environment::EnvironmentProvider * m_environment
 m_flow's Environment, from FinalSetup.
 
environment::SeafloorForcesInterface * m_seafloorForces = nullptr
 The shared resource SeafloorForces, from FinalSetup.
 
bool m_endSegmentsInSeabedContact = false
 Whether either end segment was in contact at the last end-force computation.
 
bool m_inSeabedContact = false
 Whether any segment was in contact at the last OdeFcn: the cable has no Jacobian then.
 

Static Protected Attributes

static constexpr int kLiveSegment = -1
 test if a parameter is positive, and reports error if not.
 

Constructor & Destructor Documentation

◆ CCable()

CCable::CCable ( const std::string &  simObjectName,
ISimObjectCreator *const  creator 
)

This constructor performs all initial setup for a point mass simobject. Reading in parameters, setting up communication interface i.e. output ports, input ports, and states, plus additional 'one time only' resource setup.

Parameters
[in]simObjectName-> The name of the simobject. Used primarily by superclass constructor
[in]creator-> Retrieve parameters. Register states, ports and shared resources

Member Function Documentation

◆ addSegmentHydrodynamicJacobian()

void CCable::addSegmentHydrodynamicJacobian ( const SegmentSample &  sample,
const double *  vA,
const double *  vB,
SegmentJacobian &  jac 
) const
protected

Adds the derivatives of one segment's wetted-fraction terms to jac: the buoyancy and the drag's factor, the wetted fraction, w.r.t. both node positions (R66), and the drag w.r.t. both node velocities and, through the segment direction, both node positions.

◆ computeEndpoints()

void CCable::computeEndpoints ( const double  T,
const StateFrame &  frame 
) const

Computes the retracted nodes, residual lengths and virtual endpoints.

Parameters
[in]TCurrent simulation time
[in]frameThe state vector: the input ports are read at frame.Global(), the nodes at frame.State()

◆ computeSegmentForces()

void CCable::computeSegmentForces ( const double  T,
int  segment,
const double *  X,
const double *  pA,
const double *  pB,
const double *  vA,
const double *  vB,
double *  FA,
double *  FB,
double  waveBound,
double *  wetOut = nullptr,
bool *  inSeabedContactOut = nullptr 
) const
protected

Computes structural and environmental forces acting on an element i.e. the cable length between two cable nodes, and distributes the total force on the two nodes.

Parameters
[in]T-> current simulation time
[in]segment-> the segment's index: that of its node B, numElements for the one to endpoint B (the sample point of PreOdeFcn); kLiveSegment samples the flow live
[in]X-> current simulation state
[in]pA-> position of element A
[in]pB-> position of element B
[in]vA-> velocity of element A
[in]vB-> velocity of element B
[out]FA-> force on element A
[out]FB-> force on element B
[in]waveBound-> EnvironmentFacade::MaxWaveElevation() of the environment, taken once per evaluation
[out]wetOut-> the wetted fraction of the segment; null to skip
[out]inSeabedContactOut-> whether the segment is in contact with the seabed; null to skip

◆ computeVirtualPoint()

void CCable::computeVirtualPoint ( const double *const  target,
const double *const  point,
const double *const  targetVel,
const double *const  pointVel,
double *  virtualPoint,
double *  virtualPointVel,
double  residual,
double  dResidual 
) const
protected

Winch functionality is implemented by pulling the closest free node towards a virtual point rather than the actual endpoint.

Parameters
[in]target-> actual endpoint position
[in]point-> position of free node
[in]targetVel-> actual endpoint velocity
[in]pointVel-> velocity of free node
[in]residual-> free element length
[in]dResidual-> rate of change in free element length
[out]virtualPoint-> position of virtual point
[out]virtualPointVel-> velocity of virtual point

◆ InitialConditionSetup()

void CCable::InitialConditionSetup ( const double  T,
const double *const  currentIC,
double *const  updatedIC,
ISimObjectCreator *const  creator 
)

Sets initial conditions based on the value of input ports. Element positions of free nodes are equally distributed between endpoint positions. Element Velocity are linearly interpolated between endpoint velocity

Parameters
[in]T-> The time at the beginning of the simulation. Usually but not necessarily zero
[in]currentIC-> Array of initial conditions. If the value is QNAN, the value is not set yet and can be set by the SimObject, otherwise the value is set, and can not be changed. Trying to change an already set value will trigger an error
[in]creator-> Report back to creator if output port are not ready
[out]updatedIC-> Array of ONAN. Any initial condition that are ready to be set, should be written to this array.

◆ nodeMass()

double CCable::nodeMass ( double  wetHalves) const
protected

A free node's mass: its own, plus the added mass Ca rho A L times wetHalves, the summed wetted fractions of its two half-segments (R93, BASE-0068).

◆ OdeFcn()

void CCable::OdeFcn ( const double  T,
const double *const  X,
double *const  XDot 
) const

Computes object derivatives as a function of time, states and input ports

Returns state derivatives. Velocity as derivative of position, external-force/mass and gravity as derivative of velocity. Adjusts position of not-free nodes.

Parameters
[in]T-> current simulation time
[in]X-> current simulation state
[out]XDot-> state derivatives
[in]bIsMajorTimeStep-> Is this a major time step?

◆ PreOdeFcn()

void CCable::PreOdeFcn ( const double  T,
const double *const  X,
IStateUpdater *const  updater 
)
override

Takes the other objects' wakes at the segment midpoints for the step (MARE-0223 of fhsim_marine_elements, owner ruling R-c): the segment forces of the step read the held composition, applied to the live current at the segment in each evaluation (fhsim_environment's ElementFlowInteraction, ExternalWakeUpdate).

Parameters
[in]TTime of the step start [s].
[in]XThe global state vector; null does nothing.
[in]updaterUnused.

◆ sampleSegment()

SegmentSample CCable::sampleSegment ( const double  T,
int  segment,
const double *  pA,
const double *  pB,
double  waveBound,
bool  withWetDerivatives 
) const
protected

Samples the geometry and the environment for the segment from pB to pA.

Parameters
withWetDerivativesAlso fill jacobianWet, dWet_dpA and dWet_dpB.

◆ surfaceElevation()

std::optional< double > CCable::surfaceElevation ( const double  T,
const double *  pA,
const double *  pB,
double  waveBound 
) const
protected

The wave elevation over a segment's midpoint, one wave sum (owner ruling R66, BASE-0058).

Parameters
[in]TCurrent simulation time.
[in]pAPosition of node A.
[in]pBPosition of node B.
[in]waveBoundEnvironmentFacade::MaxWaveElevation() of the environment.
Returns
The elevation, or none without evaluating it when the whole segment is below every trough.

◆ wetFraction()

double CCable::wetFraction ( const double *  pA,
const double *  pB,
std::optional< double >  seaElevation,
double *  dWet_dpA = nullptr,
double *  dWet_dpB = nullptr 
) const
protected

The fraction of a segment's displaced volume that is in water (owner ruling R66, BASE-0058).

Parameters
[in]pAPosition of node A.
[in]pBPosition of node B.
[in]seaElevationsurfaceElevation of the segment; none: below every trough, the fraction is 1.
[out]dWet_dpAOptional: d fraction / d pA, with the wave elevation taken as given.
[out]dWet_dpBOptional: d fraction / d pB, likewise.
Returns
environment::body_submergence::CylinderWetFraction of a cylinder of the nominal diameter between the two nodes, under the wave surface taken flat at seaElevation; with the derivatives, the value of CylinderWetFractionGradient, which may differ from it in the last bits.

Member Data Documentation

◆ kLiveSegment

constexpr int CCable::kLiveSegment = -1
staticconstexprprotected

What the geometry and the environment give for one segment at one time, the common input of computeSegmentForces and addSegmentHydrodynamicJacobian.

Q is the unit vector from node B to node A (zero for a segment with no length). The wetted fraction is known always; the quantities after it are only sampled for a wetted segment, and the current only where the segment is not deeper below the seabed than the cable is thick. OdeJacobian samples each segment once, with the derivatives, for its forces and its Jacobian (BASE-0064). The segment index of computeSegmentForces for a flow sampled live, not from the per-step take (tests).

◆ m_flow

environment::wake::ElementFlowInteraction CCable::m_flow
protected

The flow at the segment midpoints, the other objects' wakes taken per step (MARE-0223); the Environment, from FinalSetup.

◆ m_stateBase

int CCable::m_stateBase = 0
protected

Global index of this object's first state, element0_position; cached in the constructor.


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