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) 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).
 
void AcceptedStep (const double T, const double *const X) override
 
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

NetNodeLayout Layout () const override
 
void AddExternalForces (double T, const double *X, double *nodeForce) const override
 The forces of the input force ports, on their nodes.
 
void TakeNodeForces (double T, const double *X, const double *nodeForce, double *XDot) const override
 The state derivatives: velocity, force over inertia (and MassFactor), bounded by MaxVelocity.
 
bool HasJacobianConfiguration () const
 
virtual void AddInputPorts (ISimObjectCreator *creator)
 
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, const NetStructureSpec &NetSpec, ISimObjectCreator *creator)
 
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
 
int LocalIndex (int globalStateIndex) const
 

Protected Attributes

double m_StrainEnergy
 
std::unique_ptr< NetCore > m_core
 The net core: the panels, cable elements, their loads, the wakes and the seabed contact (NetCore.h).
 
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
 
VSPairStrInt m_VsNodesOutputPosAndVel
 Nodes reachable directly through input or output ports.
 
VSPairStrInt m_VsNodesInputForce
 
bool m_useTagForExternalNodes
 

Friends

class NetStructureTestAccess
 

Member Function Documentation

◆ AddExternalForces()

void NetStructure::AddExternalForces ( double  T,
const double *  X,
double *  nodeForce 
) const
overrideprotectedvirtual

Implements NetNodeStates.

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

◆ 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, from the axial law (CableAxialLaw.h): no slopes where the tension is at 0 or the maximum tension, the turning of the tension kept at the maximum (MARE-0387)
  • cable hydrodynamic drag, velocity and position blocks, with the water velocity taken at the element midpoint and its spatial gradient ignored, and the element's air/water density blend at the state (MARE-0319) without the slope of its wet fraction
  • 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 (NetElement3N::NodeForceJacobian), 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). HasJacobians is const and takes no state, so the contact it sees is that of the last OdeFcn call, which may have been at a perturbed or another stage's state, and there is none before the first call. FhSim reads it when it assembles the model (before any OdeFcn), to wire the solver's Jacobian, and again at each Jacobian assembly: a net on the seabed at T = 0 is assembled as having an analytical Jacobian, and contact that starts between an OdeFcn and the next Jacobian evaluation gets the analytical block without the contact. Only the Newton matrix is affected, which may slow an implicit integrator at touchdown (MARE-0327, documented limitation; pinned by NetStructureBottomContact.HasJacobiansFollowsTheLastOdeFcnNotTheStateBeforeIt). HasPortJacobians ignores bottom contact, which does not depend on the inputs. OdeJacobian writes nothing while HasJacobians is false (FhSim's Jacobian checker, E12-Q3).

◆ Layout()

NetNodeLayout NetStructure::Layout ( ) const
overrideprotectedvirtual

The node-state seam (NetNodeStates.h): the free-node adapter of the net core. Every node has its own Pos_ and Vel_ states.

Implements NetNodeStates.

◆ 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. There is no input option for it (MARE-0384). The cast wake's lumped momentum deficit M omits this drag, as it omits the cable share (QF9, MARE-0164).

◆ TakeNodeForces()

void NetStructure::TakeNodeForces ( double  T,
const double *  X,
const double *  nodeForce,
double *  XDot 
) const
overrideprotectedvirtual

Implements NetNodeStates.


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