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 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  region | Region to be evaluated | no | default region
60  \endtable
61 
62 SourceFiles
63  specieFlux.C
64 
65 \*---------------------------------------------------------------------------*/
66 
67 #ifndef specieFlux_H
68 #define specieFlux_H
69 
70 #include "fieldExpression.H"
71 #include "volFieldsFwd.H"
72 #include "surfaceFieldsFwd.H"
73 
74 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
75 
76 namespace Foam
77 {
78 
79 class fluidThermophysicalTransportModel;
80 
81 namespace functionObjects
82 {
83 
84 /*---------------------------------------------------------------------------*\
85  Class specieFluxBase Declaration
86 \*---------------------------------------------------------------------------*/
87 
88 class specieFluxBase
89 :
90  public fieldExpression
91 {
92  // Protected Data
93 
94  //- Name of field from which schemes are taken
95  const word schemesField_;
96 
97 
98  // Private Member Functions
99 
100  //- Calculate the specie flux field and return true if successful
101  virtual bool calc();
102 
103  //- Calculate the specie flux field
104  virtual tmp<surfaceScalarField> calc
105  (
106  const fluidThermophysicalTransportModel& ttm,
107  const volScalarField& Yi
108  ) = 0;
109 
110 
111 protected:
112 
113  // Protected Member Functions
114 
115  //- Return the advective flux
117  (
119  const volScalarField& Yi
120  ) const;
121 
122  //- Return the diffusive flux
124  (
126  const volScalarField& Yi
127  ) const;
128 
129 public:
130 
131 
132  // Constructors
133 
134  //- Construct from Time and dictionary
136  (
137  const word& name,
138  const Time& runTime,
139  const dictionary& dict,
140  const word& typeName
141  );
142 
143 
144  //- Destructor
145  virtual ~specieFluxBase();
146 };
147 
148 
149 /*---------------------------------------------------------------------------*\
150  Class specieFlux Declaration
151 \*---------------------------------------------------------------------------*/
152 
153 class specieFlux
154 :
155  public specieFluxBase
156 {
157 private:
158 
159  // Private Member Functions
160 
161  //- Calculate the specie flux field
162  virtual tmp<surfaceScalarField> calc
163  (
165  const volScalarField& Yi
166  );
167 
168 
169 public:
170 
171  //- Runtime type information
172  TypeName("specieFlux");
173 
174 
175  // Constructors
176 
177  //- Construct from Time and dictionary
178  specieFlux
179  (
180  const word& name,
181  const Time& runTime,
182  const dictionary& dict
183  );
184 };
185 
186 
187 /*---------------------------------------------------------------------------*\
188  Class specieAdvectiveFlux Declaration
189 \*---------------------------------------------------------------------------*/
190 
192 :
193  public specieFluxBase
194 {
195 private:
196 
197  // Private Member Functions
198 
199  //- Calculate the specie flux field
200  virtual tmp<surfaceScalarField> calc
201  (
203  const volScalarField& Yi
204  );
205 
206 
207 public:
208 
209  //- Runtime type information
210  TypeName("specieAdvectiveFlux");
211 
212 
213  // Constructors
214 
215  //- Construct from Time and dictionary
217  (
218  const word& name,
219  const Time& runTime,
220  const dictionary& dict
221  );
222 };
223 
224 
225 /*---------------------------------------------------------------------------*\
226  Class specieDiffusiveFlux Declaration
227 \*---------------------------------------------------------------------------*/
228 
230 :
231  public specieFluxBase
232 {
233 private:
234 
235  // Private Member Functions
236 
237  //- Calculate the specie flux field
238  virtual tmp<surfaceScalarField> calc
239  (
241  const volScalarField& Yi
242  );
243 
244 
245 public:
246 
247  //- Runtime type information
248  TypeName("specieDiffusiveFlux");
249 
250 
251  // Constructors
252 
253  //- Construct from Time and dictionary
255  (
256  const word& name,
257  const Time& runTime,
258  const dictionary& dict
259  );
260 };
261 
262 
263 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
264 
265 } // End namespace functionObjects
266 } // End namespace Foam
267 
268 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
269 
270 #endif
271 
272 // ************************************************************************* //
Generic GeometricField class.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:76
A list of keyword definitions, which are a keyword followed by any number of values (e....
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:182
TypeName("specieDiffusiveFlux")
Runtime type information.
specieDiffusiveFlux(const word &name, const Time &runTime, const dictionary &dict)
Construct from Time and dictionary.
Definition: specieFlux.C:193
tmp< surfaceScalarField > calcPhiYif(const fluidThermophysicalTransportModel &ttm, const volScalarField &Yi) const
Return the advective flux.
Definition: specieFlux.C:126
tmp< surfaceScalarField > calcJ(const fluidThermophysicalTransportModel &ttm, const volScalarField &Yi) const
Return the diffusive flux.
Definition: specieFlux.C:145
specieFluxBase(const word &name, const Time &runTime, const dictionary &dict, const word &typeName)
Construct from Time and dictionary.
Definition: specieFlux.C:158
virtual ~specieFluxBase()
Destructor.
Definition: specieFlux.C:205
These functions calculate the specie-flux and write it as a surfaceScalarField called 'specie<Type>Fl...
Definition: specieFlux.H:176
TypeName("specieFlux")
Runtime type information.
specieFlux(const word &name, const Time &runTime, const dictionary &dict)
Construct from Time and dictionary.
Definition: specieFlux.C:171
A class for managing temporary objects.
Definition: tmp.H:55
A class for handling words, derived from string.
Definition: word.H:62
Namespace for OpenFOAM.
VolField< scalar > volScalarField
Definition: volFieldsFwd.H:64
dictionary dict