unityLewisEddyDiffusivity.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) 2020-2026 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 
27 #include "fvcSnGrad.H"
28 #include "fvmLaplacian.H"
29 
30 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
31 
32 namespace Foam
33 {
34 namespace turbulenceThermophysicalTransportModels
35 {
36 
37 // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
38 
39 template<class TurbulenceThermophysicalTransportModel>
42 {
43  alphat_ =
44  this->momentumTransport().rho()
45  *this->momentumTransport().nut()/Prt_;
46  alphat_.correctBoundaryConditions();
47 }
48 
49 
50 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
51 
52 template<class TurbulenceThermophysicalTransportModel>
55 (
56  const momentumTransportModel& momentumTransport,
57  const thermoModel& thermo,
58  const bool allowDefaultPrt
59 )
60 :
62  (
63  typeName,
64  momentumTransport,
65  thermo,
66  allowDefaultPrt
67  )
68 {}
69 
70 
71 template<class TurbulenceThermophysicalTransportModel>
74 (
75  const word& type,
76  const momentumTransportModel& momentumTransport,
77  const thermoModel& thermo,
78  const bool allowDefaultPrt
79 )
80 :
81  TurbulenceThermophysicalTransportModel
82  (
83  type,
84  momentumTransport,
85  thermo
86  ),
87 
88  Prt_
89  (
90  allowDefaultPrt
91  ? dimensioned<scalar>("Prt", dimless, this->typeDict(type), 1)
92  : dimensioned<scalar>("Prt", dimless, this->typeDict(type))
93  ),
94 
95  alphat_
96  (
97  IOobject
98  (
99  IOobject::groupName
100  (
101  "alphat",
102  thermo.phaseName()
103  ),
104  momentumTransport.time().name(),
105  momentumTransport.mesh(),
106  IOobject::MUST_READ,
107  IOobject::AUTO_WRITE
108  ),
109  momentumTransport.mesh(),
110  dimensions::dynamicDiffusivity
111  )
112 {}
113 
114 
115 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
116 
117 template<class TurbulenceThermophysicalTransportModel>
119 {
121  {
122  Prt_.readIfPresent(this->typeDict());
123 
124  return true;
125  }
126  else
127  {
128  return false;
129  }
130 }
131 
132 
133 template<class TurbulenceThermophysicalTransportModel>
136 {
138  (
140  (
141  "q",
142  this->thermo().phaseName()
143  ),
144  -fvc::interpolate(this->alpha()*this->alphaEff())
145  *fvc::snGrad(this->thermo().he())
146  );
147 }
148 
149 
150 template<class TurbulenceThermophysicalTransportModel>
153 (
154  const label patchi
155 ) const
156 {
157  return
158  - (
159  this->alpha().boundaryField()[patchi]
160  *this->alphaEff(patchi)
161  *this->thermo().he().boundaryField()[patchi].snGrad()
162  );
163 }
164 
165 
166 template<class TurbulenceThermophysicalTransportModel>
169 (
170  volScalarField& he
171 ) const
172 {
173  return -fvm::laplacian(this->alpha()*this->alphaEff(), he);
174 }
175 
176 
177 template<class TurbulenceThermophysicalTransportModel>
180 (
181  const volScalarField& Yi
182 ) const
183 {
185  (
187  (
188  "j(" + Yi.name() + ')',
189  this->thermo().phaseName()
190  ),
191  -fvc::interpolate(this->DEff(Yi)*this->alpha())*fvc::snGrad(Yi)
192  );
193 }
194 
195 
196 template<class TurbulenceThermophysicalTransportModel>
199 (
200  const volScalarField& Yi,
201  const label patchi
202 ) const
203 {
204  return
205  - (
206  this->alpha().boundaryField()[patchi]
207  *this->DEff(Yi, patchi)
208  *Yi.boundaryField()[patchi].snGrad()
209  );
210 }
211 
212 
213 template<class TurbulenceThermophysicalTransportModel>
216 (
217  volScalarField& Yi
218 ) const
219 {
220  return -fvm::laplacian(this->alpha()*this->DEff(Yi), Yi);
221 }
222 
223 
224 template<class TurbulenceThermophysicalTransportModel>
226 predict()
227 {
228  TurbulenceThermophysicalTransportModel::predict();
229  correctAlphat();
230 }
231 
232 
233 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
234 
235 } // End namespace turbulenceThermophysicalTransportModels
236 } // End namespace Foam
237 
238 // ************************************************************************* //
Generic GeometricField class.
const Boundary & boundaryField() const
Return const-reference to the boundary field.
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
const word & name() const
Return name.
Definition: IOobject.H:307
static word groupName(Name name, const word &group)
Generic dimensioned Type class.
A class for managing temporary objects.
Definition: tmp.H:55
Eddy-diffusivity based energy gradient heat flux model for RAS or LES of turbulent flow....
unityLewisEddyDiffusivity(const momentumTransportModel &momentumTransport, const thermoModel &thermo, const bool allowDefaultPrt=false)
Construct from a momentum transport model and a thermo model.
virtual tmp< fvScalarMatrix > divq(volScalarField &he) const
Return the source term for the energy equation.
virtual tmp< fvScalarMatrix > divj(volScalarField &Yi) const
Return the source term for the given specie mass-fraction equation.
virtual void predict()
Correct the unityLewisEddyDiffusivity viscosity.
virtual tmp< surfaceScalarField > j(const volScalarField &Yi) const
Return the specie flux for the given specie mass-fraction [kg/m^2/s].
TurbulenceThermophysicalTransportModel::momentumTransportModel momentumTransportModel
virtual tmp< surfaceScalarField > q() const
Return the heat flux [W/m^2].
Template function which returns the un-mangled name of a given type. Useful for types which do not ha...
A class for handling words, derived from string.
Definition: word.H:63
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
Calculate the snGrad of the given volField.
Calculate the matrix for the laplacian of the field.
label patchi
volScalarField alpha(IOobject("alpha", runTime.name(), mesh, IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE), lambda *max(Ua &U, zeroSensitivity))
void read(Istream &, label &, const dictionary &)
In-place read with dictionary lookup.
const dimensionSet dimless
const dimensionSet time
const dimensionSet dynamicDiffusivity
static tmp< SurfaceField< Type > > interpolate(const VolField< Type > &tvf, const surfaceScalarField &faceFlux, Istream &schemeData)
Interpolate field onto faces using scheme given by Istream.
tmp< SurfaceField< Type > > snGrad(const VolField< Type > &vf, const word &name)
Definition: fvcSnGrad.C:45
tmp< fvMatrix< Type > > laplacian(const VolField< Type > &vf, const word &name)
Definition: fvmLaplacian.C:47
Namespace for OpenFOAM.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
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
fluidMulticomponentThermo & thermo
Definition: createFields.H:15