FhSim  3.1.0
Marine systems simulation
Loading...
Searching...
No Matches
Ring.h
1#pragma once
126#include <string>
127
128#include <Eigen/Eigen>
129
130#include <fhsim/PrintDuringExec.h>
131#include <fhsim/simobject/SimObject.h>
132#include <fhsim_environment/EnvironmentProvider.h>
133#include <fhsim_environment/ElementFlowInteraction.h>
134
135#include "cable/GaussPointDrag.h"
136#ifdef FH_VISUALIZATION
137# include "sfh/ogre/C3DLine.h"
138#endif
139
140namespace RbCable
141{
142class Ring : public SimObject
143{
144public:
145 Ring(const std::string& simObjectName, ISimObjectCreator* const creator);
146 ~Ring();
147 void OdeFcn(const double T, const double* const X, double* const XDot) const;
148 void InitialConditionSetup(const double T, const double* const currentIC, double* const updatedIC, ISimObjectCreator* const creator);
149 void FinalSetup(const double T, const double* const X, ISimObjectCreator* const creator) override;
150 void PreOdeFcn(const double T, const double* const X) override;
151
152
153 // virtual methods (to be overridden by subclasses)
154 virtual void GetExternalForces(const double T, const double* const X, double* m_extlForce, int index);
155
156
157 // const double* const point(const double T, const double* const X, const int index);
158 void calculations(const double T, const double* const X);
159 void calculationsCommon(const double T, const double* const X) const;
160
162 void BuildGaussPoints(const double* const X);
163
164 virtual const double* outConnectorPos(const double T, const double* const X, const int index);
165 virtual const double* outConnectorVel(const double T, const double* const X, const int index);
166
167#ifdef FH_VISUALIZATION
168 void RenderInit(Ogre::Root* const ogreRoot, ISimObjectCreator* const creator);
169 void RenderUpdate(const double T, const double* const X);
170#endif
171
172protected:
173 typedef Eigen::Matrix<double, 3, 3> mat3;
174 typedef Eigen::Matrix<double, 3, 1> vec3;
175
176 int m_numElements;
177 double m_totalLength;
178 double m_radius;
179 double m_weight;
180 double m_length;
181 double m_mass;
182 double m_Ixy;
183 double m_Iz;
184
185 double m_alphaN;
186 double m_betaN;
187 double m_epsilonN;
188 double m_alphaM;
189 double m_betaM;
190 double m_epsilonM;
191 double m_alphaT;
192 double m_betaT;
193 double m_epsilonT;
194
195 double m_centrePosInit[3];
196
197 // hydrodynamic parameters
198 double m_rho;
199 double m_rhoWater;
200 PrintDuringExec* m_print = nullptr;
201 environment::wake::ElementFlowInteraction m_flow;
202 bool m_gaussPointDrag = true;
204 double m_Ct; // tangential damping coefficient
205 double m_Cn; // normal damping coefficient
206 double m_buoyFactor; // Factor of volume contributing to buoyancy. Default 0.1 for bottom ring.
207
208 // Connectors
212 ISignalPort** m_iIForce;
213 double m_extlForce[3];
216
217 double m_bending_epsilon[3];
218
219 struct element
220 {
221 int p;
222 int q;
223 int v;
224 int w;
225 mat3 Mi;
226 mat3 MiT;
227 vec3 k;
228 mat3 K;
229 vec3 eDot;
230 double nuDot;
231 };
232 element* m_el;
233
234 /* ISignalPort* m_posA;
235 ISignalPort* m_posB;
236 ISignalPort* m_velA;
237 ISignalPort* m_velB;*/
238
239 ICommonComputation* m_calcDynamics;
240 Eigen::Matrix<double, Eigen::Dynamic, 1> m_lambda;
241 Eigen::Matrix<double, Eigen::Dynamic, 1> m_F_MDotV; // external force F, minus Coriolis term dM/dt*V
242 // double* m_lambda;
243
244 double m_forceA[3];
245 double m_forceB[3];
246
247#ifdef FH_VISUALIZATION
248
249 Ogre::SceneNode** m_ManualObjectNodes = nullptr;
250/* Ogre::ManualObject* m_ManualObject;
251 double m_scale;
252 Ogre::SceneNode* m_ManualObjectNode;*/
253#endif
254};
255} // namespace RbCable
Definition Ring.h:143
int m_ElementsPerConnector
number of elements between connectors
Definition Ring.h:211
wet_cylinder_water::ElementGaussPoints m_gaussPoints
The Gauss points of the elements of the loop, and the water at them; buffers kept from call to call.
Definition Ring.h:203
bool m_gaussPointDrag
Gauss-point drag with the water at the Gauss points (MARE-0396).
Definition Ring.h:202
double m_extlForce[3]
Array for holding current value of external force at a given node.
Definition Ring.h:213
Ring(const std::string &simObjectName, ISimObjectCreator *const creator)
reads parameters, registers states, output and intput ports.
double m_centrePosInit[3]
Parameter for describing the initial position of the centre of the ring (not an IC since there is no ...
Definition Ring.h:195
double ** m_aadConnectorVel
Local array for storing output velocities.
Definition Ring.h:215
void PreOdeFcn(const double T, const double *const X) override
Takes the other objects' wakes at the element centres, or with the Gauss-point drag at the Gauss poin...
void BuildGaussPoints(const double *const X)
Finds the Gauss points of the closed loop of elements from the state; the axis of an element is its q...
PrintDuringExec * m_print
The shared printer for run errors; null if the creator has none, as in a unit test.
Definition Ring.h:200
double ** m_aadConnectorPos
Local array for storing output positions.
Definition Ring.h:214
environment::wake::ElementFlowInteraction m_flow
The flow at the element centres, the other objects' wakes taken per step (MARE-0223); the Environment...
Definition Ring.h:201
ISignalPort ** m_iIForce
Array of indices to connector forces in input vector.
Definition Ring.h:212
int m_numConnectors
number of additional connectors, if any
Definition Ring.h:210
void FinalSetup(const double T, const double *const X, ISimObjectCreator *const creator) override
Takes the Environment (MARE-0315).
virtual void GetExternalForces(const double T, const double *const X, double *m_extlForce, int index)
get the external forces at element 'index'. Should be overridden by inheriting classes to get forces ...
bool m_additionalConnectors
flag for additional connectors along cable
Definition Ring.h:209
Definition GaussPointDrag.h:56
Definition Ring.h:220
mat3 MiT
The inverse of the translational inertia with the added mass normal to the axis, global frame (MARE-0...
Definition Ring.h:226