actuationDiskSourceTemplates.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 2011-2013 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 "actuationDiskSource.H"
27 #include "volFields.H"
28 
29 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
30 
31 template<class RhoFieldType>
32 void Foam::fv::actuationDiskSource::addActuationDiskAxialInertialResistance
33 (
34  vectorField& Usource,
35  const labelList& cells,
36  const scalarField& Vcells,
37  const RhoFieldType& rho,
38  const vectorField& U
39 ) const
40 {
41  scalar a = 1.0 - Cp_/Ct_;
42  vector uniDiskDir = diskDir_/mag(diskDir_);
44  E.xx() = uniDiskDir.x();
45  E.yy() = uniDiskDir.y();
46  E.zz() = uniDiskDir.z();
47 
48  vector upU = vector(VGREAT, VGREAT, VGREAT);
49  scalar upRho = VGREAT;
50  if (upstreamCellId_ != -1)
51  {
52  upU = U[upstreamCellId_];
53  upRho = rho[upstreamCellId_];
54  }
55  reduce(upU, minOp<vector>());
56  reduce(upRho, minOp<scalar>());
57 
58  scalar T = 2.0*upRho*diskArea_*mag(upU)*a*(1 - a);
59 
60  forAll(cells, i)
61  {
62  Usource[cells[i]] += ((Vcells[cells[i]]/V())*T*E) & upU;
63  }
64 }
65 
66 
67 // ************************************************************************* //
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
scalar Cp_
Power coefficient.
dimensioned< scalar > mag(const dimensioned< Type > &)
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
Tensor< scalar > tensor
Tensor of scalars.
Definition: tensor.H:51
static const Tensor zero
Definition: Tensor.H:80
vector diskDir_
Disk area normal.
volVectorField vectorField(fieldObject, mesh)
label upstreamCellId_
Upstream cell ID.
scalar V() const
Return const access to the total cell volume.
#define forAll(list, i)
Definition: UList.H:421
List< label > labelList
A List of labels.
Definition: labelList.H:56
Vector< scalar > vector
A scalar version of the templated Vector.
Definition: vector.H:49
scalar Ct_
Thrust coefficient.
volScalarField scalarField(fieldObject, mesh)