|
FhSim
3.1.0
Marine systems simulation
|
#include <WaterMapFields.h>
Inheritance diagram for environment::WaterMapCurrent:
Collaboration diagram for environment::WaterMapCurrent:Public Member Functions | |
| WaterMapCurrent (std::shared_ptr< const WaterMap > map, std::shared_ptr< marenv::seafloor::BathymetryField > seafloor, std::shared_ptr< const Tide > tide=nullptr) | |
| marenv::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. | |
The surface flow of a water map as a current (Current.WaterMap; river and sheltered-water plan, Phase 2).
The map's flow (north, east) at the surface, with a 1/7 power-law profile over the local water depth from the bathymetry: u(d) = u_surface (1 - d / h)^(1/7) at the depth d below the surface, zero below the seabed. Where the depth is unknown (or not positive) the profile is uniform. No vertical velocity. Outside the map, and where it has no flow, zero: the field is added to the configured current (marenv's facade sums its current fields), so give the map no flow where the configured current already describes the water.
| environment::WaterMapCurrent::WaterMapCurrent | ( | std::shared_ptr< const WaterMap > | map, |
| std::shared_ptr< marenv::seafloor::BathymetryField > | seafloor, | ||
| std::shared_ptr< const Tide > | tide = nullptr |
||
| ) |
| [in] | map | The water map (shared, read-only). |
| [in] | seafloor | The bathymetry for the depth profile; may be null (uniform profile). |
| [in] | tide | The tidal level the depths are measured from; may be null (z = 0). |
|
overridevirtual |
Return the ocean current velocity in a given position and time.
| [in] | time | Time stamp in simulation time. |
| [in] | position | The position to query for. |
| [out] | currentVelocity | The velocity of the ocean current in the given time and position. |
Threading contract, for every implementation: GetCurrent() may be called from several threads at once (a visualiser sampling in parallel while the simulation waits), so it must not change the field's state; it is non-const for historical reasons only. A field may read state the simulation writes between steps, so it need not be safe against a writer. Registration (EnvironmentFacade::AddCurrentField()) happens during setup.
Order rule (owner ruling D46): the answer depends only on time, position and state that is fixed during a step. A field that depends on simulation state (a propeller jet that follows its propeller) reads its own copy of that state, written between steps (for example in AcceptedStep), never members that port functions or OdeFcn write during the step. Such a field lags the simulation by one step, the same for any number of threads.
Implements marenv::current::CurrentField.