FhSim  3.1.0
Marine systems simulation
Loading...
Searching...
No Matches
CableElBasics.h
1
9
10#ifndef CCableElBasics_H
11#define CCableElBasics_H
12
13// Includes
14#include <fhsim_environment/hydrodynamics/CylinderHydro.h>
15
16#include <assert.h>
17#include <fhsim/Exceptions.h>
18
19#ifdef FH_VISUALIZATION
20# undef ATTACH_SPHERE
21// #define SIMPLE_LINE_RENDERING
22# pragma warning(push)
23# pragma warning(disable : 4251)
24# include <Ogre.h>
25# pragma warning(pop)
26# include "sfh/ogre/CDynamicLines.h"
27#endif
28
29// Class definition
31constexpr double kMaxCompressionSpeedSaturation = 1.0e2;
32
34{
35public:
38
41
43 virtual void AddEndForces(
44 const double adPosA[3],
45 const double adVelA[3],
46 const double adPosB[3],
47 const double adVelB[3],
48 const double adFluidVel[3],
49 const double rhoWater,
50 double adForceA[3],
51 double adForceB[3]);
52
54 virtual void SetConstants();
55
57 virtual void CalcMassAndWeight();
58
60 virtual bool CheckAndInitialize();
61
63 double GetDampingCoeff() const { return ma_dDampingCoeff; }
64
66 virtual void UpdateLength(double newLength);
67
68 double GetLength();
69#ifdef FH_VISUALIZATION
71 virtual void RenderInit(Ogre::Root* ogreRoot);
72
74 virtual void RenderUpdate(const double adPosA[3], const double adPosB[3]);
75
76 const double* const GetDirection() { return ma_adDirection; }
77#endif
78 unsigned long m_iD;
79 std::string m_cableName;
80 double m_dL0;
81 double m_dD;
82 double m_dE;
83 double m_rho;
87 double m_rhoWater;
88 double m_rhoAir = 1.2;
89
97 void SetSurfaceElevation(double etaA, double etaB)
98 {
99 m_surfaceElevation[0] = etaA;
100 m_surfaceElevation[1] = etaB;
101 }
102
104 virtual double SurfaceHalfSize() const { return 0.5 * m_dD; }
105
110 void SetWaveAcceleration(const double acceleration[3])
111 {
112 for (int k = 0; k < 3; k++)
113 m_waveAcceleration[k] = acceleration[k];
114 }
115
119 static constexpr double kAddedMassCoefficient = environment::cylinder_hydro::kCylinderAddedMassCoefficient;
120
122 double InertiaShare() const;
123
134 void WaveExcitationPositionJacobian(const double posA[3], const double posB[3], const double acceleration[3], double dF_dpB[9]) const;
135 double m_minLength;
138
139 // Calculated properties.
140 double m_eA;
141 double m_dA;
142 double m_weightInWater[2];
143 double m_massInWater[2];
146#ifdef FH_VISUALIZATION
147 std::string m_materialName;
148 unsigned short m_cableFaces;
149 double m_drawScale;
150#endif
151protected:
153 virtual bool AppendagesNearTheSurface() { return false; }
154
155 double m_surfaceElevation[2] = {0.0, 0.0};
156 double m_submergence[2] = {1e10, 1e10};
157 double m_axisVertical = 0.0;
158 double m_wetFraction = 1.0;
159 double m_rhoWaterFull = 1025.0;
160 double m_waveAcceleration[3] = {0.0, 0.0, 0.0};
161
163 void AddWaveExcitationCable(double adForceA[3], double adForceB[3]) const;
164
167 void CalcFoundation(const double adPosA[3],
168 const double adVelA[3],
169 const double adPosB[3],
170 const double adVelB[3],
171 const double adFluidVel[3],
172 const double rhoWater);
173
175 virtual void AddStructuralForces(double adForceA[3], double adForceB[3]);
176
178 void AddGravityBuoyancy(double adForceA[3], double adForceB[3], const double adPosA[3], const double adPosB[3]);
179
181 void AddHydroForcesCable(double adForceA[3], double adForceB[3]);
182
183
184 // For computational efficiency.
185 double ma_adDirection[3];
187 double ma_adVel[3];
188 double ma_dVelAmp;
189 double ma_adVt[3];
190 double ma_dVtAmp;
191 double ma_adVn[3];
192 double ma_dVnAmp;
193 double ma_adVn_A[3];
194 double ma_adVn_B[3];
195 double ma_dVnAmp_A;
196 double ma_dVnAmp_B;
197 double ma_dLength;
201
202#ifdef FH_VISUALIZATION
203 Ogre::Root* m_ogreRoot;
204 Ogre::SceneManager* m_sceneMgr;
205 Ogre::Entity* m_renderElement;
206 Ogre::SceneNode* m_renderNode;
207 CDynamicLines* m_lines;
208 Ogre::ManualObject* m_cableRenderObj;
209 double m_drawDiam;
210# ifdef ATTACH_SPHERE
211 Ogre::Entity* m_renderSphere;
212 Ogre::SceneNode* m_renderNodeSphere;
213# endif
214
215#endif
216};
217
218
219#endif
Definition CableElBasics.h:34
virtual double SurfaceHalfSize() const
The half-size the surface gate needs: the element's radius; larger with floats (NetCableElement).
Definition CableElBasics.h:104
double ma_dDampingCoeff
A intermediate damping calculation to increase the computational efficiency.
Definition CableElBasics.h:186
double m_waveAcceleration[3]
The water particle acceleration at the element (SetWaveAcceleration) [m/s²].
Definition CableElBasics.h:160
void AddHydroForcesCable(double adForceA[3], double adForceB[3])
Calculates the hydrodynamic forces on the cable and the spheres and disks attached to it....
double ma_dVnAmp_A
The scalar hydrodynamic normal velocity of the end A.
Definition CableElBasics.h:195
double m_submergence[2]
z + η at the ends at the last CalcFoundation [m]; deep before the first.
Definition CableElBasics.h:156
static constexpr double kAddedMassCoefficient
Definition CableElBasics.h:119
~CableElBasics()
The destructor.
void SetSurfaceElevation(double etaA, double etaB)
Definition CableElBasics.h:97
double m_rhoWaterFull
The water density the owner passed, unblended [kg/m³].
Definition CableElBasics.h:159
double InertiaShare() const
The inertia force factor of one end node: half of (1 + Ca) rho V f (environment::cylinder_hydro::Iner...
CableElBasics()
The constructor.
double ma_dCompressionSpeed
The speed at which the distance between the two ends decreases.
Definition CableElBasics.h:198
double m_rhoWater
The density of the surrounding fluid: the water density blended with the air density by the submerged...
Definition CableElBasics.h:87
double ma_dVelAmp
The scalar average hydrodynamic velocity of the element.
Definition CableElBasics.h:188
double m_surfaceElevation[2]
η above the ends [m] (SetSurfaceElevation).
Definition CableElBasics.h:155
double ma_dVnAmp
The scalar average normal hydrodynamic velocity of the element.
Definition CableElBasics.h:192
double m_dE
The Young modulus of the element.
Definition CableElBasics.h:82
double m_wetFraction
The element's wet fraction at the last CalcFoundation (CylinderWetFraction).
Definition CableElBasics.h:158
double m_rhoAir
The air density, kg/m³; the owner sets the environment's (cable_air::EnvironmentAirDensity,...
Definition CableElBasics.h:88
double m_normalDragCoeff
The normal drag coefficient of the cable element.
Definition CableElBasics.h:86
double ma_adDirection[3]
Memory allocation to increase the computational efficiency.
Definition CableElBasics.h:185
double m_massInWaterPerMeter[2]
The mass in water distributed to each node, per meter cable.
Definition CableElBasics.h:145
double ma_adVel[3]
The average hydrodynamic velocity of the element.
Definition CableElBasics.h:187
double m_dD
The diameter of the element.
Definition CableElBasics.h:81
double ma_adVt[3]
The average tangential hydrodynamic velocity of the element.
Definition CableElBasics.h:189
double m_weightInWaterPerMeter[2]
The weight in water distributed to each node, per meter cable.
Definition CableElBasics.h:144
void AddWaveExcitationCable(double adForceA[3], double adForceB[3]) const
Adds the rope's Froude-Krylov and added-mass wave excitation (owner rulings R67, R104)....
void SetWaveAcceleration(const double acceleration[3])
Definition CableElBasics.h:110
virtual void UpdateLength(double newLength)
Upates the length of the cable element, and its dependant properties.
double ma_dNormalDragFactor
A factor used when calculating the normal drag force.
Definition CableElBasics.h:200
double ma_dVnAmp_B
The scalar hydrodynamic normal velocity of the end B.
Definition CableElBasics.h:196
double m_minLength
The minimum length of the element.
Definition CableElBasics.h:135
virtual void AddStructuralForces(double adForceA[3], double adForceB[3])
Adds the forces from tension and internal damping to the nodes. CalcFoundation must be run first.
virtual bool CheckAndInitialize()
Does the initialization and checking to make sure that the element is ready for simulation.
virtual bool AppendagesNearTheSurface()
True when a float on the element is near the surface, so its weight must be recomputed every call; no...
Definition CableElBasics.h:153
void CalcFoundation(const double adPosA[3], const double adVelA[3], const double adPosB[3], const double adVelB[3], const double adFluidVel[3], const double rhoWater)
double ma_dTangentialDragFactor
A factor used when calculating the tangential drag force.
Definition CableElBasics.h:199
double m_addedWeightInWater
The weight in water added to the element.
Definition CableElBasics.h:84
double m_weightInWater[2]
The weight in water distributed to each node.
Definition CableElBasics.h:142
double m_eA
The linear stiffness of the element.
Definition CableElBasics.h:140
double ma_adVn_B[3]
The hydrodynamic normal velocity of the end B.
Definition CableElBasics.h:194
double ma_dLength
The actual distance between the ends.
Definition CableElBasics.h:197
double m_maxTension
The maximum tension in the element.
Definition CableElBasics.h:136
double m_dL0
The relaxed length of the element.
Definition CableElBasics.h:80
double m_axisVertical
The vertical component of the unit axis A→B at the last CalcFoundation.
Definition CableElBasics.h:157
double m_dA
The cross sectional area of the cable.
Definition CableElBasics.h:141
virtual void AddEndForces(const double adPosA[3], const double adVelA[3], const double adPosB[3], const double adVelB[3], const double adFluidVel[3], const double rhoWater, double adForceA[3], double adForceB[3])
Calculates the end forces on the cable element.
double ma_adVn_A[3]
The hydrodynamic normal velocity of the end A.
Definition CableElBasics.h:193
double ma_dVtAmp
The scalar average tangential hydrodynamic velocity of the element.
Definition CableElBasics.h:190
double m_massInWater[2]
The mass in water distributed to each node.
Definition CableElBasics.h:143
double ma_adVn[3]
The average normal hydrodynamic velocity of the element.
Definition CableElBasics.h:191
unsigned long m_iD
The ID of the element.
Definition CableElBasics.h:78
virtual void CalcMassAndWeight()
Calculates the mass and weight of the element in water.
void AddGravityBuoyancy(double adForceA[3], double adForceB[3], const double adPosA[3], const double adPosB[3])
Adds the forces from gravity and buoyancy to the nodes. CalcFoundation must be run first.
void WaveExcitationPositionJacobian(const double posA[3], const double posB[3], const double acceleration[3], double dF_dpB[9]) const
virtual void SetConstants()
Calculates parameters and sets physical constants.
double m_tangentialFrictionCoeff
The tangential drag coefficient of the cable element.
Definition CableElBasics.h:85
double GetDampingCoeff() const
Returns the structural damping coefficient (negative value: -2*dampRatio*area*sqrt(E*rho)).
Definition CableElBasics.h:63
double m_rho
The density of the element material.
Definition CableElBasics.h:83
std::string m_cableName
The name of the parent cable.
Definition CableElBasics.h:79
double m_dampingRatio
The relative damping ratio of the cable.
Definition CableElBasics.h:137