Marine systems simulation
CNetStructureWakeEffect.h
1#pragma once
2
175//#define CNetStructureWakeEffect_DO_PROFILE
176
177// Includes
178#include <string>
179
180#include <CEnvironment.h>
181
182#include <SimObject.h>
183#include <ICurrentVel.h>
184#include "sfh/timers/ProfilerWallclock.h"
185#include <IBasicBottom.h>
186
187#include <environment/DeepSeaGravityWaves.h>
188#include "CNetElement3NWakeEffect.h"
189#include "CNetCableElementSpec.h"
190#include "CNetCableElement.h"
191#include "CNetElementDef.h"
192#include "CNetBottomContactFilter.h"
193#include "CNetStructureSpec.h"
194
195
196#ifdef FH_VISUALIZATION
197 #include "sfh/ogre/NMeshGenerators.h"
198 #include "sfh/ogre/C3DLine.h"
199 #include <CTextRenderer.h>
200#endif
201
202//Class definition
203class CNetStructureWakeEffect : public SimObject
204{
205public:
207 CNetStructureWakeEffect(std::string sSimObjectName, ISimObjectCreator *pCreator);
210 virtual void OdeFcn(const double dT, const double *const adX, double *const adXDot, const bool bIsMajorTimeStep);
211 virtual void InitialConditionSetup(const double dT, const double *const adCurrentIC, double *const adUpdatedIC, ISimObjectCreator *const pCreator);
212 virtual void FinalSetup(const double dT, const double *const adX, ISimObjectCreator *const pCreator);
213 const double * outExternalNodeForce(const double dT, const double *const adX, int iExtNode);
214
215#ifdef FH_VISUALIZATION
217 virtual void RenderInit(Ogre::Root *const pOgreRoot, ISimObjectCreator *const pCreator);
219 virtual void RenderUpdate(const double dT, const double *const adX);
220
221 void CreateCapsule( Ogre::ManualObject *capsule_manual);
222 C3DLine *myline;
223#endif
224 virtual const double * NodePos(const double dT, const double *const adX, int iExtNode);
225 virtual const double * NodeVel(const double dT, const double *const adX, int iExtNode);
226 virtual const double * BottomContact(const double dT, const double *const adX);
227 void SetAddedDragPerMPS(double AddedDragPerMPS);
228 const double* GetNetTotalForceForCheck(const double dT, const double *const adX);
229protected:
230 virtual void CalcStateDerivatives(const double *const adX, double *const adXDot);
231 virtual void AddExternalForces(const double dT, const double *const adX);
232 virtual void AddNetForces(const double dT, const double *const adX);
233 virtual void AddCableForces(const double dT, const double *const adX);
234 virtual double AddNodeBottomForce(const double *const adX, int iNode, double dDiam, double adForceInOut[3]);
235 virtual void AddBottomForces(const double *const adX);
236 virtual void AddInputPorts(ISimObjectCreator *pCreator);
237 virtual void CreateNetPanels(std::vector<const CNetElementDef*> VNetElementDefs, ISimObjectCreator *pCreator);
238 virtual void CreateNetCables(std::vector<const CNetCableElementSpec*> VCableElements, ISimObjectCreator *pCreator);
239 virtual void CreateDataStructures();
240 virtual void CreateOutputPorts(ISimObjectCreator *pCreator);
241 VSPairStrInt CreateExternalNodeMap( std::string sTag, int* piUsed, CNetStructureSpec & NetSpec, ISimObjectCreator *pCreator);
242 void PRINTALLNODEFORCES(std::string spec, double dT);
243
245
246 ISignalPort **m_apInExternalForces;
247 int *m_aIStatePos;
248 int *m_aIStateVel;
250 double* m_NodeExternalForces;
252
254 int m_iNumNodesOutputPosAndVel;
255 int m_iNumPanelsCalc;
256 int m_iNumCablesCalc;
257 int m_iNumNodesOriginal;
258 int m_iNumNodesCalc;
259 int m_iNumNodeOutputs;
261
263
265 double m_adBottomContact[6];
266
267 IBasicBottom** m_ppBottom;
268 ICurrentVel** m_ppCurrentVel;
269 CEnvironment* m_pEnvironment;
271
273
274 std::vector<CNetCableElement*> m_VpCableElements;
275 std::vector<CNetElement3NWakeEffect*> m_VpNetElements;
276 float* m_afInertia;
277 int* m_aiNetConn;
278 int** m_aaiCableConn;
279 SAdaptationSpec_t m_SAdaptations;
280 bool m_bFoldingPointRefinementUsed;
282
283
285
287 VSPairStrInt m_VsNodesInputForce;
288 bool m_bUseTagForExternalNodes;
290
291 double* m_adNodeForce;
292 sfh::timers::StopWatch m_OdeTimer;
293
294 // Screen model
295 bool m_UseScreenModel;
296 bool m_UseMoeFore2021; // Use drag and lift coefficients from model tests published in Moe-F�re et al. 2021.
297 double m_SnImg; // Use solidity derived from image analysis. Only to be used with drag formulation from Moe-F�re et al. 2021.
298 double m_RhoWater;
299 double m_NetForcesTotalForOutputCheck[3];
300
301 // Wake effect inclusion
306 bool m_useReynoldsDependentDragCoefficients;
307
308#ifdef CNetStructureWakeEffect_DO_PROFILE
309 sfh::timers::ProfilerWallclock m_Profiler;
310#endif
311
312
313};
Definition: CEnvironment.h:10
Definition: CNetBottomContactFilter.h:7
Definition: CNetStructureSpec.h:38
Definition: CNetStructureWakeEffect.h:204
CNetStructureWakeEffect(std::string sSimObjectName, ISimObjectCreator *pCreator)
The constructor sets the pointer to the output object and the parser object.
int m_NElementBarsInWakeEffectCalc
Number of u and v bars in calculation of wake effect if m_UseActualElementSizeInWakeEffect is set to ...
Definition: CNetStructureWakeEffect.h:305
CNetBottomContactFilter m_BottomContactFilter
Environment.
Definition: CNetStructureWakeEffect.h:264
bool m_UseActualElementSizeInWakeEffect
Set to true if actual size (number of u and v bars) of net element shall be used in wake effect calcu...
Definition: CNetStructureWakeEffect.h:304
int m_iNumNodesInputForce
Node counts.
Definition: CNetStructureWakeEffect.h:253
ISignalPort ** m_apInExternalForces
Interface member variables.
Definition: CNetStructureWakeEffect.h:246
std::vector< CNetCableElement * > m_VpCableElements
Element properties.
Definition: CNetStructureWakeEffect.h:274
virtual void CalcStateDerivatives(const double *const adX, double *const adXDot)
For screen model. Checking calculated total net force.
virtual ~CNetStructureWakeEffect()
The destructor deletes dynamically allocated memory.
bool m_ExternalElementWakeEffectsActive
Set to true if elements should be affected by the wake from other elements.
Definition: CNetStructureWakeEffect.h:302
VSPairStrInt m_VsNodesOutputPosAndVel
Nodes reachable directly through input or output ports.
Definition: CNetStructureWakeEffect.h:286
bool m_InternalElementWakeEffectsActive
Set to true if wake effects should be active within an element.
Definition: CNetStructureWakeEffect.h:303
Interface for calculating the bottom force on various objects.
Definition: IBasicBottom.h:23
Definition: ICurrentVel.h:12
Class containing the specification for a net object.
Definition: CNetStructureSpec.h:22