FhSim  3.1.0
Marine systems simulation
Loading...
Searching...
No Matches
environment::wake::detail::WakeCaster Class Reference

#include <WakeCaster.h>

Public Member Functions

 WakeCaster (std::string name, const SourceSetWakeSettings &settings, double rho)
 
void Register (EnvironmentProvider &environment)
 
void Update (double T, const double *X, const WakeSourceSet &set, ISimObjectLogger &logger)
 
std::shared_ptr< marenv::wake::WakeField > Field () const
 The registered lumped field; null before Register().
 
std::shared_ptr< marenv::wake::WakeField > PrivateField () const
 The unregistered private per-source field; null before Register() and with WakeEvaluation::None.
 
marenv::wake::WakeQuery Query () const
 The query of the object's own sources: skip the lumped field, compose the private field in (C5); no own field with WakeEvaluation::None; skip the own jet (ExcludeJet()). It leaves no own source out: see OwnSources().
 
const OwnSourceMap & OwnSources () const
 
void ExcludeJet (const marenv::wake::JetField *jet)
 
const marenv::wake::LumpedSourceInput & LastLumpedInput () const
 The lumped-source input of the last rebuild: summed source force, U_ref, ρ, rear-face centre and W·H.
 
const marenv::wake::LumpedSourceResult & LastSource () const
 The lumped source of the last rebuild, after relaxation; casts is false once a failed current lookup has emptied the lumped field (MARE-0339).
 
const WakeSchedule & Schedule () const
 The schedule: rebuild count, Freeze state and the last change, the larger of max|ΔR| of the private field at the sources and |ΔM|/M of the lumped source (R121).
 
double LastRebuildSeconds () const
 Wall-clock duration of the last rebuild, s.
 
const double * SourceVelocity () const
 The filtered source velocity u_s, m/s, NED.
 
const marenv::wake::WakeFrame & LastFrame () const
 The frame of the last rebuild; all zero before the first.
 
const marenv::wake::GridSpec & LastGrid () const
 The private grid of the last Grid rebuild; all zero before the first.
 
double LastGridCutoff () const
 The cutoff of the last Grid rebuild's private grid; 0 before the first.
 

Detailed Description

Builds, schedules and publishes the private and the lumped wake of one object of many sources (design §3.2; plan §B4, §B6; phase F design §1).

Not thread-safe: Update() is called from PreOdeFcn, which FhSim runs serially. The fields it publishes are read concurrently (marenv threading contract).

Constructor & Destructor Documentation

◆ WakeCaster()

environment::wake::detail::WakeCaster::WakeCaster ( std::string  name,
const SourceSetWakeSettings &  settings,
double  rho 
)

Creates the caster.

Parameters
[in]nameName the lumped field is registered under, the SimObject name; the log prefix.
[in]settingsThe wake settings, from ReadSourceSetWakeSettings().
[in]rhoFluid density of the object's load law, kg/m³ (Rho).
Exceptions
std::invalid_argumentif rho is not positive.

Member Function Documentation

◆ ExcludeJet()

void environment::wake::detail::WakeCaster::ExcludeJet ( const marenv::wake::JetField *  jet)
inline

Leaves the object's own registered propeller jet out of every rebuild's free stream and out of Query() (D3, marenv ADR 0003).

The free stream of a rebuild adds the other objects' jets (owner ruling 2026-10-12); a self-propelled body's hull must not feel its own. Call after Register().

Parameters
[in]jetThe object's registered jet; null leaves out none.

◆ OwnSources()

const OwnSourceMap & environment::wake::detail::WakeCaster::OwnSources ( ) const
inline

Each sample point's own sources (MapOwnSources()) as of the last rebuild; empty before it and unless WakeEvaluation::Direct.

A sample point's query leaves them out of the private field (marenv::wake::WakeQuery::ownExcludedTags, ENV-0107, owner ruling 2026-10-13), so it never sees its own private source after overtaking its frozen wake. Only the Direct field leaves them out; a Grid field cannot (ENV-0107, ENV-0108). The map is rebuilt at every rebuild: do not keep a span of it across an Update().

◆ Register()

void environment::wake::detail::WakeCaster::Register ( EnvironmentProvider &  environment)

Registers the (still empty) lumped field in the environment and creates the private field, unless WakeEvaluation::None. Call from FinalSetup.

Parameters
[in]environmentThe environment; it must outlive the caster.

◆ Update()

void environment::wake::detail::WakeCaster::Update ( double  T,
const double *  X,
const WakeSourceSet &  set,
ISimObjectLogger &  logger 
)

Skips a step with a malformed source (ENV-0096) or a non-finite carrier (ENV-0074), filters the carrier velocities, checks the current lookups at the source position and the sources (a failure holds the wakes, MARE-0339), checks the Freeze re-arm against u_s and the ambient current at the source position, and rebuilds the wakes when due. Call from PreOdeFcn, after Register().

Parameters
[in]TSimulation time, s, at the start of the major step.
[in]XThe global state vector.
[in]setThe object's sources.
[in]loggerReceives the rebuild, freeze, re-arm, skip, widening, resolution, malformed-source, non-finite and failed-lookup lines.
Exceptions
std::logic_errorbefore Register(); BodyWake logs an Update before its Register instead (ENV-0102).

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