diff --git a/src/thermophysicalModels/specie/equationOfState/icoPolynomial/icoPolynomial.C b/src/thermophysicalModels/specie/equationOfState/icoPolynomial/icoPolynomial.C index 376b299757..180ef6a76a 100644 --- a/src/thermophysicalModels/specie/equationOfState/icoPolynomial/icoPolynomial.C +++ b/src/thermophysicalModels/specie/equationOfState/icoPolynomial/icoPolynomial.C @@ -53,6 +53,17 @@ icoPolynomial::icoPolynomial(const dictionary& dict) } +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +void icoPolynomial::write(Ostream& os) const +{ + specie::write(os); + os.writeKeyword("rhoPolynomial") << rhoPolynomial_/this->W() + << token::END_STATEMENT << nl; +} + + // * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * // template diff --git a/src/thermophysicalModels/specie/equationOfState/icoPolynomial/icoPolynomial.H b/src/thermophysicalModels/specie/equationOfState/icoPolynomial/icoPolynomial.H index 9d6b10cd14..f178a67256 100644 --- a/src/thermophysicalModels/specie/equationOfState/icoPolynomial/icoPolynomial.H +++ b/src/thermophysicalModels/specie/equationOfState/icoPolynomial/icoPolynomial.H @@ -138,14 +138,22 @@ public: // Member functions - //- Return density [kg/m^3] - inline scalar rho(scalar p, scalar T) const; + // Fundamental properties - //- Return compressibility rho/p [s^2/m^2] - inline scalar psi(scalar p, scalar T) const; + //- Return density [kg/m^3] + inline scalar rho(scalar p, scalar T) const; - //- Return compression factor [] - inline scalar Z(scalar p, scalar T) const; + //- Return compressibility rho/p [s^2/m^2] + inline scalar psi(scalar p, scalar T) const; + + //- Return compression factor [] + inline scalar Z(scalar p, scalar T) const; + + + // I-O + + //- Write to Ostream + void write(Ostream& os) const; // Member operators diff --git a/src/thermophysicalModels/specie/equationOfState/perfectGas/perfectGas.C b/src/thermophysicalModels/specie/equationOfState/perfectGas/perfectGas.C index ef01ba2b14..ece0d8baff 100644 --- a/src/thermophysicalModels/specie/equationOfState/perfectGas/perfectGas.C +++ b/src/thermophysicalModels/specie/equationOfState/perfectGas/perfectGas.C @@ -47,6 +47,14 @@ perfectGas::perfectGas(const dictionary& dict) {} +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void perfectGas::write(Ostream& os) const +{ + specie::write(os); +} + + // * * * * * * * * * * * * * * * 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 228b23aca5..68425f2a7d 100644 --- a/src/thermophysicalModels/specie/equationOfState/perfectGas/perfectGas.H +++ b/src/thermophysicalModels/specie/equationOfState/perfectGas/perfectGas.H @@ -81,14 +81,22 @@ public: // Member functions - //- Return density [kg/m^3] - inline scalar rho(scalar p, scalar T) const; + // Fundamental properties - //- Return compressibility rho/p [s^2/m^2] - inline scalar psi(scalar p, scalar T) const; + //- Return density [kg/m^3] + inline scalar rho(scalar p, scalar T) const; - //- Return compression factor [] - inline scalar Z(scalar p, scalar T) const; + //- Return compressibility rho/p [s^2/m^2] + inline scalar psi(scalar p, scalar T) const; + + //- Return compression factor [] + inline scalar Z(scalar p, scalar T) const; + + + // I-O + + //- Write to Ostream + void write(Ostream& os) const; // Member operators diff --git a/src/thermophysicalModels/specie/reaction/Reactions/IrreversibleReaction/IrreversibleReaction.C b/src/thermophysicalModels/specie/reaction/Reactions/IrreversibleReaction/IrreversibleReaction.C index 9bfbd4405c..1d729b54ab 100644 --- a/src/thermophysicalModels/specie/reaction/Reactions/IrreversibleReaction/IrreversibleReaction.C +++ b/src/thermophysicalModels/specie/reaction/Reactions/IrreversibleReaction/IrreversibleReaction.C @@ -98,7 +98,7 @@ void Foam::IrreversibleReaction::write ) const { Reaction::write(os); - os << token::SPACE << k_; + k_.write(os); } diff --git a/src/thermophysicalModels/specie/reaction/Reactions/NonEquilibriumReversibleReaction/NonEquilibriumReversibleReaction.C b/src/thermophysicalModels/specie/reaction/Reactions/NonEquilibriumReversibleReaction/NonEquilibriumReversibleReaction.C index 344f8160cd..79cdaf263b 100644 --- a/src/thermophysicalModels/specie/reaction/Reactions/NonEquilibriumReversibleReaction/NonEquilibriumReversibleReaction.C +++ b/src/thermophysicalModels/specie/reaction/Reactions/NonEquilibriumReversibleReaction/NonEquilibriumReversibleReaction.C @@ -136,7 +136,8 @@ void Foam::NonEquilibriumReversibleReaction::write ) const { Reaction::write(os); - os << token::SPACE << fk_ << token::SPACE << rk_; + fk_.write(os); + rk_.write(os); } diff --git a/src/thermophysicalModels/specie/reaction/Reactions/Reaction/Reaction.C b/src/thermophysicalModels/specie/reaction/Reactions/Reaction/Reaction.C index 97e4496ddd..94a369f9a3 100644 --- a/src/thermophysicalModels/specie/reaction/Reactions/Reaction/Reaction.C +++ b/src/thermophysicalModels/specie/reaction/Reactions/Reaction/Reaction.C @@ -26,6 +26,53 @@ License #include "Reaction.H" #include "DynamicList.H" +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +template +Foam::string Foam::Reaction::reactionStr() const +{ + OStringStream reaction; + + for (label i = 0; i < lhs_.size(); i++) + { + if (i > 0) + { + reaction << " + "; + } + if (mag(lhs_[i].stoichCoeff - 1) > SMALL) + { + reaction << lhs_[i].stoichCoeff; + } + reaction << species_[lhs_[i].index]; + if (mag(lhs_[i].exponent - lhs_[i].stoichCoeff) > SMALL) + { + reaction << "^" << lhs_[i].exponent; + } + } + + reaction << " = "; + + for (label i = 0; i < rhs_.size(); i++) + { + if (i > 0) + { + reaction << " + "; + } + if (mag(rhs_[i].stoichCoeff - 1) > SMALL) + { + reaction << rhs_[i].stoichCoeff; + } + reaction << species_[rhs_[i].index]; + if (mag(rhs_[i].exponent - rhs_[i].stoichCoeff) > SMALL) + { + reaction << "^" << rhs_[i].exponent; + } + } + + return reaction.str(); +} + + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template @@ -207,7 +254,7 @@ Foam::Reaction::Reaction ReactionThermo(*thermoDatabase[species[0]]), species_(species) { - setLRhs(IStringStream(dict.lookup("reaction"))()); + setLRhs(dict.lookup("reaction")); setThermo(thermoDatabase); } @@ -305,55 +352,7 @@ Foam::Reaction::New template void Foam::Reaction::write(Ostream& os) const { - os << type() << nl << " "; - - forAll(lhs_, i) - { - const typename Reaction::specieCoeffs& sc = lhs_[i]; - - if (sc.stoichCoeff != 1) - { - os << sc.stoichCoeff; - } - - os << species_[sc.index]; - - if (sc.exponent != sc.stoichCoeff) - { - os << '^' << sc.exponent; - } - - if (i < lhs_.size() - 1) - { - os << " + "; - } - } - - os << " = "; - - forAll(rhs_, i) - { - const typename Reaction::specieCoeffs& sc = rhs_[i]; - - if (sc.stoichCoeff != 1) - { - os << sc.stoichCoeff; - } - - os << species_[sc.index]; - - if (sc.exponent != sc.stoichCoeff) - { - os << '^' << sc.exponent; - } - - if (i < rhs_.size() - 1) - { - os << " + "; - } - } - - os << endl << " "; + os.writeKeyword("reaction") << reactionStr() << token::END_STATEMENT << nl; } diff --git a/src/thermophysicalModels/specie/reaction/Reactions/Reaction/Reaction.H b/src/thermophysicalModels/specie/reaction/Reactions/Reaction/Reaction.H index 26c7806c13..0108e80105 100644 --- a/src/thermophysicalModels/specie/reaction/Reactions/Reaction/Reaction.H +++ b/src/thermophysicalModels/specie/reaction/Reactions/Reaction/Reaction.H @@ -124,7 +124,13 @@ private: // Private Member Functions + //- Return string representation of reaction + string reactionStr() const; + + //- Construct the left- and right-hand-side reaction coefficients void setLRhs(Istream&); + + //- Construct reaction thermo void setThermo(const HashPtrTable& thermoDatabase); //- Disallow default bitwise assignment diff --git a/src/thermophysicalModels/specie/reaction/Reactions/Reaction/ReactionI.H b/src/thermophysicalModels/specie/reaction/Reactions/Reaction/ReactionI.H index 7a6f93119d..c62106877e 100644 --- a/src/thermophysicalModels/specie/reaction/Reactions/Reaction/ReactionI.H +++ b/src/thermophysicalModels/specie/reaction/Reactions/Reaction/ReactionI.H @@ -53,7 +53,56 @@ Reaction::rhs() const template inline Ostream& operator<<(Ostream& os, const Reaction& r) { - r.write(os); + os << r.type() << nl << " "; + + forAll(r.lhs_, i) + { + const typename Reaction::specieCoeffs& sc = r.lhs_[i]; + + if (sc.stoichCoeff != 1) + { + os << sc.stoichCoeff; + } + + os << r.species_[sc.index]; + + if (sc.exponent != sc.stoichCoeff) + { + os << '^' << sc.exponent; + } + + if (i < r.lhs_.size() - 1) + { + os << " + "; + } + } + + os << " = "; + + forAll(r.rhs_, i) + { + const typename Reaction::specieCoeffs& sc = r.rhs_[i]; + + if (sc.stoichCoeff != 1) + { + os << sc.stoichCoeff; + } + + os << r.species_[sc.index]; + + if (sc.exponent != sc.stoichCoeff) + { + os << '^' << sc.exponent; + } + + if (i < r.rhs_.size() - 1) + { + os << " + "; + } + } + + os << endl << " "; + return os; } diff --git a/src/thermophysicalModels/specie/reaction/Reactions/ReactionList/ReactionList.C b/src/thermophysicalModels/specie/reaction/Reactions/ReactionList/ReactionList.C index 7741403747..52b2984114 100644 --- a/src/thermophysicalModels/specie/reaction/Reactions/ReactionList/ReactionList.C +++ b/src/thermophysicalModels/specie/reaction/Reactions/ReactionList/ReactionList.C @@ -120,4 +120,23 @@ bool Foam::ReactionList::readReactionDict() } +template +void Foam::ReactionList::write(Ostream& os) const +{ + os << "reactions" << nl; + os << token::BEGIN_BLOCK << incrIndent << nl; + + forAllConstIter(typename SLPtrList >, *this, iter) + { + const Reaction& r = iter(); + os << indent << r.type() << nl + << indent << token::BEGIN_BLOCK << incrIndent << nl; + r.write(os); + os << decrIndent << indent << token::END_BLOCK << nl; + } + + os << decrIndent << token::END_BLOCK << nl; +} + + // ************************************************************************* // diff --git a/src/thermophysicalModels/specie/reaction/Reactions/ReactionList/ReactionList.H b/src/thermophysicalModels/specie/reaction/Reactions/ReactionList/ReactionList.H index 1ea93846ea..d9bf05ab15 100644 --- a/src/thermophysicalModels/specie/reaction/Reactions/ReactionList/ReactionList.H +++ b/src/thermophysicalModels/specie/reaction/Reactions/ReactionList/ReactionList.H @@ -113,6 +113,9 @@ public: //- Read reactions from dictionary bool readReactionDict(); + + //- Write + void write(Ostream& os) const; }; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/thermophysicalModels/specie/reaction/Reactions/ReversibleReaction/ReversibleReaction.C b/src/thermophysicalModels/specie/reaction/Reactions/ReversibleReaction/ReversibleReaction.C index 5b5feecaa1..83b9721c97 100644 --- a/src/thermophysicalModels/specie/reaction/Reactions/ReversibleReaction/ReversibleReaction.C +++ b/src/thermophysicalModels/specie/reaction/Reactions/ReversibleReaction/ReversibleReaction.C @@ -123,7 +123,7 @@ void Foam::ReversibleReaction::write ) const { Reaction::write(os); - os << token::SPACE << k_; + k_.write(os); } diff --git a/src/thermophysicalModels/specie/reaction/reactionRate/ArrheniusReactionRate/ArrheniusReactionRate.H b/src/thermophysicalModels/specie/reaction/reactionRate/ArrheniusReactionRate/ArrheniusReactionRate.H index ecebc952e3..87e3509a59 100644 --- a/src/thermophysicalModels/specie/reaction/reactionRate/ArrheniusReactionRate/ArrheniusReactionRate.H +++ b/src/thermophysicalModels/specie/reaction/reactionRate/ArrheniusReactionRate/ArrheniusReactionRate.H @@ -100,6 +100,9 @@ public: const scalarField& c ) const; + //- Write to stream + inline void write(Ostream& os) const; + // Ostream Operator diff --git a/src/thermophysicalModels/specie/reaction/reactionRate/ArrheniusReactionRate/ArrheniusReactionRateI.H b/src/thermophysicalModels/specie/reaction/reactionRate/ArrheniusReactionRate/ArrheniusReactionRateI.H index 2e688ba145..7db23243d6 100644 --- a/src/thermophysicalModels/specie/reaction/reactionRate/ArrheniusReactionRate/ArrheniusReactionRateI.H +++ b/src/thermophysicalModels/specie/reaction/reactionRate/ArrheniusReactionRate/ArrheniusReactionRateI.H @@ -89,6 +89,14 @@ inline Foam::scalar Foam::ArrheniusReactionRate::operator() } +inline void Foam::ArrheniusReactionRate::write(Ostream& os) const +{ + os.writeKeyword("A") << A_ << token::END_STATEMENT << nl; + os.writeKeyword("beta") << beta_ << token::END_STATEMENT << nl; + os.writeKeyword("Ta") << Ta_ << token::END_STATEMENT << nl; +} + + inline Foam::Ostream& Foam::operator<< ( Ostream& os, diff --git a/src/thermophysicalModels/specie/reaction/reactionRate/ChemicallyActivatedReactionRate/ChemicallyActivatedReactionRate.H b/src/thermophysicalModels/specie/reaction/reactionRate/ChemicallyActivatedReactionRate/ChemicallyActivatedReactionRate.H index 12bb7f433f..6697e49ed0 100644 --- a/src/thermophysicalModels/specie/reaction/reactionRate/ChemicallyActivatedReactionRate/ChemicallyActivatedReactionRate.H +++ b/src/thermophysicalModels/specie/reaction/reactionRate/ChemicallyActivatedReactionRate/ChemicallyActivatedReactionRate.H @@ -116,6 +116,9 @@ public: const scalarField& c ) const; + //- Write to stream + inline void write(Ostream& os) const; + // Ostream Operator diff --git a/src/thermophysicalModels/specie/reaction/reactionRate/ChemicallyActivatedReactionRate/ChemicallyActivatedReactionRateI.H b/src/thermophysicalModels/specie/reaction/reactionRate/ChemicallyActivatedReactionRate/ChemicallyActivatedReactionRateI.H index 0bba5ee60d..e96e9f2878 100644 --- a/src/thermophysicalModels/specie/reaction/reactionRate/ChemicallyActivatedReactionRate/ChemicallyActivatedReactionRateI.H +++ b/src/thermophysicalModels/specie/reaction/reactionRate/ChemicallyActivatedReactionRate/ChemicallyActivatedReactionRateI.H @@ -106,6 +106,20 @@ inline Foam::scalar Foam::ChemicallyActivatedReactionRate } +template +inline void Foam::ChemicallyActivatedReactionRate +< + ReactionRate, + ChemicallyActivationFunction +>::write(Ostream& os) const +{ + k0_.write(os); + kInf_.write(os); + F_.write(os); + thirdBodyEfficiencies_.write(os); +} + + template inline Foam::Ostream& Foam::operator<< ( diff --git a/src/thermophysicalModels/specie/reaction/reactionRate/FallOffReactionRate/FallOffReactionRate.H b/src/thermophysicalModels/specie/reaction/reactionRate/FallOffReactionRate/FallOffReactionRate.H index 0ce7011059..5c98b860d6 100644 --- a/src/thermophysicalModels/specie/reaction/reactionRate/FallOffReactionRate/FallOffReactionRate.H +++ b/src/thermophysicalModels/specie/reaction/reactionRate/FallOffReactionRate/FallOffReactionRate.H @@ -56,7 +56,7 @@ inline Ostream& operator<< /*---------------------------------------------------------------------------*\ - Class FallOffReactionRate Declaration + Class FallOffReactionRate Declaration \*---------------------------------------------------------------------------*/ template @@ -113,6 +113,9 @@ public: const scalarField& c ) const; + //- Write to stream + inline void write(Ostream& os) const; + // Ostream Operator diff --git a/src/thermophysicalModels/specie/reaction/reactionRate/FallOffReactionRate/FallOffReactionRateI.H b/src/thermophysicalModels/specie/reaction/reactionRate/FallOffReactionRate/FallOffReactionRateI.H index 90256f3251..d72bcee163 100644 --- a/src/thermophysicalModels/specie/reaction/reactionRate/FallOffReactionRate/FallOffReactionRateI.H +++ b/src/thermophysicalModels/specie/reaction/reactionRate/FallOffReactionRate/FallOffReactionRateI.H @@ -94,6 +94,19 @@ Foam::FallOffReactionRate::operator() } +template +inline void Foam::FallOffReactionRate::write +( + Ostream& os +) const +{ + k0_.write(os); + kInf_.write(os); + F_.write(os); + thirdBodyEfficiencies_.write(os); +} + + template inline Foam::Ostream& Foam::operator<< ( diff --git a/src/thermophysicalModels/specie/reaction/reactionRate/JanevReactionRate/JanevReactionRate.H b/src/thermophysicalModels/specie/reaction/reactionRate/JanevReactionRate/JanevReactionRate.H index 955b68513b..a98d841a88 100644 --- a/src/thermophysicalModels/specie/reaction/reactionRate/JanevReactionRate/JanevReactionRate.H +++ b/src/thermophysicalModels/specie/reaction/reactionRate/JanevReactionRate/JanevReactionRate.H @@ -103,6 +103,9 @@ public: const scalarField& c ) const; + //- Write to stream + inline void write(Ostream& os) const; + // Ostream Operator diff --git a/src/thermophysicalModels/specie/reaction/reactionRate/JanevReactionRate/JanevReactionRateI.H b/src/thermophysicalModels/specie/reaction/reactionRate/JanevReactionRate/JanevReactionRateI.H index 9a37c526ef..c5a55a9c97 100644 --- a/src/thermophysicalModels/specie/reaction/reactionRate/JanevReactionRate/JanevReactionRateI.H +++ b/src/thermophysicalModels/specie/reaction/reactionRate/JanevReactionRate/JanevReactionRateI.H @@ -104,6 +104,15 @@ inline Foam::scalar Foam::JanevReactionRate::operator() } +inline void Foam::JanevReactionRate::write(Ostream& os) const +{ + os.writeKeyword("A") << A_ << nl; + os.writeKeyword("beta") << beta_ << nl; + os.writeKeyword("Ta") << Ta_ << nl; + os.writeKeyword("b") << b_ << nl; +} + + inline Foam::Ostream& Foam::operator<< ( Ostream& os, diff --git a/src/thermophysicalModels/specie/reaction/reactionRate/LandauTellerReactionRate/LandauTellerReactionRate.H b/src/thermophysicalModels/specie/reaction/reactionRate/LandauTellerReactionRate/LandauTellerReactionRate.H index 3729463c7c..8cde7c2bc8 100644 --- a/src/thermophysicalModels/specie/reaction/reactionRate/LandauTellerReactionRate/LandauTellerReactionRate.H +++ b/src/thermophysicalModels/specie/reaction/reactionRate/LandauTellerReactionRate/LandauTellerReactionRate.H @@ -44,7 +44,7 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class LandauTellerReactionRate Declaration + Class LandauTellerReactionRate Declaration \*---------------------------------------------------------------------------*/ class LandauTellerReactionRate @@ -57,6 +57,7 @@ class LandauTellerReactionRate scalar B_; scalar C_; + public: // Constructors @@ -101,6 +102,9 @@ public: const scalarField& c ) const; + //- Write to stream + inline void write(Ostream& os) const; + // Ostream Operator diff --git a/src/thermophysicalModels/specie/reaction/reactionRate/LandauTellerReactionRate/LandauTellerReactionRateI.H b/src/thermophysicalModels/specie/reaction/reactionRate/LandauTellerReactionRate/LandauTellerReactionRateI.H index 68d2904d41..7931222697 100644 --- a/src/thermophysicalModels/specie/reaction/reactionRate/LandauTellerReactionRate/LandauTellerReactionRateI.H +++ b/src/thermophysicalModels/specie/reaction/reactionRate/LandauTellerReactionRate/LandauTellerReactionRateI.H @@ -114,6 +114,16 @@ inline Foam::scalar Foam::LandauTellerReactionRate::operator() } +inline void Foam::LandauTellerReactionRate::write(Ostream& os) const +{ + os.writeKeyword("A") << A_ << token::END_STATEMENT << nl; + os.writeKeyword("beta") << beta_ << token::END_STATEMENT << nl; + os.writeKeyword("Ta") << Ta_ << token::END_STATEMENT << nl; + os.writeKeyword("B") << B_ << token::END_STATEMENT << nl; + os.writeKeyword("C") << C_ << token::END_STATEMENT << nl; +} + + inline Foam::Ostream& Foam::operator<< ( Ostream& os, diff --git a/src/thermophysicalModels/specie/reaction/reactionRate/LangmuirHinshelwood/LangmuirHinshelwoodReactionRate.H b/src/thermophysicalModels/specie/reaction/reactionRate/LangmuirHinshelwood/LangmuirHinshelwoodReactionRate.H index 52308f7962..118bae3f09 100644 --- a/src/thermophysicalModels/specie/reaction/reactionRate/LangmuirHinshelwood/LangmuirHinshelwoodReactionRate.H +++ b/src/thermophysicalModels/specie/reaction/reactionRate/LangmuirHinshelwood/LangmuirHinshelwoodReactionRate.H @@ -104,6 +104,9 @@ public: const scalarField& c ) const; + //- Write to stream + inline void write(Ostream& os) const; + // Ostream Operator diff --git a/src/thermophysicalModels/specie/reaction/reactionRate/LangmuirHinshelwood/LangmuirHinshelwoodReactionRateI.H b/src/thermophysicalModels/specie/reaction/reactionRate/LangmuirHinshelwood/LangmuirHinshelwoodReactionRateI.H index 64c57104e7..51bac5d59e 100644 --- a/src/thermophysicalModels/specie/reaction/reactionRate/LangmuirHinshelwood/LangmuirHinshelwoodReactionRateI.H +++ b/src/thermophysicalModels/specie/reaction/reactionRate/LangmuirHinshelwood/LangmuirHinshelwoodReactionRateI.H @@ -110,6 +110,20 @@ inline Foam::scalar Foam::LangmuirHinshelwoodReactionRate::operator() } +inline void Foam::LangmuirHinshelwoodReactionRate::write(Ostream& os) const +{ + FixedList, n_> coeffs; + + forAll(coeffs, i) + { + coeffs[i].first() = A_[i]; + coeffs[i].second() = Ta_[i]; + } + + os.writeKeyword("coeffs") << coeffs << nl; +} + + inline Foam::Ostream& Foam::operator<< ( Ostream& os, diff --git a/src/thermophysicalModels/specie/reaction/reactionRate/fallOffFunctions/LindemannFallOffFunction/LindemannFallOffFunction.H b/src/thermophysicalModels/specie/reaction/reactionRate/fallOffFunctions/LindemannFallOffFunction/LindemannFallOffFunction.H index 580f675c3d..4202f74844 100644 --- a/src/thermophysicalModels/specie/reaction/reactionRate/fallOffFunctions/LindemannFallOffFunction/LindemannFallOffFunction.H +++ b/src/thermophysicalModels/specie/reaction/reactionRate/fallOffFunctions/LindemannFallOffFunction/LindemannFallOffFunction.H @@ -49,7 +49,7 @@ Ostream& operator<<(Ostream&, const LindemannFallOffFunction&); /*---------------------------------------------------------------------------*\ - Class LindemannFallOffFunction Declaration + Class LindemannFallOffFunction Declaration \*---------------------------------------------------------------------------*/ class LindemannFallOffFunction @@ -83,6 +83,9 @@ public: const scalar Pr ) const; + //- Write to stream + inline void write(Ostream& os) const; + // Ostream Operator diff --git a/src/thermophysicalModels/specie/reaction/reactionRate/fallOffFunctions/LindemannFallOffFunction/LindemannFallOffFunctionI.H b/src/thermophysicalModels/specie/reaction/reactionRate/fallOffFunctions/LindemannFallOffFunction/LindemannFallOffFunctionI.H index 142c174b8a..bdcff41200 100644 --- a/src/thermophysicalModels/specie/reaction/reactionRate/fallOffFunctions/LindemannFallOffFunction/LindemannFallOffFunctionI.H +++ b/src/thermophysicalModels/specie/reaction/reactionRate/fallOffFunctions/LindemannFallOffFunction/LindemannFallOffFunctionI.H @@ -52,6 +52,10 @@ inline Foam::scalar Foam::LindemannFallOffFunction::operator() } +inline void Foam::LindemannFallOffFunction::write(Ostream& os) const +{} + + // * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * // inline Foam::Ostream& Foam::operator<< diff --git a/src/thermophysicalModels/specie/reaction/reactionRate/fallOffFunctions/SRIFallOffFunction/SRIFallOffFunction.H b/src/thermophysicalModels/specie/reaction/reactionRate/fallOffFunctions/SRIFallOffFunction/SRIFallOffFunction.H index ca16df0b0c..66c7b77b95 100644 --- a/src/thermophysicalModels/specie/reaction/reactionRate/fallOffFunctions/SRIFallOffFunction/SRIFallOffFunction.H +++ b/src/thermophysicalModels/specie/reaction/reactionRate/fallOffFunctions/SRIFallOffFunction/SRIFallOffFunction.H @@ -49,7 +49,7 @@ Ostream& operator<<(Ostream&, const SRIFallOffFunction&); /*---------------------------------------------------------------------------*\ - Class SRIFallOffFunction Declaration + Class SRIFallOffFunction Declaration \*---------------------------------------------------------------------------*/ class SRIFallOffFunction @@ -94,6 +94,9 @@ public: const scalar Pr ) const; + //- Write to stream + inline void write(Ostream& os) const; + // Ostream Operator diff --git a/src/thermophysicalModels/specie/reaction/reactionRate/fallOffFunctions/SRIFallOffFunction/SRIFallOffFunctionI.H b/src/thermophysicalModels/specie/reaction/reactionRate/fallOffFunctions/SRIFallOffFunction/SRIFallOffFunctionI.H index fd645cdaae..d9af2b227a 100644 --- a/src/thermophysicalModels/specie/reaction/reactionRate/fallOffFunctions/SRIFallOffFunction/SRIFallOffFunctionI.H +++ b/src/thermophysicalModels/specie/reaction/reactionRate/fallOffFunctions/SRIFallOffFunction/SRIFallOffFunctionI.H @@ -77,6 +77,16 @@ inline Foam::scalar Foam::SRIFallOffFunction::operator() } +inline void Foam::SRIFallOffFunction::write(Ostream& os) const +{ + os.writeKeyword("a") << a_ << token::END_STATEMENT << nl; + os.writeKeyword("b") << b_ << token::END_STATEMENT << nl; + os.writeKeyword("c") << c_ << token::END_STATEMENT << nl; + os.writeKeyword("d") << d_ << token::END_STATEMENT << nl; + os.writeKeyword("e") << e_ << token::END_STATEMENT << nl; +} + + // * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * // inline Foam::Ostream& Foam::operator<< diff --git a/src/thermophysicalModels/specie/reaction/reactionRate/fallOffFunctions/TroeFallOffFunction/TroeFallOffFunction.H b/src/thermophysicalModels/specie/reaction/reactionRate/fallOffFunctions/TroeFallOffFunction/TroeFallOffFunction.H index 6b85c9e2c5..64baa4f890 100644 --- a/src/thermophysicalModels/specie/reaction/reactionRate/fallOffFunctions/TroeFallOffFunction/TroeFallOffFunction.H +++ b/src/thermophysicalModels/specie/reaction/reactionRate/fallOffFunctions/TroeFallOffFunction/TroeFallOffFunction.H @@ -49,7 +49,7 @@ Ostream& operator<<(Ostream&, const TroeFallOffFunction&); /*---------------------------------------------------------------------------*\ - Class TroeFallOffFunction Declaration + Class TroeFallOffFunction Declaration \*---------------------------------------------------------------------------*/ class TroeFallOffFunction @@ -94,6 +94,9 @@ public: const scalar Pr ) const; + //- Write to stream + inline void write(Ostream& os) const; + // Ostream Operator diff --git a/src/thermophysicalModels/specie/reaction/reactionRate/fallOffFunctions/TroeFallOffFunction/TroeFallOffFunctionI.H b/src/thermophysicalModels/specie/reaction/reactionRate/fallOffFunctions/TroeFallOffFunction/TroeFallOffFunctionI.H index 21b730d613..97858887f7 100644 --- a/src/thermophysicalModels/specie/reaction/reactionRate/fallOffFunctions/TroeFallOffFunction/TroeFallOffFunctionI.H +++ b/src/thermophysicalModels/specie/reaction/reactionRate/fallOffFunctions/TroeFallOffFunction/TroeFallOffFunctionI.H @@ -86,6 +86,15 @@ inline Foam::scalar Foam::TroeFallOffFunction::operator() } +inline void Foam::TroeFallOffFunction::write(Ostream& os) const +{ + os.writeKeyword("alpha") << alpha_ << token::END_STATEMENT << nl; + os.writeKeyword("Tsss") << Tsss_ << token::END_STATEMENT << nl; + os.writeKeyword("Ts") << Ts_ << token::END_STATEMENT << nl; + os.writeKeyword("Tss") << Tss_ << token::END_STATEMENT << nl; +} + + // * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * // inline Foam::Ostream& Foam::operator<< diff --git a/src/thermophysicalModels/specie/reaction/reactionRate/powerSeries/powerSeriesReactionRate.H b/src/thermophysicalModels/specie/reaction/reactionRate/powerSeries/powerSeriesReactionRate.H index 7df96a7844..4d4239ebc1 100644 --- a/src/thermophysicalModels/specie/reaction/reactionRate/powerSeries/powerSeriesReactionRate.H +++ b/src/thermophysicalModels/specie/reaction/reactionRate/powerSeries/powerSeriesReactionRate.H @@ -45,7 +45,7 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class powerSeriesReactionRate Declaration + Class powerSeriesReactionRate Declaration \*---------------------------------------------------------------------------*/ class powerSeriesReactionRate @@ -103,6 +103,9 @@ public: const scalarField& c ) const; + //- Write to stream + inline void write(Ostream& os) const; + // Ostream Operator diff --git a/src/thermophysicalModels/specie/reaction/reactionRate/powerSeries/powerSeriesReactionRateI.H b/src/thermophysicalModels/specie/reaction/reactionRate/powerSeries/powerSeriesReactionRateI.H index a0d847672c..7900f282e5 100644 --- a/src/thermophysicalModels/specie/reaction/reactionRate/powerSeries/powerSeriesReactionRateI.H +++ b/src/thermophysicalModels/specie/reaction/reactionRate/powerSeries/powerSeriesReactionRateI.H @@ -97,6 +97,15 @@ inline Foam::scalar Foam::powerSeriesReactionRate::operator() } +inline void Foam::powerSeriesReactionRate::write(Ostream& os) const +{ + os.writeKeyword("A") << A_ << token::END_STATEMENT << nl; + os.writeKeyword("beta") << beta_ << token::END_STATEMENT << nl; + os.writeKeyword("Ta") << Ta_ << token::END_STATEMENT << nl; + os.writeKeyword("b") << b_ << token::END_STATEMENT << nl; +} + + inline Foam::Ostream& Foam::operator<< ( Ostream& os, diff --git a/src/thermophysicalModels/specie/reaction/reactionRate/thirdBodyArrheniusReactionRate/thirdBodyArrheniusReactionRate.H b/src/thermophysicalModels/specie/reaction/reactionRate/thirdBodyArrheniusReactionRate/thirdBodyArrheniusReactionRate.H index 03cbb03f96..1cf3a5d8b8 100644 --- a/src/thermophysicalModels/specie/reaction/reactionRate/thirdBodyArrheniusReactionRate/thirdBodyArrheniusReactionRate.H +++ b/src/thermophysicalModels/specie/reaction/reactionRate/thirdBodyArrheniusReactionRate/thirdBodyArrheniusReactionRate.H @@ -99,6 +99,9 @@ public: const scalarField& c ) const; + //- Write to stream + inline void write(Ostream& os) const; + // Ostream Operator diff --git a/src/thermophysicalModels/specie/reaction/reactionRate/thirdBodyArrheniusReactionRate/thirdBodyArrheniusReactionRateI.H b/src/thermophysicalModels/specie/reaction/reactionRate/thirdBodyArrheniusReactionRate/thirdBodyArrheniusReactionRateI.H index 0289ffdd16..91cd4dfdfb 100644 --- a/src/thermophysicalModels/specie/reaction/reactionRate/thirdBodyArrheniusReactionRate/thirdBodyArrheniusReactionRateI.H +++ b/src/thermophysicalModels/specie/reaction/reactionRate/thirdBodyArrheniusReactionRate/thirdBodyArrheniusReactionRateI.H @@ -85,6 +85,13 @@ inline Foam::scalar Foam::thirdBodyArrheniusReactionRate::operator() } +inline void Foam::thirdBodyArrheniusReactionRate::write(Ostream& os) const +{ + ArrheniusReactionRate::write(os); + thirdBodyEfficiencies_.write(os); +} + + inline Foam::Ostream& Foam::operator<< ( Ostream& os, diff --git a/src/thermophysicalModels/specie/reaction/reactionRate/thirdBodyEfficiencies/thirdBodyEfficiencies.H b/src/thermophysicalModels/specie/reaction/reactionRate/thirdBodyEfficiencies/thirdBodyEfficiencies.H index 7ed4e6e014..d168174f8d 100644 --- a/src/thermophysicalModels/specie/reaction/reactionRate/thirdBodyEfficiencies/thirdBodyEfficiencies.H +++ b/src/thermophysicalModels/specie/reaction/reactionRate/thirdBodyEfficiencies/thirdBodyEfficiencies.H @@ -93,6 +93,10 @@ public: //- Calculate and return M, the concentration of the third-bodies inline scalar M(const scalarList& c) const; + //- Write to stream + inline void write(Ostream& os) const; + + // Ostream Operator diff --git a/src/thermophysicalModels/specie/reaction/reactionRate/thirdBodyEfficiencies/thirdBodyEfficienciesI.H b/src/thermophysicalModels/specie/reaction/reactionRate/thirdBodyEfficiencies/thirdBodyEfficienciesI.H index 5a449f99ed..c1dddc3f1e 100644 --- a/src/thermophysicalModels/specie/reaction/reactionRate/thirdBodyEfficiencies/thirdBodyEfficienciesI.H +++ b/src/thermophysicalModels/specie/reaction/reactionRate/thirdBodyEfficiencies/thirdBodyEfficienciesI.H @@ -161,6 +161,19 @@ inline Foam::scalar Foam::thirdBodyEfficiencies::M(const scalarList& c) const } +inline void Foam::thirdBodyEfficiencies::write(Ostream& os) const +{ + List > coeffs(species_.size()); + forAll(coeffs, i) + { + coeffs[i].first() = species_[i]; + coeffs[i].second() = operator[](i); + } + + os.writeKeyword("coeffs") << coeffs << token::END_STATEMENT << nl; +} + + // * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * // inline Foam::Ostream& Foam::operator<< diff --git a/src/thermophysicalModels/specie/specie/specie.C b/src/thermophysicalModels/specie/specie/specie.C index ae3d3c9f18..d83a0dfb3f 100644 --- a/src/thermophysicalModels/specie/specie/specie.C +++ b/src/thermophysicalModels/specie/specie/specie.C @@ -59,6 +59,15 @@ Foam::specie::specie(const dictionary& dict) {} +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::specie::write(Ostream& os) const +{ + os.writeKeyword("nMoles") << nMoles_ << token::END_STATEMENT << nl; + os.writeKeyword("molWeight") << molWeight_ << token::END_STATEMENT << nl; +} + + // * * * * * * * * * * * * * * * 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 8bfc0faccc..ee3ee3769e 100644 --- a/src/thermophysicalModels/specie/specie/specie.H +++ b/src/thermophysicalModels/specie/specie/specie.H @@ -115,6 +115,9 @@ public: // Access + //- Name + inline const word& name() const; + //- Molecular weight [kg/kmol] inline scalar W() const; @@ -125,6 +128,12 @@ public: inline scalar R() const; + // I-O + + //- Write to Ostream + void write(Ostream& os) const; + + // Member operators inline void operator=(const specie&); diff --git a/src/thermophysicalModels/specie/specie/specieI.H b/src/thermophysicalModels/specie/specie/specieI.H index 21892aba7d..d04df6e1a2 100644 --- a/src/thermophysicalModels/specie/specie/specieI.H +++ b/src/thermophysicalModels/specie/specie/specieI.H @@ -32,7 +32,6 @@ namespace Foam // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -// Construct from components inline specie::specie ( const word& name, @@ -46,7 +45,6 @@ inline specie::specie {} -// Construct from components without name inline specie::specie ( const scalar nMoles, @@ -60,7 +58,6 @@ inline specie::specie // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -// Construct as copy inline specie::specie(const specie& st) : name_(st.name_), @@ -69,7 +66,6 @@ inline specie::specie(const specie& st) {} -// Construct as named copy inline specie::specie(const word& name, const specie& st) : name_(name), @@ -80,19 +76,24 @@ inline specie::specie(const word& name, const specie& st) // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -//- Molecular weight [kg/kmol] +inline const word& specie::name() const +{ + return name_; +} + + inline scalar specie::W() const { return molWeight_; } -//- No of moles of this species in mixture + inline scalar specie::nMoles() const { return nMoles_; } -//- Gas constant [J/(kg K)] + inline scalar specie::R() const { return RR/molWeight_; @@ -103,7 +104,7 @@ inline scalar specie::R() const inline void specie::operator=(const specie& st) { - //name_ = st.name_; + //name_ = st.name_; nMoles_ = st.nMoles_; molWeight_ = st.molWeight_; } diff --git a/src/thermophysicalModels/specie/thermo/eConst/eConstThermo.C b/src/thermophysicalModels/specie/thermo/eConst/eConstThermo.C index 7259926648..41671b58e7 100644 --- a/src/thermophysicalModels/specie/thermo/eConst/eConstThermo.C +++ b/src/thermophysicalModels/specie/thermo/eConst/eConstThermo.C @@ -48,6 +48,17 @@ Foam::eConstThermo::eConstThermo(const dictionary& dict) {} +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +void Foam::eConstThermo::write(Ostream& os) const +{ + equationOfState::write(os); + os.writeKeyword("Cv") << Cv_ << token::END_STATEMENT << nl; + os.writeKeyword("Hf") << Hf_ << token::END_STATEMENT << nl; +} + + // * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * // template diff --git a/src/thermophysicalModels/specie/thermo/eConst/eConstThermo.H b/src/thermophysicalModels/specie/thermo/eConst/eConstThermo.H index 37e6f00980..9211123b10 100644 --- a/src/thermophysicalModels/specie/thermo/eConst/eConstThermo.H +++ b/src/thermophysicalModels/specie/thermo/eConst/eConstThermo.H @@ -135,7 +135,7 @@ public: // Member Functions - // Fundamaental properties + // Fundamental properties //- Heat capacity at constant pressure [J/(kmol K)] inline scalar cp(const scalar T) const; @@ -153,6 +153,12 @@ public: inline scalar s(const scalar T) const; + // I-O + + //- Write to Ostream + void write(Ostream& os) const; + + // Member operators inline void operator+=(const eConstThermo&); diff --git a/src/thermophysicalModels/specie/thermo/hConst/hConstThermo.C b/src/thermophysicalModels/specie/thermo/hConst/hConstThermo.C index e5a0c523fc..250d355770 100644 --- a/src/thermophysicalModels/specie/thermo/hConst/hConstThermo.C +++ b/src/thermophysicalModels/specie/thermo/hConst/hConstThermo.C @@ -48,6 +48,17 @@ Foam::hConstThermo::hConstThermo(const dictionary& dict) {} +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +void Foam::hConstThermo::write(Ostream& os) const +{ + equationOfState::write(os); + os.writeKeyword("Cp") << Cp_ << token::END_STATEMENT << nl; + os.writeKeyword("Hf") << Hf_ << token::END_STATEMENT << nl; +} + + // * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * // template diff --git a/src/thermophysicalModels/specie/thermo/hConst/hConstThermo.H b/src/thermophysicalModels/specie/thermo/hConst/hConstThermo.H index c47e9af313..237822a52d 100644 --- a/src/thermophysicalModels/specie/thermo/hConst/hConstThermo.H +++ b/src/thermophysicalModels/specie/thermo/hConst/hConstThermo.H @@ -133,7 +133,7 @@ public: // Member Functions - // Fundamaental properties + // Fundamental properties //- Heat capacity at constant pressure [J/(kmol K)] inline scalar cp(const scalar T) const; @@ -151,6 +151,12 @@ public: inline scalar s(const scalar T) const; + // I-O + + //- Write to Ostream + void write(Ostream& os) const; + + // Member operators inline void operator+=(const hConstThermo&); diff --git a/src/thermophysicalModels/specie/thermo/hPolynomial/hPolynomialThermo.C b/src/thermophysicalModels/specie/thermo/hPolynomial/hPolynomialThermo.C index 1e793d3a13..8fd3eadcd3 100644 --- a/src/thermophysicalModels/specie/thermo/hPolynomial/hPolynomialThermo.C +++ b/src/thermophysicalModels/specie/thermo/hPolynomial/hPolynomialThermo.C @@ -84,6 +84,22 @@ Foam::hPolynomialThermo::hPolynomialThermo } +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +void Foam::hPolynomialThermo::write +( + Ostream& os +) const +{ + EquationOfState::write(os); + os.writeKeyword("Hf") << Hf_ << token::END_STATEMENT << nl; + os.writeKeyword("Sf") << Sf_ << token::END_STATEMENT << nl; + os.writeKeyword("cpPolynomial") << cpPolynomial_/this->W() + << token::END_STATEMENT << nl; +} + + // * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * // template diff --git a/src/thermophysicalModels/specie/thermo/hPolynomial/hPolynomialThermo.H b/src/thermophysicalModels/specie/thermo/hPolynomial/hPolynomialThermo.H index ce6709fec9..76ba5b0c32 100644 --- a/src/thermophysicalModels/specie/thermo/hPolynomial/hPolynomialThermo.H +++ b/src/thermophysicalModels/specie/thermo/hPolynomial/hPolynomialThermo.H @@ -150,20 +150,28 @@ public: // Member Functions - //- Heat capacity at constant pressure [J/(kmol K)] - inline scalar cp(const scalar T) const; + // Fundamental properties - //- Enthalpy [J/kmol] - inline scalar h(const scalar T) const; + //- Heat capacity at constant pressure [J/(kmol K)] + inline scalar cp(const scalar T) const; - //- Sensible enthalpy [J/kmol] - inline scalar hs(const scalar T) const; + //- Enthalpy [J/kmol] + inline scalar h(const scalar T) const; - //- Chemical enthalpy [J/kmol] - inline scalar hc() const; + //- Sensible enthalpy [J/kmol] + inline scalar hs(const scalar T) const; - //- Entropy [J/(kmol K)] - inline scalar s(const scalar T) const; + //- Chemical enthalpy [J/kmol] + inline scalar hc() const; + + //- Entropy [J/(kmol K)] + inline scalar s(const scalar T) const; + + + // I-O + + //- Write to Ostream + void write(Ostream& os) const; // Member operators diff --git a/src/thermophysicalModels/specie/thermo/janaf/janafThermo.C b/src/thermophysicalModels/specie/thermo/janaf/janafThermo.C index 8c284048aa..71a4cb45f2 100644 --- a/src/thermophysicalModels/specie/thermo/janaf/janafThermo.C +++ b/src/thermophysicalModels/specie/thermo/janaf/janafThermo.C @@ -95,6 +95,22 @@ Foam::janafThermo::janafThermo(const dictionary& dict) } +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +void Foam::janafThermo::write(Ostream& os) const +{ + equationOfState::write(os); + os.writeKeyword("Tlow") << Tlow_ << token::END_STATEMENT << endl; + os.writeKeyword("Thigh") << Thigh_ << token::END_STATEMENT << endl; + os.writeKeyword("Tcommon") << Tcommon_ << token::END_STATEMENT << endl; + os.writeKeyword("highCpCoeffs") << highCpCoeffs_ << token::END_STATEMENT + << endl; + os.writeKeyword("lowCpCoeffs") << lowCpCoeffs_ << token::END_STATEMENT + << endl; +} + + // * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * // template diff --git a/src/thermophysicalModels/specie/thermo/janaf/janafThermo.H b/src/thermophysicalModels/specie/thermo/janaf/janafThermo.H index 3399b3bd33..8cd749b94d 100644 --- a/src/thermophysicalModels/specie/thermo/janaf/janafThermo.H +++ b/src/thermophysicalModels/specie/thermo/janaf/janafThermo.H @@ -153,20 +153,28 @@ public: // Member Functions - //- Heat capacity at constant pressure [J/(kmol K)] - inline scalar cp(const scalar T) const; + // Fundamental properties - //- Enthalpy [J/kmol] - inline scalar h(const scalar T) const; + //- Heat capacity at constant pressure [J/(kmol K)] + inline scalar cp(const scalar T) const; - //- Sensible enthalpy [J/kmol] - inline scalar hs(const scalar T) const; + //- Enthalpy [J/kmol] + inline scalar h(const scalar T) const; - //- Chemical enthalpy [J/kmol] - inline scalar hc() const; + //- Sensible enthalpy [J/kmol] + inline scalar hs(const scalar T) const; - //- Entropy [J/(kmol K)] - inline scalar s(const scalar T) const; + //- Chemical enthalpy [J/kmol] + inline scalar hc() const; + + //- Entropy [J/(kmol K)] + inline scalar s(const scalar T) const; + + + // I-O + + //- Write to Ostream + void write(Ostream& os) const; // Member operators diff --git a/src/thermophysicalModels/specie/thermo/specieThermo/specieThermo.C b/src/thermophysicalModels/specie/thermo/specieThermo/specieThermo.C index 74aec4376a..857402c95e 100644 --- a/src/thermophysicalModels/specie/thermo/specieThermo/specieThermo.C +++ b/src/thermophysicalModels/specie/thermo/specieThermo/specieThermo.C @@ -53,6 +53,15 @@ Foam::specieThermo::specieThermo(const dictionary& dict) {} +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +void Foam::specieThermo::write(Ostream& os) const +{ + thermo::write(os); +} + + // * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * // template diff --git a/src/thermophysicalModels/specie/thermo/specieThermo/specieThermo.H b/src/thermophysicalModels/specie/thermo/specieThermo/specieThermo.H index 03bcc0f469..231bf4586b 100644 --- a/src/thermophysicalModels/specie/thermo/specieThermo/specieThermo.H +++ b/src/thermophysicalModels/specie/thermo/specieThermo/specieThermo.H @@ -251,6 +251,12 @@ public: inline scalar TE(const scalar E, const scalar T0) const; + // I-O + + //- Write to Ostream + void write(Ostream& os) const; + + // Member operators inline void operator+=(const specieThermo&); diff --git a/src/thermophysicalModels/specie/transport/const/constTransport.C b/src/thermophysicalModels/specie/transport/const/constTransport.C index caac4c400c..8c16529daf 100644 --- a/src/thermophysicalModels/specie/transport/const/constTransport.C +++ b/src/thermophysicalModels/specie/transport/const/constTransport.C @@ -37,8 +37,8 @@ template constTransport::constTransport(Istream& is) : thermo(is), - Mu(readScalar(is)), - rPr(1.0/readScalar(is)) + Mu_(readScalar(is)), + rPr_(1.0/readScalar(is)) { is.check("constTransport::constTransport(Istream& is)"); } @@ -48,18 +48,32 @@ template constTransport::constTransport(const dictionary& dict) : thermo(dict), - Mu(readScalar(dict.lookup("Mu"))), - rPr(1.0/readScalar(dict.lookup("Pr"))) + Mu_(readScalar(dict.lookup("Mu"))), + rPr_(1.0/readScalar(dict.lookup("Pr"))) {} +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +void constTransport::constTransport::write(Ostream& os) const +{ + os << this->name() << endl; + os << token::BEGIN_BLOCK << incrIndent << nl; + thermo::write(os); + os.writeKeyword("Mu") << Mu_ << token::END_STATEMENT << nl; + os.writeKeyword("Pr") << Mu_ << token::END_STATEMENT << nl; + os << decrIndent << token::END_BLOCK << nl; +} + + // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // template Ostream& operator<<(Ostream& os, const constTransport& ct) { operator<<(os, static_cast(ct)); - os << tab << ct.Mu << tab << 1.0/ct.rPr; + os << tab << ct.Mu_ << tab << 1.0/ct.rPr_; os.check("Ostream& operator<<(Ostream& os, const constTransport& ct)"); diff --git a/src/thermophysicalModels/specie/transport/const/constTransport.H b/src/thermophysicalModels/specie/transport/const/constTransport.H index 3ba608f43d..309e4b0dfd 100644 --- a/src/thermophysicalModels/specie/transport/const/constTransport.H +++ b/src/thermophysicalModels/specie/transport/const/constTransport.H @@ -94,8 +94,11 @@ class constTransport { // Private data - //- Constant viscosity and reciprocal Prandtl Number. - scalar Mu, rPr; + //- Constant viscosity [Pa.s] + scalar Mu_; + + //- Reciprocal Prandtl Number [] + scalar rPr_; // Private Member Functions @@ -137,6 +140,9 @@ public: // Species diffusivity //inline scalar D(const scalar T) const; + //- Write to Ostream + void write(Ostream& os) const; + // Member operators diff --git a/src/thermophysicalModels/specie/transport/const/constTransportI.H b/src/thermophysicalModels/specie/transport/const/constTransportI.H index 7cb5fa437c..37fa5b311b 100644 --- a/src/thermophysicalModels/specie/transport/const/constTransportI.H +++ b/src/thermophysicalModels/specie/transport/const/constTransportI.H @@ -30,7 +30,6 @@ namespace Foam // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -// Construct from components template inline constTransport::constTransport ( @@ -40,12 +39,11 @@ inline constTransport::constTransport ) : thermo(t), - Mu(mu), - rPr(1.0/Pr) + Mu_(mu), + rPr_(1.0/Pr) {} -// Construct as named copy template inline constTransport::constTransport ( @@ -54,30 +52,27 @@ inline constTransport::constTransport ) : thermo(name, ct), - Mu(ct.Mu), - rPr(ct.rPr) + Mu_(ct.Mu_), + rPr_(ct.rPr_) {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -// Dynamic viscosity [kg/ms] template inline scalar constTransport::mu(const scalar) const { - return Mu; + return Mu_; } -// Thermal conductivity [W/mK] template inline scalar constTransport::kappa(const scalar T) const { - return this->Cp(T)*mu(T)*rPr; + return this->Cp(T)*mu(T)*rPr_; } -// Thermal diffusivity for enthalpy [kg/ms] template inline scalar constTransport::alpha(const scalar T) const { @@ -87,7 +82,7 @@ inline scalar constTransport::alpha(const scalar T) const scalar CpBar = (deltaT*(this->H(T) - this->H(specie::Tstd)) + Cp_)/(sqr(deltaT) + 1); - return Cp_*mu(T)*rPr/CpBar; + return Cp_*mu(T)*rPr_/CpBar; } @@ -101,8 +96,8 @@ inline constTransport& constTransport::operator= { thermo::operator=(ct); - Mu = ct.Mu; - rPr = ct.rPr; + Mu_ = ct.Mu_; + rPr_ = ct.rPr_; return *this; } @@ -128,8 +123,8 @@ inline constTransport operator+ return constTransport ( t, - molr1*ct1.Mu + molr2*ct2.Mu, - molr1*ct1.rPr + molr2*ct2.rPr + molr1*ct1.Mu_ + molr2*ct2.Mu_, + molr1*ct1.rPr_ + molr2*ct2.rPr_ ); } @@ -152,8 +147,8 @@ inline constTransport operator- return constTransport ( t, - molr1*ct1.Mu - molr2*ct2.Mu, - molr1*ct1.rPr - molr2*ct2.rPr + molr1*ct1.Mu_ - molr2*ct2.Mu_, + molr1*ct1.rPr_ - molr2*ct2.rPr_ ); } @@ -168,8 +163,8 @@ inline constTransport operator* return constTransport ( s*static_cast(ct), - ct.Mu, - ct.rPr + ct.Mu_, + ct.rPr_ ); } diff --git a/src/thermophysicalModels/specie/transport/polynomial/polynomialTransport.C b/src/thermophysicalModels/specie/transport/polynomial/polynomialTransport.C index fc41275dbb..b71ccd3f57 100644 --- a/src/thermophysicalModels/specie/transport/polynomial/polynomialTransport.C +++ b/src/thermophysicalModels/specie/transport/polynomial/polynomialTransport.C @@ -55,6 +55,22 @@ Foam::polynomialTransport::polynomialTransport } +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +void Foam::polynomialTransport::write(Ostream& os) const +{ + os << this->name() << endl; + os << token::BEGIN_BLOCK << incrIndent << nl; + Thermo::write(os); + os.writeKeyword("muPolynomial") << muPolynomial_/this->W() + << token::END_STATEMENT << nl; + os.writeKeyword("kappaPolynomial") << kappaPolynomial_/this->W() + << token::END_STATEMENT << nl; + os << decrIndent << token::END_BLOCK << nl; +} + + // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // template diff --git a/src/thermophysicalModels/specie/transport/polynomial/polynomialTransport.H b/src/thermophysicalModels/specie/transport/polynomial/polynomialTransport.H index cf7543f2ed..bc42391a8d 100644 --- a/src/thermophysicalModels/specie/transport/polynomial/polynomialTransport.H +++ b/src/thermophysicalModels/specie/transport/polynomial/polynomialTransport.H @@ -154,6 +154,9 @@ public: // Species diffusivity //inline scalar D(const scalar T) const; + //- Write to Ostream + void write(Ostream& os) const; + // Member operators diff --git a/src/thermophysicalModels/specie/transport/speciesTransport/speciesTransport.C b/src/thermophysicalModels/specie/transport/speciesTransport/speciesTransport.C index 26e5599772..cd8c900581 100644 --- a/src/thermophysicalModels/specie/transport/speciesTransport/speciesTransport.C +++ b/src/thermophysicalModels/specie/transport/speciesTransport/speciesTransport.C @@ -50,6 +50,17 @@ speciesTransport::speciesTransport(const dictionary& dict) {} +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void speciesTransport::write(Ostream& os) const +{ + os << this->name() << endl; + os << token::BEGIN_BLOCK << incrIndent << nl; + janafThermo::write(os); + os << decrIndent << token::END_BLOCK << nl; +} + + // * * * * * * * * * * * * * * * 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 d80b6d3e8f..582de1f8a3 100644 --- a/src/thermophysicalModels/specie/transport/speciesTransport/speciesTransport.H +++ b/src/thermophysicalModels/specie/transport/speciesTransport/speciesTransport.H @@ -87,6 +87,9 @@ public: // Species diffusivity //inline scalar D(const scalar T) const; + //- Write to Ostream + void write(Ostream& os) const; + // Ostream Operator diff --git a/src/thermophysicalModels/specie/transport/sutherland/sutherlandTransport.C b/src/thermophysicalModels/specie/transport/sutherland/sutherlandTransport.C index 57fe48cadf..f90f6f30f6 100644 --- a/src/thermophysicalModels/specie/transport/sutherland/sutherlandTransport.C +++ b/src/thermophysicalModels/specie/transport/sutherland/sutherlandTransport.C @@ -53,6 +53,19 @@ sutherlandTransport::sutherlandTransport(const dictionary& dict) {} +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +void sutherlandTransport::write(Ostream& os) const +{ + os << this->name() << endl; + os << token::BEGIN_BLOCK << incrIndent << nl; + thermo::write(os); + os.writeKeyword("As") << As_ << token::END_STATEMENT << nl; + os.writeKeyword("Ts") << As_ << token::END_STATEMENT << nl; + os << decrIndent << token::END_BLOCK << nl; +} + // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // template diff --git a/src/thermophysicalModels/specie/transport/sutherland/sutherlandTransport.H b/src/thermophysicalModels/specie/transport/sutherland/sutherlandTransport.H index f7c9b09c53..f3117b003f 100644 --- a/src/thermophysicalModels/specie/transport/sutherland/sutherlandTransport.H +++ b/src/thermophysicalModels/specie/transport/sutherland/sutherlandTransport.H @@ -168,6 +168,9 @@ public: // Species diffusivity //inline scalar D(const scalar T) const; + //- Write to Ostream + void write(Ostream& os) const; + // Member operators