Marine systems simulation
CNetElement3NWithConstraints.h
1
7
8#ifndef C_NET_ELEMENT_3N_WITH_CONSTRAINTS
9#define C_NET_ELEMENT_3N_WITH_CONSTRAINTS
10
11#include <math.h>
12#include "CNetElementDef.h"
13#include "CPrintDuringExec.h"
14
15#ifdef FH_VISUALIZATION
16//#define USE_DYNAMIC_LINES
17#ifdef USE_DYNAMIC_LINES
18 #include "sfh/ogre/CDynamicLines.h"
19#else
20 #include "sfh/ogre/C3DLine.h"
21#endif
22#endif
23
24//#define RENDER_OUTLINE
25#define RENDER_MESH
26//#define ATTACH_SPHERE
27//#define RENDER_MATERIAL
28//#define FILTER_FORCES
29//#define CNetElement3NWithConstraints_TRANSPARENT
30
31class CDynamicLines; // forward declaration
32
34{
35public:
38 const std::string sNetName,
39 const unsigned long iID,
40 const CNetElementDef* pNetPanel,
41 const double dNy_water,
42 const double dRho_water,
43 const double dKnotDiameterRatio,
44 const double dKnotMomStiff,
45 const double dKknotMomStiff_contact,
46 const double dCnLinearLimitAngle,
47 const double dCnLinear,
48 const double dCnTurb,
49 const double dCnLam,
50 const double dTurbLimit,
51 const double dLamLimit,
52 const double dCt_nominal,
53 const double dCnKnots_nominal,
54 const double dDampingRatio);
55
58
59 void AddNodeForces(const double* const adNodePosA_ned,
60 const double* const adNodePosB_ned,
61 const double* const adNodePosC_ned,
62 const double* const adNodeVelA_ned,
63 const double* const adNodeVelB_ned,
64 const double* const adNodeVelC_ned,
65 const double* const adWaterVel_ned,
66 double * const adNodeForceA_ned,
67 double * const adNodeForceB_ned,
68 double * const adNodeForceC_ned,
69 double dHydroForcesRatio = 1.0,
70 double dAddedLinearDrag = 0.0);
71
73 double CalcNodeInertia(int iNode);
74
76 double GetNodeWeight(int iNode);
77
80
83
86
87#ifdef FH_VISUALIZATION
89 void RenderInit(Ogre::Root* pOgreRoot);
90
92 void RenderUpdate( const double* const adPosA, const double* const adPosB,
93 const double* const adPosC );
94#endif
95
96
97private:
98 void CalcTensionForces( double meshBarComp_panel[6], double meshBarLength[2],
99 double twineTension[2], double nodeATension_panel[3], double nodeBTension_panel[3],
100 double nodeCTension_panel[3]);
101
102 void CalcLocalUVComponents( double nodesABdist_panel[3], double nodesACdist_panel[3],
103 double nodesBCdist_panel[3], double meshBarComp_panel[6], double meshBarLength[2]);
104
105 void CalcMeshContactForces( double meshBarComp_panel[6],
106 double meshBarLength[2],
107 double nodeAMeshOpeningRes_panel[3],
108 double nodeBMeshOpeningRes_panel[3],
109 double nodeCMeshOpeningRes_panel[3],
110 double nodeATwineContactRes_panel[3],
111 double nodeBTwineContactRes_panel[3],
112 double nodeCTwineContactRes_panel[3]);
113
114 double CalcVelocities(double R_ned2panel[3][3],
115 const double* const adNodeVelA_ned,
116 const double* const adNodeVelB_ned,
117 const double* const adNodeVelC_ned,
118 const double* const adWaterVel_ned,
119 double elementVel_ned[3],
120 double hydDynVel_ned[3],
121 double hydDynVel_panel[3]);
122
123 void CalcHydroDynamicForces(double meshBarComp_panel[6],
124 double meshBarLength[2],
125 double R_ned2panel[3][3],
126 const double* const adNodeVelA_ned,
127 const double* const adNodeVelB_ned,
128 const double* const adNodeVelC_ned,
129 const double* const adWaterVel_ned,
130 double elementVel_ned[3],
131 double totalDragPerNode_panel[3]);
132
133 void CalcDampingForces( double elementVel_ned[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 adDampingForcesNodeA[3],
139 double adDampingForcesNodeB[3],
140 double adDampingForcesNodeC[3],
141 double dAddedLinearDrag);
142
143 //****NEW STUFF FOR WAKE EFFECT INCLUSION****//
144
145 void SortPanelNodes(int index, const double * aadNodes[3], double adNodePosA_mesh[2], double adNodePosB_mesh[2], double adNodePosC_mesh[2], unsigned short* aiSort);
146 void FindTwineCrossings(unsigned short index, unsigned short kiNumMeshPerLine, double* CoeffA, double* CoeffB, const double* aadNodes[3]);
147
148 bool m_InternalWakeEffectsActive;
149
150 //****END NEW STUFF FOR WAKE EFFECT INCLUSION****//
151
152 // Input
153 unsigned long m_iID;
154 std::string m_sNetName;
155 double m_ny_water;
156 double m_adNodeInertia[3];
157 //double m_rho_water; ///< Density of water.
158 //double m_rho_twines; ///< Material density of twines.
159 //double m_EModulus; ///< E-modulus of twine material.
160 double m_dBarD;
161 double m_dKnotD;
162 double m_dBarL0;
163 double m_dKnotMomStiff;
164 double m_dKnotMomStiffContact;
165 double m_adNodeAPos_mesh[2];
166 double m_adNodeBPos_mesh[2];
167 double m_adNodeCPos_mesh[2];
168 double m_CnLinearLimitAngle;
169 double m_CnLinear;
170 double m_CnTurb;
171 double m_CnLam;
172 double m_TurbLimit;
173 double m_LamLimit;
174 double m_Ct_nominal;
175 double m_CnKnots_nominal;
176
177 // Calculated element properties
178 //double m_twineCrossSecArea; ///< The cross sectional area of each twine.
179 double m_adNodesDistAB_mesh[2];
180 double m_adNodesDistAC_mesh[2];
181 double m_adNodesDistBC_mesh[2];
182 double m_dMeshDet;
183 double m_dNumMeshes;
184 double m_dNumUBars;
185 double m_dNumVBars;
186 double m_dNumKnots;
187 double m_dWeight;
188 double m_dEATwine;
189
190 double m_dMeshOpeningAngle;
191 double m_ShadowEffect[3];
192 double m_ShadowEffectBias;
193 // Calculated constants for increased computational performance.
194 double m_Ct;
195 double m_kKnot;
196 double m_NodeWeight;
197 double m_kTwineDragNormal[2];
198 double m_nodeAforce_ned[3];
199 double m_nodeBforce_ned[3];
200 double m_nodeCforce_ned[3];
201 double m_dDampingCoeff;
202#ifdef FILTER_FORCES
203 double m_nodeAforce_ned_last[3];
204 double m_nodeBforce_ned_last[3];
205 double m_nodeCforce_ned_last[3];
206#endif
207
208#ifdef FH_VISUALIZATION
209 // Visualization specifics
210 Ogre::Root* m_pOgreRoot;
211 Ogre::SceneManager* m_pSceneMgr;
212 Ogre::Entity* m_apRenderElement[3];
213 Ogre::Entity* m_apRenderSphere[3];
214 Ogre::SceneNode* m_pRenderNodeMesh;
215 Ogre::SceneNode* m_apRenderNodeSphere[3];
216 Ogre::SceneNode* m_pRenderNodeOutline;
217 Ogre::SceneNode* m_pRenderNodeMaterial;
218#ifdef USE_DYNAMIC_LINES
219 CDynamicLines* m_pLines;
220#else
221 C3DLine* m_pLines;
222#endif
223 CDynamicLines* m_pLineOutline;
224 Ogre::ManualObject * m_pNetRenderObj;
225
226 // Visualization variables
227 unsigned short* m_aiSortU;
228 unsigned short* m_aiSortV;
229 unsigned long m_iNumTwines;
230 unsigned long m_iNumUTwines;
231 unsigned long m_iNumVTwines;
232 double* m_adInterpCoeffAu;
233 double* m_adInterpCoeffAv;
234 double* m_adInterpCoeffBu;
235 double* m_adInterpCoeffBv;
236#endif
237
238};
239
240
241#endif
Definition: CNetElement3NWithConstraints.h:34
double CalcNodeInertia(int iNode)
Calculates the inertia of a node.
double GetTwineDiameter()
Returns the twine diameter in the panel.
double GetNumberOfTwineLengthsU()
Returns the number of twine lengths in mesh direction u in panel.
~CNetElement3NWithConstraints(void)
The destructor.
double GetNodeWeight(int iNode)
Returns the weight of a node.
CNetElement3NWithConstraints(const std::string sNetName, const unsigned long iID, const CNetElementDef *pNetPanel, 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)
The constructor.
double GetNumberOfTwineLengthsV()
Returns the number of twine lengths in mesh direction v in panel.
Class containing the description of a net panel and methods necessary for taking this over to triangu...
Definition: CNetElementDef.h:22