Fourier.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 "Fourier.H"
27 #include "fvmLaplacian.H"
28 #include "fvcLaplacian.H"
29 
30 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
31 
32 namespace Foam
33 {
34 namespace laminarThermophysicalTransportModels
35 {
36 
37 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
38 
39 template<class BasicThermophysicalTransportModel>
41 (
42  const momentumTransportModel& momentumTransport,
43  const thermoModel& thermo
44 )
45 :
46  laminarThermophysicalTransportModel<BasicThermophysicalTransportModel>
47  (
48  typeName,
49  momentumTransport,
50  thermo
51  )
52 {}
53 
54 
55 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
56 
57 template<class BasicThermophysicalTransportModel>
58 const dictionary&
60 {
61  return dictionary::null;
62 }
63 
64 
65 template<class BasicThermophysicalTransportModel>
67 {
68  return true;
69 }
70 
71 
72 template<class TurbulenceThermophysicalTransportModel>
75 (
76  const volScalarField& Yi
77 ) const
78 {
80  << type() << " supports single component systems only, " << nl
81  << " for multi-component transport select"
82  " unityLewisFourier"
83  << exit(FatalError);
84 
85  return tmp<volScalarField>(nullptr);
86 }
87 
88 
89 template<class TurbulenceThermophysicalTransportModel>
92 (
93  const volScalarField& Yi,
94  const label patchi
95 ) const
96 {
98  << type() << " supports single component systems only, " << nl
99  << " for multi-component transport select"
100  " unityLewisFourier"
101  << exit(FatalError);
102 
103  return tmp<scalarField>(nullptr);
104 }
105 
106 
107 template<class BasicThermophysicalTransportModel>
109 {
110  const thermoModel& thermo = this->thermo();
111 
113  (
115  (
116  "q",
117  this->momentumTransport().alphaRhoPhi().group()
118  ),
119  -fvc::interpolate(this->alpha()*thermo.kappa())*fvc::snGrad(thermo.T())
120  );
121 }
122 
123 
124 template<class BasicThermophysicalTransportModel>
127 {
128  const thermoModel& thermo = this->thermo();
129 
130  // Return heat flux source as an implicit energy correction
131  // to the temperature gradient flux
132  return
133  -fvc::laplacian(this->alpha()*thermo.kappa(), thermo.T())
135  (
136  this->alpha()*thermo.kappa()/thermo.Cpv(),
137  he
138  );
139 }
140 
141 
142 template<class BasicThermophysicalTransportModel>
144 (
145  const volScalarField& Yi
146 ) const
147 {
149  << type() << " supports single component systems only, " << nl
150  << " for multi-component transport select"
151  " unityLewisFourier"
152  << exit(FatalError);
153 
154  return tmp<surfaceScalarField>(nullptr);
155 }
156 
157 
158 template<class BasicThermophysicalTransportModel>
161 {
163  << type() << " supports single component systems only, " << nl
164  << " for multi-component transport select"
165  " unityLewisFourier"
166  << exit(FatalError);
167 
168  return tmp<fvScalarMatrix>(nullptr);
169 }
170 
171 
172 template<class BasicThermophysicalTransportModel>
174 {
176  <
177  BasicThermophysicalTransportModel
178  >::predict();
179 }
180 
181 
182 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
183 
184 } // End namespace laminarThermophysicalTransportModels
185 } // End namespace Foam
186 
187 // ************************************************************************* //
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,.
static word groupName(Name name, const word &group)
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:162
static const dictionary null
Null dictionary.
Definition: dictionary.H:258
Templated abstract base class for laminar thermophysical transport models.
Fourier(const momentumTransportModel &momentumTransport, const thermoModel &thermo)
Construct from components.
Definition: Fourier.C:41
virtual tmp< volScalarField > DEff(const volScalarField &Yi) const
Effective mass diffusion coefficient.
Definition: Fourier.C:75
virtual tmp< fvScalarMatrix > divq(volScalarField &he) const
Return the source term for the energy equation.
Definition: Fourier.C:126
virtual tmp< fvScalarMatrix > divj(volScalarField &Yi) const
Return the source term for the given specie mass-fraction equation.
Definition: Fourier.C:160
virtual void predict()
Correct the Fourier viscosity.
Definition: Fourier.C:173
virtual tmp< surfaceScalarField > j(const volScalarField &Yi) const
Return the specie flux for the given specie mass-fraction [kg/m^2/s].
Definition: Fourier.C:144
virtual tmp< surfaceScalarField > q() const
Return the heat flux [W/m^2].
Definition: Fourier.C:108
BasicThermophysicalTransportModel::thermoModel thermoModel
Definition: Fourier.H:73
BasicThermophysicalTransportModel::momentumTransportModel momentumTransportModel
Definition: Fourier.H:70
virtual const dictionary & coeffDict() const
Const access to the coefficients dictionary.
Definition: Fourier.C:59
virtual bool read()
Read thermophysicalTransport dictionary.
Definition: Fourier.C:66
A class for managing temporary objects.
Definition: tmp.H:55
#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))
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
error FatalError
static const char nl
Definition: Ostream.H:266
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