chemistryReductionMethods: Change dictionaries to lists
The "initialSet" and "fuelSpecies" settings for chemistry reduction methods now have to be formatted as lists, rather than dictionaries. This is so that the settings in the TDAC configuration files can be overridden in a case without the dictionaries being merged.
This commit is contained in:
@ -22,11 +22,11 @@ reduction
|
||||
|
||||
// Search initiating set (SIS) of species, needed for most methods
|
||||
initialSet
|
||||
{
|
||||
CO;
|
||||
CH4;
|
||||
HO2;
|
||||
}
|
||||
(
|
||||
CO
|
||||
CH4
|
||||
HO2
|
||||
);
|
||||
|
||||
// For DAC, option to automatically change the SIS switch from HO2 to H2O
|
||||
// and CO to CO2, + disable fuel
|
||||
@ -34,9 +34,9 @@ reduction
|
||||
|
||||
// When automaticSIS, the method needs to know the fuel
|
||||
fuelSpecies
|
||||
{
|
||||
CH4 1;
|
||||
}
|
||||
(
|
||||
(CH4 1)
|
||||
);
|
||||
}
|
||||
|
||||
tabulation
|
||||
|
||||
@ -22,11 +22,11 @@ reduction
|
||||
|
||||
// Search initiating set (SIS) of species, needed for most methods
|
||||
initialSet
|
||||
{
|
||||
CO;
|
||||
CH4;
|
||||
HO2;
|
||||
}
|
||||
(
|
||||
CO
|
||||
CH4
|
||||
HO2
|
||||
);
|
||||
|
||||
// For DAC, option to automatically change the SIS switch from HO2 to H2O
|
||||
// and CO to CO2, + disable fuel
|
||||
@ -34,9 +34,9 @@ reduction
|
||||
|
||||
// When automaticSIS, the method needs to know the fuel
|
||||
fuelSpecies
|
||||
{
|
||||
CH4 1;
|
||||
}
|
||||
(
|
||||
(CH4 1)
|
||||
);
|
||||
}
|
||||
|
||||
tabulation
|
||||
|
||||
@ -35,7 +35,7 @@ Foam::chemistryReductionMethods::DAC<ThermoType>::DAC
|
||||
)
|
||||
:
|
||||
chemistryReductionMethod<ThermoType>(dict, chemistry),
|
||||
searchInitSet_(this->coeffsDict_.subDict("initialSet").size()),
|
||||
searchInitSet_(),
|
||||
zprime_(0),
|
||||
nbCLarge_(3),
|
||||
sC_(this->nSpecie_,0),
|
||||
@ -87,22 +87,10 @@ Foam::chemistryReductionMethods::DAC<ThermoType>::DAC
|
||||
),
|
||||
forceFuelInclusion_(false)
|
||||
{
|
||||
label j=0;
|
||||
dictionary initSet = this->coeffsDict_.subDict("initialSet");
|
||||
for (label i=0; i<chemistry.nSpecie(); i++)
|
||||
const wordHashSet initSet(this->coeffsDict_.lookup("initialSet"));
|
||||
forAllConstIter(wordHashSet, initSet, iter)
|
||||
{
|
||||
if (initSet.found(chemistry.Y()[i].member()))
|
||||
{
|
||||
searchInitSet_[j++] = i;
|
||||
}
|
||||
}
|
||||
if (j<searchInitSet_.size())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< searchInitSet_.size()-j
|
||||
<< " species in the initial set is not in the mechanism "
|
||||
<< initSet
|
||||
<< exit(FatalError);
|
||||
searchInitSet_.append(chemistry.mixture().species()[iter.key()]);
|
||||
}
|
||||
|
||||
if (this->coeffsDict_.found("automaticSIS"))
|
||||
@ -195,52 +183,29 @@ Foam::chemistryReductionMethods::DAC<ThermoType>::DAC
|
||||
// According to the given mass fraction, an equivalent O/C ratio is computed
|
||||
if (automaticSIS_)
|
||||
{
|
||||
dictionary fuelDict;
|
||||
if (this->coeffsDict_.found("fuelSpecies"))
|
||||
{
|
||||
fuelDict = this->coeffsDict_.subDict("fuelSpecies");
|
||||
fuelSpecies_ = fuelDict.toc();
|
||||
if (fuelSpecies_.size() == 0)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "With automatic SIS, the fuel species should be "
|
||||
<< "specified in the fuelSpecies subDict"
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "With automatic SIS, the fuel species should be "
|
||||
<< "specified in the fuelSpecies subDict"
|
||||
<< exit(FatalError);
|
||||
}
|
||||
List<Tuple2<word, scalar>> fuelSpeciesEntry
|
||||
(
|
||||
this->coeffsDict_.lookup("fuelSpecies")
|
||||
);
|
||||
|
||||
if (this->coeffsDict_.found("nbCLarge"))
|
||||
{
|
||||
nbCLarge_ = fuelDict.lookup<label>("nbCLarge");
|
||||
}
|
||||
|
||||
fuelSpeciesID_.setSize(fuelSpecies_.size());
|
||||
fuelSpeciesProp_.setSize(fuelSpecies_.size());
|
||||
fuelSpecies_.setSize(fuelSpeciesEntry.size());
|
||||
fuelSpeciesID_.setSize(fuelSpeciesEntry.size());
|
||||
fuelSpeciesProp_.setSize(fuelSpeciesEntry.size());
|
||||
scalar Mmtot(0.0);
|
||||
|
||||
forAll(fuelSpecies_, i)
|
||||
forAll(fuelSpeciesEntry, i)
|
||||
{
|
||||
fuelSpeciesProp_[i] = fuelDict.lookup<scalar>(fuelSpecies_[i]);
|
||||
for (label j=0; j<this->nSpecie_; j++)
|
||||
{
|
||||
if (this->chemistry_.Y()[j].member() == fuelSpecies_[i])
|
||||
{
|
||||
fuelSpeciesID_[i] = j;
|
||||
break;
|
||||
}
|
||||
}
|
||||
fuelSpecies_[i] = fuelSpeciesEntry[i].first();
|
||||
fuelSpeciesProp_[i] = fuelSpeciesEntry[i].second();
|
||||
fuelSpeciesID_[i] =
|
||||
this->chemistry_.mixture().species()[fuelSpecies_[i]];
|
||||
scalar curMm =
|
||||
this->chemistry_.specieThermos()[fuelSpeciesID_[i]].W();
|
||||
Mmtot += fuelSpeciesProp_[i]/curMm;
|
||||
}
|
||||
|
||||
this->coeffsDict_.readIfPresent("nbCLarge", nbCLarge_);
|
||||
|
||||
Mmtot = 1.0/Mmtot;
|
||||
scalar nbC(0.0);
|
||||
scalar nbO(0.0);
|
||||
|
||||
@ -35,24 +35,12 @@ Foam::chemistryReductionMethods::DRG<ThermoType>::DRG
|
||||
)
|
||||
:
|
||||
chemistryReductionMethod<ThermoType>(dict, chemistry),
|
||||
searchInitSet_(this->coeffsDict_.subDict("initialSet").size())
|
||||
searchInitSet_()
|
||||
{
|
||||
label j=0;
|
||||
dictionary initSet = this->coeffsDict_.subDict("initialSet");
|
||||
for (label i=0; i<chemistry.nSpecie(); i++)
|
||||
const wordHashSet initSet(this->coeffsDict_.lookup("initialSet"));
|
||||
forAllConstIter(wordHashSet, initSet, iter)
|
||||
{
|
||||
if (initSet.found(chemistry.Y()[i].member()))
|
||||
{
|
||||
searchInitSet_[j++] = i;
|
||||
}
|
||||
}
|
||||
if (j<searchInitSet_.size())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< searchInitSet_.size()-j
|
||||
<< " species in the initial set is not in the mechanism "
|
||||
<< initSet
|
||||
<< exit(FatalError);
|
||||
searchInitSet_.append(chemistry.mixture().species()[iter.key()]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -36,29 +36,17 @@ Foam::chemistryReductionMethods::DRGEP<ThermoType>::DRGEP
|
||||
)
|
||||
:
|
||||
chemistryReductionMethod<ThermoType>(dict, chemistry),
|
||||
searchInitSet_(this->coeffsDict_.subDict("initialSet").size()),
|
||||
searchInitSet_(),
|
||||
sC_(this->nSpecie_,0),
|
||||
sH_(this->nSpecie_,0),
|
||||
sO_(this->nSpecie_,0),
|
||||
sN_(this->nSpecie_,0),
|
||||
NGroupBased_(50)
|
||||
{
|
||||
label j=0;
|
||||
dictionary initSet = this->coeffsDict_.subDict("initialSet");
|
||||
for (label i=0; i<chemistry.nSpecie(); i++)
|
||||
const wordHashSet initSet(this->coeffsDict_.lookup("initialSet"));
|
||||
forAllConstIter(wordHashSet, initSet, iter)
|
||||
{
|
||||
if (initSet.found(chemistry.Y()[i].member()))
|
||||
{
|
||||
searchInitSet_[j++]=i;
|
||||
}
|
||||
}
|
||||
if (j<searchInitSet_.size())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< searchInitSet_.size()-j
|
||||
<< " species in the initial set is not in the mechanism "
|
||||
<< initSet
|
||||
<< exit(FatalError);
|
||||
searchInitSet_.append(chemistry.mixture().species()[iter.key()]);
|
||||
}
|
||||
|
||||
if (this->coeffsDict_.found("NGroupBased"))
|
||||
|
||||
@ -35,27 +35,12 @@ Foam::chemistryReductionMethods::PFA<ThermoType>::PFA
|
||||
)
|
||||
:
|
||||
chemistryReductionMethod<ThermoType>(dict, chemistry),
|
||||
searchInitSet_(this->coeffsDict_.subDict("initialSet").size())
|
||||
searchInitSet_()
|
||||
{
|
||||
label j=0;
|
||||
|
||||
dictionary initSet = this->coeffsDict_.subDict("initialSet");
|
||||
|
||||
for (label i=0; i<chemistry.nSpecie(); i++)
|
||||
const wordHashSet initSet(this->coeffsDict_.lookup("initialSet"));
|
||||
forAllConstIter(wordHashSet, initSet, iter)
|
||||
{
|
||||
if (initSet.found(chemistry.Y()[i].member()))
|
||||
{
|
||||
searchInitSet_[j++] = i;
|
||||
}
|
||||
}
|
||||
|
||||
if (j<searchInitSet_.size())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< searchInitSet_.size()-j
|
||||
<< " species in the initial set is not in the mechanism "
|
||||
<< initSet
|
||||
<< abort(FatalError);
|
||||
searchInitSet_.append(chemistry.mixture().species()[iter.key()]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -40,11 +40,11 @@ reduction
|
||||
|
||||
// Search initiating set (SIS) of species, needed for most methods
|
||||
initialSet
|
||||
{
|
||||
CO;
|
||||
IC8H18;
|
||||
HO2;
|
||||
}
|
||||
(
|
||||
CO
|
||||
IC8H18
|
||||
HO2
|
||||
);
|
||||
}
|
||||
|
||||
// Tabulation is not effective for single-cell ignition calculations
|
||||
|
||||
@ -48,11 +48,11 @@ reduction
|
||||
|
||||
// Search initiating set (SIS) of species, needed for most methods
|
||||
initialSet
|
||||
{
|
||||
CO;
|
||||
CH4;
|
||||
HO2;
|
||||
}
|
||||
(
|
||||
CO
|
||||
CH4
|
||||
HO2
|
||||
);
|
||||
|
||||
// For DAC, option to automatically change the SIS switch from HO2 to H2O
|
||||
// and CO to CO2, + disable fuel
|
||||
@ -60,9 +60,9 @@ reduction
|
||||
|
||||
// When automaticSIS, the method needs to know the fuel
|
||||
fuelSpecies
|
||||
{
|
||||
CH4 1;
|
||||
}
|
||||
(
|
||||
(CH4 1)
|
||||
);
|
||||
}
|
||||
|
||||
tabulation
|
||||
|
||||
Reference in New Issue
Block a user