continuousGasKEpsilon.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) 2013-2024 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 "continuousGasKEpsilon.H"
27 #include "fvModels.H"
28 #include "fvConstraints.H"
29 #include "phaseSystem.H"
30 #include "dragModel.H"
32 
33 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
34 
35 namespace Foam
36 {
37 namespace RASModels
38 {
39 
40 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
41 
42 template<class BasicMomentumTransportModel>
44 (
45  const alphaField& alpha,
46  const rhoField& rho,
47  const volVectorField& U,
48  const surfaceScalarField& alphaRhoPhi,
49  const surfaceScalarField& phi,
50  const viscosity& viscosity,
51  const word& type
52 )
53 :
54  kEpsilon<BasicMomentumTransportModel>
55  (
56  alpha,
57  rho,
58  U,
59  alphaRhoPhi,
60  phi,
61  viscosity,
62  type
63  ),
64 
65  liquidTurbulencePtr_(nullptr),
66 
67  nutEff_
68  (
69  IOobject
70  (
71  this->groupName("nutEff"),
72  this->runTime_.name(),
73  this->mesh_,
74  IOobject::READ_IF_PRESENT,
75  IOobject::AUTO_WRITE
76  ),
77  this->nut_
78  ),
79 
80  alphaInversion_("alphaInversion", this->coeffDict(), 0.7)
81 {}
82 
83 
84 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
85 
86 template<class BasicMomentumTransportModel>
88 {
90  {
91  alphaInversion_.readIfPresent(this->coeffDict());
92 
93  return true;
94  }
95  else
96  {
97  return false;
98  }
99 }
100 
101 
102 template<class BasicMomentumTransportModel>
104 {
106 
107  const momentumTransportModel& liquidTurbulence = this->liquidTurbulence();
108 
109  const phaseModel& gas = refCast<const phaseModel>(this->properties());
110  const phaseSystem& fluid = gas.fluid();
111  const phaseModel& liquid = fluid.otherPhase(gas);
112 
117 
118  volScalarField thetal(liquidTurbulence.k()/liquidTurbulence.epsilon());
119  volScalarField rhodv(gas.rho() + virtualMass.Cvm()*liquid.rho());
120  volScalarField thetag
121  (
122  (rhodv/(18*liquid.rho()*liquid.fluidThermo().nu()))*sqr(gas.d())
123  );
124  volScalarField expThetar
125  (
126  min
127  (
128  exp(min(thetal/thetag, scalar(50))),
129  scalar(1)
130  )
131  );
132  volScalarField omega((1 - expThetar)/(1 + expThetar));
133 
134  nutEff_ = omega*liquidTurbulence.nut();
135  fvConstraints::New(this->mesh_).constrain(nutEff_);
136 }
137 
138 
139 template<class BasicMomentumTransportModel>
142 {
143  if (!liquidTurbulencePtr_)
144  {
145  const volVectorField& U = this->U_;
146 
147  const phaseModel& gas = refCast<const phaseModel>(this->properties());
148  const phaseSystem& fluid = gas.fluid();
149  const phaseModel& liquid = fluid.otherPhase(gas);
150 
151  liquidTurbulencePtr_ =
152  &U.db().lookupType<momentumTransportModel>(liquid.name());
153  }
154 
155  return *liquidTurbulencePtr_;
156 }
157 
158 
159 template<class BasicMomentumTransportModel>
162 {
163  volScalarField blend
164  (
165  max
166  (
167  min
168  (
169  (this->alpha_ - scalar(0.5))/(alphaInversion_ - 0.5),
170  scalar(1)
171  ),
172  scalar(0)
173  )
174  );
175 
176  return volScalarField::New
177  (
178  this->groupName("nuEff"),
179  blend*this->nut_
180  + (1.0 - blend)*rhoEff()*nutEff_/this->rho_
181  + this->nu()
182  );
183 }
184 
185 
186 template<class BasicMomentumTransportModel>
189 {
190  const phaseModel& gas = refCast<const phaseModel>(this->properties());
191  const phaseSystem& fluid = gas.fluid();
192  const phaseModel& liquid = fluid.otherPhase(gas);
193 
198 
199  return volScalarField::New
200  (
201  this->groupName("rhoEff"),
202  gas.rho() + (virtualMass.Cvm() + 3.0/20.0)*liquid.rho()
203  );
204 }
205 
206 
207 template<class BasicMomentumTransportModel>
210 {
211  const volVectorField& U = this->U_;
212  const alphaField& alpha = this->alpha_;
213  const rhoField& rho = this->rho_;
214 
215  const momentumTransportModel& liquidTurbulence = this->liquidTurbulence();
216 
217  return
218  (
219  max(alphaInversion_ - alpha, scalar(0))
220  *rho
221  *min
222  (
223  liquidTurbulence.epsilon()/liquidTurbulence.k(),
224  1.0/U.time().deltaT()
225  )
226  );
227 }
228 
229 
230 template<class BasicMomentumTransportModel>
233 {
234  const momentumTransportModel& liquidTurbulence = this->liquidTurbulence();
235  const volScalarField phaseTransferCoeff(this->phaseTransferCoeff());
236 
237  return
238  phaseTransferCoeff*liquidTurbulence.k()
239  - fvm::Sp(phaseTransferCoeff, this->k_);
240 }
241 
242 
243 template<class BasicMomentumTransportModel>
246 {
247  const momentumTransportModel& liquidTurbulence = this->liquidTurbulence();
248  const volScalarField phaseTransferCoeff(this->phaseTransferCoeff());
249 
250  return
251  phaseTransferCoeff*liquidTurbulence.epsilon()
252  - fvm::Sp(phaseTransferCoeff, this->epsilon_);
253 }
254 
255 
256 template<class BasicMomentumTransportModel>
259 {
260  tmp<volScalarField> tk(this->k());
261 
263  (
264  this->groupName("R"),
265  ((2.0/3.0)*I)*tk() - (nutEff_)*dev(twoSymm(fvc::grad(this->U_)))
266  );
267 }
268 
269 
270 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
271 
272 } // End namespace RASModels
273 } // End namespace Foam
274 
275 // ************************************************************************* //
label k
Generic GeometricField class.
static tmp< GeometricField< Type, GeoMesh, PrimitiveField > > New(const word &name, const Internal &, const PtrList< Patch > &, const HashPtrTable< Source > &=HashPtrTable< Source >())
Return a temporary field constructed from name,.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:99
virtual tmp< fvScalarMatrix > epsilonSource() const
Source term for the epsilon equation.
virtual tmp< volScalarField > nuEff() const
Return the effective viscosity.
tmp< volScalarField > phaseTransferCoeff() const
virtual tmp< volScalarField > rhoEff() const
Return the effective density for the stress.
virtual tmp< volSymmTensorField > R() const
Return the Reynolds stress tensor [m^2/s^2].
virtual void correctNut()
Correct the eddy-viscosity nut.
virtual tmp< fvScalarMatrix > kSource() const
Source term for the k equation.
continuousGasKEpsilon(const alphaField &alpha, const rhoField &rho, const volVectorField &U, const surfaceScalarField &alphaRhoPhi, const surfaceScalarField &phi, const viscosity &viscosity, const word &type=typeName)
Construct from components.
const momentumTransportModel & liquidTurbulence() const
Return the turbulence model for the liquid phase.
virtual bool read()
Re-read model coefficients if they have changed.
Standard k-epsilon turbulence model for incompressible and compressible flows including rapid distort...
Definition: kEpsilon.H:86
virtual void correctNut()
Correct the eddy-viscosity nut.
Definition: kEpsilon.C:50
static autoPtr< dictionary > New(Istream &)
Construct top-level dictionary on freestore from Istream.
Definition: dictionaryIO.C:103
Class to represent a interface between phases where one phase is considered dispersed within the othe...
BasicMomentumTransportModel::alphaField alphaField
BasicMomentumTransportModel::rhoField rhoField
virtual const word & name() const
Return the name of the liquid.
Generic thermophysical properties class for a liquid in which the functions and coefficients for each...
Definition: liquid.H:53
scalar rho(scalar p, scalar T) const
Liquid density [kg/m^3].
Definition: liquidI.H:26
Abstract base class for turbulence models (RAS, LES and laminar).
virtual tmp< volScalarField > nut() const =0
Return the turbulence viscosity.
virtual tmp< volScalarField > k() const =0
Return the turbulence kinetic energy.
virtual tmp< volScalarField > epsilon() const =0
Return the turbulence kinetic energy dissipation rate.
Convenience class to handle the input of constant rotational speed. Reads an omega entry with default...
Definition: omega.H:54
const phaseSystem & fluid() const
Return the system to which this phase belongs.
Definition: phaseModel.C:163
tmp< volScalarField > d() const
Return the Sauter-mean diameter.
Definition: phaseModel.C:181
virtual const volScalarField & rho() const =0
Return the density field.
Class to represent a system of phases.
Definition: phaseSystem.H:74
const phaseModel & otherPhase(const phaseModel &phase) const
Return the phase not given as an argument in a two-phase system.
Definition: phaseSystemI.H:174
const ModelType & lookupInterfacialModel(const phaseInterface &interface) const
Return a sub model for an interface.
A class for managing temporary objects.
Definition: tmp.H:55
virtual tmp< volScalarField > Cvm() const =0
Return the virtual mass coefficient.
Abstract base class for all fluid physical properties.
Definition: viscosity.H:50
A class for handling words, derived from string.
Definition: word.H:62
const scalar omega
U
Definition: pEqn.H:72
volScalarField alpha(IOobject("alpha", runTime.name(), mesh, IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE), lambda *max(Ua &U, zeroSensitivity))
tmp< VolField< typename outerProduct< vector, Type >::type > > grad(const SurfaceField< Type > &ssf)
Definition: fvcGrad.C:46
tmp< fvMatrix< Type > > Sp(const volScalarField::Internal &, const VolField< Type > &)
Namespace for OpenFOAM.
dimensionedScalar exp(const dimensionedScalar &ds)
void dev(LagrangianPatchField< tensor > &f, const LagrangianPatchField< tensor > &f1)
void twoSymm(LagrangianPatchField< tensor > &f, const LagrangianPatchField< tensor > &f1)
static const Identity< scalar > I
Definition: Identity.H:93
layerAndWeight min(const layerAndWeight &a, const layerAndWeight &b)
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
void sqr(LagrangianPatchField< typename outerProduct< Type, Type >::type > &f, const LagrangianPatchField< Type > &f1)
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.
Definition: POSIX.C:488