Marine systems simulation
DeepSeaGravityWaves.h
1
149#pragma once
150
151#include <CEnvironment.h>
152#include <vector>
153#include <CNCField.h>
154using std::vector;
155using std::copy;
156
157namespace NetCDFsinmod
158{
159 class Parser;
160 struct Grid;
161}
162
163class LinearWaveTheory;
164
165
166#ifdef FH_VISUALIZATION
167 #include <CFhCamera.h>
168 #include "sfh/ogre/C3DLine.h"
169#endif
170
172{
173public:
186 DeepSeaGravityWaves(string simObjectName, ISimObjectCreator* creator);
188
189 virtual void FinalSetup(const double T, const double *const X, ISimObjectCreator *const creator);
190
199 double GetSurfaceElevation (const double dT, const double* const dX, const double adPos[2]);
208 void GetSurfaceUnitNormal (const double dT, const double* const dX, const double adPos[2], double *adUnitNormalOut);
219 void GetParticleVelocity (const double dT, const double* const dX, const double adPos[3], double *adVelOut);
220
231 void GetParticleAcceleration (const double dT, const double* const dX, const double adPos[3], double *adAccOut);
240 double GetPressure (const double dT, const double* const dX, const double adPos[3]);
251 double GetTotalPressure (const double dT, const double* const dX, const double adPos[3]);
258 double GetSeadepth (const double adPos[2]);
265 double GetSeabedSigma (const double adPos[3]);
272 double GetSeabedTau (const double adPos[3]);
281 double GetSeabedRho (const double adPos[3]);
299 void GetWaveFrequencies (std::vector<double> & vec);
308 void GetWaveAmplitudes (std::vector<double> & vec);
317 void GetWavePhaseAngles (std::vector<double> & vec);
326 void GetWaveDirections (std::vector<double> & vec);
335 void GetWaveNumbers (std::vector<double> & vec);
346 void GetCurrentVelocity (const double dT, const double* const dX, const double adPos[3], double *adVelOut);
357 void GetCurrentProducerVelocity (const double dT, const double* const dX, const double adPos[3], double *adVelOut);
358
366 double GetDensity(const double T, const double *const X, const double pos[3]);
367
368
369 EnvironmentQuery PointEnvironmentQuery(const double T, const double* const X, const double Position[3]);
370 void PointEnvironmentQuery2(const double T, const double* const X, const double Position[3], EnvironmentQuery &q);
371
372 #ifdef FH_VISUALIZATION
381 void RenderInit(Ogre::Root* const ogreRoot, ISimObjectCreator* const creator);
390 void RenderUpdate(const double T, const double* const X);
391 #endif
392
393protected:
394 LinearWaveTheory* m_WaveTheory;
396 string m_spectrum;
397 int m_MaxNumWaves;
398 int m_NumWaves;
399 int m_NumWaves4Multiplier;
400
401 vector<double> m_adWaveFrequency;
402 vector<double> m_adWaveAmplitude;
403 vector<double> m_adWaveDirection;
404 vector<double> m_adPhaseAngle;
405 vector<double> m_adWaveNumber;
406
408 double* m_depthMap;
409 ICurrentField* m_globalCurrentField;
410 vector<ICurrentField*> m_registeredCurrentFields;
411 double m_length_x;
412 double m_length_y;
413
414 // ==================== Use NetCDFField (PC)
415 bool m_useNetCDFField;
417 // ==================== Use dummy/artificial velocity field for tanks.
422
423
424 // ==================== Wake effect (BiaoSu)
426 int m_wakeObjNum;
427 ISignalPort** m_wakeObjPort;
428 ISignalPort* m_wakeDirPort;
429 ISignalPort* m_wakeRatioPort;
430 double m_wakeObjRadius[3];
431 double m_wakeObjDepth[3];
432 double m_wakeObjPower;
433
442 double GetWakeRatio(const double T, const double *const X, const double adPos[3]);
443 // ==================== Wake effect (BiaoSu)
444
445 // ==================== Avoid crashes due to initial condition (BiaoSu)
446 double m_RampT;
447 // ==================== Avoid crashes due to initial condition (BiaoSu)
448
449 #ifdef FH_VISUALIZATION
450 string m_sMaterial;
451 Ogre::SceneNode* m_pWorldSceneNode;
452 Ogre::SceneNode* m_RenderOceanNode;
453 Ogre::ManualObject* m_pOceanRenderObj;
454 Ogre::Light* m_pLight;
455 C3DLine* m_lines;
456 Ogre::ManualObject** m_depthPolygons;
457 Ogre::SceneNode** m_depthPolygonsNodes;
458 CFhCamera* m_FhCamera;
459 Ogre::Camera* m_OgreCamera;
460
461 bool m_BoolVisualization;
462 #endif
463private:
464
465
466
467};
Definition: CEnvironment.h:10
Definition: CNCField.h:8
Definition: DeepSeaGravityWaves.h:172
DeepSeaGravityWaves(string simObjectName, ISimObjectCreator *creator)
Reads parameters, registers states, input/output ports and shared resources.
vector< double > m_adWaveFrequency
For simulation without visualization. Is multiplied with 4 to get the total number of waves in a sea ...
Definition: DeepSeaGravityWaves.h:401
vector< double > m_adWaveAmplitude
Array holding wave frequencies for all waves.
Definition: DeepSeaGravityWaves.h:402
double GetWakeRatio(const double T, const double *const X, const double adPos[3])
Returns the wake effect ratio at a specific position. The horizontal velocity will be multiplied with...
double GetSurfaceElevation(const double dT, const double *const dX, const double adPos[2])
PC For initiation of shared resource NetCDFField.
double GetTotalPressure(const double dT, const double *const dX, const double adPos[3])
Returns the total pressure at a specific position.
void GetCurrentVelocity(const double dT, const double *const dX, const double adPos[3], double *adVelOut)
Returns the water current velocity at a specific position.
double m_UzArtField
Maximum velocity at tank walls (assuming circular tank)
Definition: DeepSeaGravityWaves.h:420
double m_tankRadius
Vertical (constant) velocity in tank. Assuming constant vertical velocity with drain in the entire wi...
Definition: DeepSeaGravityWaves.h:421
vector< double > m_adWaveDirection
Array holding wave amplitudes for all waves.
Definition: DeepSeaGravityWaves.h:403
NetCDFsinmod::Grid * m_grid
Array holding wave number for all waves.
Definition: DeepSeaGravityWaves.h:407
bool m_wakeEffect
Tank radius for artificial velocity field.
Definition: DeepSeaGravityWaves.h:425
double GetSeabedSigma(const double adPos[3])
Returns the sea depth sigma at a specific position.
void GetCurrentProducerVelocity(const double dT, const double *const dX, const double adPos[3], double *adVelOut)
Returns the water current velocity producer at a specific position.
void GetWavePhaseAngles(std::vector< double > &vec)
Returns a vector of all wave phase angles.
string m_waveTheoryName
Enumerator holding the wave theory used.
Definition: DeepSeaGravityWaves.h:395
double GetPressure(const double dT, const double *const dX, const double adPos[3])
Returns the dynamic pressure at a specific position.
void GetWaveAmplitudes(std::vector< double > &vec)
Returns a vector of all wave amplitudes.
void GetWaveFrequencies(std::vector< double > &vec)
Returns a vector of all wave frequencies.
double GetSeabedTau(const double adPos[3])
Returns the sea depth tau at a specific position.
void GetSurfaceUnitNormal(const double dT, const double *const dX, const double adPos[2], double *adUnitNormalOut)
Returns the unit normal vector of the surface at a specific position.
void GetParticleAcceleration(const double dT, const double *const dX, const double adPos[3], double *adAccOut)
Returns the particle acceleration at a specific position.
double GetDensity(const double T, const double *const X, const double pos[3])
Returns the water density at a specific position.
vector< double > m_adWaveNumber
Array holding phase angles for all waves.
Definition: DeepSeaGravityWaves.h:405
CNCField * m_ncField
Parameter that decides whether NetCDFField (true) should be used.
Definition: DeepSeaGravityWaves.h:416
void GetWaveDirections(std::vector< double > &vec)
Returns a vector of all wave directions.
void GetParticleVelocity(const double dT, const double *const dX, const double adPos[3], double *adVelOut)
Returns the particle velocity at a specific position.
void GetWaveNumbers(std::vector< double > &vec)
Returns a vector of all wave numbers.
double GetSeabedRho(const double adPos[3])
Returns the density of the seabed at a specific position.
double m_UxyArtField
Boolean variable. True means that an artificial field is set.
Definition: DeepSeaGravityWaves.h:419
vector< double > m_adPhaseAngle
Array holding wave propagation directions for all waves.
Definition: DeepSeaGravityWaves.h:404
void RegisterCurrentField(ICurrentField *currentField)
Registers an input current field in the environmental representation.
double GetSeadepth(const double adPos[2])
Returns the sea depth at a specific position.
bool m_useArtificialTankVelField
Pointer to CNCField.
Definition: DeepSeaGravityWaves.h:418
Definition: ICurrentField.h:4
Definition: LinearWaveTheory.h:25
Definition: CEnvironment.h:38
Definition: NetCDFParser.h:7