diff --git a/src/thermophysicalModels/specie/equationOfState/icoPolynomial/icoPolynomial.C b/src/thermophysicalModels/specie/equationOfState/icoPolynomial/icoPolynomial.C index 95ab12629d..376b299757 100644 --- a/src/thermophysicalModels/specie/equationOfState/icoPolynomial/icoPolynomial.C +++ b/src/thermophysicalModels/specie/equationOfState/icoPolynomial/icoPolynomial.C @@ -43,6 +43,16 @@ icoPolynomial::icoPolynomial(Istream& is) } +template +icoPolynomial::icoPolynomial(const dictionary& dict) +: + specie(dict), + rhoPolynomial_(dict.lookup("rhoPolynomial")) +{ + rhoPolynomial_ *= this->W(); +} + + // * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * // template diff --git a/src/thermophysicalModels/specie/equationOfState/icoPolynomial/icoPolynomial.H b/src/thermophysicalModels/specie/equationOfState/icoPolynomial/icoPolynomial.H index 889837b8ad..9d6b10cd14 100644 --- a/src/thermophysicalModels/specie/equationOfState/icoPolynomial/icoPolynomial.H +++ b/src/thermophysicalModels/specie/equationOfState/icoPolynomial/icoPolynomial.H @@ -117,6 +117,9 @@ public: //- Construct from Istream icoPolynomial(Istream&); + //- Construct from dictionary + icoPolynomial(const dictionary& dict); + //- Construct as copy inline icoPolynomial(const icoPolynomial&); @@ -129,6 +132,9 @@ public: // Selector from Istream inline static autoPtr New(Istream& is); + // Selector from dictionary + inline static autoPtr New(const dictionary& dict); + // Member functions diff --git a/src/thermophysicalModels/specie/equationOfState/icoPolynomial/icoPolynomialI.H b/src/thermophysicalModels/specie/equationOfState/icoPolynomial/icoPolynomialI.H index e4a1699e20..5f75c1c4b3 100644 --- a/src/thermophysicalModels/specie/equationOfState/icoPolynomial/icoPolynomialI.H +++ b/src/thermophysicalModels/specie/equationOfState/icoPolynomial/icoPolynomialI.H @@ -83,6 +83,17 @@ Foam::icoPolynomial::New(Istream& is) } +template +inline Foam::autoPtr > +Foam::icoPolynomial::New(const dictionary& dict) +{ + return autoPtr > + ( + new icoPolynomial(dict) + ); +} + + // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template diff --git a/src/thermophysicalModels/specie/equationOfState/perfectGas/perfectGas.C b/src/thermophysicalModels/specie/equationOfState/perfectGas/perfectGas.C index 04c85a1344..ef01ba2b14 100644 --- a/src/thermophysicalModels/specie/equationOfState/perfectGas/perfectGas.C +++ b/src/thermophysicalModels/specie/equationOfState/perfectGas/perfectGas.C @@ -41,6 +41,12 @@ perfectGas::perfectGas(Istream& is) } +perfectGas::perfectGas(const dictionary& dict) +: + specie(dict) +{} + + // * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * // Ostream& operator<<(Ostream& os, const perfectGas& pg) diff --git a/src/thermophysicalModels/specie/equationOfState/perfectGas/perfectGas.H b/src/thermophysicalModels/specie/equationOfState/perfectGas/perfectGas.H index 10d42ad164..228b23aca5 100644 --- a/src/thermophysicalModels/specie/equationOfState/perfectGas/perfectGas.H +++ b/src/thermophysicalModels/specie/equationOfState/perfectGas/perfectGas.H @@ -63,6 +63,9 @@ public: //- Construct from Istream perfectGas(Istream&); + //- Construct from dictionary + perfectGas(const dictionary& dict); + //- Construct as named copy inline perfectGas(const word& name, const perfectGas&); @@ -72,6 +75,9 @@ public: // Selector from Istream inline static autoPtr New(Istream& is); + // Selector from dictionary + inline static autoPtr New(const dictionary& dict); + // Member functions diff --git a/src/thermophysicalModels/specie/equationOfState/perfectGas/perfectGasI.H b/src/thermophysicalModels/specie/equationOfState/perfectGas/perfectGasI.H index 798e39343d..a72cf9fb87 100644 --- a/src/thermophysicalModels/specie/equationOfState/perfectGas/perfectGasI.H +++ b/src/thermophysicalModels/specie/equationOfState/perfectGas/perfectGasI.H @@ -32,7 +32,6 @@ namespace Foam // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -// Construct from components inline perfectGas::perfectGas ( const specie& sp @@ -44,42 +43,44 @@ inline perfectGas::perfectGas // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -// Construct as named copy inline perfectGas::perfectGas(const word& name, const perfectGas& pg) : specie(name, pg) {} -// Construct and return a clone inline autoPtr perfectGas::clone() const { return autoPtr(new perfectGas(*this)); } -// Selector from Istream inline autoPtr perfectGas::New(Istream& is) { return autoPtr(new perfectGas(is)); } +inline autoPtr perfectGas::New(const dictionary& dict) +{ + return autoPtr(new perfectGas(dict)); +} + + // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -//- Return density [kg/m^3] inline scalar perfectGas::rho(scalar p, scalar T) const { return p/(R()*T); } -//- Return compressibility rho/p [s^2/m^2] + inline scalar perfectGas::psi(scalar, scalar T) const { return 1.0/(R()*T); } -//- Return compression factor [] + inline scalar perfectGas::Z(scalar, scalar) const { return 1.0; @@ -93,11 +94,13 @@ inline void perfectGas::operator+=(const perfectGas& pg) specie::operator+=(pg); } + inline void perfectGas::operator-=(const perfectGas& pg) { specie::operator-=(pg); } + inline void perfectGas::operator*=(const scalar s) { specie::operator*=(s); diff --git a/src/thermophysicalModels/specie/reaction/Reactions/IrreversibleReaction/IrreversibleReaction.C b/src/thermophysicalModels/specie/reaction/Reactions/IrreversibleReaction/IrreversibleReaction.C index 7e810f1225..9bfbd4405c 100644 --- a/src/thermophysicalModels/specie/reaction/Reactions/IrreversibleReaction/IrreversibleReaction.C +++ b/src/thermophysicalModels/specie/reaction/Reactions/IrreversibleReaction/IrreversibleReaction.C @@ -25,16 +25,10 @@ License #include "IrreversibleReaction.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -// Construct from components template -IrreversibleReaction::IrreversibleReaction +Foam::IrreversibleReaction::IrreversibleReaction ( const Reaction& reaction, const ReactionRate& k @@ -45,9 +39,8 @@ IrreversibleReaction::IrreversibleReaction {} -// Construct from components template -IrreversibleReaction::IrreversibleReaction +Foam::IrreversibleReaction::IrreversibleReaction ( const speciesTable& species, const HashPtrTable& thermoDatabase, @@ -59,9 +52,21 @@ IrreversibleReaction::IrreversibleReaction {} -// Construct as copy given new speciesTable template -IrreversibleReaction::IrreversibleReaction +Foam::IrreversibleReaction::IrreversibleReaction +( + const speciesTable& species, + const HashPtrTable& thermoDatabase, + const dictionary& dict +) +: + Reaction(species, thermoDatabase, dict), + k_(species, dict) +{} + + +template +Foam::IrreversibleReaction::IrreversibleReaction ( const IrreversibleReaction& irr, const speciesTable& species @@ -75,7 +80,7 @@ IrreversibleReaction::IrreversibleReaction // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template -scalar IrreversibleReaction::kf +Foam::scalar Foam::IrreversibleReaction::kf ( const scalar T, const scalar p, @@ -87,7 +92,7 @@ scalar IrreversibleReaction::kf template -void IrreversibleReaction::write +void Foam::IrreversibleReaction::write ( Ostream& os ) const @@ -97,8 +102,4 @@ void IrreversibleReaction::write } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - // ************************************************************************* // diff --git a/src/thermophysicalModels/specie/reaction/Reactions/IrreversibleReaction/IrreversibleReaction.H b/src/thermophysicalModels/specie/reaction/Reactions/IrreversibleReaction/IrreversibleReaction.H index 46a6414e96..1c90ebef73 100644 --- a/src/thermophysicalModels/specie/reaction/Reactions/IrreversibleReaction/IrreversibleReaction.H +++ b/src/thermophysicalModels/specie/reaction/Reactions/IrreversibleReaction/IrreversibleReaction.H @@ -44,7 +44,7 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class IrreversibleReaction Declaration + Class IrreversibleReaction Declaration \*---------------------------------------------------------------------------*/ template @@ -96,6 +96,14 @@ public: Istream& is ); + //- Construct from dictionary + IrreversibleReaction + ( + const speciesTable& species, + const HashPtrTable& thermoDatabase, + const dictionary& dict + ); + //- Construct and return a clone virtual autoPtr > clone() const { diff --git a/src/thermophysicalModels/specie/reaction/Reactions/NonEquilibriumReversibleReaction/NonEquilibriumReversibleReaction.C b/src/thermophysicalModels/specie/reaction/Reactions/NonEquilibriumReversibleReaction/NonEquilibriumReversibleReaction.C index 06befe7e8e..344f8160cd 100644 --- a/src/thermophysicalModels/specie/reaction/Reactions/NonEquilibriumReversibleReaction/NonEquilibriumReversibleReaction.C +++ b/src/thermophysicalModels/specie/reaction/Reactions/NonEquilibriumReversibleReaction/NonEquilibriumReversibleReaction.C @@ -25,16 +25,10 @@ License #include "NonEquilibriumReversibleReaction.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -// Construct from components template -NonEquilibriumReversibleReaction:: +Foam::NonEquilibriumReversibleReaction:: NonEquilibriumReversibleReaction ( const Reaction& reaction, @@ -48,9 +42,9 @@ NonEquilibriumReversibleReaction {} -// Construct from components + template -NonEquilibriumReversibleReaction:: +Foam::NonEquilibriumReversibleReaction:: NonEquilibriumReversibleReaction ( const speciesTable& species, @@ -63,9 +57,24 @@ NonEquilibriumReversibleReaction rk_(species, is) {} -// Construct as copy given new speciesTable + template -NonEquilibriumReversibleReaction:: +Foam::NonEquilibriumReversibleReaction:: +NonEquilibriumReversibleReaction +( + const speciesTable& species, + const HashPtrTable& thermoDatabase, + const dictionary& dict +) +: + Reaction(species, thermoDatabase, dict), + fk_(species, dict), + rk_(species, dict) +{} + + +template +Foam::NonEquilibriumReversibleReaction:: NonEquilibriumReversibleReaction ( const NonEquilibriumReversibleReaction& nerr, @@ -81,7 +90,8 @@ NonEquilibriumReversibleReaction // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template -scalar NonEquilibriumReversibleReaction::kf +Foam::scalar +Foam::NonEquilibriumReversibleReaction::kf ( const scalar T, const scalar p, @@ -93,7 +103,8 @@ scalar NonEquilibriumReversibleReaction::kf template -scalar NonEquilibriumReversibleReaction::kr +Foam::scalar +Foam::NonEquilibriumReversibleReaction::kr ( const scalar, const scalar T, @@ -106,7 +117,8 @@ scalar NonEquilibriumReversibleReaction::kr template -scalar NonEquilibriumReversibleReaction::kr +Foam::scalar +Foam::NonEquilibriumReversibleReaction::kr ( const scalar T, const scalar p, @@ -118,7 +130,7 @@ scalar NonEquilibriumReversibleReaction::kr template -void NonEquilibriumReversibleReaction::write +void Foam::NonEquilibriumReversibleReaction::write ( Ostream& os ) const @@ -128,8 +140,4 @@ void NonEquilibriumReversibleReaction::write } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - // ************************************************************************* // diff --git a/src/thermophysicalModels/specie/reaction/Reactions/NonEquilibriumReversibleReaction/NonEquilibriumReversibleReaction.H b/src/thermophysicalModels/specie/reaction/Reactions/NonEquilibriumReversibleReaction/NonEquilibriumReversibleReaction.H index 2cc66c430e..6c6ffee026 100644 --- a/src/thermophysicalModels/specie/reaction/Reactions/NonEquilibriumReversibleReaction/NonEquilibriumReversibleReaction.H +++ b/src/thermophysicalModels/specie/reaction/Reactions/NonEquilibriumReversibleReaction/NonEquilibriumReversibleReaction.H @@ -44,7 +44,7 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class NonEquilibriumReversibleReaction Declaration + Class NonEquilibriumReversibleReaction Declaration \*---------------------------------------------------------------------------*/ template @@ -100,6 +100,14 @@ public: Istream& is ); + //- Construct from dictionary + NonEquilibriumReversibleReaction + ( + const speciesTable& species, + const HashPtrTable& thermoDatabase, + const dictionary& dict + ); + //- Construct and return a clone virtual autoPtr > clone() const { diff --git a/src/thermophysicalModels/specie/reaction/Reactions/Reaction/Reaction.C b/src/thermophysicalModels/specie/reaction/Reactions/Reaction/Reaction.C index 87b8eb123c..97e4496ddd 100644 --- a/src/thermophysicalModels/specie/reaction/Reactions/Reaction/Reaction.C +++ b/src/thermophysicalModels/specie/reaction/Reactions/Reaction/Reaction.C @@ -196,6 +196,22 @@ Foam::Reaction::Reaction } +template +Foam::Reaction::Reaction +( + const speciesTable& species, + const HashPtrTable& thermoDatabase, + const dictionary& dict +) +: + ReactionThermo(*thermoDatabase[species[0]]), + species_(species) +{ + setLRhs(IStringStream(dict.lookup("reaction"))()); + setThermo(thermoDatabase); +} + + // * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * // template @@ -211,11 +227,11 @@ Foam::Reaction::New { FatalIOErrorIn ( - "Reaction::New(const speciesTable& species," - " const HashPtrTable& thermoDatabase, Istream&)", + "Reaction::New(const speciesTable&, " + " const HashPtrTable&, Istream&)", is ) << "Reaction type not specified" << nl << nl - << "Valid Reaction types are :" << endl + << "Valid Reaction types are :" << nl << IstreamConstructorTablePtr_->sortedToc() << exit(FatalIOError); } @@ -229,12 +245,12 @@ Foam::Reaction::New { FatalIOErrorIn ( - "Reaction::New(const speciesTable& species," - " const HashPtrTable& thermoDatabase, Istream&)", + "Reaction::New(const speciesTable&, " + " const HashPtrTable&, Istream&)", is ) << "Unknown reaction type " << reactionTypeName << nl << nl - << "Valid reaction types are :" << endl + << "Valid reaction types are :" << nl << IstreamConstructorTablePtr_->sortedToc() << exit(FatalIOError); } @@ -246,6 +262,44 @@ Foam::Reaction::New } +template +Foam::autoPtr > +Foam::Reaction::New +( + const speciesTable& species, + const HashPtrTable& thermoDatabase, + const dictionary& dict +) +{ + const word& reactionTypeName = dict.dictName(); + + typename dictionaryConstructorTable::iterator cstrIter + = dictionaryConstructorTablePtr_->find(reactionTypeName); + + if (cstrIter == dictionaryConstructorTablePtr_->end()) + { + FatalErrorIn + ( + "Reaction::New" + "(" + "const speciesTable&, " + "const HashPtrTable&, " + "const dictionary&" + ")" + ) << "Unknown reaction type " + << reactionTypeName << nl << nl + << "Valid reaction types are :" << nl + << dictionaryConstructorTablePtr_->sortedToc() + << exit(FatalError); + } + + return autoPtr > + ( + cstrIter()(species, thermoDatabase, dict) + ); +} + + // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template diff --git a/src/thermophysicalModels/specie/reaction/Reactions/Reaction/Reaction.H b/src/thermophysicalModels/specie/reaction/Reactions/Reaction/Reaction.H index 73a704935a..26c7806c13 100644 --- a/src/thermophysicalModels/specie/reaction/Reactions/Reaction/Reaction.H +++ b/src/thermophysicalModels/specie/reaction/Reactions/Reaction/Reaction.H @@ -152,6 +152,19 @@ public: (species, thermoDatabase, is) ); + declareRunTimeSelectionTable + ( + autoPtr, + Reaction, + dictionary, + ( + const speciesTable& species, + const HashPtrTable& thermoDatabase, + const dictionary& dict + ), + (species, thermoDatabase, dict) + ); + // Public classes @@ -205,6 +218,14 @@ public: Istream& is ); + //- Construct from dictionary + Reaction + ( + const speciesTable& species, + const HashPtrTable& thermoDatabase, + const dictionary& dict + ); + //- Construct and return a clone virtual autoPtr > clone() const { @@ -229,12 +250,20 @@ public: // Selectors - //- Return a pointer to a new patchField created on freestore from input + //- Return a pointer to new patchField created on freestore from input static autoPtr > New ( const speciesTable& species, const HashPtrTable& thermoDatabase, - Istream& + Istream& is + ); + + //- Return a pointer to new patchField created on freestore from dict + static autoPtr > New + ( + const speciesTable& species, + const HashPtrTable& thermoDatabase, + const dictionary& dict ); diff --git a/src/thermophysicalModels/specie/reaction/Reactions/Reaction/ReactionList.C b/src/thermophysicalModels/specie/reaction/Reactions/Reaction/ReactionList.C new file mode 100644 index 0000000000..b579d321d9 --- /dev/null +++ b/src/thermophysicalModels/specie/reaction/Reactions/Reaction/ReactionList.C @@ -0,0 +1,136 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "ReactionList.H" +#include "IFstream.H" +#include "SLPtrList.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +Foam::ReactionList::ReactionList +( + const speciesTable& species, + const HashPtrTable& thermoDb +) +: + PtrList >(), + species_(species), + thermoDb_(thermoDb), + dict_(dictionary::null) +{} + + +template +Foam::ReactionList::ReactionList +( + const speciesTable& species, + const HashPtrTable& thermoDb, + const dictionary& dict +) +: + PtrList >(), + species_(species), + thermoDb_(thermoDb), + dict_(dict) +{ + readReactionDict(); +} + + +template +Foam::ReactionList::ReactionList +( + const speciesTable& species, + const HashPtrTable& thermoDb, + const fileName& fName +) +: + PtrList > + ( + dictionary(IFstream(fName)()).lookup("reactions"), + Reaction::iNew(species, thermoDb) + ), + species_(species), + thermoDb_(thermoDb), + dict_(dictionary::null) +{} + + +template +Foam::ReactionList::ReactionList(const ReactionList& reactions) +: + PtrList >(reactions), + species_(reactions.species_), + thermoDb_(reactions.thermoDb_), + dict_(reactions.dict_) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +template +Foam::ReactionList::~ReactionList() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +bool Foam::ReactionList::readReactionDict() +{ + const dictionary& reactions(dict_.subDict("reactions")); + PtrList > newPtrs(reactions.size()); + + label i = 0; + forAllConstIter(dictionary, reactions, iter) + { + newPtrs.set + ( + i++, + Reaction::New + ( + species_, + thermoDb_, + reactions.subDict(iter().keyword()) + ) + ); + } + + PtrList >::transfer(newPtrs); + + return true; +} + + +template +const Foam::PtrList >& +Foam::ReactionList::reactions() const +{ + return *this; +} + + +// ************************************************************************* // diff --git a/src/thermophysicalModels/specie/reaction/Reactions/Reaction/ReactionList.H b/src/thermophysicalModels/specie/reaction/Reactions/Reaction/ReactionList.H new file mode 100644 index 0000000000..233855d5f5 --- /dev/null +++ b/src/thermophysicalModels/specie/reaction/Reactions/Reaction/ReactionList.H @@ -0,0 +1,135 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::ReactionList + +Description + List of templated reactions + +SourceFiles + ReactionList.C + +\*---------------------------------------------------------------------------*/ + +#ifndef ReactionList_H +#define ReactionList_H + +#include "PtrList.H" +#include "SLPtrList.H" +#include "speciesTable.H" +#include "HashPtrTable.H" +#include "Reaction.H" +#include "fileName.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class ReactionList Declaration +\*---------------------------------------------------------------------------*/ + +template +class ReactionList +: + private PtrList > +{ + // Private data + + //- Reference to the table of species + const speciesTable& species_; + + //- Reference to the thermo database + const HashPtrTable& thermoDb_; + + //- The dictionary used for construction + const dictionary dict_; + + + // Private Member Functions + + //- Disallow default bitwise assignment + void operator=(const ReactionList&); + + +public: + + // Constructors + + //- Construct null + ReactionList + ( + const speciesTable& species, + const HashPtrTable& thermoDatabase + ); + + //- Construct from dictionary + ReactionList + ( + const speciesTable& species, + const HashPtrTable& thermoDatabase, + const dictionary& dict + ); + + //- Construct from file using (Istream) + ReactionList + ( + const speciesTable& species, + const HashPtrTable& thermoDatabase, + const fileName& fName + ); + + //- Construct copy + ReactionList(const ReactionList& reactions); + + + //- Destructor + ~ReactionList(); + + + // Public Member Functions + + //- Read reactions from dictionary + bool readReactionDict(); + + //- Return the list of reactions + const PtrList >& reactions() const; +}; + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "ReactionList.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/thermophysicalModels/specie/reaction/Reactions/ReversibleReaction/ReversibleReaction.C b/src/thermophysicalModels/specie/reaction/Reactions/ReversibleReaction/ReversibleReaction.C index 6456299ede..5b5feecaa1 100644 --- a/src/thermophysicalModels/specie/reaction/Reactions/ReversibleReaction/ReversibleReaction.C +++ b/src/thermophysicalModels/specie/reaction/Reactions/ReversibleReaction/ReversibleReaction.C @@ -25,16 +25,10 @@ License #include "ReversibleReaction.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -// Construct from components template -ReversibleReaction::ReversibleReaction +Foam::ReversibleReaction::ReversibleReaction ( const Reaction& reaction, const ReactionRate& k @@ -45,9 +39,8 @@ ReversibleReaction::ReversibleReaction {} -// Construct from components template -ReversibleReaction::ReversibleReaction +Foam::ReversibleReaction::ReversibleReaction ( const speciesTable& species, const HashPtrTable& thermoDatabase, @@ -59,9 +52,21 @@ ReversibleReaction::ReversibleReaction {} -// Construct as copy given new speciesTable template -ReversibleReaction::ReversibleReaction +Foam::ReversibleReaction::ReversibleReaction +( + const speciesTable& species, + const HashPtrTable& thermoDatabase, + const dictionary& dict +) +: + Reaction(species, thermoDatabase, dict), + k_(species, dict) +{} + + +template +Foam::ReversibleReaction::ReversibleReaction ( const ReversibleReaction& rr, const speciesTable& species @@ -75,7 +80,7 @@ ReversibleReaction::ReversibleReaction // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template -scalar ReversibleReaction::kf +Foam::scalar Foam::ReversibleReaction::kf ( const scalar T, const scalar p, @@ -87,7 +92,7 @@ scalar ReversibleReaction::kf template -scalar ReversibleReaction::kr +Foam::scalar Foam::ReversibleReaction::kr ( const scalar kfwd, const scalar T, @@ -100,7 +105,7 @@ scalar ReversibleReaction::kr template -scalar ReversibleReaction::kr +Foam::scalar Foam::ReversibleReaction::kr ( const scalar T, const scalar p, @@ -112,7 +117,7 @@ scalar ReversibleReaction::kr template -void ReversibleReaction::write +void Foam::ReversibleReaction::write ( Ostream& os ) const @@ -122,8 +127,4 @@ void ReversibleReaction::write } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - // ************************************************************************* // diff --git a/src/thermophysicalModels/specie/reaction/Reactions/ReversibleReaction/ReversibleReaction.H b/src/thermophysicalModels/specie/reaction/Reactions/ReversibleReaction/ReversibleReaction.H index b2f115957d..a035ac1bb5 100644 --- a/src/thermophysicalModels/specie/reaction/Reactions/ReversibleReaction/ReversibleReaction.H +++ b/src/thermophysicalModels/specie/reaction/Reactions/ReversibleReaction/ReversibleReaction.H @@ -44,7 +44,7 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class ReversibleReaction Declaration + Class ReversibleReaction Declaration \*---------------------------------------------------------------------------*/ template @@ -93,6 +93,14 @@ public: Istream& is ); + //- Construct from dictionary + ReversibleReaction + ( + const speciesTable& species, + const HashPtrTable& thermoDatabase, + const dictionary& dict + ); + //- Construct and return a clone virtual autoPtr > clone() const { diff --git a/src/thermophysicalModels/specie/reaction/reactionRate/ArrheniusReactionRate/ArrheniusReactionRate.H b/src/thermophysicalModels/specie/reaction/reactionRate/ArrheniusReactionRate/ArrheniusReactionRate.H index a20955e15a..ecebc952e3 100644 --- a/src/thermophysicalModels/specie/reaction/reactionRate/ArrheniusReactionRate/ArrheniusReactionRate.H +++ b/src/thermophysicalModels/specie/reaction/reactionRate/ArrheniusReactionRate/ArrheniusReactionRate.H @@ -25,7 +25,9 @@ Class Foam::ArrheniusReactionRate Description - Arrhenius reaction rate. + Arrhenius reaction rate given by: + + k = A * T^beta * exp(-Ta/T) SourceFiles ArrheniusReactionRateI.H @@ -44,7 +46,7 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class ArrheniusReactionRate Declaration + Class ArrheniusReactionRate Declaration \*---------------------------------------------------------------------------*/ class ArrheniusReactionRate @@ -75,6 +77,13 @@ public: Istream& is ); + //- Construct from dictionary + inline ArrheniusReactionRate + ( + const speciesTable& species, + const dictionary& dict + ); + // Member Functions diff --git a/src/thermophysicalModels/specie/reaction/reactionRate/ArrheniusReactionRate/ArrheniusReactionRateI.H b/src/thermophysicalModels/specie/reaction/reactionRate/ArrheniusReactionRate/ArrheniusReactionRateI.H index 25ad2db342..2e688ba145 100644 --- a/src/thermophysicalModels/specie/reaction/reactionRate/ArrheniusReactionRate/ArrheniusReactionRateI.H +++ b/src/thermophysicalModels/specie/reaction/reactionRate/ArrheniusReactionRate/ArrheniusReactionRateI.H @@ -23,15 +23,9 @@ License \*---------------------------------------------------------------------------*/ -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -// Construct from components -inline ArrheniusReactionRate::ArrheniusReactionRate +inline Foam::ArrheniusReactionRate::ArrheniusReactionRate ( const scalar A, const scalar beta, @@ -44,8 +38,7 @@ inline ArrheniusReactionRate::ArrheniusReactionRate {} -//- Construct from Istream -inline ArrheniusReactionRate::ArrheniusReactionRate +inline Foam::ArrheniusReactionRate::ArrheniusReactionRate ( const speciesTable&, Istream& is @@ -59,9 +52,21 @@ inline ArrheniusReactionRate::ArrheniusReactionRate } +inline Foam::ArrheniusReactionRate::ArrheniusReactionRate +( + const speciesTable&, + const dictionary& dict +) +: + A_(readScalar(dict.lookup("A"))), + beta_(readScalar(dict.lookup("beta"))), + Ta_(readScalar(dict.lookup("Ta"))) +{} + + // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -inline scalar ArrheniusReactionRate::operator() +inline Foam::scalar Foam::ArrheniusReactionRate::operator() ( const scalar T, const scalar, @@ -84,7 +89,11 @@ inline scalar ArrheniusReactionRate::operator() } -inline Ostream& operator<<(Ostream& os, const ArrheniusReactionRate& arr) +inline Foam::Ostream& Foam::operator<< +( + Ostream& os, + const ArrheniusReactionRate& arr +) { os << token::BEGIN_LIST << arr.A_ << token::SPACE << arr.beta_ << token::SPACE << arr.Ta_ @@ -93,8 +102,4 @@ inline Ostream& operator<<(Ostream& os, const ArrheniusReactionRate& arr) } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - // ************************************************************************* // diff --git a/src/thermophysicalModels/specie/reaction/reactionRate/ChemicallyActivatedReactionRate/ChemicallyActivatedReactionRate.H b/src/thermophysicalModels/specie/reaction/reactionRate/ChemicallyActivatedReactionRate/ChemicallyActivatedReactionRate.H index 3930d3ec19..12bb7f433f 100644 --- a/src/thermophysicalModels/specie/reaction/reactionRate/ChemicallyActivatedReactionRate/ChemicallyActivatedReactionRate.H +++ b/src/thermophysicalModels/specie/reaction/reactionRate/ChemicallyActivatedReactionRate/ChemicallyActivatedReactionRate.H @@ -91,6 +91,13 @@ public: Istream& is ); + //- Construct from dictionary + inline ChemicallyActivatedReactionRate + ( + const speciesTable& species, + const dictionary& dict + ); + // Member Functions diff --git a/src/thermophysicalModels/specie/reaction/reactionRate/ChemicallyActivatedReactionRate/ChemicallyActivatedReactionRateI.H b/src/thermophysicalModels/specie/reaction/reactionRate/ChemicallyActivatedReactionRate/ChemicallyActivatedReactionRateI.H index b857aa4080..0bba5ee60d 100644 --- a/src/thermophysicalModels/specie/reaction/reactionRate/ChemicallyActivatedReactionRate/ChemicallyActivatedReactionRateI.H +++ b/src/thermophysicalModels/specie/reaction/reactionRate/ChemicallyActivatedReactionRate/ChemicallyActivatedReactionRateI.H @@ -25,16 +25,12 @@ License // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -namespace Foam -{ - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -// Construct from components template -inline -ChemicallyActivatedReactionRate:: -ChemicallyActivatedReactionRate +inline Foam::ChemicallyActivatedReactionRate +< + ReactionRate, + ChemicallyActivationFunction +>::ChemicallyActivatedReactionRate ( const ReactionRate& k0, const ReactionRate& kInf, @@ -49,11 +45,12 @@ ChemicallyActivatedReactionRate {} -//- Construct from Istream template -inline -ChemicallyActivatedReactionRate:: -ChemicallyActivatedReactionRate +inline Foam::ChemicallyActivatedReactionRate +< + ReactionRate, + ChemicallyActivationFunction +>::ChemicallyActivatedReactionRate ( const speciesTable& species, Istream& is @@ -68,11 +65,32 @@ ChemicallyActivatedReactionRate } +template +inline Foam::ChemicallyActivatedReactionRate +< + ReactionRate, + ChemicallyActivationFunction +>::ChemicallyActivatedReactionRate +( + const speciesTable& species, + const dictionary& dict +) +: + k0_(species, dict), + kInf_(species, dict), + F_(dict), + thirdBodyEfficiencies_(species, dict) +{} + + // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template -inline scalar ChemicallyActivatedReactionRate - ::operator() +inline Foam::scalar Foam::ChemicallyActivatedReactionRate +< + ReactionRate, + ChemicallyActivationFunction +>::operator() ( const scalar T, const scalar p, @@ -89,7 +107,7 @@ inline scalar ChemicallyActivatedReactionRate template -inline Ostream& operator<< +inline Foam::Ostream& Foam::operator<< ( Ostream& os, const ChemicallyActivatedReactionRate @@ -103,8 +121,4 @@ inline Ostream& operator<< } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - // ************************************************************************* // diff --git a/src/thermophysicalModels/specie/reaction/reactionRate/FallOffReactionRate/FallOffReactionRate.H b/src/thermophysicalModels/specie/reaction/reactionRate/FallOffReactionRate/FallOffReactionRate.H index fb62a4f56b..0ce7011059 100644 --- a/src/thermophysicalModels/specie/reaction/reactionRate/FallOffReactionRate/FallOffReactionRate.H +++ b/src/thermophysicalModels/specie/reaction/reactionRate/FallOffReactionRate/FallOffReactionRate.H @@ -90,6 +90,13 @@ public: Istream& is ); + //- Construct from dictionary + inline FallOffReactionRate + ( + const speciesTable& species, + const dictionary& dict + ); + // Member Functions diff --git a/src/thermophysicalModels/specie/reaction/reactionRate/FallOffReactionRate/FallOffReactionRateI.H b/src/thermophysicalModels/specie/reaction/reactionRate/FallOffReactionRate/FallOffReactionRateI.H index d69531116c..90256f3251 100644 --- a/src/thermophysicalModels/specie/reaction/reactionRate/FallOffReactionRate/FallOffReactionRateI.H +++ b/src/thermophysicalModels/specie/reaction/reactionRate/FallOffReactionRate/FallOffReactionRateI.H @@ -23,16 +23,11 @@ License \*---------------------------------------------------------------------------*/ -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -// Construct from components template -inline FallOffReactionRate::FallOffReactionRate +inline Foam::FallOffReactionRate:: +FallOffReactionRate ( const ReactionRate& k0, const ReactionRate& kInf, @@ -47,9 +42,9 @@ inline FallOffReactionRate::FallOffReactionRate {} -//- Construct from Istream template -inline FallOffReactionRate::FallOffReactionRate +inline Foam::FallOffReactionRate:: +FallOffReactionRate ( const speciesTable& species, Istream& is @@ -64,10 +59,26 @@ inline FallOffReactionRate::FallOffReactionRate } +template +inline Foam::FallOffReactionRate:: +FallOffReactionRate +( + const speciesTable& species, + const dictionary& dict +) +: + k0_(species, dict), + kInf_(species, dict), + F_(dict), + thirdBodyEfficiencies_(species, dict) +{} + + // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template -inline scalar FallOffReactionRate::operator() +inline Foam::scalar +Foam::FallOffReactionRate::operator() ( const scalar T, const scalar p, @@ -84,7 +95,7 @@ inline scalar FallOffReactionRate::operator() template -inline Ostream& operator<< +inline Foam::Ostream& Foam::operator<< ( Ostream& os, const FallOffReactionRate& forr @@ -100,8 +111,4 @@ inline Ostream& operator<< } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - // ************************************************************************* // diff --git a/src/thermophysicalModels/specie/reaction/reactionRate/JanevReactionRate/JanevReactionRate.H b/src/thermophysicalModels/specie/reaction/reactionRate/JanevReactionRate/JanevReactionRate.H index a497883e33..955b68513b 100644 --- a/src/thermophysicalModels/specie/reaction/reactionRate/JanevReactionRate/JanevReactionRate.H +++ b/src/thermophysicalModels/specie/reaction/reactionRate/JanevReactionRate/JanevReactionRate.H @@ -37,6 +37,7 @@ SourceFiles #include "scalarField.H" #include "typeInfo.H" +#include "FixedList.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -44,7 +45,7 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class JanevReactionRate Declaration + Class JanevReactionRate Declaration \*---------------------------------------------------------------------------*/ class JanevReactionRate @@ -56,7 +57,7 @@ class JanevReactionRate scalar Ta_; static const label nb_ = 9; - scalar b_[nb_]; + FixedList b_; public: @@ -69,7 +70,7 @@ public: const scalar A, const scalar beta, const scalar Ta, - const scalar b[] + const FixedList b ); //- Construct from Istream @@ -79,6 +80,13 @@ public: Istream& is ); + //- Construct from dictionary + inline JanevReactionRate + ( + const speciesTable& species, + const dictionary& dict + ); + // Member Functions diff --git a/src/thermophysicalModels/specie/reaction/reactionRate/JanevReactionRate/JanevReactionRateI.H b/src/thermophysicalModels/specie/reaction/reactionRate/JanevReactionRate/JanevReactionRateI.H index 5a073c2363..9a37c526ef 100644 --- a/src/thermophysicalModels/specie/reaction/reactionRate/JanevReactionRate/JanevReactionRateI.H +++ b/src/thermophysicalModels/specie/reaction/reactionRate/JanevReactionRate/JanevReactionRateI.H @@ -23,35 +23,24 @@ License \*---------------------------------------------------------------------------*/ -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -// Construct from components -inline JanevReactionRate::JanevReactionRate +inline Foam::JanevReactionRate::JanevReactionRate ( const scalar A, const scalar beta, const scalar Ta, - const scalar b[] + const FixedList b ) : A_(A), beta_(beta), - Ta_(Ta) -{ - for (int n=0; n> b_[n]; - } - is.readEnd("JanevReactionRate(Istream&)"); } +inline Foam::JanevReactionRate::JanevReactionRate +( + const speciesTable&, + const dictionary& dict +) +: + A_(readScalar(dict.lookup("A"))), + beta_(readScalar(dict.lookup("beta"))), + Ta_(readScalar(dict.lookup("Ta"))), + b_(dict.lookup("b")) +{} + + // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -inline scalar JanevReactionRate::operator() +inline Foam::scalar Foam::JanevReactionRate::operator() ( const scalar T, const scalar, @@ -106,7 +104,11 @@ inline scalar JanevReactionRate::operator() } -inline Ostream& operator<<(Ostream& os, const JanevReactionRate& jrr) +inline Foam::Ostream& Foam::operator<< +( + Ostream& os, + const JanevReactionRate& jrr +) { os << token::BEGIN_LIST << jrr.A_ << token::SPACE << jrr.beta_ << token::SPACE << jrr.Ta_; @@ -122,8 +124,4 @@ inline Ostream& operator<<(Ostream& os, const JanevReactionRate& jrr) } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - // ************************************************************************* // diff --git a/src/thermophysicalModels/specie/reaction/reactionRate/LandauTellerReactionRate/LandauTellerReactionRate.H b/src/thermophysicalModels/specie/reaction/reactionRate/LandauTellerReactionRate/LandauTellerReactionRate.H index 46c6ced463..3729463c7c 100644 --- a/src/thermophysicalModels/specie/reaction/reactionRate/LandauTellerReactionRate/LandauTellerReactionRate.H +++ b/src/thermophysicalModels/specie/reaction/reactionRate/LandauTellerReactionRate/LandauTellerReactionRate.H @@ -78,6 +78,13 @@ public: Istream& is ); + //- Construct from dictionary + inline LandauTellerReactionRate + ( + const speciesTable& species, + const dictionary& dict + ); + // Member Functions diff --git a/src/thermophysicalModels/specie/reaction/reactionRate/LandauTellerReactionRate/LandauTellerReactionRateI.H b/src/thermophysicalModels/specie/reaction/reactionRate/LandauTellerReactionRate/LandauTellerReactionRateI.H index 2ef12e1868..68d2904d41 100644 --- a/src/thermophysicalModels/specie/reaction/reactionRate/LandauTellerReactionRate/LandauTellerReactionRateI.H +++ b/src/thermophysicalModels/specie/reaction/reactionRate/LandauTellerReactionRate/LandauTellerReactionRateI.H @@ -23,15 +23,9 @@ License \*---------------------------------------------------------------------------*/ -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -// Construct from components -inline LandauTellerReactionRate::LandauTellerReactionRate +inline Foam::LandauTellerReactionRate::LandauTellerReactionRate ( const scalar A, const scalar beta, @@ -48,8 +42,7 @@ inline LandauTellerReactionRate::LandauTellerReactionRate {} -//- Construct from Istream -inline LandauTellerReactionRate::LandauTellerReactionRate +inline Foam::LandauTellerReactionRate::LandauTellerReactionRate ( const speciesTable&, Istream& is @@ -65,9 +58,23 @@ inline LandauTellerReactionRate::LandauTellerReactionRate } +inline Foam::LandauTellerReactionRate::LandauTellerReactionRate +( + const speciesTable&, + const dictionary& dict +) +: + A_(readScalar(dict.lookup("A"))), + beta_(readScalar(dict.lookup("beta"))), + Ta_(readScalar(dict.lookup("Ta"))), + B_(readScalar(dict.lookup("B"))), + C_(readScalar(dict.lookup("C"))) +{} + + // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -inline scalar LandauTellerReactionRate::operator() +inline Foam::scalar Foam::LandauTellerReactionRate::operator() ( const scalar T, const scalar, @@ -107,7 +114,11 @@ inline scalar LandauTellerReactionRate::operator() } -inline Ostream& operator<<(Ostream& os, const LandauTellerReactionRate& arr) +inline Foam::Ostream& Foam::operator<< +( + Ostream& os, + const LandauTellerReactionRate& arr +) { os << token::BEGIN_LIST << arr.A_ << token::SPACE << arr.beta_ << token::SPACE << arr.Ta_ @@ -117,8 +128,4 @@ inline Ostream& operator<<(Ostream& os, const LandauTellerReactionRate& arr) } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - // ************************************************************************* // diff --git a/src/thermophysicalModels/specie/reaction/reactionRate/LangmuirHinshelwood/LangmuirHinshelwoodReactionRate.H b/src/thermophysicalModels/specie/reaction/reactionRate/LangmuirHinshelwood/LangmuirHinshelwoodReactionRate.H index 93a6e70c02..52308f7962 100644 --- a/src/thermophysicalModels/specie/reaction/reactionRate/LangmuirHinshelwood/LangmuirHinshelwoodReactionRate.H +++ b/src/thermophysicalModels/specie/reaction/reactionRate/LangmuirHinshelwood/LangmuirHinshelwoodReactionRate.H @@ -81,6 +81,13 @@ public: Istream& is ); + //- Construct from dictionary + inline LangmuirHinshelwoodReactionRate + ( + const speciesTable& species, + const dictionary& dict + ); + // Member Functions diff --git a/src/thermophysicalModels/specie/reaction/reactionRate/LangmuirHinshelwood/LangmuirHinshelwoodReactionRateI.H b/src/thermophysicalModels/specie/reaction/reactionRate/LangmuirHinshelwood/LangmuirHinshelwoodReactionRateI.H index 3bc8d92b55..64c57104e7 100644 --- a/src/thermophysicalModels/specie/reaction/reactionRate/LangmuirHinshelwood/LangmuirHinshelwoodReactionRateI.H +++ b/src/thermophysicalModels/specie/reaction/reactionRate/LangmuirHinshelwood/LangmuirHinshelwoodReactionRateI.H @@ -23,15 +23,12 @@ License \*---------------------------------------------------------------------------*/ -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ +#include "FixedList.H" +#include "Tuple2.H" // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -// Construct from components -inline LangmuirHinshelwoodReactionRate::LangmuirHinshelwoodReactionRate +inline Foam::LangmuirHinshelwoodReactionRate::LangmuirHinshelwoodReactionRate ( const scalar A[], const scalar Ta[], @@ -52,8 +49,7 @@ inline LangmuirHinshelwoodReactionRate::LangmuirHinshelwoodReactionRate } -//- Construct from Istream -inline LangmuirHinshelwoodReactionRate::LangmuirHinshelwoodReactionRate +inline Foam::LangmuirHinshelwoodReactionRate::LangmuirHinshelwoodReactionRate ( const speciesTable& st, Istream& is @@ -74,9 +70,30 @@ inline LangmuirHinshelwoodReactionRate::LangmuirHinshelwoodReactionRate } +inline Foam::LangmuirHinshelwoodReactionRate::LangmuirHinshelwoodReactionRate +( + const speciesTable& st, + const dictionary& dict +) +: + co_(st["CO"]), + c3h6_(st["C3H6"]), + no_(st["NO"]) +{ + // read (A, Ta) pairs + FixedList, n_> coeffs(dict.lookup("coeffs")); + + forAll(coeffs, i) + { + A_[i] = coeffs[i].first(); + Ta_[i] = coeffs[i].second(); + } +} + + // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -inline scalar LangmuirHinshelwoodReactionRate::operator() +inline Foam::scalar Foam::LangmuirHinshelwoodReactionRate::operator() ( const scalar T, const scalar, @@ -93,7 +110,7 @@ inline scalar LangmuirHinshelwoodReactionRate::operator() } -inline Ostream& operator<< +inline Foam::Ostream& Foam::operator<< ( Ostream& os, const LangmuirHinshelwoodReactionRate& lhrr @@ -103,7 +120,8 @@ inline Ostream& operator<< for (int i=0; i b_; public: @@ -69,7 +70,7 @@ public: const scalar A, const scalar beta, const scalar Ta, - const scalar b[] + const FixedList b ); //- Construct from Istream @@ -79,6 +80,13 @@ public: Istream& is ); + //- Construct from dictionary + inline powerSeriesReactionRate + ( + const speciesTable& species, + const dictionary& dict + ); + // Member Functions diff --git a/src/thermophysicalModels/specie/reaction/reactionRate/powerSeries/powerSeriesReactionRateI.H b/src/thermophysicalModels/specie/reaction/reactionRate/powerSeries/powerSeriesReactionRateI.H index d9a3ea4f2a..a0d847672c 100644 --- a/src/thermophysicalModels/specie/reaction/reactionRate/powerSeries/powerSeriesReactionRateI.H +++ b/src/thermophysicalModels/specie/reaction/reactionRate/powerSeries/powerSeriesReactionRateI.H @@ -23,35 +23,24 @@ License \*---------------------------------------------------------------------------*/ -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -// Construct from components -inline powerSeriesReactionRate::powerSeriesReactionRate +inline Foam::powerSeriesReactionRate::powerSeriesReactionRate ( const scalar A, const scalar beta, const scalar Ta, - const scalar b[] + const FixedList b ) : A_(A), beta_(beta), - Ta_(Ta) -{ - for (int n=0; n> b_[n]; - } - is.readEnd("powerSeriesReactionRate(Istream&)"); } +inline Foam::powerSeriesReactionRate::powerSeriesReactionRate +( + const speciesTable&, + const dictionary& dict +) +: + A_(readScalar(dict.lookup("A"))), + beta_(readScalar(dict.lookup("beta"))), + Ta_(readScalar(dict.lookup("Ta"))), + b_(dict.lookup("coeffs")) +{} + + // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -inline scalar powerSeriesReactionRate::operator() +inline Foam::scalar Foam::powerSeriesReactionRate::operator() ( const scalar T, const scalar, @@ -99,7 +97,11 @@ inline scalar powerSeriesReactionRate::operator() } -inline Ostream& operator<<(Ostream& os, const powerSeriesReactionRate& psrr) +inline Foam::Ostream& Foam::operator<< +( + Ostream& os, + const powerSeriesReactionRate& psrr +) { os << token::BEGIN_LIST << psrr.A_ << token::SPACE << psrr.beta_ << token::SPACE << psrr.Ta_; @@ -115,8 +117,4 @@ inline Ostream& operator<<(Ostream& os, const powerSeriesReactionRate& psrr) } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - // ************************************************************************* // diff --git a/src/thermophysicalModels/specie/reaction/reactionRate/thirdBodyArrheniusReactionRate/thirdBodyArrheniusReactionRate.H b/src/thermophysicalModels/specie/reaction/reactionRate/thirdBodyArrheniusReactionRate/thirdBodyArrheniusReactionRate.H index b462c74254..03cbb03f96 100644 --- a/src/thermophysicalModels/specie/reaction/reactionRate/thirdBodyArrheniusReactionRate/thirdBodyArrheniusReactionRate.H +++ b/src/thermophysicalModels/specie/reaction/reactionRate/thirdBodyArrheniusReactionRate/thirdBodyArrheniusReactionRate.H @@ -76,6 +76,13 @@ public: Istream& is ); + //- Construct from dictionary + inline thirdBodyArrheniusReactionRate + ( + const speciesTable& species, + const dictionary& dict + ); + // Member Functions diff --git a/src/thermophysicalModels/specie/reaction/reactionRate/thirdBodyArrheniusReactionRate/thirdBodyArrheniusReactionRateI.H b/src/thermophysicalModels/specie/reaction/reactionRate/thirdBodyArrheniusReactionRate/thirdBodyArrheniusReactionRateI.H index 38bc148eac..0289ffdd16 100644 --- a/src/thermophysicalModels/specie/reaction/reactionRate/thirdBodyArrheniusReactionRate/thirdBodyArrheniusReactionRateI.H +++ b/src/thermophysicalModels/specie/reaction/reactionRate/thirdBodyArrheniusReactionRate/thirdBodyArrheniusReactionRateI.H @@ -23,15 +23,9 @@ License \*---------------------------------------------------------------------------*/ -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -// Construct from components -inline thirdBodyArrheniusReactionRate::thirdBodyArrheniusReactionRate +inline Foam::thirdBodyArrheniusReactionRate::thirdBodyArrheniusReactionRate ( const scalar A, const scalar beta, @@ -44,8 +38,7 @@ inline thirdBodyArrheniusReactionRate::thirdBodyArrheniusReactionRate {} -//- Construct from Istream -inline thirdBodyArrheniusReactionRate::thirdBodyArrheniusReactionRate +inline Foam::thirdBodyArrheniusReactionRate::thirdBodyArrheniusReactionRate ( const speciesTable& species, Istream& is @@ -62,9 +55,24 @@ inline thirdBodyArrheniusReactionRate::thirdBodyArrheniusReactionRate } +inline Foam::thirdBodyArrheniusReactionRate::thirdBodyArrheniusReactionRate +( + const speciesTable& species, + const dictionary& dict +) +: + ArrheniusReactionRate + ( + species, + dict + ), + thirdBodyEfficiencies_(species, dict) +{} + + // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -inline scalar thirdBodyArrheniusReactionRate::operator() +inline Foam::scalar Foam::thirdBodyArrheniusReactionRate::operator() ( const scalar T, const scalar p, @@ -77,7 +85,7 @@ inline scalar thirdBodyArrheniusReactionRate::operator() } -inline Ostream& operator<< +inline Foam::Ostream& Foam::operator<< ( Ostream& os, const thirdBodyArrheniusReactionRate& arr @@ -91,8 +99,4 @@ inline Ostream& operator<< } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - // ************************************************************************* // diff --git a/src/thermophysicalModels/specie/reaction/reactionRate/thirdBodyEfficiencies/thirdBodyEfficiencies.H b/src/thermophysicalModels/specie/reaction/reactionRate/thirdBodyEfficiencies/thirdBodyEfficiencies.H index 0f46db8dd4..7ed4e6e014 100644 --- a/src/thermophysicalModels/specie/reaction/reactionRate/thirdBodyEfficiencies/thirdBodyEfficiencies.H +++ b/src/thermophysicalModels/specie/reaction/reactionRate/thirdBodyEfficiencies/thirdBodyEfficiencies.H @@ -50,7 +50,7 @@ Ostream& operator<<(Ostream&, const thirdBodyEfficiencies&); /*---------------------------------------------------------------------------*\ - Class thirdBodyEfficiencies Declaration + Class thirdBodyEfficiencies Declaration \*---------------------------------------------------------------------------*/ class thirdBodyEfficiencies @@ -80,6 +80,13 @@ public: Istream& is ); + //- Construct from dictionary + inline thirdBodyEfficiencies + ( + const speciesTable& species, + const dictionary& dict + ); + // Member functions diff --git a/src/thermophysicalModels/specie/reaction/reactionRate/thirdBodyEfficiencies/thirdBodyEfficienciesI.H b/src/thermophysicalModels/specie/reaction/reactionRate/thirdBodyEfficiencies/thirdBodyEfficienciesI.H index 8e8096fa71..9741554de8 100644 --- a/src/thermophysicalModels/specie/reaction/reactionRate/thirdBodyEfficiencies/thirdBodyEfficienciesI.H +++ b/src/thermophysicalModels/specie/reaction/reactionRate/thirdBodyEfficiencies/thirdBodyEfficienciesI.H @@ -23,9 +23,10 @@ License \*---------------------------------------------------------------------------*/ +#include "Tuple2.H" + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -//- Construct from components inline Foam::thirdBodyEfficiencies::thirdBodyEfficiencies ( const speciesTable& species, @@ -48,7 +49,6 @@ inline Foam::thirdBodyEfficiencies::thirdBodyEfficiencies } -//- Construct from Istream inline Foam::thirdBodyEfficiencies::thirdBodyEfficiencies ( const speciesTable& species, @@ -111,6 +111,42 @@ inline Foam::thirdBodyEfficiencies::thirdBodyEfficiencies } +inline Foam::thirdBodyEfficiencies::thirdBodyEfficiencies +( + const speciesTable& species, + const dictionary& dict +) +: + scalarList(species.size()), + species_(species) +{ + if (dict.found("coeffs")) + { + List > coeffs(dict.lookup("coeffs")); + if (coeffs.size() != species_.size()) + { + FatalErrorIn + ( + "thirdBodyEfficiencies::thirdBodyEfficiencies" + "(const speciesTable&, const dictionary&)" + ) << "number of efficiencies = " << coeffs.size() + << " is not equat to the number of species " << species_.size() + << exit(FatalIOError); + } + + forAll(coeffs, i) + { + operator[](species[coeffs[i].first()]) = coeffs[i].second(); + } + } + else + { + scalar defaultEff = readScalar(dict.lookup("defaultEfficiency")); + scalarList::operator=(defaultEff); + } +} + + // * * * * * * * * * * * * * * * Member functions * * * * * * * * * * * * * // inline Foam::scalar Foam::thirdBodyEfficiencies::M(const scalarList& c) const diff --git a/src/thermophysicalModels/specie/reaction/reactions/makeChemkinReactions.C b/src/thermophysicalModels/specie/reaction/reactions/makeChemkinReactions.C index 43b1ab4507..ba34115bde 100644 --- a/src/thermophysicalModels/specie/reaction/reactions/makeChemkinReactions.C +++ b/src/thermophysicalModels/specie/reaction/reactions/makeChemkinReactions.C @@ -47,6 +47,7 @@ namespace Foam defineTemplateTypeNameAndDebug(gasReaction, 0); defineTemplateRunTimeSelectionTable(gasReaction, Istream); +defineTemplateRunTimeSelectionTable(gasReaction, dictionary); // * * * * * * * * * * * * * Make CHEMKIN reactions * * * * * * * * * * * * // diff --git a/src/thermophysicalModels/specie/reaction/reactions/makeReactionThermo.H b/src/thermophysicalModels/specie/reaction/reactions/makeReactionThermo.H index 0837c28d03..8a0d3b3001 100644 --- a/src/thermophysicalModels/specie/reaction/reactions/makeReactionThermo.H +++ b/src/thermophysicalModels/specie/reaction/reactions/makeReactionThermo.H @@ -77,8 +77,16 @@ namespace Foam Reaction##Thermo, \ ReactionType##Thermo##ReactionRate, \ Istream \ + ); \ + \ + addToRunTimeSelectionTable \ + ( \ + Reaction##Thermo, \ + ReactionType##Thermo##ReactionRate, \ + dictionary \ ); + #define makePressureDependentReaction\ ( \ Thermo, \ diff --git a/src/thermophysicalModels/specie/reaction/reactions/makeReactionThermoReactions.C b/src/thermophysicalModels/specie/reaction/reactions/makeReactionThermoReactions.C index 8974891b88..ceb8f6ee44 100644 --- a/src/thermophysicalModels/specie/reaction/reactions/makeReactionThermoReactions.C +++ b/src/thermophysicalModels/specie/reaction/reactions/makeReactionThermoReactions.C @@ -47,6 +47,7 @@ namespace Foam defineTemplateTypeNameAndDebug(icoPoly8Reaction, 0); defineTemplateRunTimeSelectionTable(icoPoly8Reaction, Istream); +defineTemplateRunTimeSelectionTable(icoPoly8Reaction, dictionary); // * * * * * * * * * * * * * Make CHEMKIN reactions * * * * * * * * * * * * // diff --git a/src/thermophysicalModels/specie/specie/specie.C b/src/thermophysicalModels/specie/specie/specie.C index 35ba05ea11..ae3d3c9f18 100644 --- a/src/thermophysicalModels/specie/specie/specie.C +++ b/src/thermophysicalModels/specie/specie/specie.C @@ -51,6 +51,14 @@ Foam::specie::specie(Istream& is) } +Foam::specie::specie(const dictionary& dict) +: + name_(dict.dictName()), + nMoles_(readScalar(dict.lookup("nMoles"))), + molWeight_(readScalar(dict.lookup("molWeight"))) +{} + + // * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * // Foam::Ostream& Foam::operator<<(Ostream& os, const specie& st) diff --git a/src/thermophysicalModels/specie/specie/specie.H b/src/thermophysicalModels/specie/specie/specie.H index e4cd6cf908..8bfc0faccc 100644 --- a/src/thermophysicalModels/specie/specie/specie.H +++ b/src/thermophysicalModels/specie/specie/specie.H @@ -38,6 +38,7 @@ SourceFiles #include "word.H" #include "scalar.H" +#include "dictionary.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -68,11 +69,7 @@ class specie // Private Member Functions //- Construct from components without name - inline specie - ( - const scalar nMoles, - const scalar molWeight - ); + inline specie(const scalar nMoles, const scalar molWeight); public: @@ -110,6 +107,9 @@ public: //- Construct from Istream specie(Istream&); + //- Construct from dictionary + specie(const dictionary& dict); + // Member Functions diff --git a/src/thermophysicalModels/specie/thermo/eConst/eConstThermo.C b/src/thermophysicalModels/specie/thermo/eConst/eConstThermo.C index fb7b8489da..7259926648 100644 --- a/src/thermophysicalModels/specie/thermo/eConst/eConstThermo.C +++ b/src/thermophysicalModels/specie/thermo/eConst/eConstThermo.C @@ -39,6 +39,15 @@ Foam::eConstThermo::eConstThermo(Istream& is) } +template +Foam::eConstThermo::eConstThermo(const dictionary& dict) +: + equationOfState(dict), + Cv_(readScalar(dict.lookup("Cv"))), + Hf_(readScalar(dict.lookup("Hf"))) +{} + + // * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * // template diff --git a/src/thermophysicalModels/specie/thermo/eConst/eConstThermo.H b/src/thermophysicalModels/specie/thermo/eConst/eConstThermo.H index 91dc5af60b..37e6f00980 100644 --- a/src/thermophysicalModels/specie/thermo/eConst/eConstThermo.H +++ b/src/thermophysicalModels/specie/thermo/eConst/eConstThermo.H @@ -117,6 +117,9 @@ public: //- Construct from Istream eConstThermo(Istream&); + //- Construct from dictionary + eConstThermo(const dictionary& dict); + //- Construct as named copy inline eConstThermo(const word&, const eConstThermo&); @@ -126,6 +129,9 @@ public: // Selector from Istream inline static autoPtr New(Istream& is); + // Selector from dictionary + inline static autoPtr New(const dictionary& dict); + // Member Functions diff --git a/src/thermophysicalModels/specie/thermo/eConst/eConstThermoI.H b/src/thermophysicalModels/specie/thermo/eConst/eConstThermoI.H index c0357855a5..917a43089b 100644 --- a/src/thermophysicalModels/specie/thermo/eConst/eConstThermoI.H +++ b/src/thermophysicalModels/specie/thermo/eConst/eConstThermoI.H @@ -76,6 +76,17 @@ Foam::eConstThermo::New(Istream& is) } +template +inline Foam::autoPtr > +Foam::eConstThermo::New(const dictionary& dict) +{ + return autoPtr > + ( + new eConstThermo(dict) + ); +} + + // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template diff --git a/src/thermophysicalModels/specie/thermo/hConst/hConstThermo.C b/src/thermophysicalModels/specie/thermo/hConst/hConstThermo.C index 7c4e8216a9..e5a0c523fc 100644 --- a/src/thermophysicalModels/specie/thermo/hConst/hConstThermo.C +++ b/src/thermophysicalModels/specie/thermo/hConst/hConstThermo.C @@ -39,6 +39,15 @@ Foam::hConstThermo::hConstThermo(Istream& is) } +template +Foam::hConstThermo::hConstThermo(const dictionary& dict) +: + equationOfState(dict), + Cp_(readScalar(dict.lookup("Cp"))), + Hf_(readScalar(dict.lookup("Hf"))) +{} + + // * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * // template diff --git a/src/thermophysicalModels/specie/thermo/hConst/hConstThermo.H b/src/thermophysicalModels/specie/thermo/hConst/hConstThermo.H index d1acddd2c2..c47e9af313 100644 --- a/src/thermophysicalModels/specie/thermo/hConst/hConstThermo.H +++ b/src/thermophysicalModels/specie/thermo/hConst/hConstThermo.H @@ -115,6 +115,9 @@ public: //- Construct from Istream hConstThermo(Istream&); + //- Construct from dictionary + hConstThermo(const dictionary& dict); + //- Construct as named copy inline hConstThermo(const word&, const hConstThermo&); @@ -124,6 +127,9 @@ public: //- Selector from Istream inline static autoPtr New(Istream& is); + //- Selector from dictionary + inline static autoPtr New(const dictionary& dict); + // Member Functions diff --git a/src/thermophysicalModels/specie/thermo/hConst/hConstThermoI.H b/src/thermophysicalModels/specie/thermo/hConst/hConstThermoI.H index 3c596cc3f9..180201e57c 100644 --- a/src/thermophysicalModels/specie/thermo/hConst/hConstThermoI.H +++ b/src/thermophysicalModels/specie/thermo/hConst/hConstThermoI.H @@ -76,6 +76,17 @@ Foam::hConstThermo::New(Istream& is) } +template +inline Foam::autoPtr > +Foam::hConstThermo::New(const dictionary& dict) +{ + return autoPtr > + ( + new hConstThermo(dict) + ); +} + + // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template diff --git a/src/thermophysicalModels/specie/thermo/hPolynomial/hPolynomialThermo.C b/src/thermophysicalModels/specie/thermo/hPolynomial/hPolynomialThermo.C index 610b1192c2..1e793d3a13 100644 --- a/src/thermophysicalModels/specie/thermo/hPolynomial/hPolynomialThermo.C +++ b/src/thermophysicalModels/specie/thermo/hPolynomial/hPolynomialThermo.C @@ -56,6 +56,34 @@ Foam::hPolynomialThermo::hPolynomialThermo } +template +Foam::hPolynomialThermo::hPolynomialThermo +( + const dictionary& dict +) +: + EquationOfState(dict), + Hf_(readScalar(dict.lookup("Hf"))), + Sf_(readScalar(dict.lookup("Sf"))), + cpPolynomial_(dict.lookup("cpPolynomial")), + hPolynomial_(), + sPolynomial_() +{ + Hf_ *= this->W(); + Sf_ *= this->W(); + cpPolynomial_ *= this->W(); + + hPolynomial_ = cpPolynomial_.integrate(); + sPolynomial_ = cpPolynomial_.integrateMinus1(); + + // Offset h poly so that it is relative to the enthalpy at Tstd + hPolynomial_[0] += Hf_ - hPolynomial_.evaluate(specie::Tstd); + + // Offset s poly so that it is relative to the entropy at Tstd + sPolynomial_[0] += Sf_ - sPolynomial_.evaluate(specie::Tstd); +} + + // * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * // template diff --git a/src/thermophysicalModels/specie/thermo/hPolynomial/hPolynomialThermo.H b/src/thermophysicalModels/specie/thermo/hPolynomial/hPolynomialThermo.H index 587714496b..ce6709fec9 100644 --- a/src/thermophysicalModels/specie/thermo/hPolynomial/hPolynomialThermo.H +++ b/src/thermophysicalModels/specie/thermo/hPolynomial/hPolynomialThermo.H @@ -135,9 +135,12 @@ public: // Constructors - //- Construct from dictionary + //- Construct from Istream hPolynomialThermo(Istream& is); + //- Construct from dictionary + hPolynomialThermo(const dictionary& dict); + //- Construct as copy inline hPolynomialThermo(const hPolynomialThermo&); diff --git a/src/thermophysicalModels/specie/thermo/janaf/janafThermo.C b/src/thermophysicalModels/specie/thermo/janaf/janafThermo.C index c635de1b6b..8c284048aa 100644 --- a/src/thermophysicalModels/specie/thermo/janaf/janafThermo.C +++ b/src/thermophysicalModels/specie/thermo/janaf/janafThermo.C @@ -26,6 +26,34 @@ License #include "janafThermo.H" #include "IOstreams.H" +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +template +void Foam::janafThermo::checkInputData() const +{ + if (Tlow_ >= Thigh_) + { + FatalErrorIn("janafThermo::check()") + << "Tlow(" << Tlow_ << ") >= Thigh(" << Thigh_ << ')' + << exit(FatalIOError); + } + + if (Tcommon_ <= Tlow_) + { + FatalErrorIn("janafThermo::check()") + << "Tcommon(" << Tcommon_ << ") <= Tlow(" << Tlow_ << ')' + << exit(FatalIOError); + } + + if (Tcommon_ > Thigh_) + { + FatalErrorIn("janafThermo::check()") + << "Tcommon(" << Tcommon_ << ") > Thigh(" << Thigh_ << ')' + << exit(FatalIOError); + } +} + + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template @@ -36,54 +64,16 @@ Foam::janafThermo::janafThermo(Istream& is) Thigh_(readScalar(is)), Tcommon_(readScalar(is)) { - if (Tlow_ >= Thigh_) + checkInputData(); + + forAll(highCpCoeffs_, i) { - FatalIOErrorIn - ( - "janafThermo::janafThermo(Istream& is)", - is - ) << "Tlow(" << Tlow_ << ") >= Thigh(" << Thigh_ << ')' - << exit(FatalIOError); + is >> highCpCoeffs_[i]; } - if (Tcommon_ <= Tlow_) + forAll(lowCpCoeffs_, i) { - FatalIOErrorIn - ( - "janafThermo::janafThermo(Istream& is)", - is - ) << "Tcommon(" << Tcommon_ << ") <= Tlow(" << Tlow_ << ')' - << exit(FatalIOError); - } - - if (Tcommon_ > Thigh_) - { - FatalIOErrorIn - ( - "janafThermo::janafThermo(Istream& is)", - is - ) << "Tcommon(" << Tcommon_ << ") > Thigh(" << Thigh_ << ')' - << exit(FatalIOError); - } - - for - ( - register label coefLabel=0; - coefLabel::nCoeffs_; - coefLabel++ - ) - { - is >> highCpCoeffs_[coefLabel]; - } - - for - ( - register label coefLabel=0; - coefLabel::nCoeffs_; - coefLabel++ - ) - { - is >> lowCpCoeffs_[coefLabel]; + is >> lowCpCoeffs_[i]; } // Check state of Istream @@ -91,6 +81,20 @@ Foam::janafThermo::janafThermo(Istream& is) } +template +Foam::janafThermo::janafThermo(const dictionary& dict) +: + equationOfState(dict), + Tlow_(readScalar(dict.lookup("Tlow"))), + Thigh_(readScalar(dict.lookup("Thigh"))), + Tcommon_(readScalar(dict.lookup("Tcommon"))), + highCpCoeffs_(dict.lookup("highCpCoeffs")), + lowCpCoeffs_(dict.lookup("lowCpCoeffs")) +{ + checkInputData(); +} + + // * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * // template @@ -107,26 +111,16 @@ Foam::Ostream& Foam::operator<< os << nl << " "; - for - ( - register label coefLabel=0; - coefLabel::nCoeffs_; - coefLabel++ - ) + forAll(jt.highCpCoeffs_, i) { - os << jt.highCpCoeffs_[coefLabel] << ' '; + os << jt.highCpCoeffs_[i] << ' '; } os << nl << " "; - for - ( - register label coefLabel=0; - coefLabel::nCoeffs_; - coefLabel++ - ) + forAll(jt.lowCpCoeffs_, i) { - os << jt.lowCpCoeffs_[coefLabel] << ' '; + os << jt.lowCpCoeffs_[i] << ' '; } os << endl; diff --git a/src/thermophysicalModels/specie/thermo/janaf/janafThermo.H b/src/thermophysicalModels/specie/thermo/janaf/janafThermo.H index 3103671272..3399b3bd33 100644 --- a/src/thermophysicalModels/specie/thermo/janaf/janafThermo.H +++ b/src/thermophysicalModels/specie/thermo/janaf/janafThermo.H @@ -38,6 +38,7 @@ SourceFiles #define janafThermo_H #include "scalar.H" +#include "FixedList.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -96,8 +97,11 @@ class janafThermo public: + // Public data + static const int nCoeffs_ = 7; - typedef scalar coeffArray[7]; + typedef FixedList coeffArray; + private: @@ -112,6 +116,9 @@ private: // Private Member Functions + //- Check that input data is valid + void checkInputData() const; + //- Check given temperature is within the range of the fitted coeffs inline void checkT(const scalar T) const; @@ -137,6 +144,9 @@ public: //- Construct from Istream janafThermo(Istream&); + //- Construct from dictionary + janafThermo(const dictionary& dict); + //- Construct as a named copy inline janafThermo(const word&, const janafThermo&); diff --git a/src/thermophysicalModels/specie/thermo/specieThermo/specieThermo.C b/src/thermophysicalModels/specie/thermo/specieThermo/specieThermo.C index 9a5f5866f8..74aec4376a 100644 --- a/src/thermophysicalModels/specie/thermo/specieThermo/specieThermo.C +++ b/src/thermophysicalModels/specie/thermo/specieThermo/specieThermo.C @@ -46,6 +46,13 @@ Foam::specieThermo::specieThermo(Istream& is) } +template +Foam::specieThermo::specieThermo(const dictionary& dict) +: + thermo(dict) +{} + + // * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * // template diff --git a/src/thermophysicalModels/specie/thermo/specieThermo/specieThermo.H b/src/thermophysicalModels/specie/thermo/specieThermo/specieThermo.H index 3b235504c2..03bcc0f469 100644 --- a/src/thermophysicalModels/specie/thermo/specieThermo/specieThermo.H +++ b/src/thermophysicalModels/specie/thermo/specieThermo/specieThermo.H @@ -124,6 +124,9 @@ public: //- Construct from Istream specieThermo(Istream&); + //- Construct from dictionary + specieThermo(const dictionary& dict); + //- Construct as named copy inline specieThermo(const word& name, const specieThermo&); diff --git a/src/thermophysicalModels/specie/transport/const/constTransport.C b/src/thermophysicalModels/specie/transport/const/constTransport.C index 3fabc785a8..caac4c400c 100644 --- a/src/thermophysicalModels/specie/transport/const/constTransport.C +++ b/src/thermophysicalModels/specie/transport/const/constTransport.C @@ -44,6 +44,15 @@ constTransport::constTransport(Istream& is) } +template +constTransport::constTransport(const dictionary& dict) +: + thermo(dict), + Mu(readScalar(dict.lookup("Mu"))), + rPr(1.0/readScalar(dict.lookup("Pr"))) +{} + + // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // template diff --git a/src/thermophysicalModels/specie/transport/const/constTransport.H b/src/thermophysicalModels/specie/transport/const/constTransport.H index ae8d58e57d..3ba608f43d 100644 --- a/src/thermophysicalModels/specie/transport/const/constTransport.H +++ b/src/thermophysicalModels/specie/transport/const/constTransport.H @@ -119,6 +119,9 @@ public: //- Construct from Istream constTransport(Istream&); + //- Construct from dictionary + constTransport(const dictionary& dict); + // Member functions diff --git a/src/thermophysicalModels/specie/transport/polynomial/polynomialTransport.C b/src/thermophysicalModels/specie/transport/polynomial/polynomialTransport.C index df0c2fc410..fc41275dbb 100644 --- a/src/thermophysicalModels/specie/transport/polynomial/polynomialTransport.C +++ b/src/thermophysicalModels/specie/transport/polynomial/polynomialTransport.C @@ -40,6 +40,21 @@ Foam::polynomialTransport::polynomialTransport(Istream& is) } +template +Foam::polynomialTransport::polynomialTransport +( + const dictionary& dict +) +: + Thermo(dict), + muPolynomial_(dict.lookup("muPolynomial")), + kappaPolynomial_(dict.lookup("kappaPolynomial")) +{ + muPolynomial_ *= this->W(); + kappaPolynomial_ *= this->W(); +} + + // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // template diff --git a/src/thermophysicalModels/specie/transport/polynomial/polynomialTransport.H b/src/thermophysicalModels/specie/transport/polynomial/polynomialTransport.H index 7167d5c56c..cf7543f2ed 100644 --- a/src/thermophysicalModels/specie/transport/polynomial/polynomialTransport.H +++ b/src/thermophysicalModels/specie/transport/polynomial/polynomialTransport.H @@ -127,12 +127,18 @@ public: //- Construct from Istream polynomialTransport(Istream& is); + //- Construct from dictionary + polynomialTransport(const dictionary& dict); + //- Construct and return a clone inline autoPtr clone() const; // Selector from Istream inline static autoPtr New(Istream& is); + // Selector from dictionary + inline static autoPtr New(const dictionary& dict); + // Member functions diff --git a/src/thermophysicalModels/specie/transport/polynomial/polynomialTransportI.H b/src/thermophysicalModels/specie/transport/polynomial/polynomialTransportI.H index ee94f6d0e7..a15720860e 100644 --- a/src/thermophysicalModels/specie/transport/polynomial/polynomialTransportI.H +++ b/src/thermophysicalModels/specie/transport/polynomial/polynomialTransportI.H @@ -88,6 +88,17 @@ Foam::polynomialTransport::New(Istream& is) } +template +inline Foam::autoPtr > +Foam::polynomialTransport::New(const dictionary& dict) +{ + return autoPtr > + ( + new polynomialTransport(dict) + ); +} + + // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template diff --git a/src/thermophysicalModels/specie/transport/speciesTransport/speciesTransport.C b/src/thermophysicalModels/specie/transport/speciesTransport/speciesTransport.C index 9c1853b5f2..26e5599772 100644 --- a/src/thermophysicalModels/specie/transport/speciesTransport/speciesTransport.C +++ b/src/thermophysicalModels/specie/transport/speciesTransport/speciesTransport.C @@ -44,6 +44,12 @@ speciesTransport::speciesTransport(Istream& is) } +speciesTransport::speciesTransport(const dictionary& dict) +: + janafThermo(dict) +{} + + // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // Ostream& operator<<(Ostream& os, const speciesTransport& sTranport) diff --git a/src/thermophysicalModels/specie/transport/speciesTransport/speciesTransport.H b/src/thermophysicalModels/specie/transport/speciesTransport/speciesTransport.H index 95ffc6ad67..d80b6d3e8f 100644 --- a/src/thermophysicalModels/specie/transport/speciesTransport/speciesTransport.H +++ b/src/thermophysicalModels/specie/transport/speciesTransport/speciesTransport.H @@ -64,14 +64,14 @@ public: // Constructors //- Construct from speciesThermo - inline speciesTransport - ( - const janafThermo& sThermo - ); + inline speciesTransport(const janafThermo& sThermo); //- Construct from Istream speciesTransport(Istream&); + //- Construct from dictionary + speciesTransport(const dictionary& dict); + // Member Functions diff --git a/src/thermophysicalModels/specie/transport/sutherland/sutherlandTransport.C b/src/thermophysicalModels/specie/transport/sutherland/sutherlandTransport.C index aabacb72bc..29f90ba359 100644 --- a/src/thermophysicalModels/specie/transport/sutherland/sutherlandTransport.C +++ b/src/thermophysicalModels/specie/transport/sutherland/sutherlandTransport.C @@ -44,6 +44,15 @@ sutherlandTransport::sutherlandTransport(Istream& is) } +template +sutherlandTransport::sutherlandTransport(const dictionary& dict) +: + thermo(dict), + As(readScalar(dict.lookup("As"))), + Ts(readScalar(dict.lookup("Ts"))) +{} + + // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // template diff --git a/src/thermophysicalModels/specie/transport/sutherland/sutherlandTransport.H b/src/thermophysicalModels/specie/transport/sutherland/sutherlandTransport.H index 72755607aa..d598cd4a63 100644 --- a/src/thermophysicalModels/specie/transport/sutherland/sutherlandTransport.H +++ b/src/thermophysicalModels/specie/transport/sutherland/sutherlandTransport.H @@ -141,12 +141,18 @@ public: //- Construct from Istream sutherlandTransport(Istream&); + //- Construct from dictionary + sutherlandTransport(const dictionary& dict); + //- Construct and return a clone inline autoPtr clone() const; // Selector from Istream inline static autoPtr New(Istream& is); + // Selector from dictionary + inline static autoPtr New(const dictionary& dict); + // Member functions diff --git a/src/thermophysicalModels/specie/transport/sutherland/sutherlandTransportI.H b/src/thermophysicalModels/specie/transport/sutherland/sutherlandTransportI.H index ee1849655e..cf715ab600 100644 --- a/src/thermophysicalModels/specie/transport/sutherland/sutherlandTransportI.H +++ b/src/thermophysicalModels/specie/transport/sutherland/sutherlandTransportI.H @@ -51,7 +51,6 @@ inline void sutherlandTransport::calcCoeffs // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -// Construct from components template inline sutherlandTransport::sutherlandTransport ( @@ -66,7 +65,6 @@ inline sutherlandTransport::sutherlandTransport {} -// Construct from components template inline sutherlandTransport::sutherlandTransport ( @@ -81,7 +79,6 @@ inline sutherlandTransport::sutherlandTransport } -//- Construct as named copy template inline sutherlandTransport::sutherlandTransport ( @@ -95,7 +92,6 @@ inline sutherlandTransport::sutherlandTransport {} -// Construct and return a clone template inline autoPtr > sutherlandTransport::clone () const @@ -107,7 +103,6 @@ inline autoPtr > sutherlandTransport::clone } -// Selector from Istream template inline autoPtr > sutherlandTransport::New ( @@ -121,6 +116,19 @@ inline autoPtr > sutherlandTransport::New } +template +inline autoPtr > sutherlandTransport::New +( + const dictionary& dict +) +{ + return autoPtr > + ( + new sutherlandTransport(dict) + ); +} + + // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // Dynamic viscosity [kg/ms] @@ -131,7 +139,6 @@ inline scalar sutherlandTransport::mu(const scalar T) const } -// Thermal conductivity [W/mK] template inline scalar sutherlandTransport::kappa(const scalar T) const { @@ -140,7 +147,6 @@ inline scalar sutherlandTransport::kappa(const scalar T) const } -// Thermal diffusivity for enthalpy [kg/ms] template inline scalar sutherlandTransport::alpha(const scalar T) const {