33template<
class chemistryType>
37 if (writeToFile() && !prodFilePtr_)
39 prodFilePtr_ = createFile(
"production");
40 writeHeader(prodFilePtr_(),
"production");
41 writeFileHeader(prodFilePtr_());
43 consFilePtr_ = createFile(
"consumption");
44 writeHeader(consFilePtr_(),
"consumption");
45 writeFileHeader(consFilePtr_());
47 prodIntFilePtr_ = createFile(
"productionInt");
48 writeHeader(prodIntFilePtr_(),
"productionInt");
49 writeFileHeader(prodIntFilePtr_());
51 consIntFilePtr_ = createFile(
"consumptionInt");
52 writeHeader(consIntFilePtr_(),
"consumptionInt");
53 writeFileHeader(consIntFilePtr_());
58template<
class chemistryType>
65 writeCommented(
os,
"Reaction");
76template<
class chemistryType>
80 const basicChemistryModel& basicChemistry
83 auto RRt = tmp<DimensionedField<scalar, volMesh>>::New
98 scalar dt = time_.deltaT().value();
102 forAll(production_, speciei)
104 forAll(production_[speciei], reactioni)
106 RR = basicChemistry.calculateRR(reactioni, speciei);
110 production_[speciei][reactioni] =
RR[0];
111 productionInt_[speciei][reactioni] += dt*
RR[0];
113 else if (RR[0] < 0.0)
115 consumption_[speciei][reactioni] =
RR[0];
116 consumptionInt_[speciei][reactioni] += dt*
RR[0];
120 production_[speciei][reactioni] = 0.0;
121 consumption_[speciei][reactioni] = 0.0;
128template<
class chemistryType>
134 consFilePtr_() <<
"delta T : "<< mesh_.time().deltaT().value() <<
nl <<
nl;
135 prodFilePtr_() <<
"time : " << mesh_.time().value() <<
tab <<
nl;
136 prodFilePtr_() <<
"delta T : "<< mesh_.time().deltaT().value() <<
nl <<
nl;
138 consIntFilePtr_() <<
"start time : " << startTime_ <<
tab
139 <<
"end time :" << endTime_ <<
nl;
141 prodIntFilePtr_() <<
"start time : " << startTime_ <<
tab
142 <<
"end time :" << endTime_ <<
nl;
144 for (label reactioni = 0; reactioni < nReactions_; ++reactioni)
146 consFilePtr_() << reactioni <<
tab;
147 consIntFilePtr_() << reactioni <<
tab;
148 prodFilePtr_() << reactioni <<
tab;
149 prodIntFilePtr_() << reactioni <<
tab;
153 prodFilePtr_() << production_[i][reactioni] <<
tab;
154 consFilePtr_() << consumption_[i][reactioni] <<
tab;
155 prodIntFilePtr_() << productionInt_[i][reactioni] <<
tab;
156 consIntFilePtr_() << consumptionInt_[i][reactioni] <<
tab;
157 consumptionInt_[i][reactioni] = 0.0;
158 productionInt_[i][reactioni] = 0.0;
160 consFilePtr_() <<
nl;
161 consIntFilePtr_() <<
nl;
162 prodFilePtr_() <<
nl;
163 prodIntFilePtr_() <<
nl;
165 consFilePtr_() <<
nl <<
nl;
166 consIntFilePtr_() <<
nl <<
nl;
167 prodFilePtr_() <<
nl <<
nl;
168 prodIntFilePtr_() <<
nl <<
nl;
174template<
class chemistryType>
203 <<
"Function object only applicable to single cell cases"
207 if (foundObject<basicChemistryModel>(
"chemistryProperties"))
209 const chemistryType&
chemistry = refCast<const chemistryType>
211 lookupObject<basicChemistryModel>(
"chemistryProperties")
216 chemistry.thermo().composition().species().size()
221 speciesNames_[i] =
chemistry.thermo().composition().species()[i];
226 if (production_.
size() == 0)
235 production_[i].
setSize(nReactions_, 0.0);
236 consumption_[i].
setSize(nReactions_, 0.0);
237 productionInt_[i].
setSize(nReactions_, 0.0);
238 consumptionInt_[i].
setSize(nReactions_, 0.0);
245 <<
" No chemistry model found. "
246 <<
" Objects available are : " <<
mesh_.
names()
254template<
class chemistryType>
267template<
class chemistryType>
274 lookupObject<basicChemistryModel>(
"chemistryProperties");
281template<
class chemistryType>
289 startTime_ = endTime_;
void setSize(const label n)
Alias for resize()
virtual bool read()
Re-read model coefficients if they have changed.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
void size(const label n)
Older name for setAddressableSize.
Base class for chemistry models.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
const Type & value() const
Return const reference to value.
Watches for presence of the named trigger file in the case directory and signals a simulation stop (o...
Specialization of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
const fvMesh & mesh_
Reference to the fvMesh.
Computes indicators for reaction rates of creation or destruction of species in each reaction.
virtual bool execute()
Execute.
virtual bool write()
Calculate the reactionsSensitivityAnalysis and write.
virtual bool read(const dictionary &)
Read the reactionsSensitivityAnalysis data.
const Time & time() const
Return time database.
Base class for writing single files from the function objects.
wordList names() const
The unsorted names of all objects.
label nCells() const noexcept
Number of mesh cells.
splitCell * master() const
A class for handling words, derived from Foam::string.
BasicChemistryModel< psiReactionThermo > & chemistry
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
OBJstream os(runTime.globalPath()/outputName)
const scalar RR
Universal gas constant: default in [J/(kmol K)].
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
Ostream & endl(Ostream &os)
Add newline and flush stream.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
errorManipArg< error, int > exit(error &err, const int errNo=1)
constexpr char nl
The newline '\n' character (0x0a)
constexpr char tab
The tab '\t' character(0x09)
#define forAll(list, i)
Loop across all elements in list.