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 -------------------------------------------------------------------------------
10 License
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 
26 Class
27  Foam::functionObjects::reactionsSensitivityAnalysis
28 
29 Group
30  grpFieldFunctionObjects grpThermophysicalFunctionObjects
31 
32 Description
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 
51 Usage
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 
78 Note
79  - Function object only applicable to single cell cases.
80  - Needs a \c chemistryModel chosen.
81 
82 See also
83  - Foam::functionObject
84  - Foam::functionObjects::fvMeshFunctionObject
85  - Foam::functionObjects::writeFile
86  - ExtendedCodeGuide::functionObjects::field::reactionsSensitivityAnalysis
87 
88 SourceFiles
89  reactionsSensitivityAnalysis.C
90  reactionsSensitivityAnalysisObjects.C
91 
92 \*---------------------------------------------------------------------------*/
93 
94 #ifndef functionObjescts_reactionsSensitivityAnalysis_H
95 #define functionObjescts_reactionsSensitivityAnalysis_H
96 
97 #include "fvMeshFunctionObject.H"
98 #include "writeFile.H"
99 #include "volFieldsFwd.H"
100 #include "basicChemistryModel.H"
101 #include "autoPtr.H"
103 
104 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
105 
106 namespace Foam
107 {
108 namespace functionObjects
109 {
110 
111 /*---------------------------------------------------------------------------*\
112  Class reactionsSensitivityAnalysis Declaration
113 \*---------------------------------------------------------------------------*/
114 
115 template<class chemistryType>
116 class 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 
177 public:
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 // ************************************************************************* //
Foam::functionObjects::reactionsSensitivityAnalysis::reactionsSensitivityAnalysis
reactionsSensitivityAnalysis(const word &name, const Time &runTime, const dictionary &dict)
Construct from Time and dictionary.
Definition: reactionsSensitivityAnalysis.C:177
Foam::scalarListList
List< scalarList > scalarListList
A List of scalarList.
Definition: scalarList.H:66
runTime
engineTime & runTime
Definition: createEngineTime.H:13
volFieldsFwd.H
writeFile.H
Foam::functionObjects::reactionsSensitivityAnalysis::read
virtual bool read(const dictionary &)
Read the reactionsSensitivityAnalysis data.
Definition: reactionsSensitivityAnalysis.C:256
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::basicChemistryModel
Base class for chemistry models.
Definition: basicChemistryModel.H:58
Foam::functionObjects::reactionsSensitivityAnalysis::TypeName
TypeName("reactionsSensitivityAnalysis")
Runtime type information.
Foam::functionObjects::reactionsSensitivityAnalysis::~reactionsSensitivityAnalysis
virtual ~reactionsSensitivityAnalysis()=default
Destructor.
Foam::functionObjects::fvMeshFunctionObject
Specialization of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
Definition: fvMeshFunctionObject.H:64
Foam::wordList
List< word > wordList
A List of words.
Definition: fileName.H:62
basicChemistryModel.H
Foam::functionObjects::reactionsSensitivityAnalysis
Computes indicators for reaction rates of creation or destruction of species in each reaction.
Definition: reactionsSensitivityAnalysis.H:149
Foam::functionObjects::reactionsSensitivityAnalysis::execute
virtual bool execute()
Execute.
Definition: reactionsSensitivityAnalysis.C:269
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::functionObjects::reactionsSensitivityAnalysis::operator=
void operator=(const reactionsSensitivityAnalysis &)=delete
No copy assignment.
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
os
OBJstream os(runTime.globalPath()/outputName)
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::OFstream
Output to file stream, using an OSstream.
Definition: OFstream.H:53
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
basicMultiComponentMixture.H
Foam::functionObject::name
const word & name() const noexcept
Return the name of this functionObject.
Definition: functionObject.C:143
Foam::List< scalarList >
Foam::functionObjects::writeFile
Base class for writing single files from the function objects.
Definition: writeFile.H:119
reactionsSensitivityAnalysis.C
Foam::functionObjects::reactionsSensitivityAnalysis::write
virtual bool write()
Calculate the reactionsSensitivityAnalysis and write.
Definition: reactionsSensitivityAnalysis.C:283
autoPtr.H