Marine systems simulation
Loading...
Searching...
No Matches
marenv::wave::GerstnerWaves Class Reference

#include <GerstnerWaves.h>

+ Inheritance diagram for marenv::wave::GerstnerWaves:
+ Collaboration diagram for marenv::wave::GerstnerWaves:

Public Member Functions

 GerstnerWaves (std::shared_ptr< WaveComponents > waveComponents)
 
 GerstnerWaves (WaveEnergySpectrum::SpectrumParameters spectrumParameters, int numWaves, uint32_t randomSeed)
 
 ~GerstnerWaves () override=default
 Default destructor.
 
Status ComputeSurfaceElevation (double time, const double pos[2], double &elevationOut) override
 
Status ComputeSurfaceElevationAtLagrange (double time, const double lagrangePos[2], double &elevationOut)
 
Status ComputeSurfaceUnitNormal (double time, const double pos[2], double unitNormalOut[3]) override
 
Status ComputeSurfaceUnitNormalAtLagrange (double time, const double lagrangePos[2], double unitNormalOut[3])
 
Status ComputeParticleVelocity (double time, const double pos[3], double velOut[3]) override
 
Status ComputeParticleVelocityAtLagrange (double time, const double lagrangePos[3], double velOut[3])
 
Status ComputeParticleAcceleration (double time, const double pos[3], double accOut[3]) override
 
Status ComputeParticleAccelerationAtLagrange (double time, const double lagrangePos[3], double accOut[3])
 
Status ComputeDynamicPressure (double time, const double pos[3], double &pressureOut) override
 
Status ComputeDynamicPressureAtLagrange (double time, const double lagrangePos[3], double &pressureOut)
 
Status ComputeTotalPressure (double time, const double pos[3], double &pressureOut) override
 
Status ComputeTotalPressureWithElevation (double eulerZ, double elevation, double &pressureOut)
 
Status ComputePointQuery (double time, const double pos[3], double &surface_elevation, double surface_unit_normal[3], double particle_velocity[3], double particle_acceleration[3], double &pressure) override
 
- Public Member Functions inherited from marenv::wave::LinearWaveTheory
 LinearWaveTheory (std::shared_ptr< WaveComponents > waveComponents, std::string waveTheoryName)
 
WaveField::InsecureDatapointers GetWaveComponents () const override
 
std::string SpectrumName () const override
 
std::string WaveTheoryName () const override
 
WaveComponentData GetWaveComponentsCopy () const override
 
void BlendInPlace (WaveComponentData &other, double alpha) override
 
- Public Member Functions inherited from marenv::wave::WaveField
virtual ~WaveField ()=default
 Virtual destructor.
 
virtual marenv::wave::WaveComponentData GetWaveComponentsCopy (double time, size_t maxComponents=0) const
 

Protected Member Functions

void FindLagrangePoint3D (double time, const double eulerPosIn[3], double *lagrangePosOut)
 
void FindLagrangePoint2D (double time, const double eulerPosIn[2], double *lagrangePosOut)
 
void ThrowIfWavesAreTooSteep ()
 Throws an exception if the waves are too steep.
 
- Protected Member Functions inherited from marenv::wave::LinearWaveTheory
std::shared_ptr< WaveSnapshotLoadSnapshot () const
 
void StoreSnapshot (std::shared_ptr< WaveSnapshot > snap)
 
- Protected Member Functions inherited from marenv::wave::WaveField
 WaveField ()=default
 Constructor.
 

Additional Inherited Members

- Protected Attributes inherited from marenv::wave::LinearWaveTheory
std::string m_spectrumName
 The name of the wave spectrum.
 
std::string m_waveTheoryName
 The name of the wave theory.
 

Detailed Description

Calculates physical properties in a sea state from a set of Gerstner theory gravity waves.

This theory requires iteration when calculating properties based on Eulerian positions, and is, therefore, computational demanding.

Constructor & Destructor Documentation

◆ GerstnerWaves() [1/2]

marenv::wave::GerstnerWaves::GerstnerWaves ( std::shared_ptr< WaveComponents waveComponents)
explicit

Constructor of Gerstner waves from wave component specifications.

Parameters
[in]waveComponentsWave components specifications.

◆ GerstnerWaves() [2/2]

