moleFractions.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) 2016-2021 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::moleFractions
26 
27 Description
28  This function object calculates mole-fraction fields from the mass-fraction
29  fields of the psi/rhoReactionThermo and caches them for output and further
30  post-processing.
31 
32  The names of the mole-fraction fields are obtained from the corresponding
33  mass-fraction fields prepended by "X_"
34 
35  Example of function object specification:
36  \verbatim
37  moleFractions
38  {
39  type psiReactionThermoMoleFractions;
40  }
41  \endverbatim
42  or
43  \verbatim
44  moleFractions
45  {
46  type rhoReactionThermoMoleFractions;
47  }
48  \endverbatim
49  depending on the thermodynamics package used in the solver.
50 
51  Optionally, the name of the phase can be specified for multiphase cases.
52 
53 See also
54  Foam::functionObjects::fvMeshFunctionObject
55 
56 SourceFiles
57  moleFractions.C
58 
59 \*---------------------------------------------------------------------------*/
60 
61 #ifndef moleFractions_H
62 #define moleFractions_H
63 
64 #include "fvMeshFunctionObject.H"
65 #include "volFieldsFwd.H"
66 
67 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
68 
69 namespace Foam
70 {
71 
72 /*---------------------------------------------------------------------------*\
73  Class moleFractions Declaration
74 \*---------------------------------------------------------------------------*/
75 
76 template<class ThermoType>
77 class moleFractions
78 :
80 {
81  // Private Data
82 
83  //- Species mole fractions
85 
86  //- Optional phase name
87  word phaseName_;
88 
89 
90  // Private Member Functions
91 
92  //- Calculate the mole fraction fields
93  virtual void calculateMoleFractions();
94 
95 
96 public:
97 
98  //- Runtime type information
99  TypeName("moleFractions");
100 
101 
102  // Constructors
103 
104  //- Construct from Time and dictionary
106  (
107  const word& name,
108  const Time& t,
109  const dictionary& dict
110  );
111 
112  //- Disallow default bitwise copy construction
113  moleFractions(const moleFractions&) = delete;
114 
115 
116  //- Destructor
117  virtual ~moleFractions();
118 
119 
120  // Member Functions
121 
122  //- Read the moleFractions data
123  virtual bool read(const dictionary&);
124 
125  //- Return the list of fields required
126  virtual wordList fields() const
127  {
128  return wordList::null();
129  }
130 
131  //- Calculate the mole-fraction fields
132  virtual bool execute();
133 
134  //- The mole-fraction fields auto-write
135  virtual bool write();
136 
137 
138  // Member Operators
139 
140  //- Disallow default bitwise assignment
141  void operator=(const moleFractions&) = delete;
142 };
143 
144 
145 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
146 
147 } // End namespace Foam
148 
149 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
150 
151 #ifdef NoRepository
152  #include "moleFractions.C"
153 #endif
154 
155 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
156 
157 #endif
158 
159 // ************************************************************************* //
dictionary dict
const word & name() const
Return the name of this functionObject.
virtual ~moleFractions()
Destructor.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
static const List< T > & null()
Return a null List.
Definition: ListI.H:118
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:69
moleFractions(const word &name, const Time &t, const dictionary &dict)
Construct from Time and dictionary.
Definition: moleFractions.C:62
A class for handling words, derived from string.
Definition: word.H:59
virtual bool write()
The mole-fraction fields auto-write.
This function object calculates mole-fraction fields from the mass-fraction fields of the psi/rhoReac...
Definition: moleFractions.H:76
virtual bool execute()
Calculate the mole-fraction fields.
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
Definition: List.H:70
void operator=(const moleFractions &)=delete
Disallow default bitwise assignment.
virtual wordList fields() const
Return the list of fields required.
TypeName("moleFractions")
Runtime type information.
Specialisation of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
virtual bool read(const dictionary &)
Read the moleFractions data.
Namespace for OpenFOAM.