basic.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) 2011-2018 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"
28 
29 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
30 
31 namespace Foam
32 {
33 namespace PDRDragModels
34 {
35  defineTypeNameAndDebug(basic, 0);
36  addToRunTimeSelectionTable(PDRDragModel, basic, dictionary);
37 }
38 }
39 
40 
41 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
42 
44 (
45  const dictionary& PDRProperties,
47  const volScalarField& rho,
48  const volVectorField& U,
49  const surfaceScalarField& phi
50 )
51 :
52  PDRDragModel(PDRProperties, turbulence, rho, U, phi),
53  Csu("Csu", dimless, PDRDragModelCoeffs_),
54  Csk("Csk", dimless, PDRDragModelCoeffs_),
55 
56  Aw_
57  (
58  IOobject
59  (
60  "Aw",
61  U_.mesh().facesInstance(),
62  U_.mesh(),
63  IOobject::MUST_READ,
64  IOobject::NO_WRITE
65  ),
66  U_.mesh()
67  ),
68 
69  CR_
70  (
71  IOobject
72  (
73  "CR",
74  U_.mesh().facesInstance(),
75  U_.mesh(),
76  IOobject::MUST_READ,
77  IOobject::NO_WRITE
78  ),
79  U_.mesh()
80  )
81 {}
82 
83 
84 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
85 
87 {}
88 
89 
90 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
91 
93 {
94  tmp<volSymmTensorField> tDragDcu
95  (
97  (
98  "tDragDcu",
99  U_.mesh(),
101  (
103  Zero
104  )
105  )
106  );
107 
108  volSymmTensorField& DragDcu = tDragDcu.ref();
109 
110  if (on_)
111  {
112  const volScalarField& betav =
113  U_.db().lookupObject<volScalarField>("betav");
114 
115  DragDcu =
116  (0.5*rho_)*CR_*mag(U_) + (Csu*I)*betav*turbulence_.muEff()*sqr(Aw_);
117  }
118 
119  return tDragDcu;
120 }
121 
122 
124 {
125  tmp<volScalarField> tGk
126  (
128  (
129  "tGk",
130  U_.mesh(),
132  )
133  );
134 
135  volScalarField& Gk = tGk.ref();
136 
137  if (on_)
138  {
139  const volScalarField& betav =
140  U_.db().lookupObject<volScalarField>("betav");
141 
142  const volSymmTensorField& CT =
143  U_.db().lookupObject<volSymmTensorField>("CT");
144 
145  Gk =
146  (0.5*rho_)*mag(U_)*(U_ & CT & U_)
147  + Csk*betav*turbulence_.muEff()*sqr(Aw_)*magSqr(U_);
148  }
149 
150  return tGk;
151 }
152 
153 
154 bool Foam::PDRDragModels::basic::read(const dictionary& PDRProperties)
155 {
156  PDRDragModel::read(PDRProperties);
157 
158  PDRDragModelCoeffs_.lookup("Csu") >> Csu.value();
159  PDRDragModelCoeffs_.lookup("Csk") >> Csk.value();
160 
161  return true;
162 }
163 
164 
166 {
167  Aw_.write();
168  CR_.write();
169 }
170 
171 // ************************************************************************* //
GeometricField< symmTensor, fvPatchField, volMesh > volSymmTensorField
Definition: volFieldsFwd.H:61
virtual bool read()
Read object.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
static tmp< GeometricField< symmTensor, fvPatchField, volMesh > > New(const word &name, const Internal &, const PtrList< fvPatchField< symmTensor >> &)
Return a temporary field constructed from name,.
virtual ~basic()
Destructor.
GeometricField< vector, fvPatchField, volMesh > volVectorField
Definition: volFieldsFwd.H:58
const Type & lookupObject(const word &name) const
Lookup and return the object of the given Type.
virtual tmp< volSymmTensorField > Dcu() const
Return the momentum drag coefficient.
Macros for easy insertion into run-time selection tables.
phi
Definition: pEqn.H:104
void writeFields() const
Write fields.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:57
virtual tmp< volScalarField > Gk() const
Return the momentum drag turbulence generation rate.
dynamicFvMesh & mesh
static const Identity< scalar > I
Definition: Identity.H:93
static const zero Zero
Definition: zero.H:97
dimensioned< scalar > magSqr(const dimensioned< Type > &)
Info<< "Reading field U\"<< endl;volVectorField U(IOobject("U", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE), mesh);volScalarField rho(IOobject("rho", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::AUTO_WRITE), thermo.rho());volVectorField rhoU(IOobject("rhoU", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::NO_WRITE), rho *U);volScalarField rhoE(IOobject("rhoE", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::NO_WRITE), rho *(e+0.5 *magSqr(U)));surfaceScalarField pos(IOobject("pos", runTime.timeName(), mesh), mesh, dimensionedScalar(dimless, 1.0));surfaceScalarField neg(IOobject("neg", runTime.timeName(), mesh), mesh, dimensionedScalar(dimless, -1.0));surfaceScalarField phi("phi", fvc::flux(rhoU));Info<< "Creating turbulence model\"<< endl;autoPtr< compressible::momentumTransportModel > turbulence(compressible::momentumTransportModel::New(rho, U, phi, thermo))
Definition: createFields.H:94
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
basic(const dictionary &PDRProperties, const compressible::RASModel &turbulence, const volScalarField &rho, const volVectorField &U, const surfaceScalarField &phi)
Construct from components.
defineTypeNameAndDebug(combustionModel, 0)
dimensioned< symmTensor > dimensionedSymmTensor
Dimensioned tensor obtained from generic dimensioned type.
Internal & ref()
Return a reference to the dimensioned internal field.
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
U
Definition: pEqn.H:72
const dimensionSet dimless(0, 0, 0, 0, 0, 0, 0)
Definition: dimensionSets.H:47
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
Definition: dimensionSets.H:50
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
Definition: dimensionSets.H:51
dimensioned< scalar > mag(const dimensioned< Type > &)
const dimensionSet dimMass(1, 0, 0, 0, 0, 0, 0)
Definition: dimensionSets.H:49
A class for managing temporary objects.
Definition: PtrList.H:53
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
const objectRegistry & db() const
Return the local objectRegistry.
Definition: IOobject.C:322
RASModel< momentumTransportModel > RASModel
Typedefs for turbulence, RAS and LES models for compressible flow based on the standard laminar trans...
Namespace for OpenFOAM.