Marine systems simulation
CCableElBasics.h
1
9
10#ifndef CCableElBasics_H
11#define CCableElBasics_H
12
13// Includes
14#include <assert.h>
15#include "CExceptions.h"
16
17#ifdef FH_VISUALIZATION
18#undef ATTACH_SPHERE
19//#define SIMPLE_LINE_RENDERING
20#pragma warning(push)
21#pragma warning( disable : 4251 )
22 #include <Ogre.h>
23#pragma warning(pop)
24#include "sfh/ogre/CDynamicLines.h"
25#endif
26
27//Class definition
29{
30public:
33
36
38 virtual void AddEndForces(
39 const double adPosA[3],
40 const double adVelA[3],
41 const double adPosB[3],
42 const double adVelB[3],
43 const double adFluidVel[3],
44 const double dRhoWater,
45 double adForceA[3],
46 double adForceB[3]);
47
49 virtual void SetConstants();
50
52 virtual void CalcMassAndWeight();
53
55 virtual bool CheckAndInitialize();
56
58 virtual void UpdateLength(double dNewLength);
59
60 double GetLength();
61#ifdef FH_VISUALIZATION
63 virtual void RenderInit(Ogre::Root* pOgreRoot);
64
66 virtual void RenderUpdate( const double adPosA[3], const double adPosB[3]);
67
68 const double* const GetDirection() {return ma_adDirection;}
69#endif
70 unsigned long m_iID;
71 std::string m_sCableName;
72 double m_dL0;
73 double m_dD;
74 double m_dE;
75 double m_dRho;
79 double m_dRhoWater;
80 double m_dMinLength;
83
84 // Calculated properties.
85 double m_dEA;
86 double m_dA;
88 double m_adMassInWater[2];
91#ifdef FH_VISUALIZATION
92 std::string m_sMaterialName;
93 unsigned short m_iCableFaces;
94 double m_dDrawScale;
95#endif
96protected:
99 void CalcFoundation(const double adPosA[3],
100 const double adVelA[3],
101 const double adPosB[3],
102 const double adVelB[3],
103 const double adFluidVel[3],
104 const double dRhoWater);
105
107 virtual void AddStructuralForces( double adForceA[3], double adForceB[3]);
108
110 void AddGravityBuoyancy( double adForceA[3], double adForceB[3], const double adPosA[3], const double adPosB[3]);
111
113 void AddHydroForcesCable(double adForceA[3], double adForceB[3]);
114
115
116 // For computational efficiency.
117 double ma_adDirection[3];
119 double ma_adVel[3];
120 double ma_dVelAmp;
121 double ma_adVt[3];
122 double ma_dVtAmp;
123 double ma_adVn[3];
124 double ma_dVnAmp;
125 double ma_adVn_A[3];
126 double ma_adVn_B[3];
127 double ma_dVnAmp_A;
128 double ma_dVnAmp_B;
129 double ma_dLength;
133
134#ifdef FH_VISUALIZATION
135 Ogre::Root* m_pOgreRoot;
136 Ogre::SceneManager* m_pSceneMgr;
137 Ogre::Entity* m_pRenderElement;
138 Ogre::SceneNode* m_pRenderNode;
139 CDynamicLines* m_pLines;
140 Ogre::ManualObject* m_pCableRenderObj;
141 double m_dDrawDiam;
142#ifdef ATTACH_SPHERE
143 Ogre::Entity* m_pRenderSphere;
144 Ogre::SceneNode* m_pRenderNodeSphere;
145#endif
146
147#endif
148
149
150
151};
152
153
154#endif
Class containing a fundamental cable element object.
Definition: CCableElBasics.h:29
double ma_dTangentialDragFactor
A factor used when calculating the tangential drag force.
Definition: CCableElBasics.h:131
double m_dE
The Young modulus of the element.
Definition: CCableElBasics.h:74
double ma_adDirection[3]
Memory allocation to increase the computational efficiency.
Definition: CCableElBasics.h:117
double ma_dVnAmp
The scalar average normal hydrodynamic velocity of the element.
Definition: CCableElBasics.h:124
unsigned long m_iID
The ID of the element.
Definition: CCableElBasics.h:70
double ma_adVt[3]
The average tangential hydrodynamic velocity of the element.
Definition: CCableElBasics.h:121
virtual void CalcMassAndWeight()
Calculates the mass and weight of the element in water.
double m_dD
The diameter of the element.
Definition: CCableElBasics.h:73
double ma_dVnAmp_B
The scalar hydrodynamic normal velocity of the end B.
Definition: CCableElBasics.h:128
double ma_adVn[3]
The average normal hydrodynamic velocity of the element.
Definition: CCableElBasics.h:123
double ma_dNormalDragFactor
A factor used when calculating the normal drag force.
Definition: CCableElBasics.h:132
double ma_adVn_A[3]
The hydrodynamic normal velocity of the end A.
Definition: CCableElBasics.h:125
double ma_adVn_B[3]
The hydrodynamic normal velocity of the end B.
Definition: CCableElBasics.h:126
double m_dAddedWeightInWater
The weight in water added to the element.
Definition: CCableElBasics.h:76
double m_dNormalDragCoeff
The normal drag coefficient of the cable element.
Definition: CCableElBasics.h:78
double m_dRhoWater
The density of the surrounding water.
Definition: CCableElBasics.h:79
double ma_dCompressionSpeed
The speed at which the distance between the two ends decreases.
Definition: CCableElBasics.h:130
void AddHydroForcesCable(double adForceA[3], double adForceB[3])
Calculates the hydrodynamic forces on the cable and the spheres and disks attached to it....
double m_dL0
The relaxed length of the element.
Definition: CCableElBasics.h:72
double m_adMassInWater[2]
The mass in water distributed to each node.
Definition: CCableElBasics.h:88
double m_adWeightInWaterPerMeter[2]
The weight in water distributed to each node, per meter cable.
Definition: CCableElBasics.h:89
void CalcFoundation(const double adPosA[3], const double adVelA[3], const double adPosB[3], const double adVelB[3], const double adFluidVel[3], const double dRhoWater)
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.
double ma_dDampingCoeff
A intermediate damping calculation to increase the computational efficiency.
Definition: CCableElBasics.h:118
double m_dMinLength
The minimum length of the element.
Definition: CCableElBasics.h:80
std::string m_sCableName
The name of the parent cable.
Definition: CCableElBasics.h:71
double ma_adVel[3]
The average hydrodynamic velocity of the element.
Definition: CCableElBasics.h:119
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 dRhoWater, double adForceA[3], double adForceB[3])
Calculates the end forces on the cable element.
double m_adWeightInWater[2]
The weight in water distributed to each node.
Definition: CCableElBasics.h:87
~CCableElBasics()
The destructor.
double m_adMassInWaterPerMeter[2]
The mass in water distributed to each node, per meter cable.
Definition: CCableElBasics.h:90
double m_dRho
The density of the element material.
Definition: CCableElBasics.h:75
double m_dA
The cross sectional area of the cable.
Definition: CCableElBasics.h:86
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.
double ma_dLength
The actual distance between the ends.
Definition: CCableElBasics.h:129
double m_dMaxTension
The maximum tension in the element.
Definition: CCableElBasics.h:81
double ma_dVtAmp
The scalar average tangential hydrodynamic velocity of the element.
Definition: CCableElBasics.h:122
double m_dTangentialFrictionCoeff
The tangential drag coefficient of the cable element.
Definition: CCableElBasics.h:77
virtual void SetConstants()
Calculates parameters and sets physical constants.
double m_dDampingRatio
The relative damping ratio of the cable.
Definition: CCableElBasics.h:82
double ma_dVelAmp
The scalar average hydrodynamic velocity of the element.
Definition: CCableElBasics.h:120
virtual bool CheckAndInitialize()
Does the initialization and checking to make sure that the element is ready for simulation.
double ma_dVnAmp_A
The scalar hydrodynamic normal velocity of the end A.
Definition: CCableElBasics.h:127
double m_dEA
The linear stiffness of the element.
Definition: CCableElBasics.h:85
virtual void UpdateLength(double dNewLength)
Upates the length of the cable element, and its dependant properties.
CCableElBasics()
The constructor.