marenv::wave::GerstnerWaves::GerstnerWaves ( WaveEnergySpectrum::SpectrumParameters  spectrumParameters,
int  numWaves,
uint32_t  randomSeed 
)

Constructor of Gerstner waves from wave spectrum specification.

Parameters
[in]spectrumParametersWave spectrum specifications.
[in]numWavesNumber of waves to construct from the spectrum.
[in]randomSeedThe random seed to use.

Member Function Documentation

◆ ComputeDynamicPressure()

Status marenv::wave::GerstnerWaves::ComputeDynamicPressure ( double  time,
const double  pos[3],
double &  pressureOut 
)
overridevirtual

Returns the dynamic pressure at a specific position.

Parameters
[in]timeCurrent simulation time.
[in]posPosition (x,y,z) for which the pressure is desired.
[out]pressureOutThe pressure at pos.
Returns
marenv::Status::OK on success. See marenv::Status for other values.

Implements marenv::wave::WaveField.

◆ ComputeDynamicPressureAtLagrange()

Status marenv::wave::GerstnerWaves::ComputeDynamicPressureAtLagrange ( double  time,
const double  lagrangePos[3],
double &  pressureOut 
)

Computes dynamic pressure at a Lagrangian position.

Parameters
[in]timeTime in seconds.
[in]lagrangePosLagrangian position [m].
[out]pressureOutComputed dynamic pressure [Pa].
Returns
marenv::Status::OK on success. See marenv::Status for other values.

◆ ComputeParticleAcceleration()

Status marenv::wave::GerstnerWaves::ComputeParticleAcceleration ( double  time,
const double  pos[3],
double  accOut[3] 
)
overridevirtual

Returns the particle acceleration at a specific position.

Parameters
[in]timeCurrent simulation time.
[in]posPosition (x,y,z) for which the particle acceleration is desired.
[out]accOutThe particle acceleration at pos.
Returns
marenv::Status::OK on success. See marenv::Status for other values.

Includes effects of both current and waves.

Implements marenv::wave::WaveField.

◆ ComputeParticleAccelerationAtLagrange()

Status marenv::wave::GerstnerWaves::ComputeParticleAccelerationAtLagrange ( double  time,
const double  lagrangePos[3],
double  accOut[3] 
)

Computes particle acceleration at a Lagrangian position.

Parameters
[in]timeTime in seconds.
[in]lagrangePosLagrangian position [m].
[out]accOutComputed particle acceleration [m/s^2].
Returns
marenv::Status::OK on success. See marenv::Status for other values.

◆ ComputeParticleVelocity()

Status marenv::wave::GerstnerWaves::ComputeParticleVelocity ( double  time,
const double  pos[3],
double  velOut[3] 
)
overridevirtual

Returns the particle velocity at a specific position.

Parameters
[in]timeCurrent simulation time.
[in]posPosition (x,y,z) for which the particle velocity is desired.
[out]velOutThe particle velocity at pos.
Returns
marenv::Status::OK on success. See marenv::Status for other values.

Includes effects of both current and waves.

Implements marenv::wave::WaveField.

◆ ComputeParticleVelocityAtLagrange()

Status marenv::wave::GerstnerWaves::ComputeParticleVelocityAtLagrange ( double  time,
const double  lagrangePos[3],
double  velOut[3] 
)

Computes particle velocity at a Lagrangian position.

Parameters
[in]timeTime in seconds.
[in]lagrangePosLagrangian position [m].
[out]velOutComputed particle velocity [m/s].
Returns
marenv::Status::OK on success. See marenv::Status for other values.

◆ ComputePointQuery()

Status marenv::wave::GerstnerWaves::ComputePointQuery ( double  time,
const double  pos[3],
double &  surface_elevation,
double  surface_unit_normal[3],
double  particle_velocity[3],
double  particle_acceleration[3],
double &  pressure 
)
overridevirtual

Calculates multiple properties of the environment in one call.

Parameters
[in]timeSimulation time.
[in]posPosition.
[out]surface_elevationThe surface elevation above this point.
[out]surface_unit_normalThe surface unit normal above this point.
[out]particle_velocityThe particle velocity in this point.
[out]particle_accelerationThe particle acceleration in this point.
[out]pressureThe pressure. The pressure in this point.
Returns
marenv::Status::OK on success. See marenv::Status for other values.

