FhSim  3.1.0
Marine systems simulation
Loading...
Searching...
No Matches
marenv::current::CurrentField3DArray Class Reference

#include <CurrentField3DArray.h>

+ Inheritance diagram for marenv::current::CurrentField3DArray:
+ Collaboration diagram for marenv::current::CurrentField3DArray:

Public Member Functions

 CurrentField3DArray (std::vector< double > velocityX, std::vector< double > velocityY, std::vector< double > velocityZ, int numX, int numY, int numZ, std::vector< double > depthZ, double lengthX, double lengthY)
 
Status GetCurrent (double time, const double position[3], double currentVelocity[3]) override
 
- Public Member Functions inherited from marenv::current::CurrentField
virtual ~CurrentField ()=default
 Virtual destructor.
 

Detailed Description

Ocean current using a 3D array representation.

This class models an ocean current field defined on a structured 3D grid. Current velocity components (x, y, z) are stored in vectors across spatial dimensions, allowing queries of current velocity at arbitrary positions in space and time.

Horizontally the box spans (numX - 1) lengthX by (numY - 1) lengthY, centred on the origin; outside it there are no data and the current is zero with Status::ERROR_NOT_SET (owner ruling R122 (iv)). In depth the layers are a calc::DepthAxis: linear between them, the value of the nearest layer above the first and below the last, with Status::OUT_OF_RANGE_INACCURATE (R122 (iii), MENV-0053), a usable value that EnvironmentFacade sums. Above the surface (z < 0) the surface value applies.

Constructor & Destructor Documentation

◆ CurrentField3DArray()

marenv::current::CurrentField3DArray::CurrentField3DArray ( std::vector< double >  velocityX,
std::vector< double >  velocityY,
std::vector< double >  velocityZ,
int  numX,
int  numY,
int  numZ,
std::vector< double >  depthZ,
double  lengthX,
double  lengthY 
)

Constructs a 3D current field.

Parameters
[in]velocityXX-component velocities [m/s].
[in]velocityYY-component velocities [m/s].
[in]velocityZZ-component velocities [m/s].
[in]numXNumber of grid points in the x-direction.
[in]numYNumber of grid points in the y-direction.
[in]numZNumber of grid points in the z-direction (depth layers).
[in]depthZDepth values [m] corresponding to z-layers.
[in]lengthXGrid spacing in the x-direction [m]; the domain spans (numX - 1) * lengthX, centred on x = 0.
[in]lengthYGrid spacing in the y-direction [m]; the domain spans (numY - 1) * lengthY, centred on y = 0.
Exceptions
std::invalid_argumentunless depthZ has numZ entries, at least two, finite and strictly increasing (calc::DepthAxis).

Member Function Documentation

◆ GetCurrent()

Status marenv::current::CurrentField3DArray::GetCurrent ( double  time,
const double  position[3],
double  currentVelocity[3] 
)
overridevirtual

Returns the ocean current velocity at a given position.

Parameters
[in]timeSimulation time [s].
[in]positionPosition (x,y,z) in meters where the current is queried.
[out]currentVelocityCurrent velocity vector [m/s] at the given position.
Returns
marenv::Status::OK inside the box and between the first and the last layer; Status::OUT_OF_RANGE_INACCURATE inside the box above the first or below the last layer (the current of that layer); Status::ERROR_NOT_SET and zero outside the box or for a NaN position.

Implements marenv::current::CurrentField.


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