|
FhSim
3.1.0
Marine systems simulation
|
#include <NetCageWakeField.h>
Inheritance diagram for environment::NetCageWakeField:
Collaboration diagram for environment::NetCageWakeField:Public Types | |
| using | AmbientCurrentFunction = std::function< marenv::Status(double time, const double pos[3], double vel[3])> |
Public Member Functions | |
| NetCageWakeField (const double pos[3], double fullWakeDepth, double fullWakeDiameter, double wakeAngle, double initialBoundaryLayer, double maxDeficit, double deficitCutoff, AmbientCurrentFunction ambientCurrent) | |
| void | SetPosition (const double pos[3]) |
| marenv::Status | Sample (double time, const double pos[3], marenv::wake::WakeSample &out) const override |
Public Member Functions inherited from marenv::wake::WakeField | |
| virtual WakeSampleParts | SampleParts (double t, const double pos[3]) const |
| virtual bool | MayReach (const WakeQueryRegion ®ion) const |
Wake of a moored net cage, as a velocity deficit behind the cage.
Legacy (pre-4.0) and test-only: kept for TestNetcageWake and its pinned numbers, without momentum or images (owner ruling R127). New code casts a lumped wake (environment::wake::LumpedWakeCaster) or places a PorousDiscWakeSource.
Models the reduction of the current downstream of a net cage with a geometric wake of two zones: a full-wake region immediately behind the cage and a tapering region further downstream. The wake spreads at a configurable angle, and the deficit decays from the cage boundary.
In the marenv 2.0 convention (marenv doc/adr/0001) the field returns a velocity deficit d in [0, 1] and the source velocity u_s, and the environment composes the waked current as u = u_amb + d (u_s - u_amb). The cage is moored, so u_s = 0 and the waked current is (1 - d) u_amb: the same numbers the pre-4.0 GetCurrentVelocityFactor gave, whose "factor" the facade applied as vel *= 1 - factor. The velocity ratio is r = 1 - d.
The wake axis is the horizontal direction of the relative flow at the cage, the ambient current at the cage position minus u_s, which the field asks for through the ambient current function passed at construction. Where that flow is below 1 mm/s, or the current lookup fails (a status marenv::IsUsable rejects), the field casts no wake; a clamped current (OUT_OF_RANGE_INACCURATE, a depth profile beyond its layers) is usable (owner ruling R122).
Internal to the library's test models since owner ruling R127: the header is not installed. Depths are measured from the cage position m_pos[2]; points above the sea surface (pos[2] < 0) are never waked.
Positions outside the bounding box (computed from the deficit cutoff) get d = 0.
Sample() is const and thread-safe. SetPosition() may be called while other threads sample: the position is published as an immutable snapshot and swapped atomically, so a Sample sees either the old or the new position, never a mix.
| using environment::NetCageWakeField::AmbientCurrentFunction = std::function<marenv::Status(double time, const double pos[3], double vel[3])> |
Returns the ambient current, without any wake, at a point.
The signature of environment::EnvironmentProvider::GetAmbientCurrent. It must be safe to call from several threads at once and must not itself sample wake fields.
| environment::NetCageWakeField::NetCageWakeField | ( | const double | pos[3], |
| double | fullWakeDepth, | ||
| double | fullWakeDiameter, | ||
| double | wakeAngle, | ||
| double | initialBoundaryLayer, | ||
| double | maxDeficit, | ||
| double | deficitCutoff, | ||
| AmbientCurrentFunction | ambientCurrent | ||
| ) |
Construct the wake geometry and deficit parameters.
| [in] | pos | Cage position in NED frame [x, y, z] [m]; z is the depth the wake geometry is measured from. |
| [in] | fullWakeDepth | Depth of the full wake region below the cage position [m]. |
| [in] | fullWakeDiameter | Diameter of the full wake region [m]. |
| [in] | wakeAngle | Wake spreading half-angle from the downstream cage axis [rad]. |
| [in] | initialBoundaryLayer | Initial boundary layer thickness [m]. |
| [in] | maxDeficit | Deficit in the full wake region, in [0, 1] (XML MaxDeficit). |
| [in] | deficitCutoff | Deficit below which the far wake is cut off, sizing the bounding box (XML DeficitCutoff). Must be > 0. |
| [in] | ambientCurrent | Ambient current at a point; gives the wake axis. Must not be empty. |
| std::invalid_argument | if ambientCurrent is empty, wakeAngle is not in (0, π/2), fullWakeDiameter is not finite and positive, or initialBoundaryLayer or fullWakeDepth is negative or not finite (ENV-0058). |
| std::runtime_error | if the bounding box does not converge. |
|
overridevirtual |
Returns the wake deficit and source velocity at a point (marenv contract C4).
| [in] | time | Simulation time [s]; passed to the ambient current function. |
| [in] | pos | Query position in NED frame [x, y, z] [m]. |
| [out] | out | Deficit in [0, 1] and source velocity, which is zero for the moored cage. The deficit is 0 above the sea surface, outside the bounding box and when the horizontal relative flow at the cage is below 1 mm/s. |
Implements marenv::wake::WakeField.
| void environment::NetCageWakeField::SetPosition | ( | const double | pos[3] | ) |
Move the cage.
| [in] | pos | Position in NED frame [x, y, z] [m]. |
Safe to call while other threads call Sample().