continuousGasKEqn.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 "continuousGasKEqn.H"
28 #include "twoPhaseSystem.H"
29 
30 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
31 
32 namespace Foam
33 {
34 namespace LESModels
35 {
36 
37 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
38 
39 template<class BasicTurbulenceModel>
40 continuousGasKEqn<BasicTurbulenceModel>::continuousGasKEqn
41 (
42  const alphaField& alpha,
43  const rhoField& rho,
44  const volVectorField& U,
45  const surfaceScalarField& alphaRhoPhi,
46  const surfaceScalarField& phi,
47  const transportModel& transport,
48  const word& propertiesName,
49  const word& type
50 )
51 :
53  (
54  alpha,
55  rho,
56  U,
57  alphaRhoPhi,
58  phi,
59  transport,
60  propertiesName,
61  type
62  ),
63 
64  liquidTurbulencePtr_(NULL),
65 
66  alphaInversion_
67  (
69  (
70  "alphaInversion",
71  this->coeffDict_,
72  0.7
73  )
74  )
75 {
76  if (type == typeName)
77  {
79  this->printCoeffs(type);
80  }
81 }
82 
83 
84 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
85 
86 template<class BasicTurbulenceModel>
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 BasicTurbulenceModel>
103 const turbulenceModel&
105 {
106  if (!liquidTurbulencePtr_)
107  {
108  const volVectorField& U = this->U_;
109 
110  const transportModel& gas = this->transport();
111  const twoPhaseSystem& fluid =
112  refCast<const twoPhaseSystem>(gas.fluid());
113  const transportModel& liquid = fluid.otherPhase(gas);
114 
115  liquidTurbulencePtr_ =
117  (
119  (
121  liquid.name()
122  )
123  );
124  }
125 
126  return *liquidTurbulencePtr_;
127 }
128 
129 
130 template<class BasicTurbulenceModel>
133 {
134  const volVectorField& U = this->U_;
135  const alphaField& alpha = this->alpha_;
136  const rhoField& rho = this->rho_;
137 
138  const turbulenceModel& liquidTurbulence = this->liquidTurbulence();
139 
140  return
141  (
142  max(alphaInversion_ - alpha, scalar(0))
143  *rho
144  *min
145  (
146  this->Ce_*sqrt(liquidTurbulence.k())/this->delta(),
147  1.0/U.time().deltaT()
148  )
149  );
150 }
151 
152 
153 template<class BasicTurbulenceModel>
156 {
157  const turbulenceModel& liquidTurbulence = this->liquidTurbulence();
158  const volScalarField phaseTransferCoeff(this->phaseTransferCoeff());
159 
160  return
161  phaseTransferCoeff*liquidTurbulence.k()
162  - fvm::Sp(phaseTransferCoeff, this->k_);
163 }
164 
165 
166 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
167 
168 } // End namespace LESModels
169 } // End namespace Foam
170 
171 // ************************************************************************* //
dimensionedScalar sqrt(const dimensionedScalar &ds)
BasicTurbulenceModel::rhoField rhoField
multiphaseSystem & fluid
Definition: createFields.H:10
One equation eddy-viscosity model.
Definition: kEqn.H:74
virtual bool read()
Read model coefficients if they have changed.
A class for handling words, derived from string.
Definition: word.H:59
virtual tmp< fvScalarMatrix > kSource() const
tmp< fvMatrix< Type > > Sp(const DimensionedField< scalar, volMesh > &, const GeometricField< Type, fvPatchField, volMesh > &)
Namespace for OpenFOAM.
static word groupName(Name name, const word &group)
Generic dimensioned Type class.
const phaseModel & otherPhase(const phaseModel &phase) const
Constant access the phase not given as an argument.
const dimensionedScalar alpha
Fine-structure constant: default SI units: [].
Class which solves the volume fraction equations for two phases.
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
BasicTurbulenceModel::transportModel transportModel
const Type & lookupObject(const word &name) const
Lookup and return the object of the given Type.
scalar delta
Macros for easy insertion into run-time selection tables.
BasicTurbulenceModel::alphaField alphaField
fileName::Type type(const fileName &)
Return the file type: DIRECTORY or FILE.
Definition: POSIX.C:589
surfaceScalarField & phi
Abstract base class for turbulence models (RAS, LES and laminar).
const Time & time() const
Return time.
Definition: IOobject.C:251
static const word propertiesName
Default name of the turbulence properties dictionary.
tmp< volScalarField > phaseTransferCoeff() const
virtual tmp< volScalarField > k() const =0
Return the turbulence kinetic energy.
virtual void correctNut()
Definition: kEqn.C:38
const turbulenceModel & liquidTurbulence() const
Return the turbulence model for the liquid phase.
dimensionedScalar deltaT() const
Return time step.
Definition: TimeState.C:79
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
const objectRegistry & db() const
Return the local objectRegistry.
Definition: IOobject.C:245
A class for managing temporary objects.
Definition: PtrList.H:118
U
Definition: pEqn.H:82