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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2013-2016 OpenFOAM Foundation
9  Copyright (C) 2019-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 "continuousGasKEqn.H"
30 #include "twoPhaseSystem.H"
31 
32 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
33 
34 namespace Foam
35 {
36 namespace LESModels
37 {
38 
39 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
40 
41 template<class BasicTurbulenceModel>
42 continuousGasKEqn<BasicTurbulenceModel>::continuousGasKEqn
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& propertiesName,
51  const word& type
52 )
53 :
55  (
56  alpha,
57  rho,
58  U,
59  alphaRhoPhi,
60  phi,
61  transport,
62  propertiesName,
63  type
64  ),
65 
66  liquidTurbulencePtr_(nullptr),
67 
68  alphaInversion_
69  (
71  (
72  "alphaInversion",
73  this->coeffDict_,
74  0.7
75  )
76  )
77 {
78  if (type == typeName)
79  {
80  this->printCoeffs(type);
81  }
82 }
83 
84 
85 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
86 
87 template<class BasicTurbulenceModel>
89 {
91  {
92  alphaInversion_.readIfPresent(this->coeffDict());
93 
94  return true;
95  }
96 
97  return false;
98 }
99 
100 
101 template<class BasicTurbulenceModel>
102 const turbulenceModel&
104 {
105  if (!liquidTurbulencePtr_)
106  {
107  const volVectorField& U = this->U_;
108 
109  const transportModel& gas = this->transport();
110  const twoPhaseSystem& fluid =
111  refCast<const twoPhaseSystem>(gas.fluid());
112  const transportModel& liquid = fluid.otherPhase(gas);
113 
114  liquidTurbulencePtr_ =
115  &U.db().lookupObject<turbulenceModel>
116  (
118  (
120  liquid.name()
121  )
122  );
123  }
124 
125  return *liquidTurbulencePtr_;
126 }
127 
128 
129 template<class BasicTurbulenceModel>
132 {
133  const volVectorField& U = this->U_;
134  const alphaField& alpha = this->alpha_;
135  const rhoField& rho = this->rho_;
136 
137  const turbulenceModel& liquidTurbulence = this->liquidTurbulence();
138 
139  return
140  (
141  max(alphaInversion_ - alpha, scalar(0))
142  *rho
143  *min
144  (
145  this->Ce_*sqrt(liquidTurbulence.k())/this->delta(),
146  1.0/U.time().deltaT()
147  )
148  );
149 }
150 
151 
152 template<class BasicTurbulenceModel>
155 {
156  const turbulenceModel& liquidTurbulence = this->liquidTurbulence();
157  const volScalarField phaseTransferCoeff(this->phaseTransferCoeff());
158 
159  return
160  phaseTransferCoeff*liquidTurbulence.k()
161  - fvm::Sp(phaseTransferCoeff, this->k_);
162 }
163 
164 
165 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
166 
167 } // End namespace LESModels
168 } // End namespace Foam
169 
170 // ************************************************************************* //
Foam::LESModels::continuousGasKEqn::alphaField
BasicTurbulenceModel::alphaField alphaField
Definition: continuousGasKEqn.H:114
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::twoPhaseSystem
Class which solves the volume fraction equations for two phases.
Definition: twoPhaseSystem.H:53
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::constant::atomic::alpha
const dimensionedScalar alpha
Fine-structure constant: default SI units: [].
Definition: readThermalProperties.H:212
Foam::LESModels::continuousGasKEqn::kSource
virtual tmp< fvScalarMatrix > kSource() const
Definition: continuousGasKEqn.C:154
Foam::turbulenceModel::propertiesName
static const word propertiesName
Default name of the turbulence properties dictionary.
Definition: turbulenceModel.H:100
Foam::liquid
Generic thermophysical properties class for a liquid in which the functions and coefficients for each...
Definition: liquid.H:54
Foam::LESModels::continuousGasKEqn::read
virtual bool read()
Read model coefficients if they have changed.
Definition: continuousGasKEqn.C:88
fluid
twoPhaseSystem & fluid
Definition: setRegionFluidFields.H:3
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
Foam::LESModels::kEqn
One equation eddy-viscosity model.
Definition: kEqn.H:77
continuousGasKEqn.H
Foam::LESModels::continuousGasKEqn::phaseTransferCoeff
tmp< volScalarField > phaseTransferCoeff() const
Definition: continuousGasKEqn.C:131
Foam::LESModels::continuousGasKEqn::liquidTurbulence
const turbulenceModel & liquidTurbulence() const
Return the turbulence model for the liquid phase.
Definition: continuousGasKEqn.C:103
Foam::fvm::Sp
tmp< fvMatrix< Type > > Sp(const volScalarField::Internal &, const GeometricField< Type, fvPatchField, volMesh > &)
delta
scalar delta
Definition: LISASMDCalcMethod2.H:8
phi
surfaceScalarField & phi
Definition: setRegionFluidFields.H:8
Foam::max
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:47
Foam::turbulenceModel
Abstract base class for turbulence models (RAS, LES and laminar).
Definition: turbulenceModel.H:63
Foam::dimensioned
Generic dimensioned Type class.
Definition: dimensionedScalarFwd.H:42
Foam::turbulenceModel::k
virtual tmp< volScalarField > k() const =0
Return the turbulence kinetic energy.
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::LESModels::continuousGasKEqn::rhoField
BasicTurbulenceModel::rhoField rhoField
Definition: continuousGasKEqn.H:115
U
U
Definition: pEqn.H:72
Foam::LESModels::continuousGasKEqn::transportModel
BasicTurbulenceModel::transportModel transportModel
Definition: continuousGasKEqn.H:116
Foam::sqrt
dimensionedScalar sqrt(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:144
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::IOobject::groupName
static word groupName(StringType base, const word &group)
Create dot-delimited name.group string.
Foam::GeometricField< vector, fvPatchField, volMesh >