ENH: Propagated dictionary constructors through lib reaction thermo

This commit is contained in:
andy
2010-10-11 17:38:00 +01:00
parent 06327d3105
commit 5f5ae6c38f
9 changed files with 36 additions and 31 deletions

View File

@ -38,6 +38,7 @@ SourceFiles
#include "typeInfo.H" #include "typeInfo.H"
#include "runTimeSelectionTables.H" #include "runTimeSelectionTables.H"
#include "Reaction.H" #include "Reaction.H"
#include "ReactionList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -107,7 +108,7 @@ public:
virtual const HashPtrTable<ThermoType>& speciesThermo() const = 0; virtual const HashPtrTable<ThermoType>& speciesThermo() const = 0;
virtual const SLPtrList<Reaction<ThermoType> >& reactions() const = 0; virtual const PtrList<Reaction<ThermoType> >& reactions() const = 0;
}; };

View File

@ -296,8 +296,8 @@ List<specieElement> currentSpecieComposition(5);
scalar currentLowT = 0; scalar currentLowT = 0;
scalar currentHighT = 0; scalar currentHighT = 0;
scalar currentCommonT = 0; scalar currentCommonT = 0;
gasThermoPhysics::coeffArray highCpCoeffs = {0, 0, 0, 0, 0, 0, 0}; gasThermoPhysics::coeffArray highCpCoeffs(scalarList(7));
gasThermoPhysics::coeffArray lowCpCoeffs = {0, 0, 0, 0, 0, 0, 0}; gasThermoPhysics::coeffArray lowCpCoeffs(scalarList(7));
gasReaction::specieCoeffs currentSpecieCoeff; gasReaction::specieCoeffs currentSpecieCoeff;

View File

@ -716,7 +716,7 @@ void Foam::chemkinReader::addReaction
Afactor*ArrheniusCoeffs[0], Afactor*ArrheniusCoeffs[0],
ArrheniusCoeffs[1], ArrheniusCoeffs[1],
ArrheniusCoeffs[2]/RR, ArrheniusCoeffs[2]/RR,
JanevCoeffs.begin() FixedList<scalar, 9>(JanevCoeffs)
) )
); );
} }
@ -738,7 +738,7 @@ void Foam::chemkinReader::addReaction
Afactor*ArrheniusCoeffs[0], Afactor*ArrheniusCoeffs[0],
ArrheniusCoeffs[1], ArrheniusCoeffs[1],
ArrheniusCoeffs[2]/RR, ArrheniusCoeffs[2]/RR,
powerSeriesCoeffs.begin() FixedList<scalar, 4>(powerSeriesCoeffs)
) )
); );
} }
@ -850,7 +850,6 @@ void Foam::chemkinReader::read
// * * * * * * * * * * * * * * * * Constructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructor * * * * * * * * * * * * * * * //
// Construct from components
Foam::chemkinReader::chemkinReader Foam::chemkinReader::chemkinReader
( (
const fileName& CHEMKINFileName, const fileName& CHEMKINFileName,
@ -865,7 +864,6 @@ Foam::chemkinReader::chemkinReader
} }
// Construct from components
Foam::chemkinReader::chemkinReader(const dictionary& thermoDict) Foam::chemkinReader::chemkinReader(const dictionary& thermoDict)
: :
lineNo_(1), lineNo_(1),
@ -902,4 +900,5 @@ Foam::chemkinReader::chemkinReader(const dictionary& thermoDict)
read(chemkinFile, thermoFile); read(chemkinFile, thermoFile);
} }
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //

View File

@ -40,7 +40,7 @@ SourceFiles
#include "fileName.H" #include "fileName.H"
#include "typeInfo.H" #include "typeInfo.H"
#include "HashPtrTable.H" #include "HashPtrTable.H"
#include "SLPtrList.H" #include "ReactionList.H"
#include "DynamicList.H" #include "DynamicList.H"
#include "labelList.H" #include "labelList.H"
#include "speciesTable.H" #include "speciesTable.H"
@ -205,7 +205,7 @@ private:
HashTable<List<specieElement> > specieComposition_; HashTable<List<specieElement> > specieComposition_;
//- List of the reactions //- List of the reactions
SLPtrList<gasReaction> reactions_; SLPtrList<Reaction<gasThermoPhysics> > reactions_;
// Private Member Functions // Private Member Functions
@ -375,9 +375,10 @@ public:
} }
//- List of the reactions //- List of the reactions
const SLPtrList<gasReaction>& reactions() const const PtrList<Reaction<gasThermoPhysics> >& reactions() const
{ {
return reactions_; return PtrList<Reaction<gasThermoPhysics> >(reactions_);
// return reactions_;
} }
}; };

