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 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  This function object creates four data files named:
34 
35  - "consumption" : consumption rate
36  - "production" : destruction rate
37  - "productionInt" : integral between dumps of the production rate
38  - "consumptionInt" : integral between dumps of the consumption rate
39 
40  The function object indicates reaction rates of creation or destruction
41  of species in each reaction.
42 
43 
44 SourceFiles
45  reactionsSensitivityAnalysis.C
46 
47 \*---------------------------------------------------------------------------*/
48 
49 #ifndef functionObjescts_reactionsSensitivityAnalysis_H
50 #define functionObjescts_reactionsSensitivityAnalysis_H
51 
52 #include "fvMeshFunctionObject.H"
53 #include "writeFile.H"
54 #include "volFieldsFwd.H"
55 #include "basicChemistryModel.H"
56 #include "autoPtr.H"
58 
59 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
60 
61 namespace Foam
62 {
63 namespace functionObjects
64 {
65 
66 /*---------------------------------------------------------------------------*\
67  Class reactionsSensitivityAnalysis Declaration
68 \*---------------------------------------------------------------------------*/
69 
70 template<class chemistryType>
72 :
73  public fvMeshFunctionObject,
74  public writeFile
75 
76 {
77  // Private data
78 
79  //- List list for species production
80  scalarListList production_;
81 
82  //- List list for species consumption
83  scalarListList consumption_;
84 
85  //- List list for species production integral
86  scalarListList productionInt_;
87 
88  //- List list for species consumption integral
89  scalarListList consumptionInt_;
90 
91  //- Start time of integration
92  scalar startTime_;
93 
94  //- End time of integration
95  scalar endTime_;
96 
97  //- Word list of species
98  wordList speciesNames_;
99 
100  //-Number of reactions
101  label nReactions_;
102 
103 
104  // File streams
105 
106  //- Integrated coefficients
107  autoPtr<OFstream> prodFilePtr_;
108 
109  //- Moment coefficient
110  autoPtr<OFstream> consFilePtr_;
111 
112  //- Drag coefficient
113  autoPtr<OFstream> prodIntFilePtr_;
114 
115  //- Lift coefficient
116  autoPtr<OFstream> consIntFilePtr_;
117 
118 
119 
120  // Private Member Functions
121 
122 
123  //- Create file names for forces and bins
124  void createFileNames();
125 
126  //- Output file header information
127  void writeFileHeader(OFstream& os);
128 
129  //- Calculate production and destruction of each species
130  void calculateSpeciesRR(const basicChemistryModel&);
131 
132  //- Write species production/consumption rates
133  void writeSpeciesRR();
134 
135 
136  //- No copy construct
138  (
140  ) = delete;
141 
142  //- No copy assignment
143  void operator=(const reactionsSensitivityAnalysis&) = delete;
144 
145 
146 public:
147 
148  //- Runtime type information
149  TypeName("reactionsSensitivityAnalysis");
150 
151 
152  // Constructors
153 
154  //- Construct from Time and dictionary
156  (
157  const word& name,
158  const Time& runTime,
159  const dictionary& dict
160  );
161 
162 
163  //- Destructor
165 
166 
167  // Member Functions
168 
169  //- Read the reactionsSensitivityAnalysis data
170  virtual bool read(const dictionary&);
171 
172  //- Execute
173  virtual bool execute();
174 
175  //- Calculate the reactionsSensitivityAnalysis and write
176  virtual bool write();
177 };
178 
179 
180 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
181 
182 } // End namespace functionObjects
183 } // End namespace Foam
184 
185 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
186 
187 #ifdef NoRepository
189 #endif
190 
191 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
192 
193 #endif
194 
195 // ************************************************************************* //
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:264
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:62
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()
Destructor.
Definition: reactionsSensitivityAnalysis.C:256
Foam::functionObjects::fvMeshFunctionObject
Specialization of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
Definition: fvMeshFunctionObject.H:64
basicChemistryModel.H
Foam::label
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:62
Foam::functionObjects::reactionsSensitivityAnalysis
This function object creates four data files named:
Definition: reactionsSensitivityAnalysis.H:70
Foam::functionObjects::reactionsSensitivityAnalysis::execute
virtual bool execute()
Execute.
Definition: reactionsSensitivityAnalysis.C:276
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:121
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::OFstream
Output to file stream, using an OSstream.
Definition: OFstream.H:99
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
Return the name of this functionObject.
Definition: functionObject.C:131
Foam::List< scalarList >
Foam::functionObjects::writeFile
functionObject base class for writing single files
Definition: writeFile.H:59
reactionsSensitivityAnalysis.C
Foam::functionObjects::reactionsSensitivityAnalysis::write
virtual bool write()
Calculate the reactionsSensitivityAnalysis and write.
Definition: reactionsSensitivityAnalysis.C:290
autoPtr.H