31 template<
class ThermoType>
38 chemistry_(chemistry),
40 nActiveSpecies_(chemistry.
nSpecie()),
41 reactionsDisabled_(chemistry.
nReaction(),
false),
42 activeSpecies_(chemistry.
nSpecie(),
true),
45 sumnActiveSpecies_(0),
51 template<
class ThermoType>
58 coeffsDict_(dict.
subDict(
"reduction")),
59 chemistry_(chemistry),
61 nActiveSpecies_(chemistry.
nSpecie()),
62 reactionsDisabled_(chemistry.
nReaction(),
false),
63 activeSpecies_(chemistry.
nSpecie(),
false),
64 log_(coeffsDict_.lookupOrDefault<
Switch>(
"log",
false)),
65 tolerance_(coeffsDict_.lookupOrDefault<scalar>(
"tolerance", 1
e-4)),
66 sumnActiveSpecies_(0),
72 cpuReduceFile_ = chemistry.
logFile(
"cpu_reduce.out");
73 nActiveSpeciesFile_ = chemistry.
logFile(
"nActiveSpecies.out");
80 template<
class ThermoType>
87 template<
class ThermoType>
92 cpuTime_.cpuTimeIncrement();
97 template<
class ThermoType>
105 forAll(chemistry_.reactions(), i)
108 reactionsDisabled_[i] =
false;
113 if (!activeSpecies_[ss])
115 reactionsDisabled_[i] =
true;
120 if (!reactionsDisabled_[i])
125 if (!activeSpecies_[ss])
127 reactionsDisabled_[i] =
true;
135 nActiveSpecies_ =
count(activeSpecies_,
true);
141 if (activeSpecies_[i])
145 if (!chemistry_.active(i))
147 chemistry_.setActive(i);
157 chemistry_.setNSpecie(nActiveSpecies_);
161 sumnActiveSpecies_ += nActiveSpecies_;
163 reduceMechCpuTime_ += cpuTime_.cpuTimeIncrement();
168 template<
class ThermoType>
174 << chemistry_.time().userTimeValue()
175 <<
" " << reduceMechCpuTime_ <<
endl;
180 nActiveSpeciesFile_()
181 << chemistry_.time().userTimeValue()
182 <<
" " << sumnActiveSpecies_/sumn_ <<
endl;
185 sumnActiveSpecies_ = 0;
187 reduceMechCpuTime_ = 0;
#define forAll(list, i)
Loop across all elements in list.
void initReduceMechanism()
Protected Member Functions.
autoPtr< OFstream > logFile(const word &name) const
Create and return a TDAC log file of the given name.
Ostream & endl(Ostream &os)
Add newline and flush stream.
A simple wrapper around bool so that it can be read as a word: true/false, on/off, yes/no, y/n, t/f, or none/any.
label count(const ListType &l, typename ListType::const_reference x)
Count the number of occurrences of a value in a list.
virtual ~chemistryReductionMethod()
Destructor.
const List< specieCoeffs > & lhs() const
Return the components of the left hand side.
void endReduceMechanism(List< label > &ctos, DynamicList< label > &stoc)
End reduction of the mechanism.
Simple extension of ReactionThermo to handle reaction kinetics in addition to the equilibrium thermod...
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
const dictionary & subDict(const word &) const
Find and return a sub-dictionary.
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().x()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().y()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
void setSize(const label)
Alter the addressed list size.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects...
chemistryReductionMethod(chemistryModel< ThermoType > &chemistry)
Construct from components.
virtual label nReaction() const
The number of reactions.
Extends base chemistry model by adding a thermo package, and ODE functions. Introduces chemistry equa...
const List< specieCoeffs > & rhs() const
Return the components of the right hand side.
#define R(A, B, C, D, E, F, K, M)
virtual label nSpecie() const
The number of species.
const dimensionedScalar e
Elementary charge.