specieFlux.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) 2024-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 Class
25  Foam::functionObjects::specieFlux
26 
27 Description
28  These functions calculate the specie-flux and write it as a
29  surfaceScalarField called 'specie<Type>Flux(<specieName>)'. There are
30  three such functions; specieAdvectiveFlux and specieDiffusiveFlux return
31  the advective and diffusive parts of the flux, respectively, and
32  specieFlux returns the total combined flux.
33 
34  Example of function object specification:
35  \verbatim
36  specieFlux
37  {
38  type specieFlux; // specieAdvectiveFlux, specieDiffusiveFlux
39  libs ("libfieldFunctionObjects.so");
40  field NH3;
41  }
42  \endverbatim
43 
44  Or, using the standard configuration:
45  \verbatim
46  #includeFunc specieFlux(NH3)
47  \endverbatim
48 
49 Usage
50  \table
51  Property | Description | Required | Default value
52  type | Type name: specieFlux, \\
53  specieAdvectiveFlux, or \\
54  specieDiffusiveFlux | yes |
55  field | Name of the specie/mass \\
56  fraction field | yes |
57  schemesField | Name of the field from \\
58  which schemes are taken | no | Yi
59  phase | Name of the phase | no |
60  region | Region to be evaluated | no | default region
61  \endtable
62 
63 SourceFiles
64  specieFlux.C
65 
66 \*---------------------------------------------------------------------------*/
67 
68 #ifndef specieFlux_H
69 #define specieFlux_H
70 
71 #include "fieldExpression.H"
72 #include "volFieldsFwd.H"
73 #include "surfaceFieldsFwd.H"
74 
75 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
76 
77 namespace Foam
78 {
79 
80 class fluidThermophysicalTransportModel;
81 
82 namespace functionObjects
83 {
84 
85 /*---------------------------------------------------------------------------*\
86  Class specieFluxBase Declaration
87 \*---------------------------------------------------------------------------*/
88 
89 class specieFluxBase
90 :
91  public fieldExpression
92 {
93  // Protected Data
94 
95  //- Name of field from which schemes are taken
96  const word schemesField_;
97 
98 
99  // Private Member Functions
100 
101  //- Calculate the specie flux field and return true if successful
102  virtual bool calc();
103 
104  //- Calculate the specie flux field
105  virtual tmp<surfaceScalarField> calc
106  (
107  const fluidThermophysicalTransportModel& ttm,
108  const volScalarField& Yi
109  ) = 0;
110 
111 
112 protected:
113 
114  // Protected Member Functions
115 
116  //- Return the advective flux
118  (
120  const volScalarField& Yi
121  ) const;
122 
123  //- Return the diffusive flux
125  (
127  const volScalarField& Yi
128  ) const;
129 
130 public:
131 
132 
133  // Constructors
134 
135  //- Construct from Time and dictionary
137  (
138  const word& name,
139  const Time& runTime,
140  const dictionary& dict,
141  const word& typeName
142  );
143 
144 
145  //- Destructor
146  virtual ~specieFluxBase();
147 };
148 
149 
150 /*---------------------------------------------------------------------------*\
151  Class specieFlux Declaration
152 \*---------------------------------------------------------------------------*/
153 
154 class specieFlux
155 :
156  public specieFluxBase
157 {
158 private:
159 
160  // Private Member Functions
161 
162  //- Calculate the specie flux field
163  virtual tmp<surfaceScalarField> calc
164  (
166  const volScalarField& Yi
167  );
168 
169 
170 public:
171 
172  //- Runtime type information
173  TypeName("specieFlux");
174 
175 
176  // Constructors
177 
178  //- Construct from Time and dictionary
180  (
181  const word& name,
182  const Time& runTime,
183  const dictionary& dict
184  );
185 };
186 
187 
188 /*---------------------------------------------------------------------------*\
189  Class specieAdvectiveFlux Declaration
190 \*---------------------------------------------------------------------------*/
191 
193 :
194  public specieFluxBase
195 {
196 private:
197 
198  // Private Member Functions
199 
200  //- Calculate the specie flux field
201  virtual tmp<surfaceScalarField> calc
202  (
204  const volScalarField& Yi
205  );
206 
207 
208 public:
209 
210  //- Runtime type information
211  TypeName("specieAdvectiveFlux");
212 
213 
214  // Constructors
215 
216  //- Construct from Time and dictionary
218  (
219  const word& name,
220  const Time& runTime,
221  const dictionary& dict
222  );
223 };
224 
225 
226 /*---------------------------------------------------------------------------*\
227  Class specieDiffusiveFlux Declaration
228 \*---------------------------------------------------------------------------*/
229 
231 :
232  public specieFluxBase
233 {
234 private:
235 
236  // Private Member Functions
237 
238  //- Calculate the specie flux field
239  virtual tmp<surfaceScalarField> calc
240  (
242  const volScalarField& Yi
243  );
244 
245 
246 public:
247 
248  //- Runtime type information
249  TypeName("specieDiffusiveFlux");
250 
251 
252  // Constructors
253 
254  //- Construct from Time and dictionary
256  (
257  const word& name,
258  const Time& runTime,
259  const dictionary& dict
260  );
261 };
262 
263 
264 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
265 
266 } // End namespace functionObjects
267 } // End namespace Foam
268 
269 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
270 
271 #endif
272 
273 // ************************************************************************* //
Generic GeometricField class.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:76
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
Abstract base class for fluid thermophysical transport models RAS, LES and laminar.
const word & name() const
Return the name of this functionObject.
TypeName("specieAdvectiveFlux")
Runtime type information.
specieAdvectiveFlux(const word &name, const Time &runTime, const dictionary &dict)
Construct from Time and dictionary.
Definition: specieFlux.C:183
TypeName("specieDiffusiveFlux")
Runtime type information.
specieDiffusiveFlux(const word &name, const Time &runTime, const dictionary &dict)
Construct from Time and dictionary.
Definition: specieFlux.C:194
tmp< surfaceScalarField > calcPhiYif(const fluidThermophysicalTransportModel &ttm, const volScalarField &Yi) const
Return the advective flux.
Definition: specieFlux.C:128
tmp< surfaceScalarField > calcJ(const fluidThermophysicalTransportModel &ttm, const volScalarField &Yi) const
Return the diffusive flux.
Definition: specieFlux.C:147
specieFluxBase(const word &name, const Time &runTime, const dictionary &dict, const word &typeName)
Construct from Time and dictionary.
Definition: specieFlux.C:159
virtual ~specieFluxBase()
Destructor.
Definition: specieFlux.C:206
These functions calculate the specie-flux and write it as a surfaceScalarField called 'specie<Type>Fl...
Definition: specieFlux.H:182
TypeName("specieFlux")
Runtime type information.
specieFlux(const word &name, const Time &runTime, const dictionary &dict)
Construct from Time and dictionary.
Definition: specieFlux.C:172
A class for managing temporary objects.
Definition: tmp.H:55
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
Namespace for OpenFOAM.
VolField< scalar > volScalarField
Definition: volFieldsFwd.H:62
dictionary dict