From 5f5ae6c38f96ad7411c7b63fb3f68e722fc45f08 Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 11 Oct 2010 17:38:00 +0100 Subject: [PATCH] ENH: Propagated dictionary constructors through lib reaction thermo --- .../chemistryReader/chemistryReader.H | 3 ++- .../chemkinReader/chemkinLexer.L | 4 +-- .../chemkinReader/chemkinReader.C | 7 +++-- .../chemkinReader/chemkinReader.H | 9 ++++--- .../foamChemistryReader/foamChemistryReader.C | 26 ++++++++++++------- .../foamChemistryReader/foamChemistryReader.H | 6 ++--- .../hCombustionThermo/hCombustionThermo.C | 2 +- .../homogeneousMixture/homogeneousMixture.C | 4 +-- .../reactingMixture/reactingMixture.C | 6 +---- 9 files changed, 36 insertions(+), 31 deletions(-) diff --git a/src/thermophysicalModels/reactionThermo/chemistryReaders/chemistryReader/chemistryReader.H b/src/thermophysicalModels/reactionThermo/chemistryReaders/chemistryReader/chemistryReader.H index 72c42062b3..2701cc5d37 100644 --- a/src/thermophysicalModels/reactionThermo/chemistryReaders/chemistryReader/chemistryReader.H +++ b/src/thermophysicalModels/reactionThermo/chemistryReaders/chemistryReader/chemistryReader.H @@ -38,6 +38,7 @@ SourceFiles #include "typeInfo.H" #include "runTimeSelectionTables.H" #include "Reaction.H" +#include "ReactionList.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -107,7 +108,7 @@ public: virtual const HashPtrTable& speciesThermo() const = 0; - virtual const SLPtrList >& reactions() const = 0; + virtual const PtrList >& reactions() const = 0; }; diff --git a/src/thermophysicalModels/reactionThermo/chemistryReaders/chemkinReader/chemkinLexer.L b/src/thermophysicalModels/reactionThermo/chemistryReaders/chemkinReader/chemkinLexer.L index b36b09d787..31f07b28c7 100644 --- a/src/thermophysicalModels/reactionThermo/chemistryReaders/chemkinReader/chemkinLexer.L +++ b/src/thermophysicalModels/reactionThermo/chemistryReaders/chemkinReader/chemkinLexer.L @@ -296,8 +296,8 @@ List currentSpecieComposition(5); scalar currentLowT = 0; scalar currentHighT = 0; scalar currentCommonT = 0; -gasThermoPhysics::coeffArray highCpCoeffs = {0, 0, 0, 0, 0, 0, 0}; -gasThermoPhysics::coeffArray lowCpCoeffs = {0, 0, 0, 0, 0, 0, 0}; +gasThermoPhysics::coeffArray highCpCoeffs(scalarList(7)); +gasThermoPhysics::coeffArray lowCpCoeffs(scalarList(7)); gasReaction::specieCoeffs currentSpecieCoeff; diff --git a/src/thermophysicalModels/reactionThermo/chemistryReaders/chemkinReader/chemkinReader.C b/src/thermophysicalModels/reactionThermo/chemistryReaders/chemkinReader/chemkinReader.C index 80418cbc83..76f70036c9 100644 --- a/src/thermophysicalModels/reactionThermo/chemistryReaders/chemkinReader/chemkinReader.C +++ b/src/thermophysicalModels/reactionThermo/chemistryReaders/chemkinReader/chemkinReader.C @@ -716,7 +716,7 @@ void Foam::chemkinReader::addReaction Afactor*ArrheniusCoeffs[0], ArrheniusCoeffs[1], ArrheniusCoeffs[2]/RR, - JanevCoeffs.begin() + FixedList(JanevCoeffs) ) ); } @@ -738,7 +738,7 @@ void Foam::chemkinReader::addReaction Afactor*ArrheniusCoeffs[0], ArrheniusCoeffs[1], ArrheniusCoeffs[2]/RR, - powerSeriesCoeffs.begin() + FixedList(powerSeriesCoeffs) ) ); } @@ -850,7 +850,6 @@ void Foam::chemkinReader::read // * * * * * * * * * * * * * * * * Constructor * * * * * * * * * * * * * * * // -// Construct from components Foam::chemkinReader::chemkinReader ( const fileName& CHEMKINFileName, @@ -865,7 +864,6 @@ Foam::chemkinReader::chemkinReader } -// Construct from components Foam::chemkinReader::chemkinReader(const dictionary& thermoDict) : lineNo_(1), @@ -902,4 +900,5 @@ Foam::chemkinReader::chemkinReader(const dictionary& thermoDict) read(chemkinFile, thermoFile); } + // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // diff --git a/src/thermophysicalModels/reactionThermo/chemistryReaders/chemkinReader/chemkinReader.H b/src/thermophysicalModels/reactionThermo/chemistryReaders/chemkinReader/chemkinReader.H index 67906b18b3..bbdf0ac53a 100644 --- a/src/thermophysicalModels/reactionThermo/chemistryReaders/chemkinReader/chemkinReader.H +++ b/src/thermophysicalModels/reactionThermo/chemistryReaders/chemkinReader/chemkinReader.H @@ -40,7 +40,7 @@ SourceFiles #include "fileName.H" #include "typeInfo.H" #include "HashPtrTable.H" -#include "SLPtrList.H" +#include "ReactionList.H" #include "DynamicList.H" #include "labelList.H" #include "speciesTable.H" @@ -205,7 +205,7 @@ private: HashTable > specieComposition_; //- List of the reactions - SLPtrList reactions_; + SLPtrList > reactions_; // Private Member Functions @@ -375,9 +375,10 @@ public: } //- List of the reactions - const SLPtrList& reactions() const + const PtrList >& reactions() const { - return reactions_; + return PtrList >(reactions_); +// return reactions_; } }; diff --git a/src/thermophysicalModels/reactionThermo/chemistryReaders/foamChemistryReader/foamChemistryReader.C b/src/thermophysicalModels/reactionThermo/chemistryReaders/foamChemistryReader/foamChemistryReader.C index 5e29a87a6e..91a108c205 100644 --- a/src/thermophysicalModels/reactionThermo/chemistryReaders/foamChemistryReader/foamChemistryReader.C +++ b/src/thermophysicalModels/reactionThermo/chemistryReaders/foamChemistryReader/foamChemistryReader.C @@ -37,12 +37,16 @@ Foam::foamChemistryReader::foamChemistryReader ) : chemistryReader(), - speciesThermo_(IFstream(thermoFileName)()), - speciesTable_(dictionary(IFstream(reactionsFileName)()).lookup("species")), + speciesThermo_(dictionary(IFstream(thermoFileName.expand())())), + speciesTable_ + ( + dictionary(IFstream(reactionsFileName.expand())()).lookup("species") + ), reactions_ ( - dictionary(IFstream(reactionsFileName)()).lookup("reactions"), - Reaction::iNew(speciesTable_, speciesThermo_) + speciesTable_, + speciesThermo_, + dictionary(IFstream(reactionsFileName)) ) {} @@ -56,10 +60,13 @@ Foam::foamChemistryReader::foamChemistryReader chemistryReader(), speciesThermo_ ( - IFstream + dictionary ( - fileName(thermoDict.lookup("foamChemistryThermoFile")).expand() - )() + IFstream + ( + fileName(thermoDict.lookup("foamChemistryThermoFile")).expand() + )() + ) ), speciesTable_ ( @@ -73,14 +80,15 @@ Foam::foamChemistryReader::foamChemistryReader ), reactions_ ( + speciesTable_, + speciesThermo_, dictionary ( IFstream ( fileName(thermoDict.lookup("foamChemistryFile")).expand() )() - ).lookup("reactions"), - typename Reaction::iNew(speciesTable_, speciesThermo_) + ) ) {} diff --git a/src/thermophysicalModels/reactionThermo/chemistryReaders/foamChemistryReader/foamChemistryReader.H b/src/thermophysicalModels/reactionThermo/chemistryReaders/foamChemistryReader/foamChemistryReader.H index 5cba4d8b9f..d03434ee74 100644 --- a/src/thermophysicalModels/reactionThermo/chemistryReaders/foamChemistryReader/foamChemistryReader.H +++ b/src/thermophysicalModels/reactionThermo/chemistryReaders/foamChemistryReader/foamChemistryReader.H @@ -65,7 +65,7 @@ class foamChemistryReader speciesTable speciesTable_; //- List of the reactions - SLPtrList > reactions_; + ReactionList reactions_; // Private Member Functions @@ -117,9 +117,9 @@ public: } //- List of the reactions - const SLPtrList >& reactions() const + const PtrList >& reactions() const { - return reactions_; + return reactions_.reactions(); } }; diff --git a/src/thermophysicalModels/reactionThermo/combustionThermo/hCombustionThermo/hCombustionThermo.C b/src/thermophysicalModels/reactionThermo/combustionThermo/hCombustionThermo/hCombustionThermo.C index 126823c624..4e64f39c7b 100644 --- a/src/thermophysicalModels/reactionThermo/combustionThermo/hCombustionThermo/hCombustionThermo.C +++ b/src/thermophysicalModels/reactionThermo/combustionThermo/hCombustionThermo/hCombustionThermo.C @@ -51,7 +51,7 @@ Foam::hCombustionThermo::hCombustionThermo(const fvMesh& mesh) IOobject::NO_WRITE ), mesh, - dimensionSet(0, 2, -2, 0, 0), + dimEnergy/dimMass, this->hBoundaryTypes() ) {} diff --git a/src/thermophysicalModels/reactionThermo/mixtures/homogeneousMixture/homogeneousMixture.C b/src/thermophysicalModels/reactionThermo/mixtures/homogeneousMixture/homogeneousMixture.C index eca7ffd0d5..e72edf4b24 100644 --- a/src/thermophysicalModels/reactionThermo/mixtures/homogeneousMixture/homogeneousMixture.C +++ b/src/thermophysicalModels/reactionThermo/mixtures/homogeneousMixture/homogeneousMixture.C @@ -48,8 +48,8 @@ Foam::homogeneousMixture::homogeneousMixture mesh ), - reactants_(thermoDict.lookup("reactants")), - products_(thermoDict.lookup("products")), + reactants_(thermoDict.subDict("reactants")), + products_(thermoDict.subDict("products")), mixture_("mixture", reactants_), b_(Y("b")) {} diff --git a/src/thermophysicalModels/reactionThermo/mixtures/reactingMixture/reactingMixture.C b/src/thermophysicalModels/reactionThermo/mixtures/reactingMixture/reactingMixture.C index 3e10336dbb..a4b0081668 100644 --- a/src/thermophysicalModels/reactionThermo/mixtures/reactingMixture/reactingMixture.C +++ b/src/thermophysicalModels/reactionThermo/mixtures/reactingMixture/reactingMixture.C @@ -48,11 +48,7 @@ Foam::reactingMixture::reactingMixture ), PtrList > ( - PtrList > - ( - autoPtr >::operator()().reactions() - ), - this->species_ + autoPtr >::operator()().reactions() ) { autoPtr >::clear();