FhSim  3.1.0
Marine systems simulation
Loading...
Searching...
No Matches
WetCylinderWater.h
1#pragma once
2
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>
19
20#include <sfh/constants.h>
21
22#include <marenv/marenv.h>
23
24#include <Eigen/Eigen>
25
26#include <optional>
27
28namespace wet_cylinder_water
29{
32{
33 double wetFraction;
34 environment::wet_cylinder::Vector waterVelocity;
35 std::optional<environment::wet_cylinder::Vector> waveAcceleration;
36};
37
50inline WaterAtElement SampleWater(const environment::wake::ElementFlowInteraction& flow, double T, const double centre[3], const double axis[3], double length, double radius, int point)
51{
52 environment::EnvironmentProvider& environment = *flow.Environment();
53 WaterAtElement water;
54 water.waterVelocity = {0.0, 0.0, 0.0};
55 flow.WaterVelocity(T, point, centre, water.waterVelocity.data());
56
57 const double half = 0.5 * length;
58 const double endA[3] = {centre[0] - half * axis[0], centre[1] - half * axis[1], centre[2] - half * axis[2]};
59 const double endB[3] = {centre[0] + half * axis[0], centre[1] + half * axis[1], centre[2] + half * axis[2]};
60 water.wetFraction = environment::body_submergence::CylinderWetFraction(environment, environment.MaxWaveElevation(), T, endA, endB, radius);
61 const auto waves = environment.GetWaves();
62 if (waves && water.wetFraction > 0.0) {
63 environment::wet_cylinder::Vector mean;
64 environment::body_submergence::MeanWaveAcceleration(waves.get(), T, endA, endB, mean.data());
65 water.waveAcceleration = mean;
66 }
67 return water;
68}
69
72{
73 double length;
74 double radius;
75 double tangential;
76 double normal;
78};
79
82{
83 Eigen::Vector3d force = Eigen::Vector3d::Zero();
84 double displacedMass = 0.0;
85};
86
102inline FixedDragLoad FixedDragLoadOnElement(const environment::wake::ElementFlowInteraction& flow, double T, const Eigen::Vector3d& P, const Eigen::Vector3d& V,
103 const Eigen::Vector3d& axis, const FixedDragElement& element, int point)
104{
105 using environment::wet_cylinder::Vector;
106 FixedDragLoad load;
107 const auto water = SampleWater(flow, T, P.data(), axis.data(), element.length, element.radius, point);
108 const double f = water.wetFraction;
109 if (!(f > 0.0))
110 return load;
111
112 environment::wet_cylinder::WetCylinder cylinder {};
113 cylinder.length = element.length;
114 cylinder.radius = element.radius;
115 cylinder.volume = sfh::pi * element.radius * element.radius * element.length;
116 cylinder.waterDensity = element.waterDensity;
117 cylinder.addedMassCoefficient = 0.0;
118 load.displacedMass = element.waterDensity * cylinder.volume * f;
119
120 const Vector unitAxis {axis(0), axis(1), axis(2)};
121 const Vector relative {V(0) - water.waterVelocity[0], V(1) - water.waterVelocity[1], V(2) - water.waterVelocity[2]};
122 const Vector drag = environment::wet_cylinder::Drag(cylinder, environment::wet_cylinder::DragCoefficients {element.normal, element.tangential}, f, relative, unitAxis);
123 load.force += Eigen::Vector3d(drag.data());
124 if (water.waveAcceleration)
125 load.force += Eigen::Vector3d(environment::wet_cylinder::MorisonForce(cylinder, f, *water.waveAcceleration, unitAxis).data());
126 return load;
127}
128} // namespace wet_cylinder_water
constexpr double seawaterDensity
Ocean water density.
Definition marenv.h:20
A cylinder element with fixed drag coefficients (RbCable/6DofCable, RbCable/Ring).
Definition WetCylinderWater.h:72
double radius
The element radius [m].
Definition WetCylinderWater.h:74
double normal
Cn, on the flow normal to the axis.
Definition WetCylinderWater.h:76
double waterDensity
The water density [kg/m³].
Definition WetCylinderWater.h:77
double tangential
Ct, on the skin area π D L, on the flow along the axis.
Definition WetCylinderWater.h:75
double length
The element length [m].
Definition WetCylinderWater.h:73
The water load on an element with fixed drag coefficients.
Definition WetCylinderWater.h:82
double displacedMass
ρ f V, the mass of the water the wet part displaces [kg]; its buoyancy is g times it,...
Definition WetCylinderWater.h:84
Eigen::Vector3d force
The drag and the Froude-Krylov force [N], NED.
Definition WetCylinderWater.h:83
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