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>
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_);
43  tensor E(tensor::zero);
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 // ************************************************************************* //
volFields.H
Foam::Tensor
Templated 3D tensor derived from VectorSpace adding construction from 9 components,...
Definition: complexI.H:224
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:406
Foam::minOp
Definition: ops.H:173
Foam::mag
dimensioned< scalar > mag(const dimensioned< Type > &)
U
U
Definition: pEqn.H:46
Foam::reduce
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
Definition: PstreamReduceOps.H:43
Foam::Field
Pre-declare SubField and related Field type.
Definition: Field.H:57
Foam::Tensor::yy
const Cmpt & yy() const
Definition: TensorI.H:188
Foam::Tensor::zz
const Cmpt & zz() const
Definition: TensorI.H:216
Foam::Vector::x
const Cmpt & x() const
Definition: VectorI.H:65
Foam::Vector::z
const Cmpt & z() const
Definition: VectorI.H:77
Foam::vector
Vector< scalar > vector
A scalar version of the templated Vector.
Definition: vector.H:49
rho
rho
Definition: pEqn.H:3
Foam::Tensor::xx
const Cmpt & xx() const
Definition: TensorI.H:160
Foam::fv::actuationDiskSource::addActuationDiskAxialInertialResistance
void addActuationDiskAxialInertialResistance(vectorField &Usource, const labelList &cells, const scalarField &V, const RhoFieldType &rho, const vectorField &U) const
Add resistance to the UEqn.
Definition: actuationDiskSourceTemplates.C:33
T
const volScalarField & T
Definition: createFields.H:25
Foam::Vector< scalar >
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:59
Foam::Vector::y
const Cmpt & y() const
Definition: VectorI.H:71
cells
const cellShapeList & cells
Definition: gmvOutputHeader.H:3
actuationDiskSource.H