mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
BUG: Corrected chemistry reactions - read from dictionary
This commit is contained in:
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -26,8 +26,21 @@ License
|
|||||||
#include "Reaction.H"
|
#include "Reaction.H"
|
||||||
#include "DynamicList.H"
|
#include "DynamicList.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Static Data * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class ReactionThermo>
|
||||||
|
Foam::label Foam::Reaction<ReactionThermo>::nUnNamedReactions = 0;
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class ReactionThermo>
|
||||||
|
Foam::label Foam::Reaction<ReactionThermo>::getNewReactionID()
|
||||||
|
{
|
||||||
|
return nUnNamedReactions++;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class ReactionThermo>
|
template<class ReactionThermo>
|
||||||
Foam::string Foam::Reaction<ReactionThermo>::reactionStr() const
|
Foam::string Foam::Reaction<ReactionThermo>::reactionStr() const
|
||||||
{
|
{
|
||||||
@ -114,6 +127,7 @@ Foam::Reaction<ReactionThermo>::Reaction
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
ReactionThermo(*thermoDatabase[species[0]]),
|
ReactionThermo(*thermoDatabase[species[0]]),
|
||||||
|
name_("un-named-reaction-" + Foam::name(getNewReactionID())),
|
||||||
species_(species),
|
species_(species),
|
||||||
lhs_(lhs),
|
lhs_(lhs),
|
||||||
rhs_(rhs)
|
rhs_(rhs)
|
||||||
@ -130,6 +144,7 @@ Foam::Reaction<ReactionThermo>::Reaction
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
ReactionThermo(r),
|
ReactionThermo(r),
|
||||||
|
name_(r.name() + "Copy"),
|
||||||
species_(species),
|
species_(species),
|
||||||
lhs_(r.lhs_),
|
lhs_(r.lhs_),
|
||||||
rhs_(r.rhs_)
|
rhs_(r.rhs_)
|
||||||
@ -236,6 +251,7 @@ Foam::Reaction<ReactionThermo>::Reaction
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
ReactionThermo(*thermoDatabase[species[0]]),
|
ReactionThermo(*thermoDatabase[species[0]]),
|
||||||
|
name_("un-named-reaction" + Foam::name(getNewReactionID())),
|
||||||
species_(species)
|
species_(species)
|
||||||
{
|
{
|
||||||
setLRhs(is);
|
setLRhs(is);
|
||||||
@ -252,6 +268,7 @@ Foam::Reaction<ReactionThermo>::Reaction
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
ReactionThermo(*thermoDatabase[species[0]]),
|
ReactionThermo(*thermoDatabase[species[0]]),
|
||||||
|
name_(dict.dictName()),
|
||||||
species_(species)
|
species_(species)
|
||||||
{
|
{
|
||||||
setLRhs(IStringStream(dict.lookup("reaction"))());
|
setLRhs(IStringStream(dict.lookup("reaction"))());
|
||||||
@ -318,7 +335,7 @@ Foam::Reaction<ReactionThermo>::New
|
|||||||
const dictionary& dict
|
const dictionary& dict
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
const word& reactionTypeName = dict.dictName();
|
const word& reactionTypeName = dict.lookup("type");
|
||||||
|
|
||||||
typename dictionaryConstructorTable::iterator cstrIter
|
typename dictionaryConstructorTable::iterator cstrIter
|
||||||
= dictionaryConstructorTablePtr_->find(reactionTypeName);
|
= dictionaryConstructorTablePtr_->find(reactionTypeName);
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -69,6 +69,12 @@ class Reaction
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
// Static data
|
||||||
|
|
||||||
|
//- Number of un-named reactions
|
||||||
|
static label nUnNamedReactions;
|
||||||
|
|
||||||
|
|
||||||
// Public data types
|
// Public data types
|
||||||
|
|
||||||
//- Class to hold the specie index and its coefficients in the
|
//- Class to hold the specie index and its coefficients in the
|
||||||
@ -112,6 +118,9 @@ private:
|
|||||||
|
|
||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
|
//- Name of reaction
|
||||||
|
const word name_;
|
||||||
|
|
||||||
//- List of specie names present in reaction system
|
//- List of specie names present in reaction system
|
||||||
const speciesTable& species_;
|
const speciesTable& species_;
|
||||||
|
|
||||||
@ -136,6 +145,9 @@ private:
|
|||||||
//- Disallow default bitwise assignment
|
//- Disallow default bitwise assignment
|
||||||
void operator=(const Reaction<ReactionThermo>&);
|
void operator=(const Reaction<ReactionThermo>&);
|
||||||
|
|
||||||
|
//- Return new reaction ID for un-named reactions
|
||||||
|
label getNewReactionID();
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -282,6 +294,9 @@ public:
|
|||||||
|
|
||||||
// Access
|
// Access
|
||||||
|
|
||||||
|
inline word& name();
|
||||||
|
inline const word& name() const;
|
||||||
|
|
||||||
inline const List<specieCoeffs>& lhs() const;
|
inline const List<specieCoeffs>& lhs() const;
|
||||||
inline const List<specieCoeffs>& rhs() const;
|
inline const List<specieCoeffs>& rhs() const;
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -32,6 +32,20 @@ namespace Foam
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class ReactionThermo>
|
||||||
|
inline word& Reaction<ReactionThermo>::name()
|
||||||
|
{
|
||||||
|
return name();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class ReactionThermo>
|
||||||
|
inline const word& Reaction<ReactionThermo>::name() const
|
||||||
|
{
|
||||||
|
return name();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class ReactionThermo>
|
template<class ReactionThermo>
|
||||||
inline const List<typename Reaction<ReactionThermo>::specieCoeffs>&
|
inline const List<typename Reaction<ReactionThermo>::specieCoeffs>&
|
||||||
Reaction<ReactionThermo>::lhs() const
|
Reaction<ReactionThermo>::lhs() const
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -105,13 +105,15 @@ bool Foam::ReactionList<ThermoType>::readReactionDict()
|
|||||||
|
|
||||||
forAllConstIter(dictionary, reactions, iter)
|
forAllConstIter(dictionary, reactions, iter)
|
||||||
{
|
{
|
||||||
|
const word reactionName = iter().keyword();
|
||||||
|
|
||||||
this->append
|
this->append
|
||||||
(
|
(
|
||||||
Reaction<ThermoType>::New
|
Reaction<ThermoType>::New
|
||||||
(
|
(
|
||||||
species_,
|
species_,
|
||||||
thermoDb_,
|
thermoDb_,
|
||||||
reactions.subDict(iter().keyword())
|
reactions.subDict(reactionName)
|
||||||
).ptr()
|
).ptr()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -129,8 +131,9 @@ void Foam::ReactionList<ThermoType>::write(Ostream& os) const
|
|||||||
forAllConstIter(typename SLPtrList<Reaction<ThermoType> >, *this, iter)
|
forAllConstIter(typename SLPtrList<Reaction<ThermoType> >, *this, iter)
|
||||||
{
|
{
|
||||||
const Reaction<ThermoType>& r = iter();
|
const Reaction<ThermoType>& r = iter();
|
||||||
os << indent << r.type() << nl
|
os << indent << r.name() << nl
|
||||||
<< indent << token::BEGIN_BLOCK << incrIndent << nl;
|
<< indent << token::BEGIN_BLOCK << incrIndent << nl;
|
||||||
|
os.writeKeyword("type") << r.type() << nl;
|
||||||
r.write(os);
|
r.write(os);
|
||||||
os << decrIndent << indent << token::END_BLOCK << nl;
|
os << decrIndent << indent << token::END_BLOCK << nl;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,8 +9,9 @@ species
|
|||||||
|
|
||||||
reactions
|
reactions
|
||||||
{
|
{
|
||||||
irreversibleArrheniusReaction
|
methaneReaction
|
||||||
{
|
{
|
||||||
|
type irreversibleArrheniusReaction;
|
||||||
reaction "CH4 + 2O2 = CO2 + 2H2O";
|
reaction "CH4 + 2O2 = CO2 + 2H2O";
|
||||||
A 5.2e16;
|
A 5.2e16;
|
||||||
beta 0;
|
beta 0;
|
||||||
|
|||||||
@ -10,15 +10,17 @@ species
|
|||||||
|
|
||||||
reactions
|
reactions
|
||||||
{
|
{
|
||||||
irreversibleArrheniusReaction
|
methaneReaction
|
||||||
{
|
{
|
||||||
|
type irreversibleArrheniusReaction;
|
||||||
reaction "CH4 + 2O2^1.0 = CO2 + 2H2O^1.0";
|
reaction "CH4 + 2O2^1.0 = CO2 + 2H2O^1.0";
|
||||||
A 7e+06;
|
A 7e+06;
|
||||||
beta 0;
|
beta 0;
|
||||||
Ta 10063.8;
|
Ta 10063.8;
|
||||||
}
|
}
|
||||||
irreversibleArrheniusReaction
|
hydrogenReaction
|
||||||
{
|
{
|
||||||
|
type irreversibleArrheniusReaction;
|
||||||
reaction "H2 + 0.5O2^1.0 = H2O";
|
reaction "H2 + 0.5O2^1.0 = H2O";
|
||||||
A 4.74342e+12;
|
A 4.74342e+12;
|
||||||
beta 0;
|
beta 0;
|
||||||
|
|||||||
@ -9,11 +9,12 @@ species
|
|||||||
|
|
||||||
reactions
|
reactions
|
||||||
{
|
{
|
||||||
irreversibleArrheniusReaction
|
methaneReaction
|
||||||
{
|
{
|
||||||
|
type irreversibleArrheniusReaction;
|
||||||
reaction "CH4 + 2O2 = CO2 + 2H2O";
|
reaction "CH4 + 2O2 = CO2 + 2H2O";
|
||||||
A 5.2e16;
|
A 5.2e16;
|
||||||
beta 0;
|
beta 0;
|
||||||
Ta 14906;
|
Ta 14906;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user