View File

@ -37,12 +37,16 @@ Foam::foamChemistryReader<ThermoType>::foamChemistryReader
) )
: :
chemistryReader<ThermoType>(), chemistryReader<ThermoType>(),
speciesThermo_(IFstream(thermoFileName)()), speciesThermo_(dictionary(IFstream(thermoFileName.expand())())),
speciesTable_(dictionary(IFstream(reactionsFileName)()).lookup("species")), speciesTable_
(
dictionary(IFstream(reactionsFileName.expand())()).lookup("species")
),
reactions_ reactions_
( (
dictionary(IFstream(reactionsFileName)()).lookup("reactions"), speciesTable_,
Reaction<ThermoType>::iNew(speciesTable_, speciesThermo_) speciesThermo_,
dictionary(IFstream(reactionsFileName))
) )
{} {}
@ -56,10 +60,13 @@ Foam::foamChemistryReader<ThermoType>::foamChemistryReader
chemistryReader<ThermoType>(), chemistryReader<ThermoType>(),
speciesThermo_ speciesThermo_
( (
IFstream dictionary
( (
fileName(thermoDict.lookup("foamChemistryThermoFile")).expand() IFstream
)() (
fileName(thermoDict.lookup("foamChemistryThermoFile")).expand()
)()
)
), ),
speciesTable_ speciesTable_
( (
@ -73,14 +80,15 @@ Foam::foamChemistryReader<ThermoType>::foamChemistryReader
), ),
reactions_ reactions_
( (
speciesTable_,
speciesThermo_,
dictionary dictionary
( (
IFstream IFstream
( (
fileName(thermoDict.lookup("foamChemistryFile")).expand() fileName(thermoDict.lookup("foamChemistryFile")).expand()
)() )()
).lookup("reactions"), )
typename Reaction<ThermoType>::iNew(speciesTable_, speciesThermo_)
) )
{} {}

View File

@ -65,7 +65,7 @@ class foamChemistryReader
speciesTable speciesTable_; speciesTable speciesTable_;
//- List of the reactions //- List of the reactions
SLPtrList<Reaction<ThermoType> > reactions_; ReactionList<ThermoType> reactions_;
// Private Member Functions // Private Member Functions
@ -117,9 +117,9 @@ public:
} }
//- List of the reactions //- List of the reactions
const SLPtrList<Reaction<ThermoType> >& reactions() const const PtrList<Reaction<ThermoType> >& reactions() const
{ {
return reactions_; return reactions_.reactions();
} }
}; };

View File

@ -51,7 +51,7 @@ Foam::hCombustionThermo::hCombustionThermo(const fvMesh& mesh)
IOobject::NO_WRITE IOobject::NO_WRITE
), ),
mesh, mesh,
dimensionSet(0, 2, -2, 0, 0), dimEnergy/dimMass,
this->hBoundaryTypes() this->hBoundaryTypes()
) )
{} {}

View File

@ -48,8 +48,8 @@ Foam::homogeneousMixture<ThermoType>::homogeneousMixture
mesh mesh
), ),
reactants_(thermoDict.lookup("reactants")), reactants_(thermoDict.subDict("reactants")),
products_(thermoDict.lookup("products")), products_(thermoDict.subDict("products")),
mixture_("mixture", reactants_), mixture_("mixture", reactants_),
b_(Y("b")) b_(Y("b"))
{} {}

View File

@ -48,11 +48,7 @@ Foam::reactingMixture<ThermoType>::reactingMixture
), ),
PtrList<Reaction<ThermoType> > PtrList<Reaction<ThermoType> >
( (
PtrList<Reaction<ThermoType> > autoPtr<chemistryReader<ThermoType> >::operator()().reactions()
(
autoPtr<chemistryReader<ThermoType> >::operator()().reactions()
),
this->species_
) )
{ {
autoPtr<chemistryReader<ThermoType> >::clear(); autoPtr<chemistryReader<ThermoType> >::clear();