propellerDiskTemplates.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2024-2025 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
26 #include "propellerDisk.H"
27 #include "fvMatrix.H"
28 #include "pimpleNoLoopControl.H"
29 #include "mathematicalConstants.H"
30 
31 using namespace Foam::constant::mathematical;
32 
33 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
34 
35 template<class AlphaFieldType, class RhoFieldType>
36 void Foam::fv::propellerDisk::addActuationDiskAxialInertialResistance
37 (
38  vectorField& Usource,
39  const AlphaFieldType& alpha,
40  const RhoFieldType& rho,
42 ) const
43 {
44  const labelList& cells = zone_.zone();
45  const scalarField& V = mesh().V();
46 
47  if (!forcePtr_.valid())
48  {
49  forcePtr_ = new volVectorField::Internal
50  (
51  IOobject
52  (
53  typedName("force"),
54  mesh().time().name(),
55  mesh(),
58  ),
59  mesh(),
60  dimensionedVector(rho.dimensions()*U.dimensions()/dimTime, Zero)
61  );
62  }
63 
64  volVectorField::Internal& force = forcePtr_();
65 
66  const vector centre(this->centre());
67  const vector normal(this->normal());
68  const scalar delta = diskThickness(centre);
69 
70  // hub radius
71  const scalar rHub = 0.5*dHub_;
72 
73  // propeller radius
74  const scalar rProp = 0.5*dProp_;
75 
76  // Disk area
77  const scalar A = (rProp - rHub)*(rProp - rHub)*pi;
78 
79  // Get reference to the n value
80  const scalar& n = this->n();
81 
82  // Evaluate advance number J,
83  // the volumetric mean advance speed of the disk
84  const scalar J = this->J(U, normal);
85 
86  // Calculate the mean velocity through the disk
87  const scalar Udisk = n*dProp_*J;
88 
89  // ... and the volumetric flux through the disk
90  const scalar phiDisk = Udisk*A;
91 
92  if (phiDisk > small)
93  {
94  // Correction of advance number J based on mometum theory
95  // using the propeller curve Kt(J) and Kq(J)
96 
97  vector2D KtandKq(propellerFunction_->value(J));
98  scalar Kt = KtandKq.x();
99  scalar Kq = KtandKq.y();
100 
101  // Evaluate thrust based on Kt
102  // Thrust units are force/rho = [m^4/s^2]
103  scalar T = Kt*sqr(n)*pow4(dProp_);
104 
105  // Correction for speed based on momentum theory
106  const scalar Ucorr = T/(2*phiDisk);
107  const scalar Jcorr = (Udisk - Ucorr)/(n*dProp_);
108 
109  // Update Kt and Kq based on the corrected J value
110  KtandKq = propellerFunction_->value(Jcorr);
111  Kt = KtandKq.x();
112  Kq = KtandKq.y();
113  T = Kt*sqr(n)*pow4(dProp_);
114  const scalar Q = Kq*sqr(n)*pow5(dProp_);
115 
116  // Correct the rotation speed from the current propulsion force
117  correctn(T);
118 
119  // Distribute momentum source
120 
121  const scalar Ax =
122  (105/8.0)*T/(delta*pi*(rProp - rHub)*(3*rHub + 4*rProp));
123  const scalar At =
124  (105/8.0)*Q/(delta*pi*rProp*(rProp - rHub)*(3*rHub + 4*rProp));
125 
126  force_ = Zero;
127  moment_ = Zero;
128 
129  forAll(cells, i)
130  {
131  const label celli = cells[i];
132 
133  const vector r = mesh().cellCentres()[celli] - centre;
134  const scalar magr = mag(r);
135 
136  if (magr > rHub)
137  {
138  const scalar rPrime = magr/rProp;
139  const scalar rHubPrime = rHub/rProp;
140 
141  // Normalised radius
142  const scalar rStar =
143  min((rPrime - rHubPrime)/(1 - rHubPrime), 1);
144 
145  const scalar Faxial = Ax*rStar*sqrt(1 - rStar);
146  const scalar Ftangential =
147  At*rStar*sqrt(1 - rStar)
148  /(rStar*(1 - rHubPrime) + rHubPrime);
149 
150  // A unit normal vector to the direction of the tangent
151  const vector radiusOrtho = normalised(r ^ normal);
152  const vector rotationVector = radiusOrtho*rotationDir_;
153 
154  force[celli] =
155  alpha[celli]*rho[celli]
156  *(Faxial*normal + Ftangential*rotationVector);
157 
158  const vector Vfi(V[celli]*force[celli]);
159 
160  // Integrate the net force and moment
161  // of the fluid on the propeller
162  force_ += Vfi;
163  moment_ += r ^ Vfi;
164 
165  Usource[celli] += Vfi;
166  }
167  }
168 
169  reduce(force_, sumOp<vector>());
170  reduce(moment_, sumOp<vector>());
171 
172  if
173  (
174  mesh().lookupObject<pimpleNoLoopControl>("solutionControl")
175  .finalIter()
176  )
177  {
178  if (logFile_.valid())
179  {
180  logFile_->writeTime
181  (
182  n,
183  J,
184  Jcorr,
185  Udisk,
186  Ucorr,
187  Kt,
188  Kq,
189  T,
190  Q,
191  force_,
192  moment_
193  );
194  }
195  }
196  }
197 }
198 
199 
200 // ************************************************************************* //
scalar delta
label n
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:433
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
DimensionedField< Type, GeoMesh, PrimitiveField > Internal
Type of the internal field from which this GeometricField is derived.
const DimensionedField< scalar, volMesh > & V() const
Return cell volumes.
const vectorField & cellCentres() const
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
const cellShapeList & cells
U
Definition: pEqn.H:72
volScalarField alpha(IOobject("alpha", runTime.name(), mesh, IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE), lambda *max(Ua &U, zeroSensitivity))
mathematical constants.
static const coefficient A("A", dimPressure, 611.21)
Vector2D< scalar > vector2D
vector2D obtained from generic Vector2D
Definition: vector2D.H:49
static const zero Zero
Definition: zero.H:97
List< label > labelList
A List of labels.
Definition: labelList.H:56
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
void T(LagrangianPatchField< Type > &f, const LagrangianPatchField< Type > &f1)
void pow4(LagrangianPatchField< scalar > &f, const LagrangianPatchField< scalar > &f1)
void mag(LagrangianPatchField< scalar > &f, const LagrangianPatchField< Type > &f1)
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
layerAndWeight min(const layerAndWeight &a, const layerAndWeight &b)
const dimensionSet dimTime
Vector< scalar > vector
A scalar version of the templated Vector.
Definition: vector.H:49
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
void pow5(LagrangianPatchField< scalar > &f, const LagrangianPatchField< scalar > &f1)
dimensionSet normalised(const dimensionSet &)
Definition: dimensionSet.C:507
word typedName(Name name)
Return the name of the object within the given type.
Definition: typeInfo.H:181
dimensioned< vector > dimensionedVector
Dimensioned vector obtained from generic dimensioned type.
Field< vector > vectorField
Specialisation of Field<T> for vector.
void sqr(LagrangianPatchField< typename outerProduct< Type, Type >::type > &f, const LagrangianPatchField< Type > &f1)
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
void sqrt(LagrangianPatchField< scalar > &f, const LagrangianPatchField< scalar > &f1)