FhSim  3.1.0
Marine systems simulation
Loading...
Searching...
No Matches
PanelFormulas.h
1#pragma once
2
16#include "PanelLoadTypes.h"
17
18#include <cmath>
19
20namespace hydrodynamics
21{
22namespace panel_formulas
23{
24
30template<class T>
31T CylinderDragCoefficient(const T& re)
32{
33 using std::log10;
34
35 const double coefficients[8] = {-78.46675, 254.73873, -327.8864, 223.64577, -87.92234,
36 20.00769, -2.44894, 0.12479};
37
38 const T x = log10(re);
39 T cd = T(coefficients[7]);
40 for (int i = 6; i >= 0; i--) {
41 cd = cd * x + coefficients[i];
42 }
43 return cd;
44}
45
46
57template<class T>
58T VelocityReductionFactor(const T& solidity, unsigned& flags)
59{
60 const T ratio = 1.08 - 0.97 * solidity;
61 if (ratio > 1.0) {
62 flags |= kPanelFlagVelocityRatioClamped;
63 return T(1.0);
64 }
65 return ratio;
66}
67
68
70template<class T>
71T VelocityReductionFactor(const T& solidity)
72{
73 unsigned ignoredFlags = 0u;
74 return VelocityReductionFactor(solidity, ignoredFlags);
75}
76
77} // namespace panel_formulas
78} // namespace hydrodynamics