FhSim  3.1.0
Marine systems simulation
Loading...
Searching...
No Matches
marenv::wake::WakeRegistry Class Reference

#include <WakeRegistry.h>

+ Inheritance diagram for marenv::wake::WakeRegistry:
+ Collaboration diagram for marenv::wake::WakeRegistry:

Public Member Functions

void Add (const std::string &id, std::shared_ptr< WakeField > field)
 
void Remove (const std::string &id)
 
bool Has (const std::string &id) const
 Whether a field is registered under id.
 
std::shared_ptr< WakeField > Get (const std::string &id) const
 
std::vector< std::string > Ids () const
 The identifiers in registration order.
 
std::vector< std::shared_ptr< const WakeField > > SelectReaching (const WakeQueryRegion &region, const WakeField *exclude=nullptr) const
 
WakeComposition Compose (double time, const double pos[3], const WakeQuery &query={}) const
 

Detailed Description

The wake fields registered in an environment, in registration order, and the rule that composes them.

Registration order is the composition order, so the result is the same on every platform (MENV-0035). Registration (Add, Remove) happens during setup only and is not synchronised; Compose() and SelectReaching() are const and thread-safe against concurrent updates of the fields themselves (see WakeField::Sample).

Composition. Every field is sampled at the point. A field that returns a status other than Status::OK (Status::ERROR_NOT_SET outside the field) contributes nothing; a returned deficit is clamped to [0, 1], and a zero or NaN deficit contributes nothing (MENV-0020). The registered fields compose by the momentum-flux rule, d_tot (1 - d_tot) = sum d_i (1 - d_i) where that has a root below the branch deficit, else the capped linear sum or 1/2 (owner ruling R95; MomentumFluxSum), with the source velocity u_s the deficit-weighted mean of the u_s,i. A WakeQuery::own field, a net's private per-panel field whose sources are normalised by their local, already shaded inflow (doc/wake.md section 4), is multiplied onto that composition: d_tot = 1 - (1 - D) (1 - d_own) (R88, R95). The deficit acts on the velocity relative to the source, u = u_amb + d_tot (u_s - u_amb) (ADR 0001), whether or not a current is present.

Member Function Documentation

◆ Add()

void marenv::wake::WakeRegistry::Add ( const std::string &  id,
std::shared_ptr< WakeField >  field 
)

Registers a wake field.

Parameters
[in]idUnique identifier.
[in]fieldThe field; kept alive by the registry.
Exceptions
std::invalid_argumentif id is already registered.

◆ Compose()

WakeComposition marenv::wake::WakeRegistry::Compose ( double  time,
const double  pos[3],
const WakeQuery &  query = {} 
) const

Composes the wake fields of the query at one point.

Parameters
[in]timeSimulation time, s.
[in]posPosition (x,y,z), m, NED.
[in]queryWhich registered field to skip and which unregistered field to add; the default composes all registered fields.
Returns
The combined deficit, source velocity and number of contributing fields; deficit 0 when none contributes.

◆ Get()

std::shared_ptr< WakeField > marenv::wake::WakeRegistry::Get ( const std::string &  id) const

Returns the field registered under id.

Exceptions
std::invalid_argumentif id is not registered.

◆ Remove()

void marenv::wake::WakeRegistry::Remove ( const std::string &  id)

Removes a wake field.

Exceptions
std::invalid_argumentif id is not registered.

◆ SelectReaching()

std::vector< std::shared_ptr< const WakeField > > marenv::wake::WakeRegistry::SelectReaching ( const WakeQueryRegion &  region,
const WakeField *  exclude = nullptr 
) const

Returns the registered fields that may reach a region, read-only (owner decision R47, MENV-0058).

Parameters
[in]regionThe sphere and time interval of the caller's queries, and the cutoff.
[in]excludeA registered field to leave out, such as the caller's own lumped field; null leaves out none.
Returns
The fields other than exclude for which WakeField::MayReach(region) is true, in registry order.

A structure calls it once per step, after the fields have been published for the step, with a sphere that holds all its query points over the step. It composes the returned fields, sampled at its points, with a WakeAccumulator in the returned order, and adds its own (unregistered) field last with WakeAccumulator::AddOwn(). With region.cutoff = 0 (the exact tier) a query at a point of the sphere and a time of the interval gives bit for bit the result of composing every field. With region.cutoff > 0 (the cutoff tier) each left-out field has d < cutoff there, so d_tot changes by less than the cutoff times the number of fields left out, over 1 - 2 min(d_tot, kMomentumFluxBranchDeficit) (the largest slope of the momentum-flux rule there, R95; at most 10 times the cutoff per field). A field published after the call, or registered after it, is not accounted for.


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