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

Public Member Functions

 NetStructure (std::string simObjectName, ISimObjectCreator *creator)
 The constructor sets the pointer to the output object and the parser object.
 
virtual ~NetStructure ()
 The destructor deletes dynamically allocated memory.
 
virtual void OdeFcn (const double dT, const double *const adX, double *const adXDot) const
 
virtual void InitialConditionSetup (const double dT, const double *const adCurrentIC, double *const adUpdatedIC, ISimObjectCreator *const creator)
 
virtual void FinalSetup (const double dT, const double *const adX, ISimObjectCreator *const creator)
 
void PreOdeFcn (double T, const double *X, IStateUpdater *updater) override
 Rebuilds the cast wake when due (with CastWake) and takes the wakes at the panel centroids and cable midpoints for the step (NetFlowInteraction::PreOdeFcn, environment::wake::BodyWake::Update).
 
const double * outExternalNodeForce (const double dT, const double *const adX, int extNode)
 
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
 
bool HasPortJacobians () const override
 
void InputPortJacobian (const std::string &portName, double T, const double *X, double *dF_dInput, int portSize, int nStates) override
 
void OutputPortJacobian (const std::string &portName, double T, const double *X, double *dPort_dX, int portSize, int nStates, int index) override
 
virtual const double * NodePos (const double dT, const double *const adX, int extNode)
 
virtual const double * NodeVel (const double dT, const double *const adX, int extNode)
 
virtual const double * BottomContact (const double dT, const double *const adX)
 
virtual const double * StrainEnergy (const double dT, const double *const adX)
 
virtual const double * VelNorm (const double dT, const double *const adX)
 
void SetAddedDragPerMPS (double AddedDragPerMPS)
 

Public Attributes

double m_velNorm
 

Protected Member Functions

virtual void CalcStateDerivatives (const double *const adX, double *const adXDot) const
 
virtual void AddExternalForces (const double dT, const double *const adX) const
 
virtual void AddNetForces (const double dT, const double *const adX) const
 
virtual void AddCableForces (const double dT, const double *const adX) const
 
void AddNetForceRange (double T, const double *X, int begin, int end, double *nodeForce) const
 Adds the loads of panels [begin, end) to nodeForce (3 per node).
 
void AddCableForceRange (double T, const double *X, int begin, int end, double *nodeForce, bool waterFollowsElement=false) const
 
void CableHydrodynamicForce (double T, const double *X, double force[3]) const
 The sum of the cables' hydrodynamic forces on the nodes, N (MARE-0141); for the wake caster's log.
 
void AddNetAndCableForcesInParallel (double T, const double *X) const
 The panel and cable loops on m_numThreads threads, deterministic for a fixed count (owner ruling R63).
 
void FlowAt (double T, int point, const double pos[3], double vel[3]) const
 The water velocity at a panel centroid (point = panel) or a cable midpoint (point = number of panels + cable) at pos.
 
void UpdateNodeWaveVelocities (double T, const double *X, int stateBase, int begin, int end) const
 Sets m_nodeWaveVelocity of nodes [begin, end) at state X, positions at X + m_iStatePos - stateBase (R62).
 
virtual bool AddNodeBottomForce (const double *const adX, int node, double diam, double adForceInOut[3]) const
 
virtual void AddBottomForces (const double *const adX) const
 
bool HasJacobianConfiguration () const
 
virtual void AddInputPorts (ISimObjectCreator *creator)
 
virtual void CreateNetPanels (std::vector< const NetElementDef * > VNetElementDefs, ISimObjectCreator *creator)
 
virtual void CreateNetCables (std::vector< const NetCableElementSpec * > VCableElements, ISimObjectCreator *creator)
 
virtual void CreateDataStructures ()
 
virtual void CreateOutputPorts (ISimObjectCreator *creator)
 
std::string PosPortName (int extNode) const
 
std::string VelPortName (int extNode) const
 
void VelNormJacobian (const double *X, double *dPort_dX) const
 
