Loading...
Searching...
No Matches
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 | postProcessing/<FO>/<time>/file
48 output field | - | -
49 \endtable
50
51Usage
52 Minimal example by using \c system/controlDict.functions:
53 \verbatim
54 reactionSensitivityAnalysisFO
55 {
56 // Mandatory entries
57 type reactionSensitivityAnalysis;
58 libs (fieldFunctionObjects);
59
60 // Inherited entries
61 ...
62 }
63 \endverbatim
64
65 where the entries mean:
66 \table
67 Property | Description | Type | Reqd | Deflt
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
76Note
77 - Function object only applicable to single cell cases.
78 - Needs a \c chemistryModel chosen.
79
80SourceFiles
81 reactionsSensitivityAnalysis.C
82 reactionsSensitivityAnalysisObjects.C
83
84\*---------------------------------------------------------------------------*/
85
86#ifndef functionObjescts_reactionsSensitivityAnalysis_H
87#define functionObjescts_reactionsSensitivityAnalysis_H
88
90#include "writeFile.H"
91#include "volFieldsFwd.H"
92#include "basicChemistryModel.H"
93#include "autoPtr.H"
95
96// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
97
98namespace Foam
99{
100namespace functionObjects
101{
102
103/*---------------------------------------------------------------------------*\
104 Class reactionsSensitivityAnalysis Declaration
105\*---------------------------------------------------------------------------*/
106
107template<class chemistryType>
109:
111 public writeFile
112{
113 // Private Data
114
115 //- Number of reactions
116 label nReactions_;
117
118 //- Start time of integration
119 scalar startTime_;
120
121 //- End time of integration
122 scalar endTime_;
123
124 //- List list for species production
125 scalarListList production_;
126
127 //- List list for species consumption
128 scalarListList consumption_;
129
130 //- List list for species production integral
131 scalarListList productionInt_;
132
133 //- List list for species consumption integral
134 scalarListList consumptionInt_;
135
136 //- Word list of species
137 wordList speciesNames_;
138
139 // File streams
140
141 //- Integrated coefficients
142 autoPtr<OFstream> prodFilePtr_;
143
144 //- Moment coefficient
145 autoPtr<OFstream> consFilePtr_;
146
147 //- Drag coefficient
148 autoPtr<OFstream> prodIntFilePtr_;
149
150 //- Lift coefficient
151 autoPtr<OFstream> consIntFilePtr_;
152
153
154 // Private Member Functions
155
156 //- Create file names for forces and bins
157 void createFileNames();
158
159 //- Output file header information
160 void writeFileHeader(OFstream& os);
161
162 //- Calculate production and destruction of each species
163 void calculateSpeciesRR(const basicChemistryModel&);
164
165 //- Write species production/consumption rates
166 void writeSpeciesRR();
167
168
169public:
170
171 //- Runtime type information
172 TypeName("reactionsSensitivityAnalysis");
173
174
175 // Constructors
176
177 //- Construct from name, Time and dictionary
179 (
180 const word& name,
181 const Time& runTime,
182 const dictionary& dict
183 );
184
185 //- No copy construct
187 (
189 ) = delete;
190
191 //- No copy assignment
192 void operator=(const reactionsSensitivityAnalysis&) = delete;
193
194
195 //- Destructor
196 virtual ~reactionsSensitivityAnalysis() = default;
197
198
199 // Member Functions
200
201 //- Read the function-object dictionary
202 virtual bool read(const dictionary& dict);
203
204 //- Execute the function-object operations
205 virtual bool execute();
206
207 //- Write the function-object results
208 virtual bool write();
209};
210
211
212// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
213
214} // End namespace functionObjects
215} // End namespace Foam
216
217// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
218
219#ifdef NoRepository
221#endif
222
223// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
224
225#endif
226
227// ************************************************************************* //
Output to file stream as an OSstream, normally using std::ofstream for the actual output.
Definition OFstream.H:75
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition Time.H:75
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition autoPtr.H:65
Base class for chemistry models.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
Specialization of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
fvMeshFunctionObject(const fvMeshFunctionObject &)=delete
No copy construct.
Computes indicators for reaction rates of creation or destruction of species in each reaction.
virtual ~reactionsSensitivityAnalysis()=default
Destructor.
virtual bool read(const dictionary &dict)
Read the function-object dictionary.
TypeName("reactionsSensitivityAnalysis")
Runtime type information.
reactionsSensitivityAnalysis(const reactionsSensitivityAnalysis &)=delete
No copy construct.
void operator=(const reactionsSensitivityAnalysis &)=delete
No copy assignment.
reactionsSensitivityAnalysis(const word &name, const Time &runTime, const dictionary &dict)
Construct from name, Time and dictionary.
virtual bool execute()
Execute the function-object operations.
virtual bool write()
Write the function-object results.
Base class for writing single files from the function objects.
Definition writeFile.H:113
writeFile(const objectRegistry &obr, const fileName &prefix, const word &name="undefined", const bool writeToFile=true, const string &ext=".dat")
Construct from objectRegistry, prefix, fileName.
Definition writeFile.C:200
A class for handling words, derived from Foam::string.
Definition word.H:66
engineTime & runTime
OBJstream os(runTime.globalPath()/outputName)
Function objects are OpenFOAM utilities to ease workflow configurations and enhance workflows.
Namespace for OpenFOAM.
List< scalarList > scalarListList
List of scalarList.
Definition scalarList.H:35
List< word > wordList
List of word.
Definition fileName.H:60
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
Definition exprTraits.C:127
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68
Forwards and collection of common volume field types.