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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -164,8 +164,20 @@ Foam::Reaction<ReactionThermo>::New
{
const word& reactionTypeName = dict.lookup("type");
typename dictionaryConstructorTable::iterator cstrIter
= dictionaryConstructorTablePtr_->find(reactionTypeName);
typename dictionaryConstructorTable::iterator cstrIter =
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())
{
@ -200,40 +212,56 @@ Foam::Reaction<ReactionThermo>::New
{
return New(species, thermoDatabase, dict);
}
else
const word& reactionTypeName = dict.lookup("type");
typename objectRegistryConstructorTable::iterator cstrIter =
objectRegistryConstructorTablePtr_->find(reactionTypeName);
// Backwards compatibility check. See above.
if (cstrIter == objectRegistryConstructorTablePtr_->end())
{
const word& reactionTypeName = dict.lookup("type");
cstrIter = objectRegistryConstructorTablePtr_->find
(
reactionTypeName.removeTrailing(typeName_())
);
}
typename objectRegistryConstructorTable::iterator cstrIter
= objectRegistryConstructorTablePtr_->find(reactionTypeName);
if (cstrIter == objectRegistryConstructorTablePtr_->end())
{
typename dictionaryConstructorTable::iterator cstrIter =
dictionaryConstructorTablePtr_->find(reactionTypeName);
if (cstrIter == objectRegistryConstructorTablePtr_->end())
// Backwards compatibility check. See above.
if (cstrIter == dictionaryConstructorTablePtr_->end())
{
typename dictionaryConstructorTable::iterator cstrIter
= dictionaryConstructorTablePtr_->find(reactionTypeName);
if (cstrIter == dictionaryConstructorTablePtr_->end())
{
FatalErrorInFunction
<< "Unknown reaction type "
<< reactionTypeName << nl << nl
<< "Valid reaction types are :" << nl
<< dictionaryConstructorTablePtr_->sortedToc()
<< objectRegistryConstructorTablePtr_->sortedToc()
<< exit(FatalError);
}
return autoPtr<Reaction<ReactionThermo>>
cstrIter = dictionaryConstructorTablePtr_->find
(
cstrIter()(species, thermoDatabase, dict)
reactionTypeName.removeTrailing(typeName_())
);
}
if (cstrIter == dictionaryConstructorTablePtr_->end())
{
FatalErrorInFunction
<< "Unknown reaction type "
<< reactionTypeName << nl << nl
<< "Valid reaction types are :" << nl
<< dictionaryConstructorTablePtr_->sortedToc()
<< objectRegistryConstructorTablePtr_->sortedToc()
<< exit(FatalError);
}
return autoPtr<Reaction<ReactionThermo>>
(
cstrIter()(species, thermoDatabase, ob, dict)
cstrIter()(species, thermoDatabase, dict)
);
}
return autoPtr<Reaction<ReactionThermo>>
(
cstrIter()(species, thermoDatabase, ob, dict)
);
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -2,7 +2,7 @@ reactions
{
methaneReaction
{
type irreversibleArrheniusReaction;
type irreversibleArrhenius;
reaction "CH4 + 2O2^1.0 = CO2 + 2H2O^1.0";
A 7e+06;
beta 0;
@ -12,7 +12,7 @@ reactions
}
hydrogenReaction
{
type irreversibleArrheniusReaction;
type irreversibleArrhenius;
reaction "H2 + 0.5O2^1.0 = H2O";
A 4.74342e+12;
beta 0;

View File

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

View File

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

View File

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

View File

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