void StrainEnergyJacobian (const double *X, double *dPort_dX) const
 
VSPairStrInt CreateExternalNodeMap (std::string tag, int *piUsed, NetStructureSpec &NetSpec, ISimObjectCreator *creator)
 
void PRINTALLNODEFORCES (std::string spec, double dT)
 
void ComputeCableStructuralJacobian (const NetCableElement *cable, const double pA[3], const double pB[3], const double vA[3], const double vB[3], double dFA_dpA[9], double dFA_dpB[9], double dFA_dvA[9], double dFA_dvB[9]) const
 
void ComputeCableDragVelocityJacobian (const NetCableElement *cable, const double pA[3], const double pB[3], const double vA[3], const double vB[3], const double vFluid[3], double rhoWater, double dFA_dvA[9], double dFA_dvB[9], double dFB_dvA[9], double dFB_dvB[9]) const
 
void ComputeCableDragPositionJacobian (const NetCableElement *cable, const double pA[3], const double pB[3], const double vA[3], const double vB[3], const double vFluid[3], double rhoWater, double dFA_dpA[9], double dFA_dpB[9], double dFB_dpA[9], double dFB_dpB[9]) const
 
void ComputePanelJacobianAD (const NetElement3N *panel, const double pA[3], const double pB[3], const double pC[3], const double vA[3], const double vB[3], const double vC[3], const double vWater[3], double addedLinearDrag, double dFA_dpA[9], double dFA_dpB[9], double dFA_dpC[9], double dFB_dpA[9], double dFB_dpB[9], double dFB_dpC[9], double dFC_dpA[9], double dFC_dpB[9], double dFC_dpC[9], double dFA_dvA[9], double dFA_dvB[9], double dFA_dvC[9], double dFB_dvA[9], double dFB_dvB[9], double dFB_dvC[9], double dFC_dvA[9], double dFC_dvB[9], double dFC_dvC[9]) const
 
const double * NodePositionState (const double *X, int node) const
 The position of a calculation node, 3 states in X.
 
const double * NodeVelocityState (const double *X, int node) const
 The velocity of a calculation node, 3 states in X.
 
int LocalIndex (int globalStateIndex) const
 

Protected Attributes

double m_StrainEnergy
 
net_panel_setup::PanelHydrodynamics m_panelHydrodynamics
 Panel hydrodynamics (MARE-0094)
 
net_solidity::SolidityModel m_solidityModel = net_solidity::kDefaultSolidityModel
 
std::unique_ptr< NetFlowInteraction > m_flow
 The wakes cast and received and the water velocity at the panels and cables (MARE-0333); from the constructor.
 
ISimObjectLogger * m_logger = nullptr
 The FhSim log, kept from FinalSetup for the clamp lines.
 
hydrodynamics::PanelClampLog m_clampLog
 Which clamps of the load law the panels have hit; reported once each in PreOdeFcn (MARE-0140).
 
ISignalPort ** m_inExternalForces
 Interface member variables.
 
int * m_iStatePos
 
int * m_iStateVel
 
int m_iStateBase = 0
 Global index of this SimObject's first state, set in the constructor.
 
int m_numNodesInputForce
 Node counts.
 
int m_numNodesOutputPosAndVel
 
int m_numPanelsCalc
 
int m_numCablesCalc
 
int m_numNodesOriginal
 
int m_numNodesCalc
 
int m_numNodeOutputs
 
NetBottomContactFilter m_BottomContactFilter
 Environment.
 
double m_bottomContact [6]
 The summed seafloor force [N] and its moment about the NED origin [N m] at the last OdeFcn state (MARE-0064).
 
environment::EnvironmentProvider * m_environment
 
environment::SeafloorForcesInterface * m_seafloor
 
bool m_inBottomContact = false
 Whether AddBottomForces gave an original node a force at the last OdeFcn state.
 
std::vector< NetCableElement * > m_VpCableElements
 Element properties.
 
