basic.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-2015 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 "basic.H"
29 
30 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
31 
32 namespace Foam
33 {
34 namespace PDRDragModels
35 {
36  defineTypeNameAndDebug(basic, 0);
37  addToRunTimeSelectionTable(PDRDragModel, basic, dictionary);
38 }
39 }
40 
41 
42 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
43 
44 Foam::PDRDragModels::basic::basic
45 (
46  const dictionary& PDRProperties,
48  const volScalarField& rho,
49  const volVectorField& U,
50  const surfaceScalarField& phi
51 )
52 :
53  PDRDragModel(PDRProperties, turbulence, rho, U, phi),
54  Csu("Csu", dimless, PDRDragModelCoeffs_),
55  Csk("Csk", dimless, PDRDragModelCoeffs_),
56 
57  Aw_
58  (
59  IOobject
60  (
61  "Aw",
62  U_.mesh().facesInstance(),
63  U_.mesh(),
64  IOobject::MUST_READ,
65  IOobject::NO_WRITE
66  ),
67  U_.mesh()
68  ),
69 
70  CR_
71  (
72  IOobject
73  (
74  "CR",
75  U_.mesh().facesInstance(),
76  U_.mesh(),
77  IOobject::MUST_READ,
78  IOobject::NO_WRITE
79  ),
80  U_.mesh()
81  )
82 {}
83 
84 
85 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
86 
88 {}
89 
90 
91 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
92 
94 {
95  tmp<volSymmTensorField> tDragDcu
96  (
98  (
99  IOobject
100  (
101  "tDragDcu",
102  U_.mesh().time().constant(),
103  U_.mesh(),
106  ),
107  U_.mesh(),
109  (
110  "zero",
112  pTraits<symmTensor>::zero
113  ),
114  zeroGradientFvPatchSymmTensorField::typeName
115  )
116  );
117 
118  volSymmTensorField& DragDcu = tDragDcu();
119 
120  if (on_)
121  {
122  const volScalarField& betav =
123  U_.db().lookupObject<volScalarField>("betav");
124 
125  DragDcu =
126  (0.5*rho_)*CR_*mag(U_) + (Csu*I)*betav*turbulence_.muEff()*sqr(Aw_);
127  }
128 
129  return tDragDcu;
130 }
131 
132 
134 {
135  tmp<volScalarField> tGk
136  (
137  new volScalarField
138  (
139  IOobject
140  (
141  "tGk",
142  U_.mesh().time().constant(),
143  U_.mesh(),
146  ),
147  U_.mesh(),
148  dimensionedScalar("zero", dimMass/dimLength/pow(dimTime, 3), 0.0),
149  zeroGradientFvPatchVectorField::typeName
150  )
151  );
152 
153  volScalarField& Gk = tGk();
154 
155  if (on_)
156  {
157  const volScalarField& betav =
158  U_.db().lookupObject<volScalarField>("betav");
159 
160  const volSymmTensorField& CT =
161  U_.db().lookupObject<volSymmTensorField>("CT");
162 
163  Gk =
164  (0.5*rho_)*mag(U_)*(U_ & CT & U_)
165  + Csk*betav*turbulence_.muEff()*sqr(Aw_)*magSqr(U_);
166  }
167 
168  return tGk;
169 }
170 
171 
172 bool Foam::PDRDragModels::basic::read(const dictionary& PDRProperties)
173 {
174  PDRDragModel::read(PDRProperties);
175 
176  PDRDragModelCoeffs_.lookup("Csu") >> Csu.value();
177  PDRDragModelCoeffs_.lookup("Csk") >> Csk.value();
178 
179  return true;
180 }
181 
182 
184 {
185  Aw_.write();
186  CR_.write();
187 }
188 
189 // ************************************************************************* //
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
dimensioned< scalar > mag(const dimensioned< Type > &)
dimensioned< scalar > magSqr(const dimensioned< Type > &)
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
Definition: dimensionSets.H:51
static const sphericalTensor I(1)
virtual ~basic()
Destructor.
autoPtr< compressible::turbulenceModel > turbulence
Definition: createFields.H:23
dynamicFvMesh & mesh
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
Definition: dimensionSets.H:50
RASModel< EddyDiffusivity< turbulenceModel > > RASModel
Namespace for OpenFOAM.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:52
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
const Type & lookupObject(const word &name) const
Lookup and return the object of the given Type.
virtual bool read()
Read object.
const dimensionSet dimMass(1, 0, 0, 0, 0, 0, 0)
Definition: dimensionSets.H:49
Macros for easy insertion into run-time selection tables.
GeometricField< symmTensor, fvPatchField, volMesh > volSymmTensorField
Definition: volFieldsFwd.H:58
surfaceScalarField & phi
GeometricField< vector, fvPatchField, volMesh > volVectorField
Definition: volFieldsFwd.H:55
virtual tmp< volSymmTensorField > Dcu() const
Return the momentum drag coefficient.
void writeFields() const
Write fields.
dimensioned< symmTensor > dimensionedSymmTensor
Dimensioned tensor obtained from generic dimensioned type.
virtual tmp< volScalarField > Gk() const
Return the momentum drag turbulence generation rate.
const dimensionSet dimless(0, 0, 0, 0, 0, 0, 0)
Definition: dimensionSets.H:47
dimensionedSymmTensor sqr(const dimensionedVector &dv)
const objectRegistry & db() const
Return the local objectRegistry.
Definition: IOobject.C:245
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
A class for managing temporary objects.
Definition: PtrList.H:118
U
Definition: pEqn.H:82
defineTypeNameAndDebug(combustionModel, 0)