NicenoKEqn.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-2021 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 "NicenoKEqn.H"
27 #include "fvModels.H"
28 #include "fvConstraints.H"
29 #include "phaseSystem.H"
30 #include "dragModel.H"
31 
32 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
33 
34 namespace Foam
35 {
36 namespace LESModels
37 {
38 
39 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
40 
41 template<class BasicMomentumTransportModel>
43 (
44  const alphaField& alpha,
45  const rhoField& rho,
46  const volVectorField& U,
47  const surfaceScalarField& alphaRhoPhi,
48  const surfaceScalarField& phi,
49  const transportModel& transport,
50  const word& type
51 )
52 :
54  (
55  alpha,
56  rho,
57  U,
58  alphaRhoPhi,
59  phi,
60  transport,
61  type
62  ),
63 
64  gasTurbulencePtr_(nullptr),
65 
66  alphaInversion_
67  (
69  (
70  "alphaInversion",
71  this->coeffDict_,
72  0.3
73  )
74  ),
75 
76  Cp_
77  (
79  (
80  "Cp",
81  this->coeffDict_,
82  this->Ck_.value()
83  )
84  ),
85 
86  Cmub_
87  (
89  (
90  "Cmub",
91  this->coeffDict_,
92  0.6
93  )
94  )
95 {
96  if (type == typeName)
97  {
98  this->printCoeffs(type);
99  }
100 }
101 
102 
103 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
104 
105 template<class BasicMomentumTransportModel>
107 {
109  {
110  alphaInversion_.readIfPresent(this->coeffDict());
111  Cp_.readIfPresent(this->coeffDict());
112  Cmub_.readIfPresent(this->coeffDict());
113 
114  return true;
115  }
116  else
117  {
118  return false;
119  }
120 }
121 
122 
123 template<class BasicMomentumTransportModel>
125 <
126  typename BasicMomentumTransportModel::transportModel
127 >&
129 {
130  if (!gasTurbulencePtr_)
131  {
132  const volVectorField& U = this->U_;
133 
134  const phaseModel& liquid = refCast<const phaseModel>(this->transport());
135  const phaseSystem& fluid = liquid.fluid();
136  const phaseModel& gas = fluid.otherPhase(liquid);
137 
138  gasTurbulencePtr_ =
139  &U.db().lookupObject
140  <
142  >
143  (
145  (
146  momentumTransportModel::typeName,
147  gas.name()
148  )
149  );
150  }
151 
152  return *gasTurbulencePtr_;
153 }
154 
155 
156 template<class BasicMomentumTransportModel>
158 {
160  gasTurbulence = this->gasTurbulence();
161 
162  const phaseModel& liquid = refCast<const phaseModel>(this->transport());
163  const phaseSystem& fluid = liquid.fluid();
164  const phaseModel& gas = fluid.otherPhase(liquid);
165 
166  this->nut_ =
167  this->Ck_*sqrt(this->k_)*this->delta()
168  + Cmub_*gas.d()*gasTurbulence.alpha()
169  *(mag(this->U_ - gasTurbulence.U()));
170 
171  this->nut_.correctBoundaryConditions();
172  fvConstraints::New(this->mesh_).constrain(this->nut_);
173 }
174 
175 
176 template<class BasicMomentumTransportModel>
178 {
180  gasTurbulence = this->gasTurbulence();
181 
182  const phaseModel& liquid = refCast<const phaseModel>(this->transport());
183  const phaseSystem& fluid = liquid.fluid();
184  const phaseModel& gas = fluid.otherPhase(liquid);
185 
186  const dragModel& drag = fluid.lookupSubModel<dragModel>(gas, liquid);
187 
188  volScalarField magUr(mag(this->U_ - gasTurbulence.U()));
189 
190  tmp<volScalarField> bubbleG
191  (
192  Cp_*sqr(magUr)*drag.K()/liquid.rho()
193  );
194 
195  return bubbleG;
196 }
197 
198 
199 template<class BasicMomentumTransportModel>
202 {
203  const volVectorField& U = this->U_;
204  const alphaField& alpha = this->alpha_;
205  const rhoField& rho = this->rho_;
206 
207  const momentumTransportModel& gasTurbulence = this->gasTurbulence();
208 
209  return
210  (
211  max(alphaInversion_ - alpha, scalar(0))
212  *rho
213  *min
214  (
215  this->Ce_*sqrt(gasTurbulence.k())/this->delta(),
216  1.0/U.time().deltaT()
217  )
218  );
219 }
220 
221 
222 template<class BasicMomentumTransportModel>
224 {
225  const alphaField& alpha = this->alpha_;
226  const rhoField& rho = this->rho_;
227 
229  gasTurbulence = this->gasTurbulence();
230 
231  const volScalarField phaseTransferCoeff(this->phaseTransferCoeff());
232 
233  return
234  alpha*rho*bubbleG()
235  + phaseTransferCoeff*gasTurbulence.k()
236  - fvm::Sp(phaseTransferCoeff, this->k_);
237 }
238 
239 
240 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
241 
242 } // End namespace LESModels
243 } // End namespace Foam
244 
245 // ************************************************************************* //
Generic thermophysical properties class for a liquid in which the functions and coefficients for each...
Definition: liquid.H:50
Templated abstract base class for multiphase compressible turbulence models.
scalar delta
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
dimensionedSymmTensor sqr(const dimensionedVector &dv)
volScalarField alpha(IOobject("alpha", runTime.timeName(), mesh, IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE), lambda *max(Ua &U, zeroSensitivity))
dimensionedScalar sqrt(const dimensionedScalar &ds)
virtual tmp< volScalarField > rho() const =0
Return the density field.
const word & name() const
Definition: phaseModel.H:110
Generic dimensioned Type class.
tmp< volScalarField > d() const
Return the Sauter-mean diameter.
tmp< fvMatrix< Type > > Sp(const volScalarField::Internal &, const GeometricField< Type, fvPatchField, volMesh > &)
const Type & lookupObject(const word &name) const
Lookup and return the object of the given Type.
Info<< "Reading strained laminar flame speed field Su\"<< endl;volScalarField Su(IOobject("Su", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE), mesh);Info<< "Reading field betav\"<< endl;volScalarField betav(IOobject("betav", mesh.facesInstance(), mesh, IOobject::MUST_READ, IOobject::NO_WRITE), mesh);Info<< "Reading field Lobs\"<< endl;volScalarField Lobs(IOobject("Lobs", mesh.facesInstance(), mesh, IOobject::MUST_READ, IOobject::NO_WRITE), mesh);Info<< "Reading field CT\"<< endl;volSymmTensorField CT(IOobject("CT", mesh.facesInstance(), mesh, IOobject::MUST_READ, IOobject::NO_WRITE), mesh);Info<< "Reading field Nv\"<< endl;volScalarField Nv(IOobject("Nv", mesh.facesInstance(), mesh, IOobject::MUST_READ, IOobject::NO_WRITE), mesh);Info<< "Reading field nsv\"<< endl;volSymmTensorField nsv(IOobject("nsv", mesh.facesInstance(), mesh, IOobject::MUST_READ, IOobject::NO_WRITE), mesh);IOdictionary PDRProperties(IOobject("PDRProperties", runTime.constant(), mesh, IOobject::MUST_READ_IF_MODIFIED, IOobject::NO_WRITE));autoPtr< PDRDragModel > drag
Definition: createFields.H:192
One equation eddy-viscosity model.
Definition: kEqn.H:71
virtual tmp< volScalarField > K() const
Return the drag coefficient K.
Class to represent a system of phases and model interfacial transfers between them.
Definition: phaseSystem.H:70
virtual bool read()
Read model coefficients if they have changed.
Definition: NicenoKEqn.C:106
A class for handling words, derived from string.
Definition: word.H:59
NicenoKEqn(const alphaField &alpha, const rhoField &rho, const volVectorField &U, const surfaceScalarField &alphaRhoPhi, const surfaceScalarField &phi, const transportModel &transport, const word &type=typeName)
Construct from components.
Definition: NicenoKEqn.C:43
static word groupName(Name name, const word &group)
tmp< volScalarField > bubbleG() const
Definition: NicenoKEqn.C:177
tmp< volScalarField > phaseTransferCoeff() const
Definition: NicenoKEqn.C:201
phaseSystem & fluid
Definition: createFields.H:11
phi
Definition: correctPhi.H:3
virtual tmp< fvScalarMatrix > kSource() const
Definition: NicenoKEqn.C:223
static autoPtr< dictionary > New(Istream &)
Construct top-level dictionary on freestore from Istream.
Definition: dictionaryIO.C:96
BasicMomentumTransportModel::rhoField rhoField
Definition: kEqn.H:98
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
virtual tmp< volScalarField > k() const =0
Return the turbulence kinetic energy.
Abstract base class for turbulence models (RAS, LES and laminar).
const volVectorField & U() const
Access function to velocity field.
U
Definition: pEqn.H:72
One-equation SGS model for the continuous phase in a two-phase system including bubble-generated turb...
Definition: NicenoKEqn.H:72
const Time & time() const
Return time.
Definition: IOobject.C:318
const phaseSystem & fluid() const
Return the system to which this phase belongs.
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.
Definition: POSIX.C:488
dimensioned< scalar > mag(const dimensioned< Type > &)
A class for managing temporary objects.
Definition: PtrList.H:53
const objectRegistry & db() const
Return the local objectRegistry.
Definition: IOobject.C:312
BasicMomentumTransportModel::transportModel transportModel
Definition: kEqn.H:99
Single incompressible phase derived from the phase-fraction. Used as part of the multiPhaseMixture fo...
Definition: phaseModel.H:53
virtual void correctNut()
Definition: NicenoKEqn.C:157
dimensionedScalar deltaT() const
Return time step.
Definition: TimeStateI.H:53
BasicMomentumTransportModel::alphaField alphaField
Definition: kEqn.H:97
Namespace for OpenFOAM.