Marine systems simulation
CNetElement3NWakeEffect.h
1
7
8#ifndef C_NET_ELEMENT_3N_WAKE_EFFECT
9#define C_NET_ELEMENT_3N_WAKE_EFFECT
10
11#include <math.h>
12#include "CNetElementDef.h"
13#include "CPrintDuringExec.h"
14#include <complex>
15//#include "eigen_matrix_defs.h"
16//#include "Eigen/Eigen"
17#include "Eigen/StdVector"
18using namespace std;
19using std::vector;
20typedef Eigen::Matrix<double,3,1> vec3;
21//#include <Eigen/Core>
22
23#ifdef FH_VISUALIZATION
24//#define USE_DYNAMIC_LINES
25#ifdef USE_DYNAMIC_LINES
26#include "sfh/ogre/CDynamicLines.h"
27#else
28#include "sfh/ogre/C3DLine.h"
29#endif
30#endif
31
32//#define RENDER_OUTLINE
33#define RENDER_MESH
34//#define ATTACH_SPHERE
35//#define RENDER_MATERIAL
36//#define FILTER_FORCES
37//#define CNetElement3NWakeEffect_TRANSPARENT
38
39class CDynamicLines; // forward declaration
40
42{
43public:
46 const std::string sNetName,
47 const unsigned long iID,
48 const CNetElementDef* pNetPanel,
49 const int NBarsInWakeEffectCalc,
50 const double dNy_water,
51 const double dRho_water,
52 const double dKnotDiameterRatio,
53 const double dKnotMomStiff,
54 const double dKknotMomStiff_contact,
55 const double dCnLinearLimitAngle,
56 const double dCnLinear,
57 const double dCnTurb,
58 const double dCnLam,
59 const double dTurbLimit,
60 const double dLamLimit,
61 const double dCt_nominal,
62 const double dCnKnots_nominal,
63 const double dDampingRatio,
64 const bool internalWakeEffectsActive,
65 const bool useActualSizeInWakeEffect,
66 const bool useReynoldsDependentDrag);
67
70
71 void AddNodeForces(const double* const adNodePosA_ned,
72 const double* const adNodePosB_ned,
73 const double* const adNodePosC_ned,
74 const double* const adNodeVelA_ned,
75 const double* const adNodeVelB_ned,
76 const double* const adNodeVelC_ned,
77 const double* const adAmbientCurrentVel_ned,
78 const double* const adWaveParticleVel_ned,
79 const double* const adWaterVel_ned,
80 double * const adNodeForceA_ned,
81 double * const adNodeForceB_ned,
82 double * const adNodeForceC_ned,
83 const bool dUseScreenModel,
84 const bool dUseDragCoeffMoeFore2021,
85 const double dSnImg,
86 const double dRhoWater,
87 double dHydroForcesRatio = 1.0,
88 double dAddedLinearDrag = 0.0
89 );
90
92 double CalcNodeInertia(int iNode);
93
94 //****NEW STUFF FOR WAKE EFFECT INCLUSION****//
95 void GenerateInternalWakeEffectPolynomial(double* currentVel);
96 void GenerateExternalWakeEffectPolynomial(double* currentVel);
97 bool IsInShadowedRegionOfCage();
98 void SetInShadowedRegionOfCage(bool value);
99 void SetDistanceToWallInFront(double distance);
100 double GetExternalWakeEffect(double* currentVel, double* posA, double* posB, double* posC);
101 double GetInternalWakeEffect(double* currentVel, double* posA, double* posB, double* posC);
102
103 //****END NEW STUFF FOR WAKE EFFECT INCLUSION****//
104
105#ifdef FH_VISUALIZATION
107 void RenderInit(Ogre::Root* pOgreRoot);
108
110 void RenderUpdate( const double* const adPosA, const double* const adPosB,
111 const double* const adPosC );
112#endif
113
114 void setElementIsCoveredByROV(bool _covered);
115
116private:
117 void CalcTensionForces( double meshBarComp_panel[6], double meshBarLength[2],
118 double twineTension[2], double nodeATension_panel[3], double nodeBTension_panel[3],
119 double nodeCTension_panel[3]);
120
121 void CalcLocalUVComponents( double nodesABdist_panel[3], double nodesACdist_panel[3],
122 double nodesBCdist_panel[3], double meshBarComp_panel[6], double meshBarLength[2]);
123
124 void CalcMeshContactForces( double meshBarComp_panel[6],
125 double meshBarLength[2],
126 double nodeAMeshOpeningRes_panel[3],
127 double nodeBMeshOpeningRes_panel[3],
128 double nodeCMeshOpeningRes_panel[3],
129 double nodeATwineContactRes_panel[3],
130 double nodeBTwineContactRes_panel[3],
131 double nodeCTwineContactRes_panel[3]);
132
133 double CalcVelocities(double R_ned2panel[3][3],
134 const double* const adNodeVelA_ned,
135 const double* const adNodeVelB_ned,
136 const double* const adNodeVelC_ned,
137 const double* const adWaterVel_ned,
138 double elementVel_ned[3],
139 double hydDynVel_ned[3],
140 double hydDynVel_panel[3]);
141
142 void CalcHydroDynamicForcesScreenModel(
143 const double* const adNodePosA_ned,
144 const double* const adNodePosB_ned,
145 const double* const adNodePosC_ned,
146 const double* const adNodeVelA_ned,
147 const double* const adNodeVelB_ned,
148 const double* const adNodeVelC_ned,
149 const double* const adAmbientCurrentVel_ned,
150 const double* const adWaveParticleVel_ned,
151 const double* const adWaterVel_ned,
152 double * const nodeAforce_ned,
153 double * const nodeBforce_ned,
154 double * const nodeCforce_ned,
155 const double rhoWater,
156 const bool useDragCoeffMoeFore2021,
157 const double SnImg);
158
159 void CalcHydroDynamicForces(double meshBarComp_panel[6],
160 double meshBarLength[2],
161 double R_ned2panel[3][3],
162 const double* const adNodeVelA_ned,
163 const double* const adNodeVelB_ned,
164 const double* const adNodeVelC_ned,
165 const double* const adWaterVel_ned,
166 double elementVel_ned[3],
167 double totalDragPerNode_panel[3]);
168
169 void CalcDampingForces( double elementVel_ned[3],
170 const double* const adNodeVelA_ned,
171 const double* const adNodeVelB_ned,
172 const double* const adNodeVelC_ned,
173 const double* const adWaterVel_ned,
174 double adDampingForcesNodeA[3],
175 double adDampingForcesNodeB[3],
176 double adDampingForcesNodeC[3],
177 double dAddedLinearDrag);
178
179 // FUNCTIONS FOR SCREEN MODEL
180 double DragCoeffCircularCylinderFromReynoldsNumber(double Sn, double Urel);
181 vec3 CalcRelativeVelocity(
182 vec3 vec_Ucurr,
183 vec3 vec_Uwave,
184 const double* const adNodeVelA_ned,
185 const double* const adNodeVelB_ned,
186 const double* const adNodeVelC_ned);
187
188 //****NEW STUFF FOR WAKE EFFECT INCLUSION****//
189
190 void SortPanelNodes(int index, const double * aadNodes[3], double adNodePosA_mesh[2], double adNodePosB_mesh[2], double adNodePosC_mesh[2], unsigned short* aiSort);
191 void FindTwineCrossings(unsigned short index, unsigned short kiNumMeshPerLine, double* CoeffA, double* CoeffB, const double* aadNodes[3]);
192
193 double GetDragCoefficientFromPolynomial(double nominalReynoldsNumber);
194 double Blevins(double DX, double DY, double Cd);
195 double SquaredSumColumnIn2DDoubleArray(Eigen::MatrixXd input,int colIndex,int length);
196 Eigen::VectorXd PolynomialFit(Eigen::VectorXd alpha, int nAlpha, Eigen::VectorXd targetArray, int order);
197 double ComputePolynomialValue(std::string polynomialType, double inputValue);
198 int m_maxUBarDimension;
199 int m_maxVBarDimension;
200 double *m_InternalWakeEffectPolynomial;
201 double *m_ExternalWakeEffectPolynomial;
202 int m_orderOfInternalPolynomial;
203 int m_orderOfExternalPolynomial;
204 bool m_InternalWakeEffectsActive;
205 bool m_isInShadowedRegionOfCage;
206 double m_distanceToWallInFront;
207 bool m_useReynoldsDependentDrag;
208 bool m_UseActualSizeInWakeEff;
209 int m_NBarsInWakeEffectCalc;
210 //****END NEW STUFF FOR WAKE EFFECT INCLUSION****//
211
212 double m_Sn;
213 double m_knotFactor;
214
215 // Input
216 unsigned long m_iID;
217 std::string m_sNetName;
218 double m_ny_water;
219 double m_adNodeInertia[3];
220 //double m_rho_water; ///< Density of water.
221 //double m_rho_twines; ///< Material density of twines.
222 //double m_EModulus; ///< E-modulus of twine material.
223 double m_dBarD;
224 double m_dKnotD;
225 double m_dBarL0;
226 double m_dKnotMomStiff;
227 double m_dKnotMomStiffContact;
228 double m_adNodeAPos_mesh[2];
229 double m_adNodeBPos_mesh[2];
230 double m_adNodeCPos_mesh[2];
231 double m_CnLinearLimitAngle;
232 double m_CnLinear;
233 double m_CnTurb;
234 double m_CnLam;
235 double m_TurbLimit;
236 double m_LamLimit;
237 double m_Ct_nominal;
238 double m_CnKnots_nominal;
239
240 // Calculated element properties
241 //double m_twineCrossSecArea; ///< The cross sectional area of each twine.
242 double m_adNodesDistAB_mesh[2];
243 double m_adNodesDistAC_mesh[2];
244 double m_adNodesDistBC_mesh[2];
245 double m_dMeshDet;
246 double m_dNumMeshes;
247 double m_dNumUBars;
248 double m_dNumVBars;
249 double m_dNumKnots;
250 double m_dWeight;
251 double m_dEATwine;
252
253 double m_dMeshOpeningAngle;
254 double m_ShadowEffect[3];
255 double m_ShadowEffectBias;
256 // Calculated constants for increased computational performance.
257 double m_Ct;
258 double m_kKnot;
259 double m_NodeWeight;
260 double m_kTwineDragNormal[2];
261 double m_nodeAforce_ned[3];
262 double m_nodeBforce_ned[3];
263 double m_nodeCforce_ned[3];
264 double m_dDampingCoeff;
265#ifdef FILTER_FORCES
266 double m_nodeAforce_ned_last[3];
267 double m_nodeBforce_ned_last[3];
268 double m_nodeCforce_ned_last[3];
269#endif
270
271 bool m_isCoveredByROV;
272
273#ifdef FH_VISUALIZATION
274 // Visualization specifics
275 Ogre::Root* m_pOgreRoot;
276 Ogre::SceneManager* m_pSceneMgr;
277 Ogre::Entity* m_apRenderElement[3];
278 Ogre::Entity* m_apRenderSphere[3];
279 Ogre::SceneNode* m_pRenderNodeMesh;
280 Ogre::SceneNode* m_apRenderNodeSphere[3];
281 Ogre::SceneNode* m_pRenderNodeOutline;
282 Ogre::SceneNode* m_pRenderNodeMaterial;
283#ifdef USE_DYNAMIC_LINES
284 CDynamicLines* m_pLines;
285#else
286 C3DLine* m_pLines;
287#endif
288 CDynamicLines* m_pLineOutline;
289 Ogre::ManualObject * m_pNetRenderObj;
290
291 // Visualization variables
292 unsigned short* m_aiSortU;
293 unsigned short* m_aiSortV;
294 unsigned long m_iNumTwines;
295 unsigned long m_iNumUTwines;
296 unsigned long m_iNumVTwines;
297 double* m_adInterpCoeffAu;
298 double* m_adInterpCoeffAv;
299 double* m_adInterpCoeffBu;
300 double* m_adInterpCoeffBv;
301#endif
302
303};
304
305
306#endif
Definition: CNetElement3NWakeEffect.h:42
double CalcNodeInertia(int iNode)
Calculates the inertia of a node.
CNetElement3NWakeEffect(const std::string sNetName, const unsigned long iID, const CNetElementDef *pNetPanel, const int NBarsInWakeEffectCalc, const double dNy_water, const double dRho_water, const double dKnotDiameterRatio, const double dKnotMomStiff, const double dKknotMomStiff_contact, const double dCnLinearLimitAngle, const double dCnLinear, const double dCnTurb, const double dCnLam, const double dTurbLimit, const double dLamLimit, const double dCt_nominal, const double dCnKnots_nominal, const double dDampingRatio, const bool internalWakeEffectsActive, const bool useActualSizeInWakeEffect, const bool useReynoldsDependentDrag)
The constructor.
~CNetElement3NWakeEffect(void)
The destructor.
Class containing the description of a net panel and methods necessary for taking this over to triangu...
Definition: CNetElementDef.h:22