|
FhSim
3.1.0
Marine systems simulation
|
#include <DepthLayeredScalarField.h>
Inheritance diagram for marenv::field::DepthLayeredScalarField:
Collaboration diagram for marenv::field::DepthLayeredScalarField:Public Member Functions | |
| DepthLayeredScalarField (std::string name, Quantity quantity, std::string unit, std::vector< double > depthZ, std::vector< double > values, std::vector< Property > properties={}) | |
| ~DepthLayeredScalarField () override=default | |
| Default destructor. | |
| marenv::Status | GetValue (double time, const double position[3], double &value) const override |
| bool | IsTimeInvariant () const override |
| bool | IsThreadSafe () const override |
Public Member Functions inherited from marenv::field::ScalarField | |
| virtual | ~ScalarField ()=default |
| Virtual destructor. | |
| virtual void | GetValues (double time, std::span< const std::array< double, 3 > > positions, std::span< double > values, std::span< marenv::Status > statuses) const |
| const std::string & | Name () const |
| Quantity | GetQuantity () const |
| const std::string & | Unit () const |
| const std::vector< Property > & | Properties () const |
| bool | Has (const std::string &key) const |
| double | Get (const std::string &key, double fallback=0.0) const |
| const std::string & | Species () const |
| void | SetSpecies (std::string species) |
Additional Inherited Members | |
Protected Member Functions inherited from marenv::field::ScalarField | |
| ScalarField (std::string name, Quantity quantity, std::string unit, std::vector< Property > properties) | |
A scalar field defined by a vertical profile, linearly interpolated between layers.
Models thermocline- and halocline-style vertical structure, or the vertical distribution of a species: the value is given at a set of strictly increasing depths and interpolated linearly in between. Horizontal position and time have no effect.
The profile is marenv::calc::DepthProfile, the stack's one depth profile (owner ruling R122, W-30), which marenv::current::DepthVaryingCurrentField uses as well. Outside the layer range the value is clamped to the shallowest or deepest layer and marenv::Status::OUT_OF_RANGE_INACCURATE is returned: a temperature of 0 degC or a salinity of 0 PSU would be physically misleading. A NaN depth gives marenv::Status::ERROR_NOT_SET and the value 0.
Depths are in the NED frame, so they are positive downwards. Unlike marenv::current::DepthVaryingCurrentField the profile is not clamped at the surface, so a layer may sit at a negative depth, above mean sea level and inside the wave zone.
| marenv::field::DepthLayeredScalarField::DepthLayeredScalarField | ( | std::string | name, |
| Quantity | quantity, | ||
| std::string | unit, | ||
| std::vector< double > | depthZ, | ||
| std::vector< double > | values, | ||
| std::vector< Property > | properties = {} |
||
| ) |
Constructs a depth-layered scalar field.
| [in] | name | Unique field name. Must not be empty. |
| [in] | quantity | Advisory tag describing what the field measures. |
| [in] | unit | Unit of values, e.g. "degC". May be empty. |
| [in] | depthZ | Depth [m] of each layer, positive down, strictly increasing. At least two entries. |
| [in] | values | Value at each layer. Same length as depthZ. |
| [in] | properties | Static properties. Keys must be unique and non-empty. |
| std::invalid_argument | if depthZ and values differ in length, if fewer than two layers are given, if the depths are not strictly increasing, if a depth or a value is not finite (ENV-0060), if name is empty, or if a property key is empty or repeated. |
|
overridevirtual |
Returns the profile value at the depth of position, ignoring x, y and time.
Returns the scalar value at a given position and time.
| [in] | time | Simulation time [s]. |
| [in] | position | Position in the NED frame [x, y, z] [m]. |
| [out] | value | The value at the given time and position. |
Implements marenv::field::ScalarField.
|
inlineoverridevirtual |
GetValue reads only the immutable profile.
Reimplemented from marenv::field::ScalarField.
|
inlineoverridevirtual |
The profile is fixed at construction, so the value ignores time.
Reimplemented from marenv::field::ScalarField.