FhSim  3.1.0
Marine systems simulation
Loading...
Searching...
No Matches
NetElement3NWithConstraints.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 "NetElementDef.h"
13#include <fhsim/PrintDuringExec.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 NetElement3NWithConstraints_TRANSPARENT
30
31class CDynamicLines; // forward declaration
32
34{
35public:
38 const std::string netName,
39 const unsigned long iID,
40 const NetElementDef* netPanel,
41 const double dNy_water,
42 const double dRho_water,
43 const double knotDiameterRatio,
44 const double knotMomStiff,
45 const double dKknotMomStiff_contact,
46 const double cnLinearLimitAngle,
47 const double cnLinear,
48 const double cnTurb,
49 const double cnLam,
50 const double turbLimit,
51 const double lamLimit,
52 const double dCt_nominal,
53 const double dCnKnots_nominal,
54 const double dampingRatio);
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 hydroForcesRatio = 1.0,
70 double addedLinearDrag = 0.0);
71
73 double CalcNodeInertia(int node);
74
76 double GetNodeWeight(int node);
77
80
83
86
87#ifdef FH_VISUALIZATION
89 void RenderInit(Ogre::Root* ogreRoot);
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 addedLinearDrag);
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_iD;
154 std::string m_netName;
155 double m_ny_water;
156 double m_nodeInertia[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_barD;
161 double m_knotD;
162 double m_barL0;
163 double m_knotMomStiff;
164 double m_knotMomStiffContact;
165 double m_nodeAPos_mesh[2];
166 double m_nodeBPos_mesh[2];
167 double m_nodeCPos_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_nodesDistAB_mesh[2];
180 double m_nodesDistAC_mesh[2];
181 double m_nodesDistBC_mesh[2];
182 double m_meshDet;
183 double m_numMeshes;
184 double m_numUBars;
185 double m_numVBars;
186 double m_numKnots;
187 double m_weight;
188 double m_eATwine;
189
190 double m_meshOpeningAngle;
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_dampingCoeff;
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_ogreRoot;
211 Ogre::SceneManager* m_sceneMgr;
212 Ogre::Entity* m_renderElement[3];
213 Ogre::Entity* m_renderSphere[3];
214 Ogre::SceneNode* m_renderNodeMesh;
215 Ogre::SceneNode* m_renderNodeSphere[3];
216 Ogre::SceneNode* m_renderNodeOutline;
217 Ogre::SceneNode* m_renderNodeMaterial;
218#ifdef USE_DYNAMIC_LINES
219 CDynamicLines* m_lines;
220#else
221 C3DLine* m_lines;
222#endif
223 CDynamicLines* m_lineOutline;
224 Ogre::ManualObject * m_netRenderObj;
225
226 // Visualization variables
227 unsigned short* m_sortU;
228 unsigned short* m_sortV;
229 unsigned long m_numTwines;
230 unsigned long m_numUTwines;
231 unsigned long m_numVTwines;
232 double* m_interpCoeffAu;
233 double* m_interpCoeffAv;
234 double* m_interpCoeffBu;
235 double* m_interpCoeffBv;
236#endif
237
238};
239
240
241#endif
Definition NetElement3NWithConstraints.h:34
double GetTwineDiameter()
Returns the twine diameter in the panel.
double GetNodeWeight(int node)
Returns the weight of a node.
double GetNumberOfTwineLengthsU()
Returns the number of twine lengths in mesh direction u in panel.
NetElement3NWithConstraints(const std::string netName, const unsigned long iID, const NetElementDef *netPanel, const double dNy_water, const double dRho_water, const double knotDiameterRatio, const double knotMomStiff, const double dKknotMomStiff_contact, const double cnLinearLimitAngle, const double cnLinear, const double cnTurb, const double cnLam, const double turbLimit, const double lamLimit, const double dCt_nominal, const double dCnKnots_nominal, const double dampingRatio)
The constructor.
double CalcNodeInertia(int node)
Calculates the inertia of a node.
double GetNumberOfTwineLengthsV()
Returns the number of twine lengths in mesh direction v in panel.
~NetElement3NWithConstraints(void)
The destructor.
Class containing the description of a net panel and methods necessary for taking this over to triangu...
Definition NetElementDef.h:22