Implements marenv::wave::WaveField.

◆ ComputeSurfaceElevation()

Status marenv::wave::GerstnerWaves::ComputeSurfaceElevation ( double  time,
const double  pos[2],
double &  elevationOut 
)
overridevirtual

Returns the surface elevation at a specific position.

Parameters
[in]timeCurrent simulation time.
[in]posPosition (x,y) for which surface elevation is desired.
[out]elevationOutSurface elevation at pos.
Returns
marenv::Status::OK on success. See marenv::Status for other values.

Implements marenv::wave::WaveField.

◆ ComputeSurfaceElevationAtLagrange()

Status marenv::wave::GerstnerWaves::ComputeSurfaceElevationAtLagrange ( double  time,
const double  lagrangePos[2],
double &  elevationOut 
)

Computes surface elevation at a Lagrangian position.

Parameters
[in]timeTime in seconds.
[in]lagrangePosLagrangian position [m].
[out]elevationOutComputed surface elevation [m].
Returns
marenv::Status::OK on success. See marenv::Status for other values.

◆ ComputeSurfaceUnitNormal()

Status marenv::wave::GerstnerWaves::ComputeSurfaceUnitNormal ( double  time,
const double  pos[2],
double  unitNormalOut[3] 
)
overridevirtual

Returns the unit normal vector of the surface at a specific position.

Parameters
[in]timeCurrent simulation time.
[in]posPosition (x,y) for which the unit normal surface vector is desired.
[out]unitNormalOutThe unit normal surface vector at pos.
Returns
marenv::Status::OK on success. See marenv::Status for other values.

Implements marenv::wave::WaveField.

◆ ComputeSurfaceUnitNormalAtLagrange()

Status marenv::wave::GerstnerWaves::ComputeSurfaceUnitNormalAtLagrange ( double  time,
const double  lagrangePos[2],
double  unitNormalOut[3] 
)

Computes surface unit normal at a Lagrangian position.

Parameters
[in]timeTime in seconds.
[in]lagrangePosLagrangian position [m].
[out]unitNormalOutComputed surface unit normal vector.
Returns
marenv::Status::OK on success. See marenv::Status for other values.

◆ ComputeTotalPressure()

Status marenv::wave::GerstnerWaves::ComputeTotalPressure ( double  time,
const double  pos[3],
double &  pressureOut 
)
overridevirtual

Returns the total pressure at a specific position.

Parameters
[in]timeCurrent simulation time.
[in]posPosition (x,y,z) for which the pressure is desired.
[out]pressureOutThe pressure at pos.
Returns
marenv::Status::OK on success. See marenv::Status for other values.

Implements marenv::wave::WaveField.

◆ ComputeTotalPressureWithElevation()

Status marenv::wave::GerstnerWaves::ComputeTotalPressureWithElevation ( double  eulerZ,
double  elevation,
double &  pressureOut 
)

Computes total pressure including elevation effects.

Parameters
[in]eulerZEulerian vertical coordinate [m].
[in]elevationSurface elevation [m].
[out]pressureOutComputed total pressure [Pa].
Returns
marenv::Status::OK on success. See marenv::Status for other values.

◆ FindLagrangePoint2D()

void marenv::wave::GerstnerWaves::FindLagrangePoint2D ( double  time,
const double  eulerPosIn[2],
double *  lagrangePosOut 
)
protected

Finds the horizontal position in Lagrangian space from one in Eulerian space using iterations.

Parameters
[in]timeTime in seconds.
[in]eulerPosInHorizontal position in Eulerian space [m].
[out]lagrangePosOutHorizontal position in Lagrangian space [m].

◆ FindLagrangePoint3D()

void marenv::wave::GerstnerWaves::FindLagrangePoint3D ( double  time,
const double  eulerPosIn[3],
double *  lagrangePosOut 
)
protected

Finds the 3D Lagrangian point corresponding to a given Eulerian point.

Parameters
[in]timeTime in seconds.
[in]eulerPosInEulerian position [m].
[out]lagrangePosOutCorresponding Lagrangian position [m].

The documentation for this class was generated from the following file: