massFractions.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) 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::functionObjects::massFractions
26 
27 Description
28  This function object calculates mass-fraction fields from mole-fraction or
29  moles fields present on disk. This is intended to be used for
30  initialisation where mole-fractions are known. If any mass fraction fields
31  are found (other than Ydefault) then an error will be generated and the
32  fields will not be overwritten. The names of the mole-fraction fields are
33  obtained from the corresponding mass-fraction fields prepended by "X_", and
34  the moles fields are prepended by "n_". Either mole-fraction fields or
35  moles fields should be present, not both.
36 
37  Example of function object specification:
38  \verbatim
39  massFractions
40  {
41  type massFractions;
42  }
43  \endverbatim
44 
45  Optionally, the name of the phase can be specified for multiphase cases.
46 
47 See also
48  Foam::functionObjects::fvMeshFunctionObject
49 
50 SourceFiles
51  massFractions.C
52 
53 \*---------------------------------------------------------------------------*/
54 
55 #ifndef functionObjects_massFractions_H
56 #define functionObjects_massFractions_H
57 
58 #include "fvMeshFunctionObject.H"
59 #include "volFieldsFwd.H"
60 
61 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
62 
63 namespace Foam
64 {
65 namespace functionObjects
66 {
67 
68 /*---------------------------------------------------------------------------*\
69  Class massFractions Declaration
70 \*---------------------------------------------------------------------------*/
71 
72 class massFractions
73 :
75 {
76  // Private Data
77 
78  //- Optional phase name
79  word phaseName_;
80 
81  //- Species mass fractions
83 
84 
85 public:
86 
87  //- Runtime type information
88  TypeName("massFractions");
89 
90 
91  // Constructors
92 
93  //- Construct from Time and dictionary
94  massFractions(const word& name, const Time& t, const dictionary& dict);
95 
96  //- Disallow default bitwise copy construction
97  massFractions(const massFractions&) = delete;
98 
99 
100  //- Destructor
101  virtual ~massFractions();
102 
103 
104  // Member Functions
105 
106  //- Read the massFractions data
107  virtual bool read(const dictionary&);
108 
109  //- Return the list of fields required
110  virtual wordList fields() const
111  {
112  return wordList::null();
113  }
114 
115  //- Calculate the mass-fraction fields
116  virtual bool execute();
117 
118  //- The mass-fraction fields auto-write
119  virtual bool write();
120 
121 
122  // Member Operators
123 
124  //- Disallow default bitwise assignment
125  void operator=(const massFractions&) = delete;
126 };
127 
128 
129 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
130 
131 } // End namespace functionObjects
132 } // End namespace Foam
133 
134 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
135 
136 #endif
137 
138 // ************************************************************************* //
static const List< word > & null()
Return a null List.
Definition: ListI.H:118
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 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:160
const word & name() const
Return the name of this functionObject.
Specialisation of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
This function object calculates mass-fraction fields from mole-fraction or moles fields present on di...
Definition: massFractions.H:74
virtual ~massFractions()
Destructor.
Definition: massFractions.C:59
virtual wordList fields() const
Return the list of fields required.
void operator=(const massFractions &)=delete
Disallow default bitwise assignment.
TypeName("massFractions")
Runtime type information.
massFractions(const word &name, const Time &t, const dictionary &dict)
Construct from Time and dictionary.
Definition: massFractions.C:45
virtual bool execute()
Calculate the mass-fraction fields.
Definition: massFractions.C:71
virtual bool write()
The mass-fraction fields auto-write.
virtual bool read(const dictionary &)
Read the massFractions data.
Definition: massFractions.C:65
A class for handling words, derived from string.
Definition: word.H:62
Namespace for OpenFOAM.
dictionary dict