mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'master' of /home/dm4/OpenFOAM/OpenFOAM-dev
This commit is contained in:
@ -137,8 +137,82 @@ gasSpecies() const
|
|||||||
template<class ReactionThermo>
|
template<class ReactionThermo>
|
||||||
void Foam::solidReaction<ReactionThermo>::write(Ostream& os) const
|
void Foam::solidReaction<ReactionThermo>::write(Ostream& os) const
|
||||||
{
|
{
|
||||||
Reaction<ReactionThermo>::write(os);
|
OStringStream reaction;
|
||||||
|
os.writeKeyword("reaction") << solidReactionStr(reaction)
|
||||||
|
<< token::END_STATEMENT << nl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class ReactionThermo>
|
||||||
|
Foam::string Foam::solidReaction<ReactionThermo>::solidReactionStr
|
||||||
|
(
|
||||||
|
OStringStream& reaction
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
this->reactionStrLeft(reaction);
|
||||||
|
reaction << " + ";
|
||||||
|
solidReactionStrLeft(reaction);
|
||||||
|
reaction << " = ";
|
||||||
|
this->reactionStrRight(reaction);
|
||||||
|
reaction << " + ";
|
||||||
|
solidReactionStrRight(reaction);
|
||||||
|
return reaction.str();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class ReactionThermo>
|
||||||
|
void Foam::solidReaction<ReactionThermo>::solidReactionStrLeft
|
||||||
|
(
|
||||||
|
OStringStream& reaction
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
for (label i = 0; i < glhs().size(); ++i)
|
||||||
|
{
|
||||||
|
reaction << " + ";
|
||||||
|
|
||||||
|
if (i > 0)
|
||||||
|
{
|
||||||
|
reaction << " + ";
|
||||||
|
}
|
||||||
|
if (mag(glhs()[i].stoichCoeff - 1) > SMALL)
|
||||||
|
{
|
||||||
|
reaction << glhs()[i].stoichCoeff;
|
||||||
|
}
|
||||||
|
reaction << gasSpecies()[glhs()[i].index];
|
||||||
|
if (mag(glhs()[i].exponent - glhs()[i].stoichCoeff) > SMALL)
|
||||||
|
{
|
||||||
|
reaction << "^" << glhs()[i].exponent;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class ReactionThermo>
|
||||||
|
void Foam::solidReaction<ReactionThermo>::solidReactionStrRight
|
||||||
|
(
|
||||||
|
OStringStream& reaction
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
|
||||||
|
for (label i = 0; i < grhs().size(); ++i)
|
||||||
|
{
|
||||||
|
reaction << " + ";
|
||||||
|
|
||||||
|
if (i > 0)
|
||||||
|
{
|
||||||
|
reaction << " + ";
|
||||||
|
}
|
||||||
|
if (mag(grhs()[i].stoichCoeff - 1) > SMALL)
|
||||||
|
{
|
||||||
|
reaction << grhs()[i].stoichCoeff;
|
||||||
|
}
|
||||||
|
reaction << gasSpecies()[grhs()[i].index];
|
||||||
|
if (mag(grhs()[i].exponent - grhs()[i].stoichCoeff) > SMALL)
|
||||||
|
{
|
||||||
|
reaction << "^" << grhs()[i].exponent;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -81,6 +81,15 @@ private:
|
|||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
|
|
||||||
|
//- Return string representation of reaction
|
||||||
|
string solidReactionStr(OStringStream&) const;
|
||||||
|
|
||||||
|
//- Return string representation of the left of the reaction
|
||||||
|
void solidReactionStrLeft(OStringStream&) const;
|
||||||
|
|
||||||
|
//- Return string representation of the right of the reaction
|
||||||
|
void solidReactionStrRight(OStringStream&) const;
|
||||||
|
|
||||||
//- Disallow default bitwise assignment
|
//- Disallow default bitwise assignment
|
||||||
void operator=(const solidReaction&);
|
void operator=(const solidReaction&);
|
||||||
|
|
||||||
|
|||||||
@ -39,7 +39,8 @@ inline Ostream& operator<<
|
|||||||
const solidReaction<ReactionThermo>& r
|
const solidReaction<ReactionThermo>& r
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
r.write(os);
|
OStringStream reaction;
|
||||||
|
os << r.solidReactionStr(reaction)<< token::END_STATEMENT <<nl;
|
||||||
return os;
|
return os;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -31,21 +31,14 @@ License
|
|||||||
template<class ReactionThermo>
|
template<class ReactionThermo>
|
||||||
Foam::label Foam::Reaction<ReactionThermo>::nUnNamedReactions = 0;
|
Foam::label Foam::Reaction<ReactionThermo>::nUnNamedReactions = 0;
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
|
||||||
|
|
||||||
template<class ReactionThermo>
|
template<class ReactionThermo>
|
||||||
Foam::label Foam::Reaction<ReactionThermo>::getNewReactionID()
|
void Foam::Reaction<ReactionThermo>::reactionStrLeft
|
||||||
|
(
|
||||||
|
OStringStream& reaction
|
||||||
|
) const
|
||||||
{
|
{
|
||||||
return nUnNamedReactions++;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class ReactionThermo>
|
|
||||||
Foam::string Foam::Reaction<ReactionThermo>::reactionStr() const
|
|
||||||
{
|
|
||||||
OStringStream reaction;
|
|
||||||
|
|
||||||
for (label i = 0; i < lhs_.size(); ++i)
|
for (label i = 0; i < lhs_.size(); ++i)
|
||||||
{
|
{
|
||||||
if (i > 0)
|
if (i > 0)
|
||||||
@ -62,28 +55,15 @@ Foam::string Foam::Reaction<ReactionThermo>::reactionStr() const
|
|||||||
reaction << "^" << lhs_[i].exponent;
|
reaction << "^" << lhs_[i].exponent;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (label i = 0; i < glhs().size(); ++i)
|
|
||||||
{
|
|
||||||
reaction << " + ";
|
|
||||||
|
|
||||||
if (i > 0)
|
|
||||||
{
|
|
||||||
reaction << " + ";
|
|
||||||
}
|
|
||||||
if (mag(glhs()[i].stoichCoeff - 1) > SMALL)
|
|
||||||
{
|
|
||||||
reaction << glhs()[i].stoichCoeff;
|
|
||||||
}
|
|
||||||
reaction << gasSpecies()[glhs()[i].index];
|
|
||||||
if (mag(glhs()[i].exponent - glhs()[i].stoichCoeff) > SMALL)
|
|
||||||
{
|
|
||||||
reaction << "^" << glhs()[i].exponent;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
reaction << " = ";
|
|
||||||
|
|
||||||
|
template<class ReactionThermo>
|
||||||
|
void Foam::Reaction<ReactionThermo>::reactionStrRight
|
||||||
|
(
|
||||||
|
OStringStream& reaction
|
||||||
|
) const
|
||||||
|
{
|
||||||
for (label i = 0; i < rhs_.size(); ++i)
|
for (label i = 0; i < rhs_.size(); ++i)
|
||||||
{
|
{
|
||||||
if (i > 0)
|
if (i > 0)
|
||||||
@ -100,26 +80,27 @@ Foam::string Foam::Reaction<ReactionThermo>::reactionStr() const
|
|||||||
reaction << "^" << rhs_[i].exponent;
|
reaction << "^" << rhs_[i].exponent;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (label i = 0; i < grhs().size(); ++i)
|
|
||||||
{
|
|
||||||
reaction << " + ";
|
|
||||||
|
|
||||||
if (i > 0)
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
{
|
|
||||||
reaction << " + ";
|
|
||||||
}
|
|
||||||
if (mag(grhs()[i].stoichCoeff - 1) > SMALL)
|
|
||||||
{
|
|
||||||
reaction << grhs()[i].stoichCoeff;
|
|
||||||
}
|
|
||||||
reaction << gasSpecies()[grhs()[i].index];
|
|
||||||
if (mag(grhs()[i].exponent - grhs()[i].stoichCoeff) > SMALL)
|
|
||||||
{
|
|
||||||
reaction << "^" << grhs()[i].exponent;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
template<class ReactionThermo>
|
||||||
|
Foam::label Foam::Reaction<ReactionThermo>::getNewReactionID()
|
||||||
|
{
|
||||||
|
return nUnNamedReactions++;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class ReactionThermo>
|
||||||
|
Foam::string Foam::Reaction<ReactionThermo>::reactionStr
|
||||||
|
(
|
||||||
|
OStringStream& reaction
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
reactionStrLeft(reaction);
|
||||||
|
reaction << " = ";
|
||||||
|
reactionStrRight(reaction);
|
||||||
return reaction.str();
|
return reaction.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -464,7 +445,9 @@ Foam::Reaction<ReactionThermo>::New
|
|||||||
template<class ReactionThermo>
|
template<class ReactionThermo>
|
||||||
void Foam::Reaction<ReactionThermo>::write(Ostream& os) const
|
void Foam::Reaction<ReactionThermo>::write(Ostream& os) const
|
||||||
{
|
{
|
||||||
os.writeKeyword("reaction") << reactionStr() << token::END_STATEMENT << nl;
|
OStringStream reaction;
|
||||||
|
os.writeKeyword("reaction") << reactionStr(reaction)
|
||||||
|
<< token::END_STATEMENT << nl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -66,6 +66,16 @@ class Reaction
|
|||||||
:
|
:
|
||||||
public ReactionThermo
|
public ReactionThermo
|
||||||
{
|
{
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Protected member functions
|
||||||
|
|
||||||
|
//- Return string representation of the left of the reaction
|
||||||
|
void reactionStrLeft(OStringStream& reaction) const;
|
||||||
|
|
||||||
|
//- Return string representation of the right of the reaction
|
||||||
|
void reactionStrRight(OStringStream& reaction) const;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -134,7 +144,7 @@ private:
|
|||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
//- Return string representation of reaction
|
//- Return string representation of reaction
|
||||||
string reactionStr() const;
|
string reactionStr(OStringStream& reaction) const;
|
||||||
|
|
||||||
//- Construct reaction thermo
|
//- Construct reaction thermo
|
||||||
void setThermo(const HashPtrTable<ReactionThermo>& thermoDatabase);
|
void setThermo(const HashPtrTable<ReactionThermo>& thermoDatabase);
|
||||||
|
|||||||
@ -67,8 +67,8 @@ Reaction<ReactionThermo>::rhs() const
|
|||||||
template<class ReactionThermo>
|
template<class ReactionThermo>
|
||||||
inline Ostream& operator<<(Ostream& os, const Reaction<ReactionThermo>& r)
|
inline Ostream& operator<<(Ostream& os, const Reaction<ReactionThermo>& r)
|
||||||
{
|
{
|
||||||
os << r.reactionStr()<< token::END_STATEMENT <<nl;
|
OStringStream reaction;
|
||||||
|
os << r.reactionStr(reaction)<< token::END_STATEMENT <<nl;
|
||||||
return os;
|
return os;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user