FhSim  3.1.0
Marine systems simulation
Loading...
Searching...
No Matches
WaterVelocity.h
1#pragma once
4
5#include <marenv/wake/WakeTypes.h> // WakeComposition
6
7namespace marenv
8{
18{
19 Full,
20 NoWaves,
21 NoWakes,
23};
24
33{
34 bool current = true;
35 bool wakes = true;
36 bool jets = true;
37 bool waves = true;
38};
39
42{
43 switch (terms) {
45 return {true, true, true, false};
47 return {true, false, false, true};
49 return {true, false, false, false};
51 default:
52 return {true, true, true, true};
53 }
54}
55
68inline void SumWaterVelocity(const WaterVelocityParts& parts, const double ambient[3], const wake::WakeComposition* wake, const double waveVel[3], double velOut[3])
69{
70 double vel[3] = {0.0, 0.0, 0.0};
71 if (parts.current)
72 for (int i = 0; i < 3; ++i)
73 vel[i] = ambient[i];
74 if (wake) {
75 if (parts.wakes)
76 for (int i = 0; i < 3; ++i)
77 vel[i] += wake->deficit * (wake->sourceVelocity[i] - ambient[i]);
78 if (wake->numJets > 0)
79 for (int i = 0; i < 3; ++i)
80 vel[i] += wake->jetVelocity[i];
81 }
82 for (int i = 0; i < 3; ++i)
83 velOut[i] = parts.waves ? vel[i] + waveVel[i] : vel[i];
84}
85} // namespace marenv
WaterVelocityTerms
Definition WaterVelocity.h:18
@ CurrentOnly
The ambient current alone: fhsim_environment's GetAmbientCurrent().
@ NoWakes
Current and waves, no wake.
@ Full
Current, wakes and waves: EnvironmentFacade::GetParticleVelocity().
@ NoWaves
Current and wakes: EnvironmentFacade::GetCurrentVelocity().
The marenv root namespace.
Definition CastPath.h:36
constexpr WaterVelocityParts PartsOf(WaterVelocityTerms terms)
The parts of a terms selection: the jets go with the wakes (Full: all four; NoWaves: no waves; NoWake...
Definition WaterVelocity.h:41
void SumWaterVelocity(const WaterVelocityParts &parts, const double ambient[3], const wake::WakeComposition *wake, const double waveVel[3], double velOut[3])
Definition WaterVelocity.h:68
Definition WaterVelocity.h:33
bool waves
The wave particle velocity.
Definition WaterVelocity.h:37
bool jets
The jets' excess velocity sum Δu_j.
Definition WaterVelocity.h:36
bool wakes
The change of the wake fields, d_tot (u_s - u_amb).
Definition WaterVelocity.h:35
bool current
The ambient current u_amb.
Definition WaterVelocity.h:34
Definition WakeTypes.h:138
double sourceVelocity[3]
Deficit-weighted mean of the source velocities u_s,i, m/s, NED; zero when d_tot = 0.
Definition WakeTypes.h:140
int numJets
Number of jet fields with a finite, non-zero excess velocity.
Definition WakeTypes.h:143
double deficit
d_tot = 1 - (1 - D) (1 - d_own), D the momentum-flux composition of the registered d_i (R95),...
Definition WakeTypes.h:139
double jetVelocity[3]
Sum of the jet fields' excess velocities Δu_j, m/s, NED (ADR 0003).
Definition WakeTypes.h:142