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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2013-2018 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 \*---------------------------------------------------------------------------*/
27 
28 #include "phasePressureModel.H"
29 #include "twoPhaseSystem.H"
30 
31 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
32 
33 Foam::RASModels::phasePressureModel::phasePressureModel
34 (
35  const volScalarField& alpha,
36  const volScalarField& rho,
37  const volVectorField& U,
38  const surfaceScalarField& alphaRhoPhi,
39  const surfaceScalarField& phi,
40  const transportModel& phase,
41  const word& propertiesName,
42  const word& type
43 )
44 :
45  eddyViscosity
46  <
48  >
49  (
50  type,
51  alpha,
52  rho,
53  U,
54  alphaRhoPhi,
55  phi,
56  phase,
57  propertiesName
58  ),
59 
60  phase_(phase),
61 
62  alphaMax_(coeffDict_.get<scalar>("alphaMax")),
63  preAlphaExp_(coeffDict_.get<scalar>("preAlphaExp")),
64  expMax_(coeffDict_.get<scalar>("expMax")),
65  g0_("g0", dimPressure, coeffDict_)
66 {
67  nut_ == dimensionedScalar(nut_.dimensions());
68 
69  if (type == typeName)
70  {
72  }
73 }
74 
75 
76 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
77 
79 {
80  if
81  (
83  <
85  >::read()
86  )
87  {
88  coeffDict().lookup("alphaMax") >> alphaMax_;
89  coeffDict().lookup("preAlphaExp") >> preAlphaExp_;
90  coeffDict().lookup("expMax") >> expMax_;
91  g0_.readIfPresent(coeffDict());
92 
93  return true;
94  }
95 
96  return false;
97 }
98 
99 
102 {
104  return nut_;
105 }
106 
107 
110 {
112  return nut_;
113 }
114 
115 
118 {
120  (
122  (
123  IOobject
124  (
125  IOobject::groupName("R", U_.group()),
126  runTime_.timeName(),
127  mesh_,
130  ),
131  mesh_,
132  dimensioned<symmTensor>(dimensionSet(0, 2, -2, 0, 0), Zero)
133  )
134  );
135 }
136 
137 
140 {
141  tmp<volScalarField> tpPrime
142  (
143  g0_
144  *min
145  (
146  exp(preAlphaExp_*(alpha_ - alphaMax_)),
147  expMax_
148  )
149  );
150 
151  volScalarField::Boundary& bpPrime =
152  tpPrime.ref().boundaryFieldRef();
153 
154  forAll(bpPrime, patchi)
155  {
156  if (!bpPrime[patchi].coupled())
157  {
158  bpPrime[patchi] == 0;
159  }
160  }
161 
162  return tpPrime;
163 }
164 
165 
168 {
170  (
171  g0_
172  *min
173  (
174  exp(preAlphaExp_*(fvc::interpolate(alpha_) - alphaMax_)),
175  expMax_
176  )
177  );
178 
179  surfaceScalarField::Boundary& bpPrime =
180  tpPrime.ref().boundaryFieldRef();
181 
182  forAll(bpPrime, patchi)
183  {
184  if (!bpPrime[patchi].coupled())
185  {
186  bpPrime[patchi] == 0;
187  }
188  }
189 
190  return tpPrime;
191 }
192 
193 
196 {
198  (
200  (
201  IOobject
202  (
203  IOobject::groupName("devRhoReff", U_.group()),
204  runTime_.timeName(),
205  mesh_,
208  ),
209  mesh_,
211  (
212  "R",
213  rho_.dimensions()*dimensionSet(0, 2, -2, 0, 0),
214  Zero
215  )
216  )
217  );
218 }
219 
220 
223 (
225 ) const
226 {
227  return tmp<fvVectorMatrix>
228  (
229  new fvVectorMatrix
230  (
231  U,
232  rho_.dimensions()*dimensionSet(0, 4, -2, 0, 0)
233  )
234  );
235 }
236 
237 
239 {}
240 
241 
242 // ************************************************************************* //
Foam::IOobject::NO_WRITE
Definition: IOobject.H:130
Foam::dimPressure
const dimensionSet dimPressure
Foam::IOobject
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:104
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:59
Foam::Zero
static constexpr const zero Zero
Global zero.
Definition: zero.H:128
Foam::RASModel
Templated abstract base class for RAS turbulence models.
Definition: RASModel.H:51
Foam::constant::atomic::alpha
const dimensionedScalar alpha
Fine-structure constant: default SI units: [].
Definition: readThermalProperties.H:212
Foam::read
bool read(const char *buf, int32_t &val)
Same as readInt32.
Definition: int32.H:108
Foam::RASModels::phasePressureModel::read
virtual bool read()
Re-read model coefficients if they have changed.
Definition: phasePressureModel.C:78
Foam::phaseCompressibleTurbulenceModel
ThermalDiffusivity< PhaseCompressibleTurbulenceModel< phaseModel > > phaseCompressibleTurbulenceModel
Typedef for phaseCompressibleTurbulenceModel.
Definition: phaseCompressibleTurbulenceModel.H:47
Foam::RASModels::phasePressureModel::epsilon
virtual tmp< volScalarField > epsilon() const
Return the turbulence kinetic energy dissipation rate.
Definition: phasePressureModel.C:109
Foam::exp
dimensionedScalar exp(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:261
Foam::dimensionSet
Dimension set for the base types.
Definition: dimensionSet.H:65
rho
rho
Definition: readInitialConditions.H:96
phasePressureModel.H
Foam::min
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:33
Foam::EddyDiffusivity< phaseCompressibleTurbulenceModel >
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:290
Foam::RASModels::phasePressureModel::pPrimef
virtual tmp< surfaceScalarField > pPrimef() const
Return the face-phase-pressure'.
Definition: phasePressureModel.C:167
NotImplemented
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:419
Foam::tmp::ref
T & ref() const
Definition: tmpI.H:258
Foam::dimensioned::readIfPresent
bool readIfPresent(const dictionary &dict)
Definition: dimensionedType.C:453
Foam::dimensionedScalar
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
Definition: dimensionedScalarFwd.H:43
phi
surfaceScalarField & phi
Definition: setRegionFluidFields.H:8
Foam::volScalarField
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:57
Foam::RASModels::phasePressureModel::pPrime
virtual tmp< volScalarField > pPrime() const
Return the phase-pressure'.
Definition: phasePressureModel.C:139
Foam::RASModels::phasePressureModel::divDevRhoReff
virtual tmp< fvVectorMatrix > divDevRhoReff(volVectorField &U) const
Return the source term for the momentum equation.
Definition: phasePressureModel.C:223
Foam::dictionary::lookup
ITstream & lookup(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Definition: dictionary.C:419
Foam::dimensioned
Generic dimensioned Type class.
Definition: dimensionedScalarFwd.H:43
Foam::fvc::interpolate
static tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > interpolate(const GeometricField< Type, fvPatchField, volMesh > &tvf, const surfaceScalarField &faceFlux, Istream &schemeData)
Interpolate field onto faces using scheme given by Istream.
Foam::volVectorField
GeometricField< vector, fvPatchField, volMesh > volVectorField
Definition: volFieldsFwd.H:60
Foam::RASModel< EddyDiffusivity< phaseCompressibleTurbulenceModel > >::coeffDict
virtual const dictionary & coeffDict() const
Const access to the coefficients dictionary.
Definition: RASModel.H:205
U
U
Definition: pEqn.H:72
Foam::compressible::RASModel
RASModel< EddyDiffusivity< turbulenceModel > > RASModel
Definition: turbulentFluidThermoModel.H:66
Foam::surfaceScalarField
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
Definition: surfaceFieldsFwd.H:54
Foam::RASModels::phasePressureModel::R
virtual tmp< volSymmTensorField > R() const
Return the Reynolds stress tensor.
Definition: phasePressureModel.C:117
Foam::GeometricField::boundaryFieldRef
Boundary & boundaryFieldRef(const bool updateAccessTime=true)
Return a reference to the boundary field.
Definition: GeometricField.C:752
Foam::IOobject::groupName
static word groupName(StringType name, const word &group)
Create dot-delimited name.group.
Foam::type
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Definition: MSwindows.C:590
Foam::fvMatrix
A special matrix type and solver, designed for finite volume solutions of scalar equations....
Definition: fvPatchField.H:76
Foam::RASModel< EddyDiffusivity< phaseCompressibleTurbulenceModel > >::printCoeffs
virtual void printCoeffs(const word &type)
Print model coefficients.
Definition: RASModel.C:34
Foam::eddyViscosity
Eddy viscosity turbulence model base class.
Definition: eddyViscosity.H:55
Foam::roots::type
type
Types of root.
Definition: Roots.H:54
Foam::RASModels::phasePressureModel::correct
virtual void correct()
Solve the kinetic theory equations and correct the viscosity.
Definition: phasePressureModel.C:238
Foam::eddyViscosity< RASModel< EddyDiffusivity< phaseCompressibleTurbulenceModel > > >::nut_
volScalarField nut_
Definition: eddyViscosity.H:66
Foam::RASModels::phasePressureModel::devRhoReff
virtual tmp< volSymmTensorField > devRhoReff() const
Return the effective stress tensor.
Definition: phasePressureModel.C:195
Foam::GeometricField< symmTensor, fvPatchField, volMesh >
Foam::IOobject::NO_READ
Definition: IOobject.H:123
Foam::RASModels::phasePressureModel::k
virtual tmp< volScalarField > k() const
Return the turbulence kinetic energy.
Definition: phasePressureModel.C:101