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

#include <WakeAccumulator.h>

Public Member Functions

double Add (const WakeField &field, double t, const double pos[3])
 
double Add (const WakeSample &sample)
 
double Add (const WakeSampleParts &parts, double t)
 
double AddOwn (const WakeField &field, double t, const double pos[3])
 
double AddOwn (const WakeSample &sample)
 
double AddOwn (const WakeSampleParts &parts, double t)
 
WakeComposition Result () const
 The composed deficit, the deficit-weighted source velocity (zero without a deficit) and the number of contributing fields.
 

Detailed Description

Running composition of wakes at one point: the rule of WakeRegistry::Compose() (owner rulings R88, R95).

Each added deficit is clamped to [0, 1]; a zero or NaN deficit, or a field that answers a status other than Status::OK, adds nothing (MENV-0020). The registered (Add()) deficits compose by the momentum-flux rule, D (1 - D) = sum d_i (1 - d_i) (MomentumFluxSum); the own deficit (AddOwn(), a net's private per-panel field, normalised by its local, shaded inflow) multiplies onto them, d_tot = 1 - (1 - D) (1 - d_own); the source velocity is the deficit-weighted mean of all of them. WakeRegistry::Compose() is this accumulator over the registered fields in registration order, then the own field, so a caller that holds samples (fhsim_environment's held sums, R46) or pre-samples (a caster's rebuild) gets the same result bit for bit when it adds them in that order. Held parts (WakeField::SampleParts()) add by the same rule, composed at the evaluation time with the live blend weight (R136).

Example usage:

for (const auto& field : selected)
wake.Add(*field, t, pos);
wake.AddOwn(*privateField, t, pos);
wake.Result().Apply(velocity);
Definition WakeAccumulator.h:52
WakeComposition Result() const
The composed deficit, the deficit-weighted source velocity (zero without a deficit) and the number of...
double AddOwn(const WakeField &field, double t, const double pos[3])
double Add(const WakeField &field, double t, const double pos[3])
void Apply(double vel[3]) const
Applies the wake in place to a water velocity: vel += d_tot (u_s - vel).
Definition WakeAccumulator.h:21

Member Function Documentation

◆ Add() [1/3]

double marenv::wake::WakeAccumulator::Add ( const WakeField &  field,
double  t,
const double  pos[3] 
)

Samples a registered field at pos and adds its deficit (momentum-flux rule).

Returns
The deficit added, clamped to [0, 1]; 0 when the field adds nothing.

◆ Add() [2/3]

double marenv::wake::WakeAccumulator::Add ( const WakeSample &  sample)

Adds the deficit and source velocity of a registered field sampled earlier (with Status::OK).

Returns
The deficit added, clamped to [0, 1]; 0 when it adds nothing.

◆ Add() [3/3]

double marenv::wake::WakeAccumulator::Add ( const WakeSampleParts &  parts,
double  t 
)

Adds a registered field's parts held from an earlier sample, composed at t (owner ruling R136; WakeField::SampleParts()).

Returns
The deficit added, clamped to [0, 1]; 0 when it adds nothing, as Add(field, t, pos) for a status other than OK.

◆ AddOwn() [1/3]

double marenv::wake::WakeAccumulator::AddOwn ( const WakeField &  field,
double  t,
const double  pos[3] 
)

Samples the own field at pos and multiplies its deficit onto the composition (product rule).

Returns
The deficit added, clamped to [0, 1]; 0 when the field adds nothing.
Exceptions
std::logic_errorif an own field was added already.

◆ AddOwn() [2/3]

double marenv::wake::WakeAccumulator::AddOwn ( const WakeSample &  sample)

Adds the own field's deficit and source velocity sampled earlier (with Status::OK).

Returns
The deficit added, clamped to [0, 1]; 0 when it adds nothing.
Exceptions
std::logic_errorif an own field was added already.

◆ AddOwn() [3/3]

double marenv::wake::WakeAccumulator::AddOwn ( const WakeSampleParts &  parts,
double  t 
)

Adds the own field's parts held from an earlier sample, composed at t (owner ruling R136).

Returns
The deficit added, clamped to [0, 1]; 0 when it adds nothing.
Exceptions
std::logic_errorif an own field was added already.

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