Fickian.H
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) 2021-2023 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 Class
25  Foam::turbulenceThermophysicalTransportModels::Fickian
26 
27 Description
28  Base class for multi-component Fickian based temperature gradient heat
29  flux models with optional Soret thermal diffusion of species.
30 
31  The mixture diffusion coefficients are specified as Function2<scalar>s of
32  pressure and temperature but independent of composition.
33 
34  The heat flux source is implemented as an implicit energy correction to the
35  temperature gradient based flux source. At convergence the energy
36  correction is 0.
37 
38 SourceFiles
39  Fickian.C
40 
41 \*---------------------------------------------------------------------------*/
42 
43 #include "Function2.H"
44 
45 #ifndef Fickian_H
46 #define Fickian_H
47 
48 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 
50 namespace Foam
51 {
52 
53 /*---------------------------------------------------------------------------*\
54  Class Fickian Declaration
55 \*---------------------------------------------------------------------------*/
56 
57 template<class BasicThermophysicalTransportModel>
58 class Fickian
59 :
60  public BasicThermophysicalTransportModel,
61  public UpdateableMeshObject<fvMesh>
62 {
63  // Private data
64 
65  // Model coefficients
66 
67  //- Choice between mass diffusion coefficient functions w.r.t
68  // mixture and mixing binary mass diffusion coefficient functions
69  bool mixtureDiffusionCoefficients_;
70 
71  //- Array of specie binary mass diffusion coefficient functions
72  // [m^2/s]
74 
75  //- List of specie mass diffusion coefficient functions
76  // w.r.t the mixture [m^2/s]
77  PtrList<Function2<scalar>> DmFuncs_;
78 
79  //- List of specie Soret thermal diffusion coefficient
80  // functions [kg/m/s]
81  PtrList<Function2<scalar>> DTFuncs_;
82 
83  //- Mass diffusion coefficients in the mixture
84  mutable PtrList<volScalarField> Dm_;
85 
86 
87  // Private member functions
88 
89  //- Update Dm_
90  void updateDm() const;
91 
92  //- Update Dm_ if not yet constructed and return
93  const PtrList<volScalarField>& Dm() const;
94 
95 
96 public:
97 
98  typedef typename BasicThermophysicalTransportModel::alphaField
99  alphaField;
100 
101  typedef typename
104 
105  typedef typename BasicThermophysicalTransportModel::thermoModel
106  thermoModel;
107 
108 
109  // Constructors
110 
111  //- Construct from a momentum transport model and a thermo model
112  Fickian
113  (
114  const word& type,
115  const momentumTransportModel& momentumTransport,
116  const thermoModel& thermo
117  );
118 
119 
120  //- Destructor
121  virtual ~Fickian()
122  {}
123 
124 
125  // Member Functions
126 
127  //- Read thermophysicalTransport dictionary
128  virtual bool read();
129 
130  //- Effective mass diffusion coefficient
131  // for a given specie mass-fraction [kg/m/s]
132  virtual tmp<volScalarField> DEff(const volScalarField& Yi) const;
133 
134  //- Effective mass diffusion coefficient
135  // for a given specie mass-fraction for patch [kg/m/s]
136  virtual tmp<scalarField> DEff
137  (
138  const volScalarField& Yi,
139  const label patchi
140  ) const;
141 
142  //- Return the heat flux [W/m^2]
143  virtual tmp<surfaceScalarField> q() const;
144 
145  //- Return the source term for the energy equation
146  virtual tmp<fvScalarMatrix> divq(volScalarField& he) const;
147 
148  //- Return the specie flux for the given specie mass-fraction [kg/m^2/s]
149  virtual tmp<surfaceScalarField> j(const volScalarField& Yi) const;
150 
151  //- Return the source term for the given specie mass-fraction equation
152  virtual tmp<fvScalarMatrix> divj(volScalarField& Yi) const;
153 
154  //- Update the diffusion coefficients
155  virtual void predict();
156 
157 
158  // Mesh changes
159 
160  //- Update for mesh motion
161  virtual bool movePoints();
162 
163  //- Update topology using the given map
164  virtual void topoChange(const polyTopoChangeMap& map);
165 
166  //- Update from another mesh using the given map
167  virtual void mapMesh(const polyMeshMap& map);
168 
169  //- Redistribute or update using the given distribution map
170  virtual void distribute(const polyDistributionMap& map);
171 };
172 
173 
174 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
175 
176 } // End namespace Foam
177 
178 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
179 
180 #ifdef NoRepository
181  #include "Fickian.C"
182 #endif
183 
184 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
185 
186 #endif
187 
188 // ************************************************************************* //
virtual bool movePoints()
Update for mesh motion.
Definition: Fickian.C:531
virtual tmp< volScalarField > DEff(const volScalarField &Yi) const
Effective mass diffusion coefficient.
Definition: Fickian.C:272
BasicThermophysicalTransportModel::alphaField alphaField
Definition: Fickian.H:98
virtual tmp< fvScalarMatrix > divq(volScalarField &he) const
Return the source term for the energy equation.
Definition: Fickian.C:380
virtual tmp< fvScalarMatrix > divj(volScalarField &Yi) const
Return the source term for the given specie mass-fraction equation.
Definition: Fickian.C:487
virtual void predict()
Update the diffusion coefficients.
Definition: Fickian.C:523
virtual void mapMesh(const polyMeshMap &map)
Update from another mesh using the given map.
Definition: Fickian.C:550
virtual tmp< surfaceScalarField > j(const volScalarField &Yi) const
Return the specie flux for the given specie mass-fraction [kg/m^2/s].
Definition: Fickian.C:454
virtual tmp< surfaceScalarField > q() const
Return the heat flux [W/m^2].
Definition: Fickian.C:303
virtual void distribute(const polyDistributionMap &map)
Redistribute or update using the given distribution map.
Definition: Fickian.C:561
BasicThermophysicalTransportModel::thermoModel thermoModel
Definition: Fickian.H:105
virtual ~Fickian()
Destructor.
Definition: Fickian.H:120
BasicThermophysicalTransportModel::momentumTransportModel momentumTransportModel
Definition: Fickian.H:102
Fickian(const word &type, const momentumTransportModel &momentumTransport, const thermoModel &thermo)
Construct from a momentum transport model and a thermo model.
Definition: Fickian.C:128
virtual void topoChange(const polyTopoChangeMap &map)
Update topology using the given map.
Definition: Fickian.C:539
virtual bool read()
Read thermophysicalTransport dictionary.
Definition: Fickian.C:161
Generic GeometricField class.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: List.H:91
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
Definition: PtrList.H:75
Class containing mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
Class containing mesh-to-mesh mapping information.
Definition: polyMeshMap.H:51
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
A class for managing temporary objects.
Definition: tmp.H:55
A class for handling words, derived from string.
Definition: word.H:62
label patchi
compressibleMomentumTransportModel momentumTransportModel
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
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