eddyDiffusivity.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-2022 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 "eddyDiffusivity.H"
27 #include "fvmLaplacian.H"
28 #include "fvcLaplacian.H"
29 
30 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
31 
32 namespace Foam
33 {
34 namespace turbulenceThermophysicalTransportModels
35 {
36 
37 // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
38 
39 template<class TurbulenceThermophysicalTransportModel>
41 {
42  alphat_ =
43  this->momentumTransport().rho()
44  *this->momentumTransport().nut()/Prt_;
45  alphat_.correctBoundaryConditions();
46 }
47 
48 
49 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
50 
51 template<class TurbulenceThermophysicalTransportModel>
53 (
54  const momentumTransportModel& momentumTransport,
55  const thermoModel& thermo
56 )
57 :
58  TurbulenceThermophysicalTransportModel
59  (
60  typeName,
61  momentumTransport,
62  thermo
63  ),
64 
65  Prt_("Prt", dimless, this->coeffDict_),
66 
67  alphat_
68  (
69  IOobject
70  (
71  IOobject::groupName
72  (
73  "alphat",
74  this->momentumTransport().alphaRhoPhi().group()
75  ),
76  momentumTransport.time().name(),
77  momentumTransport.mesh(),
78  IOobject::MUST_READ,
79  IOobject::AUTO_WRITE
80  ),
81  momentumTransport.mesh()
82  )
83 {}
84 
85 
86 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
87 
88 template<class TurbulenceThermophysicalTransportModel>
90 {
92  {
93  Prt_.read(this->coeffDict());
94 
95  return true;
96  }
97  else
98  {
99  return false;
100  }
101 }
102 
103 
104 template<class TurbulenceThermophysicalTransportModel>
107 (
108  const volScalarField& Yi
109 ) const
110 {
112  << type() << " supports single component systems only, " << nl
113  << " for multi-component transport select"
114  " nonUnityLewisEddyDiffusivity or unityLewisEddyDiffusivity"
115  << exit(FatalError);
116 
117  return tmp<volScalarField>(nullptr);
118 }
119 
120 
121 template<class TurbulenceThermophysicalTransportModel>
124 (
125  const volScalarField& Yi,
126  const label patchi
127 ) const
128 {
130  << type() << " supports single component systems only, " << nl
131  << " for multi-component transport select"
132  " nonUnityLewisEddyDiffusivity or unityLewisEddyDiffusivity"
133  << exit(FatalError);
134 
135  return tmp<scalarField>(nullptr);
136 }
137 
138 
139 template<class TurbulenceThermophysicalTransportModel>
142 {
144  (
146  (
147  "q",
148  this->momentumTransport().alphaRhoPhi().group()
149  ),
150  -fvc::interpolate(this->alpha()*this->kappaEff())
151  *fvc::snGrad(this->thermo().T())
152  );
153 }
154 
155 
156 template<class TurbulenceThermophysicalTransportModel>
159 (
161 ) const
162 {
163  // Return heat flux source as an implicit energy correction
164  // to the temperature gradient flux
165  return
166  -fvc::laplacian(this->alpha()*this->kappaEff(), this->thermo().T())
167  -fvm::laplacianCorrection(this->alpha()*this->alphaEff(), he);
168 }
169 
170 
171 template<class TurbulenceThermophysicalTransportModel>
174 (
175  const volScalarField& Yi
176 ) const
177 {
179  << type() << " supports single component systems only, " << nl
180  << " for multi-component transport select"
181  " nonUnityLewisEddyDiffusivity or unityLewisEddyDiffusivity"
182  << exit(FatalError);
183 
184  return tmp<surfaceScalarField>(nullptr);
185 }
186 
187 
188 template<class TurbulenceThermophysicalTransportModel>
191 (
192  volScalarField& Yi
193 ) const
194 {
196  << type() << " supports single component systems only, " << nl
197  << " for multi-component transport select"
198  " nonUnityLewisEddyDiffusivity or unityLewisEddyDiffusivity"
199  << exit(FatalError);
200 
201  return tmp<fvScalarMatrix>(nullptr);
202 }
203 
204 
205 template<class TurbulenceThermophysicalTransportModel>
207 {
208  TurbulenceThermophysicalTransportModel::predict();
209  correctAlphat();
210 }
211 
212 
213 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
214 
215 } // End namespace turbulenceThermophysicalTransportModels
216 } // End namespace Foam
217 
218 // ************************************************************************* //
Generic GeometricField class.
static tmp< GeometricField< Type, PatchField, GeoMesh > > New(const word &name, const Internal &, const PtrList< PatchField< Type >> &, 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
static word groupName(Name name, const word &group)
A class for managing temporary objects.
Definition: tmp.H:55
virtual tmp< volScalarField > DEff(const volScalarField &Yi) const
Effective mass diffusion coefficient.
TurbulenceThermophysicalTransportModel::thermoModel thermoModel
virtual tmp< fvScalarMatrix > divq(volScalarField &he) const
Return the source term for the energy equation.
eddyDiffusivity(const momentumTransportModel &momentumTransport, const thermoModel &thermo)
Construct from a momentum transport model and a thermo model.
virtual tmp< fvScalarMatrix > divj(volScalarField &Yi) const
Return the source term for the given specie mass-fraction equation.
virtual void predict()
Correct the eddyDiffusivity 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].
virtual bool read()
Read thermophysicalTransport dictionary.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:334
Calculate the laplacian of the given field.
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 char *const group
Group name for atomic constants.
static tmp< SurfaceField< Type > > interpolate(const VolField< Type > &tvf, const surfaceScalarField &faceFlux, Istream &schemeData)
Interpolate field onto faces using scheme given by Istream.
tmp< VolField< Type > > laplacian(const VolField< Type > &vf, const word &name)
Definition: fvcLaplacian.C:45
tmp< SurfaceField< Type > > snGrad(const VolField< Type > &vf, const word &name)
Definition: fvcSnGrad.C:45
tmp< fvMatrix< Type > > laplacianCorrection(const VolField< scalar > &gamma, const VolField< Type > &vf)
Definition: fvmLaplacian.C:340
Namespace for OpenFOAM.
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
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 bool)
Return a word representation of a bool.
Definition: boolIO.C:39
const dimensionSet dimless
error FatalError
static const char nl
Definition: Ostream.H:266
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.
Definition: POSIX.C:488
thermo he()
fluidMulticomponentThermo & thermo
Definition: createFields.H:31