From 8547ae173fa1452df6b44210e51455366a92aeb4 Mon Sep 17 00:00:00 2001 From: Will Bainbridge Date: Tue, 20 Apr 2021 17:14:30 +0100 Subject: [PATCH] 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. --- .../chemistry/TDAC/chemistryProperties.cfg | 16 ++--- .../TDAC/chemistryPropertiesFlame.cfg | 16 ++--- .../TDACChemistryModel/reduction/DAC/DAC.C | 71 +++++-------------- .../TDACChemistryModel/reduction/DRG/DRG.C | 20 ++---- .../reduction/DRGEP/DRGEP.C | 20 ++---- .../TDACChemistryModel/reduction/PFA/PFA.C | 23 ++---- .../ic8h18_TDAC/constant/chemistryProperties | 10 +-- .../DLR_A_LTS/constant/chemistryProperties | 16 ++--- 8 files changed, 59 insertions(+), 133 deletions(-) diff --git a/etc/caseDicts/solvers/chemistry/TDAC/chemistryProperties.cfg b/etc/caseDicts/solvers/chemistry/TDAC/chemistryProperties.cfg index a781416695..9478f00aa3 100644 --- a/etc/caseDicts/solvers/chemistry/TDAC/chemistryProperties.cfg +++ b/etc/caseDicts/solvers/chemistry/TDAC/chemistryProperties.cfg @@ -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 diff --git a/etc/caseDicts/solvers/chemistry/TDAC/chemistryPropertiesFlame.cfg b/etc/caseDicts/solvers/chemistry/TDAC/chemistryPropertiesFlame.cfg index fffab2c068..597f33031d 100644 --- a/etc/caseDicts/solvers/chemistry/TDAC/chemistryPropertiesFlame.cfg +++ b/etc/caseDicts/solvers/chemistry/TDAC/chemistryPropertiesFlame.cfg @@ -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 diff --git a/src/thermophysicalModels/chemistryModel/chemistryModel/TDACChemistryModel/reduction/DAC/DAC.C b/src/thermophysicalModels/chemistryModel/chemistryModel/TDACChemistryModel/reduction/DAC/DAC.C index d20d9f3805..68f179e2c3 100644 --- a/src/thermophysicalModels/chemistryModel/chemistryModel/TDACChemistryModel/reduction/DAC/DAC.C +++ b/src/thermophysicalModels/chemistryModel/chemistryModel/TDACChemistryModel/reduction/DAC/DAC.C @@ -35,7 +35,7 @@ Foam::chemistryReductionMethods::DAC::DAC ) : chemistryReductionMethod(dict, chemistry), - searchInitSet_(this->coeffsDict_.subDict("initialSet").size()), + searchInitSet_(), zprime_(0), nbCLarge_(3), sC_(this->nSpecie_,0), @@ -87,22 +87,10 @@ Foam::chemistryReductionMethods::DAC::DAC ), forceFuelInclusion_(false) { - label j=0; - dictionary initSet = this->coeffsDict_.subDict("initialSet"); - for (label i=0; icoeffsDict_.lookup("initialSet")); + forAllConstIter(wordHashSet, initSet, iter) { - if (initSet.found(chemistry.Y()[i].member())) - { - searchInitSet_[j++] = i; - } - } - if (jcoeffsDict_.found("automaticSIS")) @@ -195,52 +183,29 @@ Foam::chemistryReductionMethods::DAC::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> fuelSpeciesEntry + ( + this->coeffsDict_.lookup("fuelSpecies") + ); - if (this->coeffsDict_.found("nbCLarge")) - { - nbCLarge_ = fuelDict.lookup