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-------------------------------------------------------------------------------
11License
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
27Class
28 Foam::moleFractions
29
30Group
31 grpThermophysicalFunctionObjects
32
33Description
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
49Usage
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
89See also
90 Foam::functionObjects::fvMeshFunctionObject
91
92SourceFiles
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
106namespace Foam
107{
108
109/*---------------------------------------------------------------------------*\
110 Class moleFractions Declaration
111\*---------------------------------------------------------------------------*/
112
113template<class ThermoType>
114class 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
133public:
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
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// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
178} // End namespace Foam
179
180// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
181
182#ifdef NoRepository
183 #include "moleFractions.C"
184#endif
185
186// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
187
188#endif
189
190// ************************************************************************* //
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
Definition: PtrList.H:73
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:80
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
const word & name() const noexcept
Return the name of this functionObject.
Specialization of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
Calculates mole-fraction fields from the mass-fraction fields of the psi/rhoReactionThermo and caches...
void operator=(const moleFractions &)=delete
No copy assignment.
virtual bool write()
The mole-fraction fields auto-write - no-op.
virtual bool read(const dictionary &dict)
Read the moleFractions data.
TypeName("moleFractions")
Runtime type information.
moleFractions(const moleFractions &)=delete
No copy construct.
moleFractions(const word &name, const Time &t, const dictionary &dict)
Construct from Time and dictionary.
Definition: moleFractions.C:64
virtual ~moleFractions()=default
Destructor.
virtual bool execute()
Calculate the mole-fraction fields.
A class for handling words, derived from Foam::string.
Definition: word.H:68
Namespace for OpenFOAM.
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73