31 template<
class ThermoType>
40 reactionsDisabled_(
chemistry.nReaction(), false),
44 sumnActiveSpecies_(0),
50 template<
class ThermoType>
60 reactionsDisabled_(
chemistry.nReaction(), false),
64 coeffDict(
dict).template lookupOrDefault<
Switch>(
"log", false)
68 coeffDict(
dict).template lookupOrDefault<scalar>(
"tolerance", 1
e-4)
70 sumnActiveSpecies_(0),
76 cpuReduceFile_ =
chemistry.logFile(
"cpu_reduce.out");
77 nActiveSpeciesFile_ =
chemistry.logFile(
"nActiveSpecies.out");
84 template<
class ThermoType>
91 template<
class ThermoType>
96 cpuTime_.cpuTimeIncrement();
101 template<
class ThermoType>
109 forAll(chemistry_.reactions(), i)
112 reactionsDisabled_[i] =
false;
117 if (!activeSpecies_[ss])
119 reactionsDisabled_[i] =
true;
124 if (!reactionsDisabled_[i])
129 if (!activeSpecies_[ss])
131 reactionsDisabled_[i] =
true;
139 nActiveSpecies_ =
count(activeSpecies_,
true);
145 if (activeSpecies_[i])
149 if (!chemistry_.thermo().speciesActive()[i])
151 chemistry_.thermo().setSpecieActive(i);
161 chemistry_.setNSpecie(nActiveSpecies_);
165 sumnActiveSpecies_ += nActiveSpecies_;
167 reduceMechCpuTime_ += cpuTime_.cpuTimeIncrement();
172 template<
class ThermoType>
178 << chemistry_.time().userTimeValue()
179 <<
" " << reduceMechCpuTime_ <<
endl;
184 nActiveSpeciesFile_()
185 << chemistry_.time().userTimeValue()
186 <<
" " << sumnActiveSpecies_/sumn_ <<
endl;
189 sumnActiveSpecies_ = 0;
191 reduceMechCpuTime_ = 0;
#define forAll(list, i)
Loop across all elements in list.
void setSize(const label)
Alter the addressed list size.
Simple extension of ThermoType to handle reaction kinetics in addition to the equilibrium thermodynam...
A simple wrapper around bool so that it can be read as a word: true/false, on/off,...
Extends base chemistry model by adding a thermo package, and ODE functions. Introduces chemistry equa...
virtual ~chemistryReductionMethod()
Destructor.
void initReduceMechanism()
Initialise reduction of the mechanism.
void endReduceMechanism(List< label > &ctos, DynamicList< label > &stoc)
End reduction of the mechanism.
chemistryReductionMethod(chemistryModel< ThermoType > &chemistry)
Construct from components.
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(lagrangian::Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().x()<< " ";}gmvFile<< nl;forAllConstIter(lagrangian::Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().y()<< " ";}gmvFile<< nl;forAllConstIter(lagrangian::Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.name(), lagrangian::cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Ostream & endl(Ostream &os)
Add newline and flush stream.
static scalar R(const scalar a, const scalar x)
label count(const ListType &l, typename ListType::const_reference x)
Count the number of occurrences of a value in a list.
basicChemistryModel & chemistry