FhSim  3.1.0
Marine systems simulation
Loading...
Searching...
No Matches
ElementWaterLoad.h
1#pragma once
2
22#include "cable/subroutines/CableHydrodynamics.h"
23#include "cable/subroutines/CableSurface.h"
24
25#include <sfh/constants.h>
26
27#include <Eigen/Eigen>
28
29#include <cmath>
30#include <fhsim_environment/EnvironmentProvider.h>
31
32namespace RbCable
33{
36{
37 double length;
38 double radius;
39 double tangential;
40 double normal;
41 double waterDensity = 1025.0;
42};
43
46{
47 Eigen::Vector3d force = Eigen::Vector3d::Zero();
48 double displacedMass = 0.0;
49};
50
61inline ElementWaterLoad WaterLoadOnElement(environment::EnvironmentProvider& environment, double T, const Eigen::Vector3d& P,
62 const Eigen::Vector3d& V, const Eigen::Vector3d& axis, const CylinderElement& element)
63{
64 using vec3 = Eigen::Vector3d;
66
67 const vec3 endA = P - 0.5 * element.length * axis;
68 const vec3 endB = P + 0.5 * element.length * axis;
69 const double f = cable_surface::CylinderWetFraction(environment, environment.MaxWaveElevation(), T, endA.data(), endB.data(), element.radius);
70 if (!(f > 0.0))
71 return load;
72
73 const double volume = sfh::pi * element.radius * element.radius * element.length;
74 load.displacedMass = element.waterDensity * volume * f;
75
76 double particleVelocity[3];
77 environment.GetParticleVelocity(T, P.data(), particleVelocity);
78 const vec3 relative = V - vec3(particleVelocity);
79 const vec3 tangent = relative.dot(axis) * axis;
80 const vec3 normal = relative - tangent;
81 load.force -= element.waterDensity * element.radius * element.length * f
82 * (sfh::pi * element.tangential * tangent.norm() * tangent + element.normal * normal.norm() * normal);
83
84 const auto waves = environment.GetWaves();
85 if (waves) {
86 double mean[3];
87 cable_surface::MeanWaveAcceleration(waves.get(), T, endA.data(), endB.data(), mean);
88 const vec3 a(mean);
89 double inertiaForce[3];
90 cable_hydrodynamics::MorisonInertiaForce(cable_hydrodynamics::InertiaForceFactor(element.waterDensity, volume, f, 0.0), a.data(), axis.data(), inertiaForce);
91 load.force += vec3(inertiaForce);
92 }
93 return load;
94}
95
96} // namespace RbCable
The cylinder an element is, and its drag coefficients.
Definition ElementWaterLoad.h:36
double length
The element length [m].
Definition ElementWaterLoad.h:37
double normal
Cn, on the flow normal to the axis.
Definition ElementWaterLoad.h:40
double radius
The element radius [m].
Definition ElementWaterLoad.h:38
double waterDensity
The water density [kg/m³].
Definition ElementWaterLoad.h:41
double tangential
Ct, on the flow along the axis.
Definition ElementWaterLoad.h:39
The water load on an element.
Definition ElementWaterLoad.h:46
double displacedMass
rho f V, the mass of the water the wet part displaces [kg]; its buoyancy is g times it,...
Definition ElementWaterLoad.h:48
Eigen::Vector3d force
The drag and the Froude-Krylov force [N], NED.
Definition ElementWaterLoad.h:47