FreeFOAM The Cross-Platform CFD Toolkit
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) 2010-2010 OpenCFD Ltd.
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 the
13  Free Software Foundation; either version 3 of the License, or (at your
14  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, write to the Free Software Foundation,
23  Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24 
25 \*----------------------------------------------------------------------------*/
26 
27 #include "actuationDiskSource.H"
28 #include <finiteVolume/volFields.H>
29 #include <finiteVolume/fvMatrix.H>
30 #include <finiteVolume/fvm.H>
31 
32 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
33 
34 template<class RhoFieldType>
35 void Foam::actuationDiskSource::addActuationDiskAxialInertialResistance
36 (
37  vectorField& Usource,
38  const labelList& cells,
39  const scalarField& V,
40  const RhoFieldType& rho,
41  const vectorField& U
42 ) const
43 {
44  scalar a = 1.0 - Cp_/Ct_;
45  scalar totVol = 0.0;
46  scalarField T(cells.size());
47  vector uniDiskDir = diskDir_/mag(diskDir_);
49  E.xx() = uniDiskDir.x();
50  E.yy() = uniDiskDir.y();
51  E.zz() = uniDiskDir.z();
52  vectorField U1 = (1.0 - a)*U;
53  forAll(cells, i)
54  {
55  totVol += V[cells[i]];
56  T[i] = 2.0*rho[cells[i]]*diskArea_*mag(U1[cells[i]])*a/(1.0 - a);
57  }
58  forAll(cells, i)
59  {
60  Usource[cells[i]] += ((V[cells[i]]/totVol)*T[i]*E) & U1[cells[i]];
61  }
62 }
63 
64 
65 // ************************************************************************* //