std::vector< NetElement3N * > m_VpNetElements
 
float * m_inertia
 
int * m_netConn
 
int ** m_aaiCableConn
 
SAdaptationSpec_t m_SAdaptations
 
bool m_foldingPointRefinementUsed
 
VSPairStrInt m_VsNodesOutputPosAndVel
 Nodes reachable directly through input or output ports.
 
VSPairStrInt m_VsNodesInputForce
 
bool m_useTagForExternalNodes
 
double * m_nodeForce
 
int m_numThreads = 1
 Threads of the panel and cable loops (NumThreads, R63).
 
std::vector< double > m_threadNodeForces
 One node-force buffer per chunk of the parallel loops, set in FinalSetup.
 
std::vector< double > m_nodeWaveVelocity
 
double m_meanTensionTime = std::numeric_limits<double>::quiet_NaN()
 The time of the last per-step mean-tension update of the cable elements (owner ruling R64), s; NaN before the first.
 

Friends

template<class >
class NetWakePanels
 Wake casting (MARE-0100)
 

Member Function Documentation

◆ AddCableForceRange()

void NetStructure::AddCableForceRange ( double  T,
const double *  X,
int  begin,
int  end,
double *  nodeForce,
bool  waterFollowsElement = false 
) const
protected

Adds the loads of cable elements [begin, end) to nodeForce (3 per node). Adds the cable elements begin to end to nodeForce. With waterFollowsElement the water velocity at each element is the element's own (the drag vanishes): the reference of CableHydrodynamicForce.

◆ ComputeCableDragVelocityJacobian()

void NetStructure::ComputeCableDragVelocityJacobian ( const NetCableElement *  cable,
const double  pA[3],
const double  pB[3],
const double  vA[3],
const double  vB[3],
const double  vFluid[3],
double  rhoWater,
double  dFA_dvA[9],
double  dFA_dvB[9],
double  dFB_dvA[9],
double  dFB_dvB[9] 
) const
protected

Computes the 3x3 velocity-block contributions of the cable hydrodynamic drag (tangential + normal) to the forces on end A and end B. The position-block contribution (direction change with x) is provided separately by ComputeCableDragPositionJacobian; kSaturationSpeed clipping and the rhoWater air/water blending across z=0 are ignored.

◆ ComputeCableStructuralJacobian()

void NetStructure::ComputeCableStructuralJacobian ( const NetCableElement *  cable,
const double  pA[3],
const double  pB[3],
const double  vA[3],
const double  vB[3],
double  dFA_dpA[9],
double  dFA_dpB[9],
double  dFA_dvA[9],
double  dFA_dvB[9] 
) const
protected

Computes the 3x3 derivative blocks of the force on cable end A (FA = forceAmp * e_AB, with e_AB = (pB-pA)/L) w.r.t. the position and velocity of both ends. The force on end B is FB = -FA so the caller flips signs when assembling node B contributions.

◆ ComputePanelJacobianAD()

void NetStructure::ComputePanelJacobianAD ( const NetElement3N *  panel,
const double  pA[3],
const double  pB[3],
const double  pC[3],
const double  vA[3],
const double  vB[3],
const double  vC[3],
const double  vWater[3],
double  addedLinearDrag,
double  dFA_dpA[9],
double  dFA_dpB[9],
double  dFA_dpC[9],
double  dFB_dpA[9],
double  dFB_dpB[9],
double  dFB_dpC[9],
double  dFC_dpA[9],
double  dFC_dpB[9],
double  dFC_dpC[9],
double  dFA_dvA[9],
double  dFA_dvB[9],
double  dFA_dvC[9],
double  dFB_dvA[9],
double  dFB_dvB[9],
double  dFB_dvC[9],
double  dFC_dvA[9],
double  dFC_dvB[9],
double  dFC_dvC[9] 
) const
protected

Computes the full 18x9 panel Jacobian: the derivatives of the forces on A, B and C with respect to the positions and velocities of A, B and C. Each 3x3 output block is row-major.

