FhSim  3.1.0
Marine systems simulation
Loading...
Searching...
No Matches
environment::NetCageWakeField Class Reference

#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 &region) const
 

Detailed Description

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.

Member Typedef Documentation

◆ AmbientCurrentFunction

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.

Constructor & Destructor Documentation

◆ NetCageWakeField()

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.

Parameters
[in]posCage position in NED frame [x, y, z] [m]; z is the depth the wake geometry is measured from.
[in]fullWakeDepthDepth of the full wake region below the cage position [m].
[in]fullWakeDiameterDiameter of the full wake region [m].
[in]wakeAngleWake spreading half-angle from the downstream cage axis [rad].
[in]initialBoundaryLayerInitial boundary layer thickness [m].
[in]maxDeficitDeficit in the full wake region, in [0, 1] (XML MaxDeficit).
[in]deficitCutoffDeficit below which the far wake is cut off, sizing the bounding box (XML DeficitCutoff). Must be > 0.
[in]ambientCurrentAmbient current at a point; gives the wake axis. Must not be empty.
Exceptions
std::invalid_argumentif 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_errorif the bounding box does not converge.

Member Function Documentation

◆ Sample()

marenv::Status environment::NetCageWakeField::Sample ( double  time,
const double  pos[3],
marenv::wake::WakeSample &  out 
) const
overridevirtual

Returns the wake deficit and source velocity at a point (marenv contract C4).

Parameters
[in]timeSimulation time [s]; passed to the ambient current function.
[in]posQuery position in NED frame [x, y, z] [m].
[out]outDeficit 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.
Returns
marenv::Status::OK, or the status of the ambient current function when marenv::IsUsable rejects it (out is then zero).

Implements marenv::wake::WakeField.

◆ SetPosition()

void environment::NetCageWakeField::SetPosition ( const double  pos[3])

Move the cage.

Parameters
[in]posPosition in NED frame [x, y, z] [m].

Safe to call while other threads call Sample().


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