Marine systems simulation
CNetElement3N.h
1
7
8#ifndef C_NET_ELEMENT_3N
9#define C_NET_ELEMENT_3N
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 CNETELEMENT3N_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 );
56
59
60 void AddNodeForces(const double* const adNodePosA_ned,
61 const double* const adNodePosB_ned,
62 const double* const adNodePosC_ned,
63 const double* const adNodeVelA_ned,
64 const double* const adNodeVelB_ned,
65 const double* const adNodeVelC_ned,
66 const double* const adWaterVel_ned,
67 double * const adNodeForceA_ned,
68 double * const adNodeForceB_ned,
69 double * const adNodeForceC_ned,
70 double dHydroForcesRatio = 1.0,
71 double dAddedLinearDrag = 0.0);
72
74 double CalcNodeInertia(int iNode);
75
76#ifdef FH_VISUALIZATION
78 void RenderInit(Ogre::Root* pOgreRoot, int NumMeshPerLine = 1);
79
81 void RenderUpdate( const double* const adPosA, const double* const adPosB,
82 const double* const adPosC );
83#endif
84
85
86private:
87 void CalcTensionForces( double meshBarComp_panel[6], double meshBarLength[2],
88 double twineTension[2], double nodeATension_panel[3], double nodeBTension_panel[3],
89 double nodeCTension_panel[3]);
90
91 void CalcLocalUVComponents( double nodesABdist_panel[3], double nodesACdist_panel[3],
92 double nodesBCdist_panel[3], double meshBarComp_panel[6], double meshBarLength[2]);
93
94 void CalcMeshContactForces( double meshBarComp_panel[6],
95 double meshBarLength[2],
96 double nodeAMeshOpeningRes_panel[3],
97 double nodeBMeshOpeningRes_panel[3],
98 double nodeCMeshOpeningRes_panel[3],
99 double nodeATwineContactRes_panel[3],
100 double nodeBTwineContactRes_panel[3],
101 double nodeCTwineContactRes_panel[3]);
102
103 double CalcVelocities(double R_ned2panel[3][3],
104 const double* const adNodeVelA_ned,
105 const double* const adNodeVelB_ned,
106 const double* const adNodeVelC_ned,
107 const double* const adWaterVel_ned,
108 double elementVel_ned[3],
109 double hydDynVel_ned[3],
110 double hydDynVel_panel[3]);
111
112 void CalcHydroDynamicForces(double meshBarComp_panel[6],
113 double meshBarLength[2],
114 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 totalDragPerNode_panel[3]);
121
122 void CalcDampingForces( double elementVel_ned[3],
123 const double* const adNodeVelA_ned,
124 const double* const adNodeVelB_ned,
125 const double* const adNodeVelC_ned,
126 const double* const adWaterVel_ned,
127 double adDampingForcesNodeA[3],
128 double adDampingForcesNodeB[3],
129 double adDampingForcesNodeC[3],
130 double dAddedLinearDrag);
131
132 // Input
133 unsigned long m_iID;
134 std::string m_sNetName;
135 double m_ny_water;
136 double m_adNodeInertia[3];
137 //double m_rho_water; ///< Density of water.
138 //double m_rho_twines; ///< Material density of twines.
139 //double m_EModulus; ///< E-modulus of twine material.
140 double m_dBarD;
141 double m_dKnotD;
142 double m_dBarL0;
143 double m_dKnotMomStiff;
144 double m_dKnotMomStiffContact;
145 double m_adNodeAPos_mesh[2];
146 double m_adNodeBPos_mesh[2];
147 double m_adNodeCPos_mesh[2];
148 double m_CnLinearLimitAngle;
149 double m_CnLinear;
150 double m_CnTurb;
151 double m_CnLam;
152 double m_TurbLimit;
153 double m_LamLimit;
154 double m_Ct_nominal;
155 double m_CnKnots_nominal;
156
157 // Calculated element properties
158 //double m_twineCrossSecArea; ///< The cross sectional area of each twine.
159 double m_adNodesDistAB_mesh[2];
160 double m_adNodesDistAC_mesh[2];
161 double m_adNodesDistBC_mesh[2];
162 double m_dMeshDet;
163 double m_dNumMeshes;
164 double m_dNumUBars;
165 double m_dNumVBars;
166 double m_dNumKnots;
167 double m_dWeight;
168 double m_dEATwine;
169
170 double m_dMeshOpeningAngle;
171 double m_ShadowEffect[3];
172 double m_ShadowEffectBias;
173 // Calculated constants for increased computational performance.
174 double m_Ct;
175 double m_kKnot;
176 double m_NodeWeight;
177 double m_kTwineDragNormal[2];
178 double m_nodeAforce_ned[3];
179 double m_nodeBforce_ned[3];
180 double m_nodeCforce_ned[3];
181 double m_dDampingCoeff;
182#ifdef FILTER_FORCES
183 double m_nodeAforce_ned_last[3];
184 double m_nodeBforce_ned_last[3];
185 double m_nodeCforce_ned_last[3];
186#endif
187
188#ifdef FH_VISUALIZATION
189 // Visualization specifics
190 Ogre::Root* m_pOgreRoot;
191 Ogre::SceneManager* m_pSceneMgr;
192 Ogre::Entity* m_apRenderElement[3];
193 Ogre::Entity* m_apRenderSphere[3];
194 Ogre::SceneNode* m_pRenderNodeMesh;
195 Ogre::SceneNode* m_apRenderNodeSphere[3];
196 Ogre::SceneNode* m_pRenderNodeOutline;
197 Ogre::SceneNode* m_pRenderNodeMaterial;
198#ifdef USE_DYNAMIC_LINES
199 C3DLine* m_pLines;
200#else
201 C3DLine* m_pLines;
202 Ogre::ColourValue m_twineColour;
203#endif
204 C3DLine* m_pLineOutline;
205 //Ogre::ManualObject * m_pNetRenderObj; ///< The manual object used for rendering the net element with a triangle skin.
206
207 // Visualization variables
208 unsigned short* m_aiSortU;
209 unsigned short* m_aiSortV;
210 unsigned long m_iNumTwines;
211 unsigned long m_iNumUTwines;
212 unsigned long m_iNumVTwines;
213 double* m_adInterpCoeffAu;
214 double* m_adInterpCoeffAv;
215 double* m_adInterpCoeffBu;
216 double* m_adInterpCoeffBv;
217 int m_NumMeshPerLine;
218#endif
219
220};
221
222
223#endif
Definition: CNetElement3N.h:34
CNetElement3N(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.
~CNetElement3N(void)
The destructor.
double CalcNodeInertia(int iNode)
Calculates the inertia of a node.
Class containing the description of a net panel and methods necessary for taking this over to triangu...
Definition: CNetElementDef.h:22