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 
31 Foam::RASModels::phasePressureModel::phasePressureModel
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 {
114  notImplemented("phasePressureModel::k()");
115  return nut_;
116 }
117 
118 
121 {
122  notImplemented("phasePressureModel::epsilon()");
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 (
239  volVectorField& U
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 // ************************************************************************* //
tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > interpolate(const GeometricField< Type, fvPatchField, volMesh > &vf, const surfaceScalarField &faceFlux, Istream &schemeData)
virtual bool read()
Re-read model coefficients if they have changed.
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))
#define readScalar
Definition: doubleScalar.C:38
virtual ~phasePressureModel()
Destructor.
virtual tmp< volScalarField > pPrime() const
Return the phase-pressure&#39;.
virtual tmp< fvVectorMatrix > divDevRhoReff(volVectorField &U) const
Return the source term for the momentum equation.
dimensionedScalar exp(const dimensionedScalar &ds)
static const SymmTensor zero
Definition: SymmTensor.H:77
fvMatrix< vector > fvVectorMatrix
Definition: fvMatricesFwd.H:45
static word groupName(Name name, const word &group)
virtual tmp< volScalarField > epsilon() const
Return the turbulence kinetic energy dissipation rate.
stressControl lookup("compactNormalStress") >> compactNormalStress
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:52
virtual tmp< volSymmTensorField > devRhoReff() const
Return the effective stress tensor.
virtual tmp< surfaceScalarField > pPrimef() const
Return the face-phase-pressure&#39;.
#define forAll(list, i)
Definition: UList.H:421
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
label patchi
GeometricField< symmTensor, fvPatchField, volMesh > volSymmTensorField
Definition: volFieldsFwd.H:58
ThermalDiffusivity< PhaseCompressibleTurbulenceModel< phaseModel > > phaseCompressibleTurbulenceModel
Typedef for phaseCompressibleTurbulenceModel.
GeometricField< vector, fvPatchField, volMesh > volVectorField
Definition: volFieldsFwd.H:55
virtual tmp< volSymmTensorField > R() const
Return the Reynolds stress tensor.
virtual tmp< volScalarField > k() const
Return the turbulence kinetic energy.
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
#define notImplemented(functionName)
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:356
virtual void correct()
Solve the kinetic theory equations and correct the viscosity.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
A class for managing temporary objects.
Definition: PtrList.H:118