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 "NetElement3NForces.h"
14#include <fhsim_environment/hydrodynamics/NetSolidity.h>
15#include <fhsim/PrintDuringExec.h>
16
17#ifdef FH_VISUALIZATION
18//#define USE_DYNAMIC_LINES
19#ifdef USE_DYNAMIC_LINES
20 #include "sfh/ogre/CDynamicLines.h"
21#else
22 #include "sfh/ogre/C3DLine.h"
23#endif
24#endif
25
26//#define RENDER_OUTLINE
27#define RENDER_MESH
28//#define ATTACH_SPHERE
29//#define RENDER_MATERIAL
30//#define FILTER_FORCES
31//#define NetElement3NWithConstraints_TRANSPARENT
32
33class CDynamicLines; // forward declaration
34
36{
37public:
40 const std::string netName,
41 const unsigned long iID,
42 const NetElementDef* netPanel,
43 const double dRho_water,
44 const double knotDiameter,
45 const net_solidity::PanelSolidity& solidity);
46
49
50 // Owns raw buffers (freed in the destructor), so it must not be copied (MARE-0318).
53
75 void AddNodeForces(const hydrodynamics::PanelLoadLaw& law, const hydrodynamics::Fluid& fluid,
76 const double* const posA_ned, const double* const posB_ned, const double* const posC_ned,
77 const double* const velA_ned, const double* const velB_ned, const double* const velC_ned,
78 const double* const waterVel_ned,
79 double* const nodeAforce_ned, double* const nodeBforce_ned, double* const nodeCforce_ned,
80 const hydrodynamics::PanelClampLog* clampLog = nullptr) const;
81
98 hydrodynamics::PanelLoad<double> EvaluatePanelLoad(const hydrodynamics::PanelLoadLaw& law, const hydrodynamics::Fluid& fluid,
99 const double* const posA_ned, const double* const posB_ned, const double* const posC_ned,
100 const double elementVel[3], const double waterVel_ned[3], double& area) const;
101
103 bool HasBarDirections() const { return m_meshDet != 0; }
104
106 double Solidity(const double* const posA_ned, const double* const posB_ned, const double* const posC_ned) const;
107
109 double WakeSolidity(const double* const posA_ned, const double* const posB_ned, const double* const posC_ned) const;
110
112 double CalcNodeInertia(int node);
113
116
119
120#ifdef FH_VISUALIZATION
122 void RenderInit(Ogre::Root* ogreRoot);
123
125 void RenderUpdate( const double* const adPosA, const double* const adPosB,
126 const double* const adPosC );
127#endif
128
129
130private:
132 void FillPanelForceParams();
133
134 //****NEW STUFF FOR WAKE EFFECT INCLUSION****//
135
136 void SortPanelNodes(int index, const double * aadNodes[3], double adNodePosA_mesh[2], double adNodePosB_mesh[2], double adNodePosC_mesh[2], unsigned short* aiSort);
137 void FindTwineCrossings(unsigned short index, unsigned short kiNumMeshPerLine, double* CoeffA, double* CoeffB, const double* aadNodes[3]);
138
139 //****END NEW STUFF FOR WAKE EFFECT INCLUSION****//
140
141 // Input
142 unsigned long m_iD;
143 std::string m_netName;
144 double m_nodeInertia[3];
145 //double m_rho_water; ///< Density of water.
146 //double m_rho_twines; ///< Material density of twines.
147 //double m_EModulus; ///< E-modulus of twine material.
148 double m_barD;
149 double m_knotD;
150 double m_barL0;
151 double m_nodeAPos_mesh[2];
152 double m_nodeBPos_mesh[2];
153 double m_nodeCPos_mesh[2];
154
155 // Calculated element properties
156 //double m_twineCrossSecArea; ///< The cross sectional area of each twine.
157 double m_nodesDistAB_mesh[2];
158 double m_nodesDistAC_mesh[2];
159 double m_nodesDistBC_mesh[2];
160 double m_meshDet;
161 double m_numMeshes;
162 double m_numUBars;
163 double m_numVBars;
164 double m_numKnots;
165 double m_weight;
166 double m_NodeWeight;
167
168 net_solidity::PanelSolidity m_solidity;
169 net_element_forces::PanelParams m_panelForceParams;
170 double m_nodeAforce_ned[3];
171 double m_nodeBforce_ned[3];
172 double m_nodeCforce_ned[3];
173#ifdef FILTER_FORCES
174 double m_nodeAforce_ned_last[3];
175 double m_nodeBforce_ned_last[3];
176 double m_nodeCforce_ned_last[3];
177#endif
178
179#ifdef FH_VISUALIZATION
180 // Visualization specifics
181 Ogre::Root* m_ogreRoot;
182 Ogre::SceneManager* m_sceneMgr;
183 Ogre::Entity* m_renderElement[3];
184 Ogre::Entity* m_renderSphere[3];
185 Ogre::SceneNode* m_renderNodeMesh;
186 Ogre::SceneNode* m_renderNodeSphere[3];
187 Ogre::SceneNode* m_renderNodeOutline;
188 Ogre::SceneNode* m_renderNodeMaterial;
189#ifdef USE_DYNAMIC_LINES
190 CDynamicLines* m_lines = nullptr;
191#else
192 C3DLine* m_lines = nullptr;
193#endif
194 CDynamicLines* m_lineOutline;
195 Ogre::ManualObject * m_netRenderObj;
196
197 // Visualization variables
198 unsigned short* m_sortU = nullptr;
199 unsigned short* m_sortV = nullptr;
200 unsigned long m_numTwines;
201 unsigned long m_numUTwines;
202 unsigned long m_numVTwines;
203 double* m_interpCoeffAu = nullptr;
204 double* m_interpCoeffAv = nullptr;
205 double* m_interpCoeffBu = nullptr;
206 double* m_interpCoeffBv = nullptr;
207#endif
208
209};
210
211
212#endif
Definition NetElement3NWithConstraints.h:36
double GetTwineDiameter()
Returns the twine diameter in the panel.
void AddNodeForces(const hydrodynamics::PanelLoadLaw &law, const hydrodynamics::Fluid &fluid, const double *const posA_ned, const double *const posB_ned, const double *const posC_ned, const double *const velA_ned, const double *const velB_ned, const double *const velC_ned, const double *const waterVel_ned, double *const nodeAforce_ned, double *const nodeBforce_ned, double *const nodeCforce_ned, const hydrodynamics::PanelClampLog *clampLog=nullptr) const
double WakeSolidity(const double *const posA_ned, const double *const posB_ned, const double *const posC_ned) const
The solidity the element hands to its wake source at the given node positions, global frame (NetSolid...
double GetNumberOfTwineLengthsU()
Returns the number of twine lengths in mesh direction u in panel.
hydrodynamics::PanelLoad< double > EvaluatePanelLoad(const hydrodynamics::PanelLoadLaw &law, const hydrodynamics::Fluid &fluid, const double *const posA_ned, const double *const posB_ned, const double *const posC_ned, const double elementVel[3], const double waterVel_ned[3], double &area) const
NetElement3NWithConstraints(const std::string netName, const unsigned long iID, const NetElementDef *netPanel, const double dRho_water, const double knotDiameter, const net_solidity::PanelSolidity &solidity)
The constructor.
double CalcNodeInertia(int node)
Calculates the inertia of a node.
double Solidity(const double *const posA_ned, const double *const posB_ned, const double *const posC_ned) const
The solidity of the element at the given node positions, global frame.
~NetElement3NWithConstraints(void)
The destructor.
bool HasBarDirections() const
True when the bar directions are defined, which needs a non-zero mesh determinant.
Definition NetElement3NWithConstraints.h:103
Class containing the description of a net panel and methods necessary for taking this over to triangu...
Definition NetElementDef.h:22
Definition NetElement3NForces.h:59