reactionsSensitivityAnalysis.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 OpenCFD Ltd.
9-------------------------------------------------------------------------------
10License
11 This file is part of OpenFOAM.
12
13 OpenFOAM is free software: you can redistribute it and/or modify it
14 under the terms of the GNU General Public License as published by
15 the Free Software Foundation, either version 3 of the License, or
16 (at your option) any later version.
17
18 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25
26Class
27 Foam::functionObjects::reactionsSensitivityAnalysis
28
29Group
30 grpFieldFunctionObjects grpThermophysicalFunctionObjects
31
32Description
33 Computes indicators for reaction rates of creation or destruction
34 of species in each reaction.
35
36 This function object creates four data files named:
37
38 - \c consumption : consumption rate
39 - \c production : destruction rate
40 - \c productionInt : integral between dumps of the production rate
41 - \c consumptionInt : integral between dumps of the consumption rate
42
43 Operands:
44 \table
45 Operand | Type | Location
46 input | - | -
47 output file | dat | $FOAM_CASE/postProcessing/<FO>/<time>/<file>
48 output field | - | -
49 \endtable
50
51Usage
52 Minimal example by using \c system/controlDict.functions:
53 \verbatim
54 reactionSensitivityAnalysis1
55 {
56 // Mandatory entries (unmodifiable)
57 type reactionSensitivityAnalysis;
58 libs (fieldFunctionObjects);
59
60 // Optional (inherited) entries
61 ...
62 }
63 \endverbatim
64
65 where the entries mean:
66 \table
67 Property | Description | Type | Req'd | Dflt
68 type | Type name: reactionSensitivityAnalysis | word | yes | -
69 libs | Library name: fieldFunctionObjects | word | yes | -
70 \endtable
71
72 The inherited entries are elaborated in:
73 - \link functionObject.H \endlink
74 - \link writeFile.H \endlink
75
76 Usage by the \c postProcess utility is not available.
77
78Note
79 - Function object only applicable to single cell cases.
80 - Needs a \c chemistryModel chosen.
81
82See also
83 - Foam::functionObject
84 - Foam::functionObjects::fvMeshFunctionObject
85 - Foam::functionObjects::writeFile
86 - ExtendedCodeGuide::functionObjects::field::reactionsSensitivityAnalysis
87
88SourceFiles
89 reactionsSensitivityAnalysis.C
90 reactionsSensitivityAnalysisObjects.C
91
92\*---------------------------------------------------------------------------*/
93
94#ifndef functionObjescts_reactionsSensitivityAnalysis_H
95#define functionObjescts_reactionsSensitivityAnalysis_H
96
98#include "writeFile.H"
99#include "volFieldsFwd.H"
100#include "basicChemistryModel.H"
101#include "autoPtr.H"
103
104// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
105
106namespace Foam
107{
108namespace functionObjects
109{
110
111/*---------------------------------------------------------------------------*\
112 Class reactionsSensitivityAnalysis Declaration
113\*---------------------------------------------------------------------------*/
114
115template<class chemistryType>
116class reactionsSensitivityAnalysis
117:
118 public fvMeshFunctionObject,
119 public writeFile
120{
121 // Private Data
122
123 //- Number of reactions
124 label nReactions_;
125
126 //- Start time of integration
127 scalar startTime_;
128
129 //- End time of integration
130 scalar endTime_;
131
132 //- List list for species production
133 scalarListList production_;
134
135 //- List list for species consumption
136 scalarListList consumption_;
137
138 //- List list for species production integral
139 scalarListList productionInt_;
140
141 //- List list for species consumption integral
142 scalarListList consumptionInt_;
143
144 //- Word list of species
145 wordList speciesNames_;
146
147 // File streams
148
149 //- Integrated coefficients
150 autoPtr<OFstream> prodFilePtr_;
151
152 //- Moment coefficient
153 autoPtr<OFstream> consFilePtr_;
154
155 //- Drag coefficient
156 autoPtr<OFstream> prodIntFilePtr_;
157
158 //- Lift coefficient
159 autoPtr<OFstream> consIntFilePtr_;
160
161
162 // Private Member Functions
163
164 //- Create file names for forces and bins
165 void createFileNames();
166
167 //- Output file header information
168 void writeFileHeader(OFstream& os);
169
170 //- Calculate production and destruction of each species
171 void calculateSpeciesRR(const basicChemistryModel&);
172
173 //- Write species production/consumption rates
174 void writeSpeciesRR();
175
176
177public:
178
179 //- Runtime type information
180 TypeName("reactionsSensitivityAnalysis");
181
182
183 // Constructors
184
185 //- Construct from Time and dictionary
187 (
188 const word& name,
189 const Time& runTime,
190 const dictionary& dict
191 );
192
193 //- No copy construct
195 (
197 ) = delete;
198
199 //- No copy assignment
200 void operator=(const reactionsSensitivityAnalysis&) = delete;
201
202
203 //- Destructor
204 virtual ~reactionsSensitivityAnalysis() = default;
205
206
207 // Member Functions
208
209 //- Read the reactionsSensitivityAnalysis data
210 virtual bool read(const dictionary&);
211
212 //- Execute
213 virtual bool execute();
214
215 //- Calculate the reactionsSensitivityAnalysis and write
216 virtual bool write();
217};
218
219
220// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
221
222} // End namespace functionObjects
223} // End namespace Foam
224
225// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
226
227#ifdef NoRepository
229#endif
230
231// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
232
233#endif
234
235// ************************************************************************* //
Output to file stream, using an OSstream.
Definition: OFstream.H:57
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:80
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: autoPtr.H:66
Base class for chemistry models.
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...
Computes indicators for reaction rates of creation or destruction of species in each reaction.
virtual ~reactionsSensitivityAnalysis()=default
Destructor.
TypeName("reactionsSensitivityAnalysis")
Runtime type information.
reactionsSensitivityAnalysis(const reactionsSensitivityAnalysis &)=delete
No copy construct.
void operator=(const reactionsSensitivityAnalysis &)=delete
No copy assignment.
virtual bool write()
Calculate the reactionsSensitivityAnalysis and write.
virtual bool read(const dictionary &)
Read the reactionsSensitivityAnalysis data.
Base class for writing single files from the function objects.
Definition: writeFile.H:120
A class for handling words, derived from Foam::string.
Definition: word.H:68
engineTime & runTime
OBJstream os(runTime.globalPath()/outputName)
Namespace for OpenFOAM.
List< word > wordList
A List of words.
Definition: fileName.H:63
List< scalarList > scalarListList
A List of scalarList.
Definition: scalarList.H:66
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73