phasePressureModel.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) 2013-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 "phasePressureModel.H"
27 #include "twoPhaseSystem.H"
28 
29 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
30 
32 (
33  const volScalarField& alpha,
34  const volScalarField& rho,
35  const volVectorField& U,
36  const surfaceScalarField& alphaRhoPhi,
37  const surfaceScalarField& phi,
38  const transportModel& phase,
39  const word& propertiesName,
40  const word& type
41 )
42 :
43  eddyViscosity
44  <
46  >
47  (
48  type,
49  alpha,
50  rho,
51  U,
52  alphaRhoPhi,
53  phi,
54  phase,
55  propertiesName
56  ),
57 
58  phase_(phase),
59 
60  alphaMax_(readScalar(coeffDict_.lookup("alphaMax"))),
61  preAlphaExp_(readScalar(coeffDict_.lookup("preAlphaExp"))),
62  expMax_(readScalar(coeffDict_.lookup("expMax"))),
63  g0_
64  (
65  "g0",
66  dimensionSet(1, -1, -2, 0, 0),
67  coeffDict_.lookup("g0")
68  )
69 {
70  nut_ == dimensionedScalar("zero", nut_.dimensions(), 0.0);
71 
72  if (type == typeName)
73  {
74  printCoeffs(type);
75  }
76 }
77 
78 
79 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
80 
82 {}
83 
84 
85 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
86 
88 {
89  if
90  (
91  eddyViscosity
92  <
93  RASModel<EddyDiffusivity<phaseCompressibleTurbulenceModel> >
94  >::read()
95  )
96  {
97  coeffDict().lookup("alphaMax") >> alphaMax_;
98  coeffDict().lookup("preAlphaExp") >> preAlphaExp_;
99  coeffDict().lookup("expMax") >> expMax_;
100  g0_.readIfPresent(coeffDict());
101 
102  return true;
103  }
104  else
105  {
106  return false;
107  }
108 }
109 
110 
113 {
115  return nut_;
116 }
117 
118 
121 {
123  return nut_;
124 }
125 
126 
129 {
130  return tmp<volSymmTensorField>
131  (
133  (
134  IOobject
135  (
136  IOobject::groupName("R", U_.group()),
137  runTime_.timeName(),
138  mesh_,
141  ),
142  mesh_,
143  dimensioned<symmTensor>
144  (
145  "R",
146  dimensionSet(0, 2, -2, 0, 0),
148  )
149  )
150  );
151 }
152 
153 
156 {
157  tmp<volScalarField> tpPrime
158  (
159  g0_
160  *min
161  (
162  exp(preAlphaExp_*(alpha_ - alphaMax_)),
163  expMax_
164  )
165  );
166 
167  volScalarField::GeometricBoundaryField& bpPrime = tpPrime().boundaryField();
168 
169  forAll(bpPrime, patchi)
170  {
171  if (!bpPrime[patchi].coupled())
172  {
173  bpPrime[patchi] == 0;
174  }
175  }
176 
177  return tpPrime;
178 }
179 
180 
183 {
184  tmp<surfaceScalarField> tpPrime
185  (
186  g0_
187  *min
188  (
189  exp(preAlphaExp_*(fvc::interpolate(alpha_) - alphaMax_)),
190  expMax_
191  )
192  );
193 
194  surfaceScalarField::GeometricBoundaryField& bpPrime =
195  tpPrime().boundaryField();
196 
197  forAll(bpPrime, patchi)
198  {
199  if (!bpPrime[patchi].coupled())
200  {
201  bpPrime[patchi] == 0;
202  }
203  }
204 
205  return tpPrime;
206 }
207 
208 
211 {
212  return tmp<volSymmTensorField>
213  (
215  (
216  IOobject
217  (
218  IOobject::groupName("devRhoReff", U_.group()),
219  runTime_.timeName(),
220  mesh_,
223  ),
224  mesh_,
225  dimensioned<symmTensor>
226  (
227  "R",
228  rho_.dimensions()*dimensionSet(0, 2, -2, 0, 0),
230  )
231  )
232  );
233 }
234 
235 
238 (
240 ) const
241 {
242  return tmp<fvVectorMatrix>
243  (
244  new fvVectorMatrix
245  (
246  U,
247  rho_.dimensions()*dimensionSet(0, 4, -2, 0, 0)
248  )
249  );
250 }
251 
252 
254 {}
255 
256 
257 // ************************************************************************* //
Foam::IOobject::groupName
static word groupName(Name name, const word &group)
Foam::RASModels::phasePressureModel::divDevRhoReff
virtual tmp< fvVectorMatrix > divDevRhoReff(volVectorField &U) const
Return the source term for the momentum equation.
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:406
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:118
phi
surfaceScalarField & phi
Definition: setRegionFluidFields.H:8
Foam::constant::atomic::alpha
const dimensionedScalar alpha
Fine-structure constant: default SI units: [].
Definition: readThermalProperties.H:216
Foam::read
bool read(const char *, int32_t &)
Definition: int32IO.C:87
Foam::fvc::interpolate
tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > interpolate(const GeometricField< Type, fvPatchField, volMesh > &vf, const surfaceScalarField &faceFlux, Istream &schemeData)
Interpolate field onto faces using scheme given by Istream.
Definition: surfaceInterpolate.C:110
Foam::phaseCompressibleTurbulenceModel
ThermalDiffusivity< PhaseCompressibleTurbulenceModel< phaseModel > > phaseCompressibleTurbulenceModel
Typedef for phaseCompressibleTurbulenceModel.
Definition: phaseCompressibleTurbulenceModel.H:45
Foam::exp
dimensionedScalar exp(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:252
Foam::RASModels::phasePressureModel::phasePressureModel
phasePressureModel(const phasePressureModel &)
Disallow default bitwise copy construct.
Foam::IOobject::NO_WRITE
@ NO_WRITE
Definition: IOobject.H:118
Foam::RASModels::phasePressureModel::k
virtual tmp< volScalarField > k() const
Return the turbulence kinetic energy.
Foam::RASModels::phasePressureModel::~phasePressureModel
virtual ~phasePressureModel()
Destructor.
U
U
Definition: pEqn.H:46
Foam::RASModels::phasePressureModel::pPrime
virtual tmp< volScalarField > pPrime() const
Return the phase-pressure'.
NotImplemented
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:365
Foam::fvVectorMatrix
fvMatrix< vector > fvVectorMatrix
Definition: fvMatricesFwd.H:45
Foam::RASModels::phasePressureModel::pPrimef
virtual tmp< surfaceScalarField > pPrimef() const
Return the face-phase-pressure'.
Foam::volSymmTensorField
GeometricField< symmTensor, fvPatchField, volMesh > volSymmTensorField
Definition: volFieldsFwd.H:58
Foam::IOobject::NO_READ
@ NO_READ
Definition: IOobject.H:111
Foam::dimensionedScalar
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
Definition: dimensionedScalarFwd.H:41
Foam::volScalarField
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:52
Foam::SymmTensor< scalar >::zero
static const SymmTensor zero
Definition: SymmTensor.H:77
Foam::RASModels::phasePressureModel::read
virtual bool read()
Re-read model coefficients if they have changed.
readScalar
#define readScalar
Definition: doubleScalar.C:38
rho
rho
Definition: pEqn.H:3
Foam::volVectorField
GeometricField< vector, fvPatchField, volMesh > volVectorField
Definition: volFieldsFwd.H:55
Foam::RASModels::phasePressureModel::devRhoReff
virtual tmp< volSymmTensorField > devRhoReff() const
Return the effective stress tensor.
Foam::surfaceScalarField
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
Definition: surfaceFieldsFwd.H:52
Foam::RASModels::phasePressureModel::epsilon
virtual tmp< volScalarField > epsilon() const
Return the turbulence kinetic energy dissipation rate.
RASModel
Info<< "Reading field U\n"<< endl;volVectorField U(IOobject("U", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE), mesh);singlePhaseTransportModel laminarTransport(U, phi);autoPtr< incompressible::RASModel > RASModel(incompressible::New< incompressible::RASModel >(U, phi, laminarTransport))
patchi
label patchi
Definition: getPatchFieldScalar.H:1
Foam::type
fileName::Type type(const fileName &)
Return the file type: DIRECTORY or FILE.
Definition: POSIX.C:588
Foam::min
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
Foam::RASModels::phasePressureModel::correct
virtual void correct()
Solve the kinetic theory equations and correct the viscosity.
Foam::RASModels::phasePressureModel::R
virtual tmp< volSymmTensorField > R() const
Return the Reynolds stress tensor.
lookup
stressControl lookup("compactNormalStress") >> compactNormalStress