continuousGasKEqn.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 "continuousGasKEqn.H"
27 #include "phaseSystem.H"
28 
29 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
30 
31 namespace Foam
32 {
33 namespace LESModels
34 {
35 
36 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
37 
38 template<class BasicMomentumTransportModel>
40 (
41  const alphaField& alpha,
42  const rhoField& rho,
43  const volVectorField& U,
44  const surfaceScalarField& alphaRhoPhi,
45  const surfaceScalarField& phi,
46  const viscosity& viscosity,
47  const word& type
48 )
49 :
51  (
52  alpha,
53  rho,
54  U,
55  alphaRhoPhi,
56  phi,
57  viscosity,
58  type
59  ),
60 
61  liquidTurbulencePtr_(nullptr),
62 
63  alphaInversion_
64  (
66  (
67  "alphaInversion",
68  this->coeffDict_,
69  0.7
70  )
71  )
72 {
73  if (type == typeName)
74  {
75  this->printCoeffs(type);
76  }
77 }
78 
79 
80 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
81 
82 template<class BasicMomentumTransportModel>
84 {
86  {
87  alphaInversion_.readIfPresent(this->coeffDict());
88 
89  return true;
90  }
91  else
92  {
93  return false;
94  }
95 }
96 
97 
98 template<class BasicMomentumTransportModel>
101 {
102  if (!liquidTurbulencePtr_)
103  {
104  const volVectorField& U = this->U_;
105 
106  const phaseModel& gas = refCast<const phaseModel>(this->properties());
107  const phaseSystem& fluid = gas.fluid();
108  const phaseModel& liquid = fluid.otherPhase(gas);
109 
110  liquidTurbulencePtr_ =
112  (
114  (
115  momentumTransportModel::typeName,
116  liquid.name()
117  )
118  );
119  }
120 
121  return *liquidTurbulencePtr_;
122 }
123 
124 
125 template<class BasicMomentumTransportModel>
128 {
129  const volVectorField& U = this->U_;
130  const alphaField& alpha = this->alpha_;
131  const rhoField& rho = this->rho_;
132 
133  const momentumTransportModel& liquidTurbulence = this->liquidTurbulence();
134 
135  return
136  (
137  max(alphaInversion_ - alpha, scalar(0))
138  *rho
139  *min
140  (
141  this->Ce_*sqrt(liquidTurbulence.k())/this->delta(),
142  1.0/U.time().deltaT()
143  )
144  );
145 }
146 
147 
148 template<class BasicMomentumTransportModel>
151 {
152  const momentumTransportModel& liquidTurbulence = this->liquidTurbulence();
153  const volScalarField phaseTransferCoeff(this->phaseTransferCoeff());
154 
155  return
156  phaseTransferCoeff*liquidTurbulence.k()
157  - fvm::Sp(phaseTransferCoeff, this->k_);
158 }
159 
160 
161 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
162 
163 } // End namespace LESModels
164 } // End namespace Foam
165 
166 // ************************************************************************* //
Generic thermophysical properties class for a liquid in which the functions and coefficients for each...
Definition: liquid.H:50
scalar delta
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
U
Definition: pEqn.H:72
volScalarField alpha(IOobject("alpha", runTime.timeName(), mesh, IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE), lambda *max(Ua &U, zeroSensitivity))
dimensionedScalar sqrt(const dimensionedScalar &ds)
const word & name() const
Definition: phaseModel.H:110
Generic dimensioned Type class.
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.
One equation eddy-viscosity model.
Definition: kEqn.H:71
Class to represent a system of phases and model interfacial transfers between them.
Definition: phaseSystem.H:68
const momentumTransportModel & liquidTurbulence() const
Return the turbulence model for the liquid phase.
A class for handling words, derived from string.
Definition: word.H:59
static word groupName(Name name, const word &group)
Info<< "Reading field p\"<< endl;volScalarField p(IOobject("p", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE), mesh);Info<< "Reading field U\"<< endl;volVectorField U(IOobject("U", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE), mesh);pressureReference pressureReference(p, simple.dict());mesh.schemes().setFluxRequired(p.name());Info<< "Reading field pa\"<< endl;volScalarField pa(IOobject("pa", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE), mesh);Info<< "Reading field Ua\"<< endl;volVectorField Ua(IOobject("Ua", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE), mesh);# 65 "/home/ubuntu/OpenFOAM-10/applications/solvers/incompressible/adjointShapeOptimisationFoam/createFields.H" 2label paRefCell=0;scalar paRefValue=0.0;setRefCell(pa, simple.dict(), paRefCell, paRefValue);mesh.schemes().setFluxRequired(pa.name());autoPtr< viscosityModel > viscosity(viscosityModel::New(mesh))
layerAndWeight min(const layerAndWeight &a, const layerAndWeight &b)
phaseSystem & fluid
Definition: createFields.H:11
phi
Definition: correctPhi.H:3
virtual tmp< fvScalarMatrix > kSource() const
tmp< volScalarField > phaseTransferCoeff() const
Abstract base class for all fluid physical properties.
Definition: viscosity.H:49
BasicMomentumTransportModel::rhoField rhoField
Definition: kEqn.H:98
virtual bool read()
Read model coefficients if they have changed.
virtual tmp< volScalarField > k() const =0
Return the turbulence kinetic energy.
Abstract base class for turbulence models (RAS, LES and laminar).
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
A class for managing temporary objects.
Definition: PtrList.H:53
const objectRegistry & db() const
Return the local objectRegistry.
Definition: IOobject.C:312
continuousGasKEqn(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.
Single incompressible phase derived from the phase-fraction. Used as part of the multiPhaseMixture fo...
Definition: phaseModel.H:53
dimensionedScalar deltaT() const
Return time step.
Definition: TimeStateI.H:46
BasicMomentumTransportModel::alphaField alphaField
Definition: kEqn.H:97
Namespace for OpenFOAM.