Marine systems simulation
CMultiIceFloe.h
1
12
13#ifndef CMultiIceFloe_H
14#define CMultiIceFloe_H
15
16#include <string>
17#include <Eigen/Eigen>
18
19#include "SimObject.h"
20#include "CEnvironment.h"
21#include <CIntegratorOptions.h>
22#include <CPrintDuringExec.h>
23#include "Subroutines.h"
24
25
26namespace ice {
27
28#define MaxNumFL 5010
29
30class CMultiIceFloe : public SimObject
31{
32public:
33 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
34
35 CMultiIceFloe(std::string sSimObjectName, ISimObjectCreator* pCreator);
36 virtual void FinalSetup(const double dT, const double* const adX, ISimObjectCreator* const pCreator);
37 virtual ~CMultiIceFloe();
38
39#ifdef FH_VISUALIZATION
41 virtual void RenderInit(Ogre::Root* const ogreRoot, ISimObjectCreator* const creator);
42
44 virtual void RenderUpdate(const double dT, const double* const adX);
45
47 void DrawBody(Ogre::SceneNode* renderNode, Ogre::SceneManager* sceneMgr, const int& pi);
48#endif
49
51 virtual void OdeFcn(const double dT, const double* const adX, double* const adXDot, const bool bIsMajorTimeStep);
52 virtual void PreOdeFcn(const double dT, const double *const adX, IStateUpdater* updater);
53
54 virtual void ContactDetection(const double dT, const double* const adX);
55
56 // r: global
57 // q: global
58 // dX: bodylocal
59 // return: forcelocal
60 virtual vec6 GetInternalForces(const int& pi, const vec6& dX, const vec3& r, const quat& ql2g, const quat& qg2l, double time, const double* const states);
61
62 // return: bodylocal
63 virtual mat6 GetInertiaMatrix(const int& pi, const vec3& r, const quat& q, const double dT, const double* const adX);
64
65 // all global coords
66 virtual vec13 GetSecondDerivative(const int& pi, const vec3& r, const quat& ql2g, const quat& qg2l, const vec3& v, const vec3& w, const vec6& externalForces, const double time, const double* const states);
67
68 // bodylocal coords
69 static vec6 GetCoriolisForce(const vec6& dX, const mat6& Inertia);
70
71 virtual vec3 CalRollPitchYaw(const quat& ql2g);
72
73 virtual vec6 CalcHydroforces(const int& pi, const vec6& dX, const vec3& r, const quat& ql2g, const quat& qg2l, double time, const double* const states);
74 virtual vec6 CalcHydroforcesPolyplate(const int& pi, const vec6& dX, const vec3& r, const quat& ql2g, const quat& qg2l, double time, const double* const states);
75
76 virtual vec6 CalContactForce(const int& pi, const vec3& r, const quat& ql2g, const quat& qg2l, const double dT, const double* const adX);
77
78 // Connections =============================================================================
79 virtual vec6 CalConnectForce(const vec3& r, const vec6& dX, const quat& ql2g, const quat& qg2l, const double dT, const double* const adX);
80 // Connections =============================================================================
81
82protected:
83
84 // Input ports.
85
86 // Output ports.
87 virtual const double* Test(const double dT, const double* const adX);
88 virtual const double* ContactForce(const double dT, const double* const adX);
89 virtual const double* FloeState(const double dT, const double* const adX);
90 virtual const double* ConnectForce(const double dT, const double* const adX);
91
92 double numIcePresent[2];
93 const double * icePresenceTest(const double T, const double* const X);
94 const double * iceCriticalTest(const double T, const double* const X);
95 ISignalPort * m_inIcePresenceRegion;
96 ISignalPort * m_inIcePresenceCritical;
97
98 // States
99 int m_IStatePos;
103
104 // Parameters
105 double m_iField[4];
107 vec3** m_FloeV;
108 vec3** m_xyzFloeV;
109
111 double m_locStruct[3];
112 double m_risStruct[3];
113
116
119
121
122 double m_iDensity;
123 double m_sDensity;
124
125 double m_wDragCoeff[2];
126
127 double m_iSpeed[3];
128
130
132
136
138 double m_FloeState[19];
139
141 double current_time = 0.0;
142 double previous_time = 0.0;
143 double step_size = 0.0;
144 bool variable_steps = false;
145 };
146 //double m_StepSize[2]; /// Integration step size
147 time_step_info m_time_step_info;
148 double m_ElasticM;
149 double m_PoissonR;
150 double m_K;
151 double m_CR;
152 double m_DampingR;
153 double m_Kne;
154 double m_Kte;
155 double m_Knv;
156 double m_CStrength;
157 double m_Mui[2];
158 vec3** m_Ftp;
159
160 // Connections =============================================================================
163 double* m_ConnectLoc;
164 double* m_ConnectPos;
165 double* m_ConnectVel;
166 virtual const double* ConnectPos(const double dT, const double* const adX, int iConnect);
167 virtual const double* ConnectVel(const double dT, const double* const adX, int iConnect);
168 ISignalPort ** m_ConnectForce;
169
170 double m_StructConnectForce[8];
171 // Connections =============================================================================
172
173 // Interconnecting structures ==============================================================
176
177 ISignalPort* m_pInStructPos;
178 ISignalPort* m_pInStructVel;
179 ISignalPort* m_pInStructOmega;
180 ISignalPort* m_pInStructQuat;
181
182 double m_StructPos[3];
183 double m_StructVel[3];
184 double m_StructOmega[3];
185 double m_StructQuat[4];
186
187 virtual const double* StructForceNED(const double dT, const double* const adX);
188 virtual const double* StructTorqueNED(const double dT, const double* const adX);
189 // Interconnecting structures ==============================================================
190
191 // State-space implementation ==============================================================
192 int m_StateSpace;
193 int m_IStateSSpace;
195 int m_StateNum;
196
197 Eigen::Matrix<double,8,8>* m_SSpaceA;
198 Eigen::Matrix<double,8,1>* m_SSpaceB;
199 Eigen::Matrix<double,1,8>* m_SSpaceC;
200 Eigen::Matrix<double,1,1>* m_SSpaceD;
201 double* m_SSpaceSDot;
202
203 virtual vec6 CalStateSpace(const int& pi, const double dT, const double* const adX, const vec6& VS);
204 // State-space implementation ==============================================================
205
206 // Options =================================================================================
207 double m_CPTOL[2];
208
211
212 double m_ComAreaN[2];
213 double m_CurrentVel[3];
214
215 int m_ACP;
216 int** m_CP_P;
217 vec3** m_P0_P;
218 vec3** m_PN_P;
219 vec3** m_PB0_P;
220 vec3** m_PB1_P;
221 vec3** m_PB2_P;
222 // Options =================================================================================
223
224 CPrintDuringExec* m_Printer;
225
226 // Test
227 double m_test[100];
228
229#ifdef FH_VISUALIZATION
230 string m_Material;
231 Ogre::SceneNode** m_RenderNodes;
232 Ogre::SceneManager* m_SceneMgr;
233 vector<Ogre::ManualObject*> m_Manual;
234
235 double m_CameraPos[3];
236 virtual const double* CameraPosition(const double dT, const double* const adX);
237#endif
238
239};
240
241};
242#endif
Definition: CEnvironment.h:10
Definition: Subroutines.h:144
Definition: CMultiIceFloe.h:31
int m_ModeNum
Index of the additional states for state-space implementation in the state vector.
Definition: CMultiIceFloe.h:194
double m_Mui[2]
Ice compressive strength.
Definition: CMultiIceFloe.h:157
double m_ElasticM
Integration step info.
Definition: CMultiIceFloe.h:148
int m_numFloe
Dimension of ice field.
Definition: CMultiIceFloe.h:106
int m_ConnectNum
Tangential contact force at previous time step.
Definition: CMultiIceFloe.h:161
vec3 * m_ContactMoment
Global contact force.
Definition: CMultiIceFloe.h:134
vec3 ** m_PB2_P
PB position 1 at previous time step (relative to PA)
Definition: CMultiIceFloe.h:221
vec3 ** m_PB0_P
Normal of the common plane at previous time step (relative to PA)
Definition: CMultiIceFloe.h:219
double m_K
Poisson's ratio of ice.
Definition: CMultiIceFloe.h:150
virtual void OdeFcn(const double dT, const double *const adX, double *const adXDot, const bool bIsMajorTimeStep)
Calculates the state derivatives.
PolyplateSpec m_PolyPlate[MaxNumFL]
Particle class for contact detection.
Definition: CMultiIceFloe.h:118
double m_DampingR
Coefficient of restitution.
Definition: CMultiIceFloe.h:152
vec3 ** m_xyzFloeV
Local coordinates of ice floe vertices.
Definition: CMultiIceFloe.h:108
int m_conStruct
Output global connect force acting on the structure.
Definition: CMultiIceFloe.h:174
int m_ConnectPA
Number of connections.
Definition: CMultiIceFloe.h:162
int m_ContactMesh
User-defined tolerance for common plane calculation.
Definition: CMultiIceFloe.h:209
double m_ComAreaN[2]
0: no BC; 1: ice floes confined at the boundaries perpendicular to the drift direction
Definition: CMultiIceFloe.h:212
double m_CurrentVel[3]
Computational area North.
Definition: CMultiIceFloe.h:213
double m_sDensity
Density of ice.
Definition: CMultiIceFloe.h:123
double m_StructContactForce[8]
Global contact moment.
Definition: CMultiIceFloe.h:135
double m_Kte
Normal contact stiffness.
Definition: CMultiIceFloe.h:154
double m_PoissonR
Elastic modulus of ice.
Definition: CMultiIceFloe.h:149
double m_CR
Contact stiffness.
Definition: CMultiIceFloe.h:151
vec3 ** m_PB1_P
PB position 0 at previous time step (relative to PA)
Definition: CMultiIceFloe.h:220
double m_risStruct[3]
Location of the structure.
Definition: CMultiIceFloe.h:112
double m_wDragCoeff[2]
Density of structure.
Definition: CMultiIceFloe.h:125
int m_ACP
Current velocity.
Definition: CMultiIceFloe.h:215
Particle m_Particle[MaxNumFL]
Damping matrix.
Definition: CMultiIceFloe.h:117
int m_IStateOmega
Index of the global velocity in the state vector.
Definition: CMultiIceFloe.h:102
double m_iField[4]
Index of the global angular velocity in the state vector.
Definition: CMultiIceFloe.h:105
int m_BoundaryCondition
Use meshes (faces) to calculate contact area, 0: no mesh; 1: mesh.
Definition: CMultiIceFloe.h:210
double m_locStruct[3]
Number of structures.
Definition: CMultiIceFloe.h:111
double m_Kne
Damping ratio.
Definition: CMultiIceFloe.h:153
virtual const double * ConnectPos(const double dT, const double *const adX, int iConnect)
List of velocities (u,v,w) of the connections.
double * m_ConnectLoc
Index of the object to connect.
Definition: CMultiIceFloe.h:163
AABB * m_AABB
Polyplate structure.
Definition: CMultiIceFloe.h:120
double m_FloeState[19]
Index of ice floe for output.
Definition: CMultiIceFloe.h:138
int m_iFloePos
Output global contact force acting on the structure.
Definition: CMultiIceFloe.h:137
CEnvironment * m_Environment
Ice concentration.
Definition: CMultiIceFloe.h:131
double m_iSpeed[3]
Water drag coefficient.
Definition: CMultiIceFloe.h:127
double m_CStrength
Normal viscous damping coefficient.
Definition: CMultiIceFloe.h:156
ISignalPort * m_pInStructPos
Rendering of structures, 0: no; 1: triangle; 2: line.
Definition: CMultiIceFloe.h:177
mat6 * m_DampMatrix
Added mass matrix.
Definition: CMultiIceFloe.h:115
vec3 ** m_FloeV
Number of ice floes.
Definition: CMultiIceFloe.h:107
double m_Knv
Tangential contact stiffness.
Definition: CMultiIceFloe.h:155
double m_iDensity
Particle AABB tree.
Definition: CMultiIceFloe.h:122
CPrintDuringExec * m_Printer
PB position 2 at previous time step (relative to PA)
Definition: CMultiIceFloe.h:224
mat6 * m_AddedMass
Restriction of structure.
Definition: CMultiIceFloe.h:114
vec3 ** m_Ftp
Floe surface friction.
Definition: CMultiIceFloe.h:158
vec3 ** m_PN_P
Location of the common plane at previous time step (relative to PA)
Definition: CMultiIceFloe.h:218
vec3 ** m_P0_P
1: Common plane saved at previous time step; 0: no
Definition: CMultiIceFloe.h:217
int m_conRender
0: no interconnecting structure; 1: interconnecting structure
Definition: CMultiIceFloe.h:175
double m_iConcentration
Initial ice drift speed.
Definition: CMultiIceFloe.h:129
int ** m_CP_P
1: use approximation of common plane; 0: no
Definition: CMultiIceFloe.h:216
vec3 * m_ContactForce
Pointer to DeepSeaGravityWaves -> CEnvironment.
Definition: CMultiIceFloe.h:133
double * m_ConnectVel
List of positions (x,y,z) of the connections.
Definition: CMultiIceFloe.h:165
int m_IStateQuater
Index of the global position in the state vector.
Definition: CMultiIceFloe.h:100
double * m_ConnectPos
List of local locations of the connections.
Definition: CMultiIceFloe.h:164
int m_IStateVel
Index of the quaternions in the state vector.
Definition: CMultiIceFloe.h:101
int m_numStruct
Coordinates of ice floe vertices.
Definition: CMultiIceFloe.h:110
Definition: Subroutines.h:277
Floe states.
Definition: CMultiIceFloe.h:140
bool variable_steps
True if variable step size is used.
Definition: CMultiIceFloe.h:144
Definition: Subroutines.h:93