moleFractions.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2016-2020 OpenFOAM Foundation
9  Copyright (C) 2020 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::moleFractions
29 
30 Group
31  grpThermophysicalFunctionObjects
32 
33 Description
34  Calculates mole-fraction fields from the mass-fraction
35  fields of the psi/rhoReactionThermo and caches them
36  for output and further post-processing.
37 
38  The names of the mole-fraction fields are obtained from
39  the corresponding mass-fraction fields prepended by "X_".
40 
41  Operands:
42  \table
43  Operand | Type | Location
44  input | - | -
45  output file | - | -
46  output field | volScalarField | $FOAM_CASE/<time>/<outField>
47  \endtable
48 
49 Usage
50  Minimal example by using \c system/controlDict.functions:
51  \verbatim
52  moleFractions1
53  {
54  // Conditional mandatory entries (unmodifiable)
55  // Either of the below depending on
56  // the thermodynamics package used in the solver.
57 
58  // Option-1
59  type psiReactionThermoMoleFractions;
60 
61  // Option-2
62  type rhoReactionThermoMoleFractions;
63 
64  // Mandatory entries (unmodifiable)
65  libs (fieldFunctionObjects);
66 
67  // Optional entries (runtime modifiable)
68  phase <phaseName>;
69 
70  // Optional (inherited) entries
71  ...
72  }
73  \endverbatim
74 
75  where the entries mean:
76  \table
77  Property | Description | Type | Reqd | Dflt
78  type | Type name: psiReactionThermoMoleFractions or <!--
79  --> rhoReactionThermoMoleFractions | word | yes | -
80  libs | Library name: fieldFunctionObjects | word | yes | -
81  phase | Name of phase (e.g. "gas") | word | no | ""
82  \endtable
83 
84  The inherited entries are elaborated in:
85  - \link functionObject.H \endlink
86 
87  Usage by the \c postProcess utility is not available.
88 
89 See also
90  Foam::functionObjects::fvMeshFunctionObject
91 
92 SourceFiles
93  moleFractions.C
94  moleFractionsFunctionObjects.C
95 
96 \*---------------------------------------------------------------------------*/
97 
98 #ifndef moleFractions_H
99 #define moleFractions_H
100 
101 #include "fvMeshFunctionObject.H"
102 #include "volFieldsFwd.H"
103 
104 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
105 
106 namespace Foam
107 {
108 
109 /*---------------------------------------------------------------------------*\
110  Class moleFractions Declaration
111 \*---------------------------------------------------------------------------*/
112 
113 template<class ThermoType>
114 class moleFractions
115 :
116  public functionObjects::fvMeshFunctionObject
117 {
118  // Private Data
119 
120  //- Species mole fractions
121  PtrList<volScalarField> X_;
122 
123  //- Name of phase
124  word phaseName_;
125 
126 
127  // Private Member Functions
128 
129  //- Calculate the mole fraction fields
130  virtual void calcMoleFractions();
131 
132 
133 public:
134 
135  //- Runtime type information
136  TypeName("moleFractions");
137 
138 
139  // Constructors
140 
141  //- Construct from Time and dictionary
143  (
144  const word& name,
145  const Time& t,
146  const dictionary& dict
147  );
148 
149  //- No copy construct
150  moleFractions(const moleFractions&) = delete;
151 
152  //- No copy assignment
153  void operator=(const moleFractions&) = delete;
154 
155 
156  //- Destructor
157  virtual ~moleFractions() = default;
158 
159 
160  // Member Functions
161 
162  //- Read the moleFractions data
163  virtual bool read(const dictionary& dict);
164 
165  //- Calculate the mole-fraction fields
166  virtual bool execute();
167 
168  //- The mole-fraction fields auto-write - no-op
169  virtual bool write()
170  {
171  return true;
172  }
173 };
174 
175 
176 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
177 
178 } // End namespace Foam
179 
180 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
181 
182 #ifdef NoRepository
183  #include "moleFractions.C"
184 #endif
185 
186 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
187 
188 #endif
189 
190 // ************************************************************************* //
volFieldsFwd.H
Foam::moleFractions::operator=
void operator=(const moleFractions &)=delete
No copy assignment.
Foam::Time
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:73
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
fvMeshFunctionObject.H
Foam::moleFractions::~moleFractions
virtual ~moleFractions()=default
Destructor.
Foam::moleFractions::moleFractions
moleFractions(const word &name, const Time &t, const dictionary &dict)
Construct from Time and dictionary.
Definition: moleFractions.C:64
Foam::functionObjects::fvMeshFunctionObject
Specialization of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
Definition: fvMeshFunctionObject.H:64
Foam::moleFractions::execute
virtual bool execute()
Calculate the mole-fraction fields.
Definition: moleFractions.C:149
Foam::moleFractions
Calculates mole-fraction fields from the mass-fraction fields of the psi/rhoReactionThermo and caches...
Definition: moleFractions.H:155
Foam::moleFractions::read
virtual bool read(const dictionary &dict)
Read the moleFractions data.
Definition: moleFractions.C:132
Foam::PtrList
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
Definition: List.H:59
moleFractions.C
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::moleFractions::TypeName
TypeName("moleFractions")
Runtime type information.
Foam::functionObject::name
const word & name() const noexcept
Return the name of this functionObject.
Definition: functionObject.C:143
Foam::moleFractions::write
virtual bool write()
The mole-fraction fields auto-write - no-op.
Definition: moleFractions.H:210