MoorDyn
Classes | Public Types | Public Member Functions | List of all members
moordyn::Waves Class Reference

Class that handles wave and current kinematics. More...

#include <Waves.hpp>

Inheritance diagram for moordyn::Waves:
Inheritance graph
[legend]
Collaboration diagram for moordyn::Waves:
Collaboration graph
[legend]

Public Types

enum  coordtypes { GRID_SINGLE = 0 , GRID_LIST = 1 , GRID_LATTICE = 2 }
 Types of coordinates input on the grid file. More...
 
using NodeKinReturnType = std::tuple< const std::vector< real > &, const std::vector< vec3 > &, const std::vector< vec3 > &, const std::vector< real > & >
 

Public Member Functions

 Waves (moordyn::Log *log)
 Constructor.
 
 ~Waves ()
 Destructor.
 
std::vector< vec3getWaveKinematicsPoints ()
 Get the positions of all the nodes with wave kinematics. More...
 
void setWaveKinematics (std::vector< vec > const &U, std::vector< vec > const &Ud)
 Set the wave kinematics for all the structural nodes. More...
 
void updateWaves ()
 Recalculates any wave and current kinematics for all the nodes.
 
void addLine (moordyn::Line *line)
 Adds a line to the list of structures we calculate water kinematics for. More...
 
void addRod (moordyn::Rod *rod)
 Adds a rod to the list of structures we calculate water kinematics for. More...
 
void addBody (moordyn::Body *body)
 Adds a body to the list of structures we calculate water kinematics for. More...
 
void addPoint (moordyn::Point *point)
 Adds a point to the list of structures we calculate water kinematics for. More...
 
NodeKinReturnType getWaveKinLine (size_t lineId)
 Get the water kinematics for the line with id. More...
 
NodeKinReturnType getWaveKinRod (size_t rodId)
 Get the water kinematics for the rod with given Id. More...
 
NodeKinReturnType getWaveKinBody (size_t bodyId)
 Get the water kinematics for the body with given Id. More...
 
NodeKinReturnType getWaveKinPoint (size_t pointId)
 Get the water kinematics for the point with given Id. More...
 
real getWaveHeightPoint (vec2 point)
 Gets the surface height at a given (x, y) point. More...
 
void getWaveKin (const vec3 &pos, real &zeta, vec3 &vel, vec3 &acc, real &pdyn, Seafloor *seafloor=nullptr)
 Get the wave kinematics at a point at the current time. More...
 
void setup (EnvCondRef env, SeafloorRef seafloor, time::Scheme *t, const char *folder="Mooring/")
 Setup the wave kinematics. More...
 
- Public Member Functions inherited from moordyn::LogUser
 LogUser (Log *log=NULL)
 Constructor. More...
 
 ~LogUser ()
 Destructor.
 
void SetLogger (Log *log)
 Set the log handler. More...
 
LogGetLogger () const
 Get the log handler. More...
 

Additional Inherited Members

- Protected Attributes inherited from moordyn::LogUser
Log_log
 The log handler.
 

Detailed Description

Class that handles wave and current kinematics.

This class keep track of all the structures (lines, points, rods, bodies, etc) being simulated. For each of these structures, it stores the water and wave kinematics for each node of the structure. The Waves class is in charge of understanding the wave/current settings and following through with the correct behavior.

Waves and current kinematics can be calculated by subclasses of AbstractWaveKin and AbstractCurrentKin. This makes it simple to add new wave or current kinematics modes, assuming they can adhere to the simple interface. The waves class itself just stores an AbstractWaveKin and AbstractCurrentKin, it has no ability to compute waves or currents on its own.

Member Enumeration Documentation

◆ coordtypes

Types of coordinates input on the grid file.

Enumerator
GRID_SINGLE 

Single point (0, 0, 0)

GRID_LIST 

List of points.

GRID_LATTICE 

EQUISPACED POINTS.

Member Function Documentation

◆ addBody()

void moordyn::Waves::addBody ( moordyn::Body body)

