Marine systems simulation
CNetStructureArray.h
1#pragma once
2
164// Includes
165#include <string>
166#include "SimObject.h"
167#include "CNetCableElement.h"
168#include "CNetElementDef.h"
169#include "CNormalForceCalc.h"
170#include "IBasicBottom.h"
171#include "CNetBottomContactFilter.h"
172#include "CInputReader.h"
173#include "ICurrentVel.h"
174#include "SimObject.h"
175
176#ifdef FH_VISUALIZATION
177#include <sfh/ogre/NMeshGenerators.h>
178#endif
179
180//Class definition
181class CNetStructureArray : public SimObject
182{
183public:
185 CNetStructureArray(std::string sSimObjectName, ISimObjectCreator *pCreator);
188 virtual void OdeFcn(const double dT, const double *const adX, double *const adXDot, const bool bIsMajorTimeStep);
189 virtual void InitialConditionSetup(const double dT, const double *const adCurrentIC, double *const adUpdatedIC, ISimObjectCreator *const pCreator);
190 virtual void FinalSetup(const double dT, const double *const adX, ISimObjectCreator *const pCreator);
191#ifdef FH_VISUALIZATION
193 virtual void RenderInit(Ogre::Root *const pOgreRoot, ISimObjectCreator *const pCreator);
195 virtual void RenderUpdate(const double dT, const double *const adX);
196#endif
197
198 void SetAddedDragPerMPS(double AddedDragPerMPS);
199 virtual const double * NumExternalPos(const double dT, const double *const adX);
200 virtual const double * NodePos(const double dT, const double *const adX, int iExtNode);
201 virtual const double * NodeVel(const double dT, const double *const adX, int iExtNode);
202 virtual const double * BottomContact(const double dT, const double *const adX);
203protected:
204 virtual void CalcStateDerivatives(const double *const adX, double *const adXDot);
205 virtual void AddExternalForces(const double dT, const double *const adX);
206 virtual void DeleteAllNodeForces();
207 virtual void ReadInputFile(ISimObjectCreator *pCreator);
208 virtual void AddNetForces(const double dT, const double *const adX);
209 virtual void AddCableForces(const double dT, const double *const adX);
210 void FindNodesToDivide(int iNodesToDivide[2], double *dLength, double *dLengthFactor);
211 void RefineMesh();
212 void CheckNodeNumber(int iNodeNumber, ISimObjectCreator *const pCreator, std::string sNodeDescription = "");
213 void CheckNodes(ISimObjectCreator *pCreator);
214 unsigned short AddCalcNode(int aiNodes[2]);
215 virtual double AddNodeBottomForce(const double *const adX, int iNode, double dDiam, double adForceInOut[3]);
216 virtual void AddBottomForces(const double *const adX);
217 virtual void AddInputPorts(ISimObjectCreator *pCreator);
218
219 sfh::timers::StopWatch m_OdeTimer;
220
221 // Node indices
224
227
228 // Input ports
229 ISignalPort** m_apInExternalForces;
230
231 // Output ports
233
234 // States
237
238 // Calculation variables
245 double m_dFluidRho;
246 std::vector<CNetElementDef> m_VSPanelData;
247 std::vector<CNetCableElement*> m_VCableElements;
248 CNetBottomContactFilter m_BottomContactFilter;
249 double m_adBottomContact[6];
250 // Variables for controlling the calculation mesh refinement.
256 double m_dScale;
258 double* m_adInertia;
260 std::string m_sNetName;
261 IBasicBottom **m_ppBottom;
263 // Net element properties.
264 int * m_aiNetConn;
265 // Cable properties.
266 int **m_aaiCableConn;
267 // Variables controlling the simulation performance and adaptation.
278
279 int m_iNumNodeOutputs;
280 VSPairStrInt m_VsNodesOutput;
281 VSPairStrInt m_VsNodesInput;
282 VSPairStrInt m_VsNodesAvailable;
283
284 bool m_bUseTagForExternalNodes;
285 int CreateExternalNodeMap(VSPairStrInt& VsNodes, std::string sTag, ISimObjectCreator* pCreator);
286 void CreateNetPanels( ISimObjectCreator* pCreator);
287 void CreateNetCables( ISimObjectCreator* pCreator);
288 void CreateDataStructures();
289 void CreateOutputPorts(ISimObjectCreator* pCreator);
290
291
292 // Net element data structures
293 // double* m_adNetElementNodeForces;
294 double* adNodesDistMesh;
295 double* adMesdDet;
296 double* adEATwine;
297 double* adMeshBarLength_unstretched;
298 double* adKnotDiameter;
299 double* adKnotMomStiff_contact;
300 double* adKKnot;
301 double* adTwineDragNormal;
302 double* adTwineDiameter;
303 double* adElementWaterVel;
304 double* adDampingCoeff;
305 double* adElementNodeWeight;
306
307 void PRINTALLNODEFORCES(std::string spec, double dT);
308};
Definition: CNetBottomContactFilter.h:7
Class containing a cable element object, allowing for disks and spheres to be connected.
Definition: CNetCableElement.h:32
Definition: CNetStructureArray.h:182
double m_dNumExternalPos
The index of the output port with position of the starboard wing external nodes.
Definition: CNetStructureArray.h:232
double m_dMaxCableTension
The maximum tension of the cable elements.
Definition: CNetStructureArray.h:273
double * m_adInertia
The inertia of the nodes.
Definition: CNetStructureArray.h:258
int * m_aIStateVel
An array of indices to the node velocity states.
Definition: CNetStructureArray.h:236
std::vector< CNetElementDef > m_VSPanelData
A vector of structs containing the section data read from the input file.
Definition: CNetStructureArray.h:246
double m_dMaxSideLengthFactor
The maximum element side length factor.
Definition: CNetStructureArray.h:251
double m_dMinSideLength
The side length limit for the elements to be further subdivided.
Definition: CNetStructureArray.h:252
int m_iNumPanelsGlobal
The number of global sections of the net.
Definition: CNetStructureArray.h:240
double m_dFluidRho
The density of the surrounding fluid.
Definition: CNetStructureArray.h:245
int m_iNumNodesOriginal
The number of original nodes of the net.
Definition: CNetStructureArray.h:243
double m_dMaxVelocity
The maximum velocity component of each node.
Definition: CNetStructureArray.h:276
int m_iNumNodeInputsUsed
The number of used external force inputs.
Definition: CNetStructureArray.h:222
double m_dMinCableLength
The minimum length of the cable elements.
Definition: CNetStructureArray.h:271
VSPairStrInt m_VsNodesInput
The tag names and indices of the external nodes to be used as input.
Definition: CNetStructureArray.h:281
double m_dStepSafetyFactor
The safety factor when calculating the adapted stiffness of the elements.
Definition: CNetStructureArray.h:270
double m_dMaxStepLength
The maximum step length for the simulation.
Definition: CNetStructureArray.h:268
double m_dMaxAcceleration
The maximum acceleration component of each node.
Definition: CNetStructureArray.h:275
int m_iMaxNumCables
The maximum number of cable elements used for the calculations.
Definition: CNetStructureArray.h:255
long * m_aiExternalNodes
The index of the starboard nodes corresponding to the elements of the enum TrawlSpec::ENetExternalNod...
Definition: CNetStructureArray.h:226
CNetCableElement ** m_apCableElements
An array holding the cable elements.
Definition: CNetStructureArray.h:257
int m_iNumCablesGlobal
The number of global cable elements.
Definition: CNetStructureArray.h:242
int m_iNumPanelsCalc
The number of elements the net is divided into.
Definition: CNetStructureArray.h:239
double m_dMeanCableTension
The expected average tension of the cable elements.
Definition: CNetStructureArray.h:272
VSPairStrInt m_VsNodesOutput
The tag names and indices of the external nodes to be used as output.
Definition: CNetStructureArray.h:280
ICurrentVel ** m_ppCurrentVel
The object giving the current velocity.
Definition: CNetStructureArray.h:262
double * m_adNodeForce
The force on the global nodes.
Definition: CNetStructureArray.h:259
int m_iMaxNumPanels
The maximum number of net panels used for the calculations.
Definition: CNetStructureArray.h:254
int m_iMaxNumNodes
The maximum number of nodes used for net calculations.
Definition: CNetStructureArray.h:253
int m_iNumNodeOutputsUsed
The number of used external position outputs.
Definition: CNetStructureArray.h:223
double m_dScale
The scale of the trawl net in relation to the specifications.
Definition: CNetStructureArray.h:256
VSPairStrInt m_VsNodesAvailable
The tag names and indices of the available external nodes.
Definition: CNetStructureArray.h:282
int * m_aIExternalConn
The index of the external nodes on the starboard wing.
Definition: CNetStructureArray.h:225
std::string m_sNetName
The identification name of the net.
Definition: CNetStructureArray.h:260
int * m_aIStatePos
An array of indices to the node position states.
Definition: CNetStructureArray.h:235
double m_dAdaptationPeriod
The adaptation period for the mean tension in cables and net elements.
Definition: CNetStructureArray.h:269
double m_dMassFactor
A factor to multiply the mass of each node with, slowing down the eigenfrequencies of the system.
Definition: CNetStructureArray.h:274
int m_iNumCablesCalc
The number of elements the cable is divided into.
Definition: CNetStructureArray.h:241
ISignalPort ** m_apInExternalForces
The external forces input port.
Definition: CNetStructureArray.h:229
std::vector< CNetCableElement * > m_VCableElements
A vector of structs containing the cable data read from the input file.
Definition: CNetStructureArray.h:247
double m_dAddedDragPerMPS
The added linear drag per meter per second speed.
Definition: CNetStructureArray.h:277
CNetStructureArray(std::string sSimObjectName, ISimObjectCreator *pCreator)
The constructor sets the pointer to the output object and the parser object.
int m_iNumNodesCalc
The number of nodes of the net after refinement.
Definition: CNetStructureArray.h:244
virtual ~CNetStructureArray()
The destructor deletes dynamically allocated memory.
Interface for calculating the bottom force on various objects.
Definition: IBasicBottom.h:23
Definition: ICurrentVel.h:12