58#include "../hydrodynamics/PanelLoadTypes.h"
60#include <fhsim/ISimObjectLogger.h>
61#include <fhsim_environment/EnvironmentProvider.h>
62#include <fhsim_environment/WakeCaster.h>
63#include <fhsim_environment/WakeSchedule.h>
64#include <marenv/EnvironmentFacade.h>
65#include <marenv/wake/LumpedSource.h>
66#include <marenv/wake/WakeField.h>
67#include <marenv/wake/WakeTypes.h>
71class ISimObjectCreator;
77using WakeUpdate = environment::wake::WakeUpdate;
80using WakeEvaluation = environment::wake::WakeEvaluation;
83using WakeSettings = environment::wake::SourceSetWakeSettings;
91inline WakeSettings ReadWakeSettings(ISimObjectCreator* creator)
93 return environment::wake::ReadSourceSetWakeSettings(creator);
121 virtual void NodePosition(
const double* X,
int node,
double pos[3])
const = 0;
123 virtual void NodeVelocity(
const double* X,
int node,
double vel[3])
const = 0;
127 virtual void CableNodes(
int ,
int nodes[2])
const { nodes[0] = nodes[1] = 0; }
151 force[0] = force[1] = force[2] = 0.0;
166void PanelCentroid(
const WakePanelSource& structure,
const double* X,
int panel,
double centroid[3],
double (*corners)[3] =
nullptr);
180 : m_structure(structure)
184 int NumCarriers()
const override {
return m_structure.
NumNodes(); }
185 void CarrierPosition(
const double* X,
int carrier,
double pos[3])
const override { m_structure.
NodePosition(X, carrier, pos); }
186 void CarrierVelocity(
const double* X,
int carrier,
double vel[3])
const override { m_structure.
NodeVelocity(X, carrier, vel); }
187 int NumSources()
const override {
return m_structure.
NumPanels(); }
188 int SourceCarriers(
int source,
int carriers[3])
const override;
190 double SourceArea(
const double* X,
int source)
const override;
192 environment::wake::SourceLoad
EvaluateSource(
const double* X,
int source,
const double sourceVel[3],
const double waterVel[3])
const override;
195 const char* SourceNoun()
const override {
return "panels"; }
196 const char* ObjectNoun()
const override {
return "net"; }
232 void Register(environment::EnvironmentProvider& environment) { m_caster.Register(environment); }
247 std::shared_ptr<marenv::wake::WakeField>
LumpedField()
const {
return m_caster.LumpedField(); }
249 std::shared_ptr<marenv::wake::WakeField>
PrivateField()
const {
return m_caster.PrivateField(); }
259 int NumRebuilds()
const {
return m_caster.Schedule().NumRebuilds(); }
261 bool Frozen()
const {
return m_caster.Schedule().Frozen(); }
263 double LastChange()
const {
return m_caster.Schedule().LastChange(); }
277 environment::wake::WakeCaster m_caster;
278 bool m_updateBeforeRegisterLogged =
false;
Definition NetWakeCaster.h:216
double LastRebuildSeconds() const
Wall-clock duration of the last rebuild, s.
Definition NetWakeCaster.h:265
const marenv::wake::LumpedSourceResult & LastLumpedSource() const
The lumped source of the last rebuild, after relaxation; casts is false once a failed current lookup ...
Definition NetWakeCaster.h:256
const marenv::wake::WakeFrame & LastFrame() const
The frame of the last rebuild; all zero before the first.
Definition NetWakeCaster.h:269
NetWakeCaster(std::string name, const WakeSettings &settings, double rho)
bool Frozen() const
True while Freeze holds the wakes fixed.
Definition NetWakeCaster.h:261
std::shared_ptr< marenv::wake::WakeField > PrivateField() const
The unregistered private per-panel field; null before Register().
Definition NetWakeCaster.h:249
double LastGridCutoff() const
The cutoff of the last Grid rebuild's private grid; 0 before the first.
Definition NetWakeCaster.h:273
void Update(double T, const double *X, const WakePanelSource &structure, ISimObjectLogger &logger)
double LastChange() const
The change between the last two rebuilds of the current Freeze round, the larger of max|ΔR| of the pr...
Definition NetWakeCaster.h:263
const marenv::wake::GridSpec & LastGrid() const
The private grid of the last Grid rebuild; all zero before the first.
Definition NetWakeCaster.h:271
const double * SourceVelocity() const
The filtered source velocity u_s, m/s, NED.
Definition NetWakeCaster.h:267
void Register(environment::EnvironmentProvider &environment)
Definition NetWakeCaster.h:232
std::shared_ptr< marenv::wake::WakeField > LumpedField() const
The registered lumped field; null before Register().
Definition NetWakeCaster.h:247
int NumRebuilds() const
Rebuilds done so far.
Definition NetWakeCaster.h:259
const marenv::wake::LumpedSourceInput & LastLumpedInput() const
The lumped-source input of the last rebuild: panel force, U_ref, ρ, rear-face centre and W·H.
Definition NetWakeCaster.h:254
marenv::wake::WakeQuery PanelQuery() const
The query of the structure's own panels: skip the lumped field, compose the private field in (C5).
Definition NetWakeCaster.h:251
Definition NetWakeCaster.h:176
environment::wake::SourceLoad EvaluateSource(const double *X, int source, const double sourceVel[3], const double waterVel[3]) const override
WakePanelSource::EvaluatePanel as a SourceLoad: force, momentum deficit, area and solidity.
PanelSourceSet(const WakePanelSource &structure)
Definition NetWakeCaster.h:179
int NumSamplePoints() const override
The panels, then the cable elements.
Definition NetWakeCaster.h:198
std::string DescribeRebuild(double T, const double *X, const marenv::wake::LumpedSourceInput &lumped) const override
A sentence on the drag of the structure's cables, which the lumped source leaves out; empty without c...
double SourceArea(const double *X, int source) const override
Half the norm of (c1 − c0) × (c2 − c0) of the corners PanelCentroid takes [m²].
int SamplePointCarriers(int point, int carriers[3]) const override
A panel's three nodes, or a cable element's two (point NumPanels() + cable).
Definition NetWakeCaster.h:110
virtual void PanelNodes(int panel, int nodes[3]) const =0
The three nodes of a panel.
virtual int NumNodes() const =0
Number of nodes.
virtual void NodeVelocity(const double *X, int node, double vel[3]) const =0
Velocity of a node, m/s, NED.
virtual int NumPanels() const =0
Number of panels.
virtual PanelEvaluation EvaluatePanel(const double *X, int panel, const double elementVel[3], const double waterVel[3]) const =0
virtual int NumCables() const
Number of cable elements; the caster does not use them, NetFlowInteraction samples the flow at their ...
Definition NetWakeCaster.h:125
virtual void CableHydrodynamicForce(double T, const double *X, double force[3]) const
Definition NetWakeCaster.h:149
virtual void NodePosition(const double *X, int node, double pos[3]) const =0
Position of a node, m, NED.
virtual void CableNodes(int, int nodes[2]) const
The two nodes of a cable element.
Definition NetWakeCaster.h:127
The result of evaluating a load law on one panel.
Definition PanelLoadTypes.h:93
Definition WakeTypes.h:77
Definition LumpedSource.h:66
Definition WakeTypes.h:66
Definition WakeRegistry.h:24
A panel load and the solidity the load law was evaluated with.
Definition NetWakeCaster.h:98
double area
The panel's own area, m².
Definition NetWakeCaster.h:100
hydrodynamics::PanelLoad< double > load
The panel load; its momentum deficit is the source strength.
Definition NetWakeCaster.h:99
double solidity
The solidity of the wake source's MF2022 Eq. 11 near wake: S_c (net_solidity::WakeSolidity,...
Definition NetWakeCaster.h:101