This is exact, not a finite difference. The panel force function, including the panel load law and a mesh-opening solidity, is evaluated once over a dual number carrying twelve gradient components (NetElement3N::NodeForceJacobian: nine for the positions, three shared by the node velocities, MARE-0205), so the result is the derivative of the force code as written, with no step size, no truncation error and no dependence on the state's magnitude. The water velocity is a constant: its spatial gradient, and that of any wake in it, is left out.

◆ HasJacobianConfiguration()

bool NetStructure::HasJacobianConfiguration ( ) const
protected

HasJacobians without the bottom-contact gate: false for a mass factor, a maximum velocity clamp or a sphere or disk on a cable.

◆ HasJacobians()

bool NetStructure::HasJacobians ( ) const
override

Analytical Jacobian support. OdeJacobian covers:

  • position->velocity coupling (identity block)
  • cable element axial spring and damping, zero where the tension is saturated at 0 or the maximum tension
  • cable hydrodynamic drag, velocity and position blocks, with the water velocity taken at the element midpoint and its spatial gradient and the air/water blending across z = 0 ignored
  • the rope's wave excitation, its turning with the cable direction (owner ruling R108), with the wave acceleration's gradient and the wet fraction's slope left out
  • the net panel forces, exact by forward-mode AD (ComputePanelJacobianAD), with the water velocity at the panel centroid held constant InputPortJacobian maps the external force ports through 1/inertia. Gravity and buoyancy are state-independent, and bottom contact is omitted. HasJacobians returns false, falling back to the engine's numerical Jacobian, when a mass factor, a maximum velocity clamp, or a sphere or disk on a cable is configured, and while an original node is in seafloor contact at the state of the last OdeFcn call (MARE-0134). HasPortJacobians ignores bottom contact, which does not depend on the inputs.

◆ LocalIndex()

int NetStructure::LocalIndex ( int  globalStateIndex) const
inlineprotected

Convert a model-global state index, as AddState returned it, to an index into the local state slice and Jacobian block that the Jacobian callbacks are handed.

Parameters
[in]globalStateIndexA value from m_iStatePos or m_iStateVel.
Returns
The same state's index counted from this SimObject's first state.

◆ OdeFcn()

virtual void NetStructure::OdeFcn ( const double  dT,
const double *const  adX,
double *const  adXDot 
) const
virtual

Reimplemented in NetWithAttractor.

◆ OutputPortJacobian()

void NetStructure::OutputPortJacobian ( const std::string &  portName,
double  T,
const double *  X,
double *  dPort_dX,
int  portSize,
int  nStates,
int  index 
)
override

Exact for the node position and velocity ports, VelNorm and StrainEnergy; the force echo ports do not depend on the states. BottomContact is excluded: its Jacobian is left zero, although the port depends on the positions and velocities of the nodes in seafloor contact, through a filter updated each time the port is read (MARE-0064). It is a diagnostic output; do not feed it into a model that relies on port Jacobians.

◆ SetAddedDragPerMPS()

void NetStructure::SetAddedDragPerMPS ( double  AddedDragPerMPS)

Sets the added drag per unit speed, spread over the panels in OdeFcn and OdeJacobian. The input option AddedDragPerMPS has no effect (the net definition file overwrites it). The cast wake's lumped momentum deficit M omits this drag, as it omits the cable share (QF9, MARE-0164).

Friends And Related Symbol Documentation

◆ NetWakePanels

template<class >
friend class NetWakePanels
friend

The net as its wake caster sees it (NetWakePanels.h).

Member Data Documentation

◆ m_nodeWaveVelocity

std::vector<double> NetStructure::m_nodeWaveVelocity
mutableprotected

The wave particle velocity at each node of the state being evaluated (R62), 3 per node.

◆ m_panelHydrodynamics

net_panel_setup::PanelHydrodynamics NetStructure::m_panelHydrodynamics
protected

The law and fluid of every panel.


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