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-2016 OpenFOAM Foundation
9  Copyright (C) 2020 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 \*---------------------------------------------------------------------------*/
28 
29 #include "phasePressureModel.H"
30 #include "twoPhaseSystem.H"
31 
32 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
33 
34 Foam::RASModels::phasePressureModel::phasePressureModel
35 (
36  const volScalarField& alpha,
37  const volScalarField& rho,
38  const volVectorField& U,
39  const surfaceScalarField& alphaRhoPhi,
40  const surfaceScalarField& phi,
41  const transportModel& phase,
42  const word& propertiesName,
43  const word& type
44 )
45 :
46  eddyViscosity
47  <
48  RASModel<EddyDiffusivity<ThermalDiffusivity
49  <
50  PhaseCompressibleTurbulenceModel<phaseModel>
51  >>>
52  >
53  (
54  type,
55  alpha,
56  rho,
57  U,
58  alphaRhoPhi,
59  phi,
60  phase,
61  propertiesName
62  ),
63 
64  phase_(phase),
65 
66  alphaMax_(coeffDict_.get<scalar>("alphaMax")),
67  preAlphaExp_(coeffDict_.get<scalar>("preAlphaExp")),
68  expMax_(coeffDict_.get<scalar>("expMax")),
69  g0_("g0", dimPressure, coeffDict_)
70 {
71  nut_ == dimensionedScalar(nut_.dimensions(), Zero);
72 
73  if (type == typeName)
74  {
76  }
77 }
78 
79 
80 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
81 
83 {
84  if
85  (
86  eddyViscosity
87  <
88  RASModel<EddyDiffusivity<ThermalDiffusivity
89  <
90  PhaseCompressibleTurbulenceModel<phaseModel>
91  >>>
92  >::read()
93  )
94  {
95  coeffDict().readEntry("alphaMax", alphaMax_);
96  coeffDict().readEntry("preAlphaExp", preAlphaExp_);
97  coeffDict().readEntry("expMax", expMax_);
98  g0_.readIfPresent(coeffDict());
99 
100  return true;
101  }
102 
103  return false;
104 }
105 
106 
109 {
111  return nut_;
112 }
113 
114 
117 {
119  return nut_;
120 }
121 
122 
125 {
127  return nullptr;
128 }
129 
130 
133 {
135  (
136  IOobject
137  (
138  IOobject::groupName("R", U_.group()),
139  runTime_.timeName(),
140  mesh_,
143  ),
144  mesh_,
145  dimensioned<symmTensor>(dimensionSet(0, 2, -2, 0, 0), Zero)
146  );
147 }
148 
149 
152 {
153  tmp<volScalarField> tpPrime
154  (
155  g0_
156  *min
157  (
158  exp(preAlphaExp_*(alpha_ - alphaMax_)),
159  expMax_
160  )
161  );
162 
163  volScalarField::Boundary& bpPrime =
164  tpPrime.ref().boundaryFieldRef();
165 
166  forAll(bpPrime, patchi)
167  {
168  if (!bpPrime[patchi].coupled())
169  {
170  bpPrime[patchi] == 0;
171  }
172  }
173 
174  return tpPrime;
175 }
176 
177 
180 {
181  tmp<surfaceScalarField> tpPrime
182  (
183  g0_
184  *min
185  (
186  exp(preAlphaExp_*(fvc::interpolate(alpha_) - alphaMax_)),
187  expMax_
188  )
189  );
190 
191  surfaceScalarField::Boundary& bpPrime =
192  tpPrime.ref().boundaryFieldRef();
193 
194  forAll(bpPrime, patchi)
195  {
196  if (!bpPrime[patchi].coupled())
197  {
198  bpPrime[patchi] == 0;
199  }
200  }
201 
202  return tpPrime;
203 }
204 
205 
208 {
210  (
211  IOobject
212  (
213  IOobject::groupName("devRhoReff", U_.group()),
214  runTime_.timeName(),
215  mesh_,
218  ),
219  mesh_,
220  dimensioned<symmTensor>
221  (
222  rho_.dimensions()*dimensionSet(0, 2, -2, 0, 0), Zero
223  )
224  );
225 }
226 
227 
230 (
232 ) const
233 {
234  return tmp<fvVectorMatrix>
235  (
236  new fvVectorMatrix
237  (
238  U,
239  rho_.dimensions()*dimensionSet(0, 4, -2, 0, 0)
240  )
241  );
242 }
243 
244 
246 {}
247 
248 
249 // ************************************************************************* //
Foam::IOobject::NO_WRITE
Definition: IOobject.H:130
Foam::dimPressure
const dimensionSet dimPressure
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:59
Foam::Zero
static constexpr const zero Zero
Global zero (0)
Definition: zero.H:131
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:107
Foam::RASModels::phasePressureModel::read
virtual bool read()
Re-read model coefficients if they have changed.
Definition: phasePressureModel.C:79
Foam::RASModels::phasePressureModel::epsilon
virtual tmp< volScalarField > epsilon() const
Return the turbulence kinetic energy dissipation rate.
Definition: phasePressureModel.C:110
Foam::exp
dimensionedScalar exp(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:261
rho
rho
Definition: readInitialConditions.H:88
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
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:296
Foam::RASModels::phasePressureModel::pPrimef
virtual tmp< surfaceScalarField > pPrimef() const
Return the face-phase-pressure'.
Definition: phasePressureModel.C:176
NotImplemented
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:436
Foam::fvVectorMatrix
fvMatrix< vector > fvVectorMatrix
Definition: fvMatricesFwd.H:47
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:148
Foam::RASModels::phasePressureModel::divDevRhoReff
virtual tmp< fvVectorMatrix > divDevRhoReff(volVectorField &U) const
Return the source term for the momentum equation.
Definition: phasePressureModel.C:232
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
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:126
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::tmp::New
static tmp< T > New(Args &&... args)
Construct tmp of T with forwarding arguments.
Foam::RASModel< EddyDiffusivity< phaseCompressibleTurbulenceModel > >::printCoeffs
virtual void printCoeffs(const word &type)
Print model coefficients.
Definition: RASModel.C:34
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:247
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:204
Foam::IOobject::groupName
static word groupName(StringType base, const word &group)
Create dot-delimited name.group string.
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:102
Foam::RASModels::phasePressureModel::omega
virtual tmp< volScalarField > omega() const
Return the specific dissipation rate.
Definition: phasePressureModel.C:118