Reactions: Removed "Reaction" from the end of the reaction names

This part of the name is unnecessary, as it is clear from context that
the name refers to a reaction. The selector has been made backwards
compatible so that old names will still read successfuly.
This commit is contained in:
Will Bainbridge
2019-10-24 12:09:04 +01:00
parent ace3d0e06d
commit ba49dfa991
26 changed files with 1684 additions and 2018 deletions

View File

@ -172,8 +172,7 @@ void Foam::chemkinReader::addReactionType
{ {
reactions_.append reactions_.append
( (
new IrreversibleReaction new IrreversibleReaction<gasHThermoPhysics, ReactionRateType>
<Reaction, gasHThermoPhysics, ReactionRateType>
( (
ReactionProxy<gasHThermoPhysics> ReactionProxy<gasHThermoPhysics>
( (
@ -192,8 +191,7 @@ void Foam::chemkinReader::addReactionType
{ {
reactions_.append reactions_.append
( (
new ReversibleReaction new ReversibleReaction<gasHThermoPhysics, ReactionRateType>
<Reaction, gasHThermoPhysics, ReactionRateType>
( (
ReactionProxy<gasHThermoPhysics> ReactionProxy<gasHThermoPhysics>
( (
@ -481,7 +479,10 @@ void Foam::chemkinReader::addReaction
reactions_.append reactions_.append
( (
new NonEquilibriumReversibleReaction new NonEquilibriumReversibleReaction
<Reaction, gasHThermoPhysics, ArrheniusReactionRate> <
gasHThermoPhysics,
ArrheniusReactionRate
>
( (
ReactionProxy<gasHThermoPhysics> ReactionProxy<gasHThermoPhysics>
( (
@ -534,7 +535,6 @@ void Foam::chemkinReader::addReaction
( (
new NonEquilibriumReversibleReaction new NonEquilibriumReversibleReaction
< <
Reaction,
gasHThermoPhysics, gasHThermoPhysics,
thirdBodyArrheniusReactionRate thirdBodyArrheniusReactionRate
> >
@ -640,7 +640,6 @@ void Foam::chemkinReader::addReaction
( (
new NonEquilibriumReversibleReaction new NonEquilibriumReversibleReaction
< <
Reaction,
gasHThermoPhysics, gasHThermoPhysics,
LandauTellerReactionRate LandauTellerReactionRate
> >

View File

@ -103,35 +103,33 @@ bool Foam::string::removeRepeated(const char character)
{ {
bool changed = false; bool changed = false;
if (character && find(character) != npos) string::size_type n = 0;
{
string::size_type nChar=0;
iterator iter2 = begin(); iterator iter2 = begin();
char prev = 0; char cPrev = operator[](0) + 1;
for for
( (
string::const_iterator iter1 = iter2; string::const_iterator iter1 = iter2;
iter1 != end(); iter1 != end();
iter1++ ++ iter1
) )
{ {
char c = *iter1; char c = *iter1;
if (prev == c && c == character) if (c == cPrev && c == character)
{ {
changed = true; changed = true;
} }
else else
{ {
*iter2 = prev = c; *iter2 = cPrev = c;
++ iter2; ++ iter2;
++nChar; ++ n;
} }
} }
resize(nChar);
} resize(n);
return changed; return changed;
} }
@ -149,10 +147,10 @@ bool Foam::string::removeTrailing(const char character)
{ {
bool changed = false; bool changed = false;
string::size_type nChar = size(); string::size_type n = size();
if (character && nChar > 1 && operator[](nChar-1) == character) if (n >= 1 && operator[](n - 1) == character)
{ {
resize(nChar-1); resize(n - 1);
changed = true; changed = true;
} }
@ -162,9 +160,32 @@ bool Foam::string::removeTrailing(const char character)
Foam::string Foam::string::removeTrailing(const char character) const Foam::string Foam::string::removeTrailing(const char character) const
{ {
string str(*this); string result(*this);
str.removeTrailing(character); result.removeTrailing(character);
return str; return result;
}
bool Foam::string::removeTrailing(const string& str)
{
bool changed = false;
string::size_type n = size(), nStr = str.size();
if (n >= str.size() && operator()(n - nStr, nStr) == str)
{
resize(n - nStr);
changed = true;
}
return changed;
}
Foam::string Foam::string::removeTrailing(const string& str) const
{
string result(*this);
result.removeTrailing(str);
return result;
} }

View File

@ -206,6 +206,12 @@ public:
//- Return string with trailing character removed //- Return string with trailing character removed
string removeTrailing(const char) const; string removeTrailing(const char) const;
//- Remove trailing string returning true if string changed
bool removeTrailing(const string&);
//- Return string with trailing string removed
string removeTrailing(const string&) const;
// Member Operators // Member Operators

View File

@ -60,7 +60,7 @@ namespace Foam
#define makeReactionName(Thermo, ReactionType, ReactionRate) \ #define makeReactionName(Thermo, ReactionType, ReactionRate) \
typedef Reaction<Thermo> Reaction##Thermo; \ typedef Reaction<Thermo> Reaction##Thermo; \
\ \
typedef ReactionType<Reaction, Thermo, ReactionRate> \ typedef ReactionType<Thermo, ReactionRate> \
ReactionType##Thermo##ReactionRate; \ ReactionType##Thermo##ReactionRate; \
\ \
template<> \ template<> \
@ -68,7 +68,6 @@ namespace Foam
( \ ( \
ReactionType::typeName_() \ ReactionType::typeName_() \
+ ReactionRate::type().capitalise() \ + ReactionRate::type().capitalise() \
+ Reaction##Thermo::typeName_() \
); );

View File

@ -27,31 +27,21 @@ License
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template template<class ReactionThermo, class ReactionRate>
< Foam::IrreversibleReaction<ReactionThermo, ReactionRate>::
template<class> class ReactionType,
class ReactionThermo,
class ReactionRate
>
Foam::IrreversibleReaction<ReactionType, ReactionThermo, ReactionRate>::
IrreversibleReaction IrreversibleReaction
( (
const ReactionType<ReactionThermo>& reaction, const Reaction<ReactionThermo>& reaction,
const ReactionRate& k const ReactionRate& k
) )
: :
ReactionType<ReactionThermo>(reaction), Reaction<ReactionThermo>(reaction),
k_(k) k_(k)
{} {}
template template<class ReactionThermo, class ReactionRate>
< Foam::IrreversibleReaction<ReactionThermo, ReactionRate>::
template<class> class ReactionType,
class ReactionThermo,
class ReactionRate
>
Foam::IrreversibleReaction<ReactionType, ReactionThermo, ReactionRate>::
IrreversibleReaction IrreversibleReaction
( (
const speciesTable& species, const speciesTable& species,
@ -59,18 +49,13 @@ IrreversibleReaction
const dictionary& dict const dictionary& dict
) )
: :
ReactionType<ReactionThermo>(species, thermoDatabase, dict), Reaction<ReactionThermo>(species, thermoDatabase, dict),
k_(species, dict) k_(species, dict)
{} {}
template template<class ReactionThermo, class ReactionRate>
< Foam::IrreversibleReaction<ReactionThermo, ReactionRate>::
template<class> class ReactionType,
class ReactionThermo,
class ReactionRate
>
Foam::IrreversibleReaction<ReactionType, ReactionThermo, ReactionRate>::
IrreversibleReaction IrreversibleReaction
( (
const speciesTable& species, const speciesTable& species,
@ -79,43 +64,28 @@ IrreversibleReaction
const dictionary& dict const dictionary& dict
) )
: :
ReactionType<ReactionThermo>(species, thermoDatabase, dict), Reaction<ReactionThermo>(species, thermoDatabase, dict),
k_(species, ob, dict) k_(species, ob, dict)
{} {}
template template<class ReactionThermo, class ReactionRate>
< Foam::IrreversibleReaction<ReactionThermo, ReactionRate>::
template<class> class ReactionType,
class ReactionThermo,
class ReactionRate
>
Foam::IrreversibleReaction<ReactionType, ReactionThermo, ReactionRate>::
IrreversibleReaction IrreversibleReaction
( (
const IrreversibleReaction<ReactionType, ReactionThermo,ReactionRate>& irr, const IrreversibleReaction<ReactionThermo,ReactionRate>& irr,
const speciesTable& species const speciesTable& species
) )
: :
ReactionType<ReactionThermo>(irr, species), Reaction<ReactionThermo>(irr, species),
k_(irr.k_) k_(irr.k_)
{} {}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template template<class ReactionThermo, class ReactionRate>
< Foam::scalar Foam::IrreversibleReaction<ReactionThermo, ReactionRate>::kf
template<class> class ReactionType,
class ReactionThermo,
class ReactionRate
>
Foam::scalar Foam::IrreversibleReaction
<
ReactionType,
ReactionThermo,
ReactionRate
>::kf
( (
const scalar p, const scalar p,
const scalar T, const scalar T,
@ -127,18 +97,8 @@ Foam::scalar Foam::IrreversibleReaction
} }
template template<class ReactionThermo, class ReactionRate>
< Foam::scalar Foam::IrreversibleReaction<ReactionThermo, ReactionRate>::kr
template<class> class ReactionType,
class ReactionThermo,
class ReactionRate
>
Foam::scalar Foam::IrreversibleReaction
<
ReactionType,
ReactionThermo,
ReactionRate
>::kr
( (
const scalar kfwd, const scalar kfwd,
const scalar p, const scalar p,
@ -151,18 +111,8 @@ Foam::scalar Foam::IrreversibleReaction
} }
template template<class ReactionThermo, class ReactionRate>
< Foam::scalar Foam::IrreversibleReaction<ReactionThermo, ReactionRate>::kr
template<class> class ReactionType,
class ReactionThermo,
class ReactionRate
>
Foam::scalar Foam::IrreversibleReaction
<
ReactionType,
ReactionThermo,
ReactionRate
>::kr
( (
const scalar p, const scalar p,
const scalar T, const scalar T,
@ -174,18 +124,8 @@ Foam::scalar Foam::IrreversibleReaction
} }
template template<class ReactionThermo, class ReactionRate>
< Foam::scalar Foam::IrreversibleReaction<ReactionThermo, ReactionRate>::dkfdT
template<class> class ReactionType,
class ReactionThermo,
class ReactionRate
>
Foam::scalar Foam::IrreversibleReaction
<
ReactionType,
ReactionThermo,
ReactionRate
>::dkfdT
( (
const scalar p, const scalar p,
const scalar T, const scalar T,
@ -197,18 +137,8 @@ Foam::scalar Foam::IrreversibleReaction
} }
template template<class ReactionThermo, class ReactionRate>
< Foam::scalar Foam::IrreversibleReaction<ReactionThermo, ReactionRate>::dkrdT
template<class> class ReactionType,
class ReactionThermo,
class ReactionRate
>
Foam::scalar Foam::IrreversibleReaction
<
ReactionType,
ReactionThermo,
ReactionRate
>::dkrdT
( (
const scalar p, const scalar p,
const scalar T, const scalar T,
@ -222,36 +152,16 @@ Foam::scalar Foam::IrreversibleReaction
} }
template template<class ReactionThermo, class ReactionRate>
<
template<class> class ReactionType,
class ReactionThermo,
class ReactionRate
>
const Foam::List<Foam::Tuple2<Foam::label, Foam::scalar>>& const Foam::List<Foam::Tuple2<Foam::label, Foam::scalar>>&
Foam::IrreversibleReaction Foam::IrreversibleReaction<ReactionThermo, ReactionRate>::beta() const
<
ReactionType,
ReactionThermo,
ReactionRate
>::beta() const
{ {
return k_.beta(); return k_.beta();
} }
template template<class ReactionThermo, class ReactionRate>
< void Foam::IrreversibleReaction<ReactionThermo, ReactionRate>::dcidc
template<class> class ReactionType,
class ReactionThermo,
class ReactionRate
>
void Foam::IrreversibleReaction
<
ReactionType,
ReactionThermo,
ReactionRate
>::dcidc
( (
const scalar p, const scalar p,
const scalar T, const scalar T,
@ -264,18 +174,8 @@ void Foam::IrreversibleReaction
} }
template template<class ReactionThermo, class ReactionRate>
< Foam::scalar Foam::IrreversibleReaction<ReactionThermo, ReactionRate>::dcidT
template<class> class ReactionType,
class ReactionThermo,
class ReactionRate
>
Foam::scalar Foam::IrreversibleReaction
<
ReactionType,
ReactionThermo,
ReactionRate
>::dcidT
( (
const scalar p, const scalar p,
const scalar T, const scalar T,
@ -287,19 +187,13 @@ Foam::scalar Foam::IrreversibleReaction
} }
template template<class ReactionThermo, class ReactionRate>
< void Foam::IrreversibleReaction<ReactionThermo, ReactionRate>::write
template<class> class ReactionType,
class ReactionThermo,
class ReactionRate
>
void Foam::IrreversibleReaction<ReactionType, ReactionThermo, ReactionRate>::
write
( (
Ostream& os Ostream& os
) const ) const
{ {
ReactionType<ReactionThermo>::write(os); Reaction<ReactionThermo>::write(os);
k_.write(os); k_.write(os);
} }

View File

@ -46,15 +46,10 @@ namespace Foam
Class IrreversibleReaction Declaration Class IrreversibleReaction Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
template template<class ReactionThermo, class ReactionRate>
<
template<class> class ReactionType,
class ReactionThermo,
class ReactionRate
>
class IrreversibleReaction class IrreversibleReaction
: :
public ReactionType<ReactionThermo> public Reaction<ReactionThermo>
{ {
// Private Data // Private Data
@ -72,19 +67,14 @@ public:
//- Construct from components //- Construct from components
IrreversibleReaction IrreversibleReaction
( (
const ReactionType<ReactionThermo>& reaction, const Reaction<ReactionThermo>& reaction,
const ReactionRate& reactionRate const ReactionRate& reactionRate
); );
//- Construct as copy given new speciesTable //- Construct as copy given new speciesTable
IrreversibleReaction IrreversibleReaction
( (
const IrreversibleReaction const IrreversibleReaction<ReactionThermo, ReactionRate>&,
<
ReactionType,
ReactionThermo,
ReactionRate
>&,
const speciesTable& species const speciesTable& species
); );
@ -110,12 +100,7 @@ public:
{ {
return autoPtr<Reaction<ReactionThermo>> return autoPtr<Reaction<ReactionThermo>>
( (
new IrreversibleReaction new IrreversibleReaction<ReactionThermo, ReactionRate>(*this)
<
ReactionType,
ReactionThermo,
ReactionRate
>(*this)
); );
} }
@ -127,12 +112,7 @@ public:
{ {
return autoPtr<Reaction<ReactionThermo>> return autoPtr<Reaction<ReactionThermo>>
( (
new IrreversibleReaction new IrreversibleReaction<ReactionThermo, ReactionRate>
<
ReactionType,
ReactionThermo,
ReactionRate
>
( (
*this, *this,
species species
@ -240,12 +220,7 @@ public:
//- Disallow default bitwise assignment //- Disallow default bitwise assignment
void operator= void operator=
( (
const IrreversibleReaction const IrreversibleReaction<ReactionThermo, ReactionRate>&
<
ReactionType,
ReactionThermo,
ReactionRate
>&
) = delete; ) = delete;
}; };

View File

@ -27,43 +27,23 @@ License
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template template<class ReactionThermo, class ReactionRate>
< Foam::NonEquilibriumReversibleReaction<ReactionThermo, ReactionRate>::
template<class> class ReactionType,
class ReactionThermo,
class ReactionRate
>
Foam::NonEquilibriumReversibleReaction
<
ReactionType,
ReactionThermo,
ReactionRate
>::
NonEquilibriumReversibleReaction NonEquilibriumReversibleReaction
( (
const ReactionType<ReactionThermo>& reaction, const Reaction<ReactionThermo>& reaction,
const ReactionRate& forwardReactionRate, const ReactionRate& forwardReactionRate,
const ReactionRate& reverseReactionRate const ReactionRate& reverseReactionRate
) )
: :
ReactionType<ReactionThermo>(reaction), Reaction<ReactionThermo>(reaction),
fk_(forwardReactionRate), fk_(forwardReactionRate),
rk_(reverseReactionRate) rk_(reverseReactionRate)
{} {}
template template<class ReactionThermo, class ReactionRate>
< Foam::NonEquilibriumReversibleReaction<ReactionThermo, ReactionRate>::
template<class> class ReactionType,
class ReactionThermo,
class ReactionRate
>
Foam::NonEquilibriumReversibleReaction
<
ReactionType,
ReactionThermo,
ReactionRate
>::
NonEquilibriumReversibleReaction NonEquilibriumReversibleReaction
( (
const speciesTable& species, const speciesTable& species,
@ -71,24 +51,14 @@ NonEquilibriumReversibleReaction
const dictionary& dict const dictionary& dict
) )
: :
ReactionType<ReactionThermo>(species, thermoDatabase, dict), Reaction<ReactionThermo>(species, thermoDatabase, dict),
fk_(species, dict.subDict("forward")), fk_(species, dict.subDict("forward")),
rk_(species, dict.subDict("reverse")) rk_(species, dict.subDict("reverse"))
{} {}
template template<class ReactionThermo, class ReactionRate>
< Foam::NonEquilibriumReversibleReaction<ReactionThermo, ReactionRate>::
template<class> class ReactionType,
class ReactionThermo,
class ReactionRate
>
Foam::NonEquilibriumReversibleReaction
<
ReactionType,
ReactionThermo,
ReactionRate
>::
NonEquilibriumReversibleReaction NonEquilibriumReversibleReaction
( (
const speciesTable& species, const speciesTable& species,
@ -97,36 +67,21 @@ NonEquilibriumReversibleReaction
const dictionary& dict const dictionary& dict
) )
: :
ReactionType<ReactionThermo>(species, thermoDatabase, dict), Reaction<ReactionThermo>(species, thermoDatabase, dict),
fk_(species, ob, dict.subDict("forward")), fk_(species, ob, dict.subDict("forward")),
rk_(species, ob, dict.subDict("reverse")) rk_(species, ob, dict.subDict("reverse"))
{} {}
template template<class ReactionThermo, class ReactionRate>
< Foam::NonEquilibriumReversibleReaction<ReactionThermo, ReactionRate>::
template<class> class ReactionType,
class ReactionThermo,
class ReactionRate
>
Foam::NonEquilibriumReversibleReaction
<
ReactionType,
ReactionThermo,
ReactionRate
>::
NonEquilibriumReversibleReaction NonEquilibriumReversibleReaction
( (
const NonEquilibriumReversibleReaction const NonEquilibriumReversibleReaction<ReactionThermo, ReactionRate>& nerr,
<
ReactionType,
ReactionThermo,
ReactionRate
>& nerr,
const speciesTable& species const speciesTable& species
) )
: :
ReactionType<ReactionThermo>(nerr, species), Reaction<ReactionThermo>(nerr, species),
fk_(nerr.fk_), fk_(nerr.fk_),
rk_(nerr.rk_) rk_(nerr.rk_)
{} {}
@ -134,19 +89,9 @@ NonEquilibriumReversibleReaction
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template template<class ReactionThermo, class ReactionRate>
<
template<class> class ReactionType,
class ReactionThermo,
class ReactionRate
>
Foam::scalar Foam::scalar
Foam::NonEquilibriumReversibleReaction Foam::NonEquilibriumReversibleReaction<ReactionThermo, ReactionRate>::kf
<
ReactionType,
ReactionThermo,
ReactionRate
>::kf
( (
const scalar p, const scalar p,
const scalar T, const scalar T,
@ -158,19 +103,9 @@ Foam::NonEquilibriumReversibleReaction
} }
template template<class ReactionThermo, class ReactionRate>
<
template<class> class ReactionType,
class ReactionThermo,
class ReactionRate
>
Foam::scalar Foam::scalar
Foam::NonEquilibriumReversibleReaction Foam::NonEquilibriumReversibleReaction<ReactionThermo, ReactionRate>::kr
<
ReactionType,
ReactionThermo,
ReactionRate
>::kr
( (
const scalar, const scalar,
const scalar p, const scalar p,
@ -183,19 +118,9 @@ Foam::NonEquilibriumReversibleReaction
} }
template template<class ReactionThermo, class ReactionRate>
<
template<class> class ReactionType,
class ReactionThermo,
class ReactionRate
>
Foam::scalar Foam::scalar
Foam::NonEquilibriumReversibleReaction Foam::NonEquilibriumReversibleReaction<ReactionThermo, ReactionRate>::kr
<
ReactionType,
ReactionThermo,
ReactionRate
>::kr
( (
const scalar p, const scalar p,
const scalar T, const scalar T,
@ -207,19 +132,9 @@ Foam::NonEquilibriumReversibleReaction
} }
template template<class ReactionThermo, class ReactionRate>
<
template<class> class ReactionType,
class ReactionThermo,
class ReactionRate
>
Foam::scalar Foam::scalar
Foam::NonEquilibriumReversibleReaction Foam::NonEquilibriumReversibleReaction<ReactionThermo, ReactionRate>::dkfdT
<
ReactionType,
ReactionThermo,
ReactionRate
>::dkfdT
( (
const scalar p, const scalar p,
const scalar T, const scalar T,
@ -231,19 +146,9 @@ Foam::NonEquilibriumReversibleReaction
} }
template template<class ReactionThermo, class ReactionRate>
<
template<class> class ReactionType,
class ReactionThermo,
class ReactionRate
>
Foam::scalar Foam::scalar
Foam::NonEquilibriumReversibleReaction Foam::NonEquilibriumReversibleReaction<ReactionThermo, ReactionRate>::dkrdT
<
ReactionType,
ReactionThermo,
ReactionRate
>::dkrdT
( (
const scalar p, const scalar p,
const scalar T, const scalar T,
@ -257,36 +162,18 @@ Foam::NonEquilibriumReversibleReaction
} }
template template<class ReactionThermo, class ReactionRate>
<
template<class> class ReactionType,
class ReactionThermo,
class ReactionRate
>
const Foam::List<Foam::Tuple2<Foam::label, Foam::scalar>>& const Foam::List<Foam::Tuple2<Foam::label, Foam::scalar>>&
Foam::NonEquilibriumReversibleReaction Foam::NonEquilibriumReversibleReaction<ReactionThermo, ReactionRate>::
< beta() const
ReactionType,
ReactionThermo,
ReactionRate
>::beta() const
{ {
return fk_.beta(); return fk_.beta();
} }
template template<class ReactionThermo, class ReactionRate>
< void
template<class> class ReactionType, Foam::NonEquilibriumReversibleReaction<ReactionThermo, ReactionRate>::dcidc
class ReactionThermo,
class ReactionRate
>
void Foam::NonEquilibriumReversibleReaction
<
ReactionType,
ReactionThermo,
ReactionRate
>::dcidc
( (
const scalar p, const scalar p,
const scalar T, const scalar T,
@ -299,18 +186,9 @@ void Foam::NonEquilibriumReversibleReaction
} }
template template<class ReactionThermo, class ReactionRate>
< Foam::scalar
template<class> class ReactionType, Foam::NonEquilibriumReversibleReaction<ReactionThermo, ReactionRate>::dcidT
class ReactionThermo,
class ReactionRate
>
Foam::scalar Foam::NonEquilibriumReversibleReaction
<
ReactionType,
ReactionThermo,
ReactionRate
>::dcidT
( (
const scalar p, const scalar p,
const scalar T, const scalar T,
@ -322,23 +200,14 @@ Foam::scalar Foam::NonEquilibriumReversibleReaction
} }
template template<class ReactionThermo, class ReactionRate>
< void
template<class> class ReactionType, Foam::NonEquilibriumReversibleReaction<ReactionThermo, ReactionRate>::write
class ReactionThermo,
class ReactionRate
>
void Foam::NonEquilibriumReversibleReaction
<
ReactionType,
ReactionThermo,
ReactionRate
>::write
( (
Ostream& os Ostream& os
) const ) const
{ {
ReactionType<ReactionThermo>::write(os); Reaction<ReactionThermo>::write(os);
os << indent << "forward" << nl; os << indent << "forward" << nl;
os << indent << token::BEGIN_BLOCK << nl; os << indent << token::BEGIN_BLOCK << nl;

View File

@ -47,15 +47,10 @@ namespace Foam
Class NonEquilibriumReversibleReaction Declaration Class NonEquilibriumReversibleReaction Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
template template<class ReactionThermo, class ReactionRate>
<
template<class> class ReactionType,
class ReactionThermo,
class ReactionRate
>
class NonEquilibriumReversibleReaction class NonEquilibriumReversibleReaction
: :
public ReactionType<ReactionThermo> public Reaction<ReactionThermo>
{ {
// Private Data // Private Data
@ -74,7 +69,7 @@ public:
//- Construct from components //- Construct from components
NonEquilibriumReversibleReaction NonEquilibriumReversibleReaction
( (
const ReactionType<ReactionThermo>& reaction, const Reaction<ReactionThermo>& reaction,
const ReactionRate& forwardReactionRate, const ReactionRate& forwardReactionRate,
const ReactionRate& reverseReactionRate const ReactionRate& reverseReactionRate
); );
@ -83,7 +78,10 @@ public:
NonEquilibriumReversibleReaction NonEquilibriumReversibleReaction
( (
const NonEquilibriumReversibleReaction const NonEquilibriumReversibleReaction
<ReactionType, ReactionThermo, ReactionRate>&, <
ReactionThermo,
ReactionRate
>&,
const speciesTable& species const speciesTable& species
); );
@ -105,26 +103,35 @@ public:
); );
//- Construct and return a clone //- Construct and return a clone
virtual autoPtr<ReactionType<ReactionThermo>> clone() const virtual autoPtr<Reaction<ReactionThermo>> clone() const
{ {
return autoPtr<ReactionType<ReactionThermo>> return autoPtr<Reaction<ReactionThermo>>
( (
new NonEquilibriumReversibleReaction new NonEquilibriumReversibleReaction
<ReactionType, ReactionThermo, ReactionRate>(*this) <
ReactionThermo,
ReactionRate
>(*this)
); );
} }
//- Construct and return a clone with new speciesTable //- Construct and return a clone with new speciesTable
virtual autoPtr<ReactionType<ReactionThermo>> clone virtual autoPtr<Reaction<ReactionThermo>> clone
( (
const speciesTable& species const speciesTable& species
) const ) const
{ {
return autoPtr<ReactionType<ReactionThermo>> return autoPtr<Reaction<ReactionThermo>>
( (
new NonEquilibriumReversibleReaction new NonEquilibriumReversibleReaction
<ReactionType, ReactionThermo, ReactionRate> <
(*this, species) ReactionThermo,
ReactionRate
>
(
*this,
species
)
); );
} }
@ -229,7 +236,6 @@ public:
( (
const NonEquilibriumReversibleReaction const NonEquilibriumReversibleReaction
< <
ReactionType,
ReactionThermo, ReactionThermo,
ReactionRate ReactionRate
>& >&

View File

@ -164,8 +164,20 @@ Foam::Reaction<ReactionThermo>::New
{ {
const word& reactionTypeName = dict.lookup("type"); const word& reactionTypeName = dict.lookup("type");
typename dictionaryConstructorTable::iterator cstrIter typename dictionaryConstructorTable::iterator cstrIter =
= dictionaryConstructorTablePtr_->find(reactionTypeName); dictionaryConstructorTablePtr_->find(reactionTypeName);
// Backwards compatibility check. Reaction names used to have "Reaction"
// (Reaction<ReactionThermo>::typeName_()) appended. This was removed as it
// is unnecessary given the context in which the reaction is specified. If
// this reaction name was not found, search also for the old name.
if (cstrIter == dictionaryConstructorTablePtr_->end())
{
cstrIter = dictionaryConstructorTablePtr_->find
(
reactionTypeName.removeTrailing(typeName_())
);
}
if (cstrIter == dictionaryConstructorTablePtr_->end()) if (cstrIter == dictionaryConstructorTablePtr_->end())
{ {
@ -200,17 +212,34 @@ Foam::Reaction<ReactionThermo>::New
{ {
return New(species, thermoDatabase, dict); return New(species, thermoDatabase, dict);
} }
else
{
const word& reactionTypeName = dict.lookup("type"); const word& reactionTypeName = dict.lookup("type");
typename objectRegistryConstructorTable::iterator cstrIter typename objectRegistryConstructorTable::iterator cstrIter =
= objectRegistryConstructorTablePtr_->find(reactionTypeName); objectRegistryConstructorTablePtr_->find(reactionTypeName);
// Backwards compatibility check. See above.
if (cstrIter == objectRegistryConstructorTablePtr_->end())
{
cstrIter = objectRegistryConstructorTablePtr_->find
(
reactionTypeName.removeTrailing(typeName_())
);
}
if (cstrIter == objectRegistryConstructorTablePtr_->end()) if (cstrIter == objectRegistryConstructorTablePtr_->end())
{ {
typename dictionaryConstructorTable::iterator cstrIter typename dictionaryConstructorTable::iterator cstrIter =
= dictionaryConstructorTablePtr_->find(reactionTypeName); dictionaryConstructorTablePtr_->find(reactionTypeName);
// Backwards compatibility check. See above.
if (cstrIter == dictionaryConstructorTablePtr_->end())
{
cstrIter = dictionaryConstructorTablePtr_->find
(
reactionTypeName.removeTrailing(typeName_())
);
}
if (cstrIter == dictionaryConstructorTablePtr_->end()) if (cstrIter == dictionaryConstructorTablePtr_->end())
{ {
@ -234,7 +263,6 @@ Foam::Reaction<ReactionThermo>::New
cstrIter()(species, thermoDatabase, ob, dict) cstrIter()(species, thermoDatabase, ob, dict)
); );
} }
}
template<class ReactionThermo> template<class ReactionThermo>

View File

@ -27,31 +27,21 @@ License
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template template<class ReactionThermo, class ReactionRate>
< Foam::ReversibleReaction<ReactionThermo, ReactionRate>::
template<class> class ReactionType,
class ReactionThermo,
class ReactionRate
>
Foam::ReversibleReaction<ReactionType, ReactionThermo, ReactionRate>::
ReversibleReaction ReversibleReaction
( (
const ReactionType<ReactionThermo>& reaction, const Reaction<ReactionThermo>& reaction,
const ReactionRate& k const ReactionRate& k
) )
: :
ReactionType<ReactionThermo>(reaction), Reaction<ReactionThermo>(reaction),
k_(k) k_(k)
{} {}
template template<class ReactionThermo, class ReactionRate>
< Foam::ReversibleReaction<ReactionThermo, ReactionRate>::
template<class> class ReactionType,
class ReactionThermo,
class ReactionRate
>
Foam::ReversibleReaction<ReactionType, ReactionThermo, ReactionRate>::
ReversibleReaction ReversibleReaction
( (
const speciesTable& species, const speciesTable& species,
@ -59,18 +49,13 @@ ReversibleReaction
const dictionary& dict const dictionary& dict
) )
: :
ReactionType<ReactionThermo>(species, thermoDatabase, dict), Reaction<ReactionThermo>(species, thermoDatabase, dict),
k_(species, dict) k_(species, dict)
{} {}
template template<class ReactionThermo, class ReactionRate>
< Foam::ReversibleReaction<ReactionThermo, ReactionRate>::
template<class> class ReactionType,
class ReactionThermo,
class ReactionRate
>
Foam::ReversibleReaction<ReactionType, ReactionThermo, ReactionRate>::
ReversibleReaction ReversibleReaction
( (
const speciesTable& species, const speciesTable& species,
@ -79,43 +64,28 @@ ReversibleReaction
const dictionary& dict const dictionary& dict
) )
: :
ReactionType<ReactionThermo>(species, thermoDatabase, dict), Reaction<ReactionThermo>(species, thermoDatabase, dict),
k_(species, ob, dict) k_(species, ob, dict)
{} {}
template template<class ReactionThermo, class ReactionRate>
< Foam::ReversibleReaction<ReactionThermo, ReactionRate>::
template<class> class ReactionType,
class ReactionThermo,
class ReactionRate
>
Foam::ReversibleReaction<ReactionType, ReactionThermo, ReactionRate>::
ReversibleReaction ReversibleReaction
( (
const ReversibleReaction<ReactionType, ReactionThermo, ReactionRate>& rr, const ReversibleReaction<ReactionThermo, ReactionRate>& rr,
const speciesTable& species const speciesTable& species
) )
: :
ReactionType<ReactionThermo>(rr, species), Reaction<ReactionThermo>(rr, species),
k_(rr.k_) k_(rr.k_)
{} {}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template template<class ReactionThermo, class ReactionRate>
< Foam::scalar Foam::ReversibleReaction<ReactionThermo, ReactionRate>::kf
template<class> class ReactionType,
class ReactionThermo,
class ReactionRate
>
Foam::scalar Foam::ReversibleReaction
<
ReactionType,
ReactionThermo,
ReactionRate
>::kf
( (
const scalar p, const scalar p,
const scalar T, const scalar T,
@ -127,18 +97,8 @@ Foam::scalar Foam::ReversibleReaction
} }
template template<class ReactionThermo, class ReactionRate>
< Foam::scalar Foam::ReversibleReaction<ReactionThermo, ReactionRate>::kr
template<class> class ReactionType,
class ReactionThermo,
class ReactionRate
>
Foam::scalar Foam::ReversibleReaction
<
ReactionType,
ReactionThermo,
ReactionRate
>::kr
( (
const scalar kfwd, const scalar kfwd,
const scalar p, const scalar p,
@ -151,18 +111,8 @@ Foam::scalar Foam::ReversibleReaction
} }
template template<class ReactionThermo, class ReactionRate>
< Foam::scalar Foam::ReversibleReaction<ReactionThermo, ReactionRate>::kr
template<class> class ReactionType,
class ReactionThermo,
class ReactionRate
>
Foam::scalar Foam::ReversibleReaction
<
ReactionType,
ReactionThermo,
ReactionRate
>::kr
( (
const scalar p, const scalar p,
const scalar T, const scalar T,
@ -174,18 +124,8 @@ Foam::scalar Foam::ReversibleReaction
} }
template template<class ReactionThermo, class ReactionRate>
< Foam::scalar Foam::ReversibleReaction<ReactionThermo, ReactionRate>::dkfdT
template<class> class ReactionType,
class ReactionThermo,
class ReactionRate
>
Foam::scalar Foam::ReversibleReaction
<
ReactionType,
ReactionThermo,
ReactionRate
>::dkfdT
( (
const scalar p, const scalar p,
const scalar T, const scalar T,
@ -197,18 +137,8 @@ Foam::scalar Foam::ReversibleReaction
} }
template template<class ReactionThermo, class ReactionRate>
< Foam::scalar Foam::ReversibleReaction<ReactionThermo, ReactionRate>::dkrdT
template<class> class ReactionType,
class ReactionThermo,
class ReactionRate
>
Foam::scalar Foam::ReversibleReaction
<
ReactionType,
ReactionThermo,
ReactionRate
>::dkrdT
( (
const scalar p, const scalar p,
const scalar T, const scalar T,
@ -224,36 +154,16 @@ Foam::scalar Foam::ReversibleReaction
} }
template template<class ReactionThermo, class ReactionRate>
<
template<class> class ReactionType,
class ReactionThermo,
class ReactionRate
>
const Foam::List<Foam::Tuple2<Foam::label, Foam::scalar>>& const Foam::List<Foam::Tuple2<Foam::label, Foam::scalar>>&
Foam::ReversibleReaction Foam::ReversibleReaction<ReactionThermo, ReactionRate>::beta() const
<
ReactionType,
ReactionThermo,
ReactionRate
>::beta() const
{ {
return k_.beta(); return k_.beta();
} }
template template<class ReactionThermo, class ReactionRate>
< void Foam::ReversibleReaction<ReactionThermo, ReactionRate>::dcidc
template<class> class ReactionType,
class ReactionThermo,
class ReactionRate
>
void Foam::ReversibleReaction
<
ReactionType,
ReactionThermo,
ReactionRate
>::dcidc
( (
const scalar p, const scalar p,
const scalar T, const scalar T,
@ -266,18 +176,8 @@ void Foam::ReversibleReaction
} }
template template<class ReactionThermo, class ReactionRate>
< Foam::scalar Foam::ReversibleReaction<ReactionThermo, ReactionRate>::dcidT
template<class> class ReactionType,
class ReactionThermo,
class ReactionRate
>
Foam::scalar Foam::ReversibleReaction
<
ReactionType,
ReactionThermo,
ReactionRate
>::dcidT
( (
const scalar p, const scalar p,
const scalar T, const scalar T,
@ -289,18 +189,8 @@ Foam::scalar Foam::ReversibleReaction
} }
template template<class ReactionThermo, class ReactionRate>
< void Foam::ReversibleReaction<ReactionThermo, ReactionRate>::write
template<class> class ReactionType,
class ReactionThermo,
class ReactionRate
>
void Foam::ReversibleReaction
<
ReactionType,
ReactionThermo,
ReactionRate
>::write
( (
Ostream& os Ostream& os
) const ) const

View File

@ -47,15 +47,10 @@ namespace Foam
Class ReversibleReaction Declaration Class ReversibleReaction Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
template template<class ReactionThermo, class ReactionRate>
<
template<class> class ReactionType,
class ReactionThermo,
class ReactionRate
>
class ReversibleReaction class ReversibleReaction
: :
public ReactionType<ReactionThermo> public Reaction<ReactionThermo>
{ {
// Private Data // Private Data
@ -73,19 +68,14 @@ public:
//- Construct from components //- Construct from components
ReversibleReaction ReversibleReaction
( (
const ReactionType<ReactionThermo>& reaction, const Reaction<ReactionThermo>& reaction,
const ReactionRate& k const ReactionRate& k
); );
//- Construct as copy given new speciesTable //- Construct as copy given new speciesTable
ReversibleReaction ReversibleReaction
( (
const ReversibleReaction const ReversibleReaction<ReactionThermo, ReactionRate>&,
<
ReactionType,
ReactionThermo,
ReactionRate
>&,
const speciesTable& species const speciesTable& species
); );
@ -107,29 +97,23 @@ public:
); );
//- Construct and return a clone //- Construct and return a clone
virtual autoPtr<ReactionType<ReactionThermo>> clone() const virtual autoPtr<Reaction<ReactionThermo>> clone() const
{ {
return autoPtr<ReactionType<ReactionThermo>> return autoPtr<Reaction<ReactionThermo>>
( (
new ReversibleReaction new ReversibleReaction<ReactionThermo, ReactionRate>(*this)
<
ReactionType,
ReactionThermo,
ReactionRate
>(*this)
); );
} }
//- Construct and return a clone with new speciesTable //- Construct and return a clone with new speciesTable
virtual autoPtr<ReactionType<ReactionThermo>> clone virtual autoPtr<Reaction<ReactionThermo>> clone
( (
const speciesTable& species const speciesTable& species
) const ) const
{ {
return autoPtr<ReactionType<ReactionThermo>> return autoPtr<Reaction<ReactionThermo>>
( (
new ReversibleReaction new ReversibleReaction<ReactionThermo, ReactionRate>
<ReactionType, ReactionThermo, ReactionRate>
( (
*this, *this,
species species
@ -236,12 +220,7 @@ public:
//- Disallow default bitwise assignment //- Disallow default bitwise assignment
void operator= void operator=
( (
const ReversibleReaction const ReversibleReaction<ReactionThermo, ReactionRate>&
<
ReactionType,
ReactionThermo,
ReactionRate
>&
) = delete; ) = delete;
}; };

View File

@ -8,7 +8,7 @@
reaction reaction
{ {
type irreversibleInfiniteReaction; type irreversibleInfinite;
reaction "CH4 + 2O2 + 7.5N2 = CO2 + 2H2O + 7.5N2"; reaction "CH4 + 2O2 + 7.5N2 = CO2 + 2H2O + 7.5N2";
} }

View File

@ -8,7 +8,7 @@
reaction reaction
{ {
type irreversibleInfiniteReaction; type irreversibleInfinite;
reaction "CH4 + 2O2 + 7.5N2 = CO2 + 2H2O + 7.5N2"; reaction "CH4 + 2O2 + 7.5N2 = CO2 + 2H2O + 7.5N2";
} }

View File

@ -20,7 +20,7 @@ reactions
{ {
methaneReaction methaneReaction
{ {
type irreversibleArrheniusReaction; type irreversibleArrhenius;
reaction "CH4 + 2O2 = CO2 + 2H2O"; reaction "CH4 + 2O2 = CO2 + 2H2O";
A 5.2e16; A 5.2e16;
beta 0; beta 0;

View File

@ -20,7 +20,7 @@ reactions
{ {
methaneReaction methaneReaction
{ {
type irreversibleArrheniusReaction; type irreversibleArrhenius;
reaction "CH4 + 2O2 = CO2 + 2H2O"; reaction "CH4 + 2O2 = CO2 + 2H2O";
A 5.2e16; A 5.2e16;
beta 0; beta 0;

View File

@ -27,7 +27,7 @@ reactions
{ {
methaneReaction methaneReaction
{ {
type irreversibleArrheniusReaction; type irreversibleArrhenius;
reaction "CH4^0.2 + 2O2^1.3 = CO2 + 2H2O"; reaction "CH4^0.2 + 2O2^1.3 = CO2 + 2H2O";
A 2.11873e+11; A 2.11873e+11;
beta 0; beta 0;

View File

@ -2,7 +2,7 @@ reactions
{ {
methaneReaction methaneReaction
{ {
type irreversibleArrheniusReaction; type irreversibleArrhenius;
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;
@ -12,7 +12,7 @@ reactions
} }
hydrogenReaction hydrogenReaction
{ {
type irreversibleArrheniusReaction; type irreversibleArrhenius;
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;

View File

@ -20,7 +20,7 @@ reactions
{ {
methaneReaction methaneReaction
{ {
type irreversibleArrheniusReaction; type irreversibleArrhenius;
reaction "CH4 + 2O2 = CO2 + 2H2O"; reaction "CH4 + 2O2 = CO2 + 2H2O";
A 5.2e16; A 5.2e16;
beta 0; beta 0;

View File

@ -2,7 +2,7 @@ reactions
{ {
waterGasShift waterGasShift
{ {
type reversibleArrheniusReaction; type reversibleArrhenius;
reaction "CO^0.93 + H2O^0.24 = CO2^0.69 + H2^1"; reaction "CO^0.93 + H2O^0.24 = CO2^0.69 + H2^1";

View File

@ -25,7 +25,7 @@ reactions
{ {
oxidation oxidation
{ {
type irreversibleArrheniusReaction; type irreversibleArrhenius;
reaction "O2^0 + TiCl4 = TiO2 + 2Cl2"; reaction "O2^0 + TiCl4 = TiO2 + 2Cl2";

View File

@ -29,7 +29,7 @@ reactions
{ {
oxidation oxidation
{ {
type irreversibleArrheniusReaction; type irreversibleArrhenius;
reaction "O2^0 + TiCl4 = TiO2 + 2Cl2"; reaction "O2^0 + TiCl4 = TiO2 + 2Cl2";
@ -40,7 +40,7 @@ reactions
oxidationAtSurface oxidationAtSurface
{ {
type irreversibleSurfaceArrheniusReaction; type irreversibleSurfaceArrhenius;
reaction "O2^0 + TiCl4 = TiO2_s + 2Cl2"; reaction "O2^0 + TiCl4 = TiO2_s + 2Cl2";