15#include <fhsim_environment/ElementFlowInteraction.h>
16#include <fhsim_environment/EnvironmentProvider.h>
17#include <fhsim_environment/hydrodynamics/BodySubmergence.h>
18#include <fhsim_environment/hydrodynamics/WetCylinderLaw.h>
20#include <sfh/constants.h>
22#include <marenv/marenv.h>
28namespace wet_cylinder_water
49inline WaterAtElement SampleWaterGivenVelocity(
const environment::wake::ElementFlowInteraction& flow,
double T,
const double centre[3],
const double axis[3],
double length,
double radius,
50 const environment::wet_cylinder::Vector& waterVelocity)
52 environment::EnvironmentProvider& environment = *flow.Environment();
56 const double half = 0.5 * length;
57 const double endA[3] = {centre[0] - half * axis[0], centre[1] - half * axis[1], centre[2] - half * axis[2]};
58 const double endB[3] = {centre[0] + half * axis[0], centre[1] + half * axis[1], centre[2] + half * axis[2]};
59 water.
wetFraction = environment::body_submergence::CylinderWetFraction(environment, environment.MaxWaveElevation(), T, endA, endB, radius);
60 const auto waves = environment.GetWaves();
62 environment::wet_cylinder::Vector mean;
63 environment::body_submergence::MeanWaveAcceleration(waves.get(), T, endA, endB, mean.data());
81inline WaterAtElement SampleWater(
const environment::wake::ElementFlowInteraction& flow,
double T,
const double centre[3],
const double axis[3],
double length,
double radius,
int point)
83 environment::wet_cylinder::Vector waterVelocity = {0.0, 0.0, 0.0};
84 flow.WaterVelocity(T, point, centre, waterVelocity.data());
85 return SampleWaterGivenVelocity(flow, T, centre, axis, length, radius, waterVelocity);
102 Eigen::Vector3d
force = Eigen::Vector3d::Zero();
103 Eigen::Vector3d
moment = Eigen::Vector3d::Zero();
130inline FixedDragLoad FixedDragLoadOnElement(
const environment::wake::ElementFlowInteraction& flow,
double T,
const Eigen::Vector3d& P,
const Eigen::Vector3d& V,
131 const Eigen::Vector3d& axis,
const FixedDragElement& element,
int point,
const Eigen::Vector3d& angularVelocity = Eigen::Vector3d::Zero(),
132 const environment::wet_cylinder::EndWater* gaussWater =
nullptr)
134 using environment::wet_cylinder::Vector;
136 const auto water = gaussWater ? SampleWaterGivenVelocity(flow, T, P.data(), axis.data(), element.
length, element.
radius, gaussWater->Mean())
137 : SampleWater(flow, T, P.data(), axis.data(), element.
length, element.
radius, point);
142 environment::wet_cylinder::WetCylinder cylinder {};
143 cylinder.length = element.
length;
144 cylinder.radius = element.
radius;
149 load.
addedMass = environment::wet_cylinder::AddedMass(cylinder, f);
151 const Vector unitAxis {axis(0), axis(1), axis(2)};
154 const environment::wet_cylinder::WetCylinderState state {f, {V(0), V(1), V(2)}, water.
waterVelocity, {angularVelocity(0), angularVelocity(1), angularVelocity(2)}, unitAxis, water.
waveAcceleration};
155 load.
force += Eigen::Vector3d(environment::wet_cylinder::CoriolisForce(cylinder, state).data());
157 const environment::wet_cylinder::DragCoefficients model {element.
normal, element.
tangential};
159 const auto gauss = environment::wet_cylinder::GaussPointDragLoad(cylinder, model, f, {V(0), V(1), V(2)}, {angularVelocity(0), angularVelocity(1), angularVelocity(2)}, unitAxis, *gaussWater);
160 load.
force += Eigen::Vector3d(gauss.force.data());
161 load.
moment += Eigen::Vector3d(gauss.moment.data());
163 const Vector drag = environment::wet_cylinder::Drag(cylinder, model, f, relative, unitAxis);
164 load.
force += Eigen::Vector3d(drag.data());
167 load.
force += Eigen::Vector3d(environment::wet_cylinder::MorisonForce(cylinder, f, *water.
waveAcceleration, unitAxis).data());
constexpr double seawaterDensity
Ocean water density.
Definition marenv.h:20
A cylinder element with fixed drag coefficients (RbCable/6DofCable, RbCable/Ring).
Definition WetCylinderWater.h:90
double addedMassCoefficient
Ca: 0 for an element whose inertia has no added mass (the default), kCylinderAddedMassCoefficient for...
Definition WetCylinderWater.h:96
double radius
The element radius [m].
Definition WetCylinderWater.h:92
double normal
Cn, on the flow normal to the axis.
Definition WetCylinderWater.h:94
double waterDensity
The water density [kg/m³].
Definition WetCylinderWater.h:95
double tangential
Ct, on the skin area π D L, on the flow along the axis.
Definition WetCylinderWater.h:93
double length
The element length [m].
Definition WetCylinderWater.h:91
The water load on an element with fixed drag coefficients.
Definition WetCylinderWater.h:101
double addedMass
m_a = Ca ρ f V [kg], normal to the axis, for the element's inertia; 0 at Ca = 0.
Definition WetCylinderWater.h:105
double displacedMass
ρ f V, the mass of the water the wet part displaces [kg]; its buoyancy is g times it,...
Definition WetCylinderWater.h:104
Eigen::Vector3d force
The drag, the Morison inertia force and the Coriolis force of the added mass [N], NED.
Definition WetCylinderWater.h:102
Eigen::Vector3d moment
The drag moment about the centre [N m]; only with the Gauss-point drag (MARE-0396),...
Definition WetCylinderWater.h:103
The wet fraction, the water velocity and the wave acceleration at one element.
Definition WetCylinderWater.h:32
double wetFraction
f in [0, 1].
Definition WetCylinderWater.h:33
std::optional< environment::wet_cylinder::Vector > waveAcceleration
The mean of the ends [m/s²]; none without waves or when dry.
Definition WetCylinderWater.h:35
environment::wet_cylinder::Vector waterVelocity
u at the centre [m/s].
Definition WetCylinderWater.h:34