Adds a body to the list of structures we calculate water kinematics for.

Should be called after Waves::setup

Parameters
body

◆ addLine()

void moordyn::Waves::addLine ( moordyn::Line line)

Adds a line to the list of structures we calculate water kinematics for.

Should be called after Waves::setup

Parameters
line
Here is the call graph for this function:

◆ addPoint()

void moordyn::Waves::addPoint ( moordyn::Point point)

Adds a point to the list of structures we calculate water kinematics for.

Should be called after Waves::setup

Parameters
point

◆ addRod()

void moordyn::Waves::addRod ( moordyn::Rod rod)

Adds a rod to the list of structures we calculate water kinematics for.

Should be called after Waves::setup

Parameters
rod
Here is the call graph for this function:

◆ getWaveHeightPoint()

real moordyn::Waves::getWaveHeightPoint ( vec2  point)

Gets the surface height at a given (x, y) point.

Used mainly for debugging and visualization purposes

Parameters
point
Returns
real
Here is the call graph for this function:

◆ getWaveKin()

void moordyn::Waves::getWaveKin ( const vec3 pos,
real zeta,
vec3 vel,
vec3 acc,
real pdyn,
Seafloor seafloor = nullptr 
)

Get the wave kinematics at a point at the current time.

Parameters
posPoint
seafloorO
zeta
vel
acc
pdyn
Here is the call graph for this function:

◆ getWaveKinBody()

Waves::NodeKinReturnType moordyn::Waves::getWaveKinBody ( size_t  bodyId)

Get the water kinematics for the body with given Id.

The vectors should all be of length 1

Parameters
bodyIdId of the body
Returns
NodeKinReturnType (zeta, U, Ud, pDyn)

◆ getWaveKinematicsPoints()

std::vector< vec3 > moordyn::Waves::getWaveKinematicsPoints ( )

Get the positions of all the nodes with wave kinematics.

Returns a vector of the positions of all the line nodes, points, rod nodes, bodies, etc at the current time.

Returns
std::vector<vec3> Position of all the structural nodes with wave kinematics

◆ getWaveKinLine()

Waves::NodeKinReturnType moordyn::Waves::getWaveKinLine ( size_t  lineId)

Get the water kinematics for the line with id.

Parameters
lineIdId of the line
Returns
NodeKinReturnType (zeta, U, Ud, pDyn)

◆ getWaveKinPoint()

Waves::NodeKinReturnType moordyn::Waves::getWaveKinPoint ( size_t  pointId)

Get the water kinematics for the point with given Id.

The vectors should all be of length 1

Parameters
pointIdId of the points
Returns
NodeKinReturnType (zeta, U, Ud, pDyn)

◆ getWaveKinRod()

Waves::NodeKinReturnType moordyn::Waves::getWaveKinRod ( size_t  rodId)

Get the water kinematics for the rod with given Id.

Parameters
rodIdId of the rod
Returns
NodeKinReturnType (zeta, U, Ud, pDyn)

◆ setup()

void moordyn::Waves::setup ( EnvCondRef  env,
SeafloorRef  seafloor,
time::Scheme t,
const char *  folder = "Mooring/" 
)

Setup the wave kinematics.

Always call this function after the construtor

Parameters
envThe enviromental options
tThe time integration scheme
folderThe root folder where the wave data can be found
Exceptions
moordyn::input_file_errorIf an input file cannot be read, or if a file is ill-formatted
moordyn::invalid_value_errorIf invalid values are found
moordyn::non_implemented_errorIf WaveKin=2
moordyn::mem_errorIf there were roblems allocating memory
moordyn::output_file_errorIf data cannot be written in folder

◆ setWaveKinematics()

void moordyn::Waves::setWaveKinematics ( std::vector< vec > const &  U,
std::vector< vec > const &  Ud 
)

Set the wave kinematics for all the structural nodes.

This expects the order of the points to be the same as what was returned by getWaveKinematicsPoints

Parameters
UWater velocities at the nodes
UdWater accelerations at the nodes

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