MichaelisMentenReactionRate: Michaelis-Menten reaction rate for enzymatic reactions

Updated chemFoam to support liquid reactions
This commit is contained in:
Henry Weller
2018-06-25 10:28:21 +01:00
parent b45c527ae3
commit 19fb483c6d
8 changed files with 435 additions and 25 deletions

View File

@ -41,6 +41,98 @@ Description
#include "basicSpecieMixture.H" #include "basicSpecieMixture.H"
#include "cellModeller.H" #include "cellModeller.H"
template<class ThermoType>
scalarList W(const rhoReactionThermo& thermo)
{
const PtrList<ThermoType>& specieData =
dynamicCast<const reactingMixture<ThermoType>>(thermo)
.speciesData();
scalarList W(specieData.size());
forAll(specieData, i)
{
W[i] = specieData[i].W();
}
return W;
}
template<class ThermoType>
scalar h0
(
const rhoReactionThermo& thermo,
const scalarList& Y,
const scalar p,
const scalar T
)
{
const PtrList<ThermoType>& specieData =
dynamic_cast<const reactingMixture<ThermoType>&>(thermo)
.speciesData();
scalar h0 = 0;
forAll(Y, i)
{
h0 += Y[i]*specieData[i].Hs(p, T);
}
return h0;
}
scalarList W(const rhoReactionThermo& thermo)
{
if (isA<reactingMixture<gasHThermoPhysics>>(thermo))
{
return W<gasHThermoPhysics>(thermo);
}
else if (isA<reactingMixture<constFluidHThermoPhysics>>(thermo))
{
return W<constFluidHThermoPhysics>(thermo);
}
else
{
FatalErrorInFunction
<< "Thermodynamics type " << thermo.type()
<< " not supported by chemFoam"
<< exit(FatalError);
return scalarList::null();
}
}
scalar h0
(
const rhoReactionThermo& thermo,
const scalarList& Y,
const scalar p,
const scalar T
)
{
if (isA<reactingMixture<gasHThermoPhysics>>(thermo))
{
return h0<gasHThermoPhysics>(thermo, Y, p, T);
}
else if (isA<reactingMixture<constFluidHThermoPhysics>>(thermo))
{
return h0<constFluidHThermoPhysics>(thermo, Y, p, T);
}
else
{
FatalErrorInFunction
<< "Thermodynamics type " << thermo.type()
<< " not supported by chemFoam"
<< exit(FatalError);
return 0;
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int main(int argc, char *argv[]) int main(int argc, char *argv[])

View File

@ -5,7 +5,7 @@
scalar invW = 0.0; scalar invW = 0.0;
forAll(Y, i) forAll(Y, i)
{ {
invW += Y[i][0]/specieData[i].W(); invW += Y[i][0]/W[i];
} }
Rspecific[0] = 1000.0*constant::physicoChemical::R.value()*invW; Rspecific[0] = 1000.0*constant::physicoChemical::R.value()*invW;

View File

@ -1,4 +1,4 @@
word constProp(initialConditions.lookup("constantProperty")); const word constProp(initialConditions.lookup("constantProperty"));
if ((constProp != "pressure") && (constProp != "volume")) if ((constProp != "pressure") && (constProp != "volume"))
{ {
FatalError << "in initialConditions, unknown constantProperty type " FatalError << "in initialConditions, unknown constantProperty type "
@ -6,7 +6,7 @@
<< abort(FatalError); << abort(FatalError);
} }
word fractionBasis(initialConditions.lookup("fractionBasis")); const word fractionBasis(initialConditions.lookup("fractionBasis"));
if ((fractionBasis != "mass") && (fractionBasis != "mole")) if ((fractionBasis != "mass") && (fractionBasis != "mole"))
{ {
FatalError << "in initialConditions, unknown fractionBasis type " << nl FatalError << "in initialConditions, unknown fractionBasis type " << nl
@ -14,20 +14,8 @@
<< fractionBasis << abort(FatalError); << fractionBasis << abort(FatalError);
} }
label nSpecie = Y.size(); const label nSpecie = Y.size();
PtrList<gasHThermoPhysics> specieData(Y.size()); const scalarList W(::W(thermo));
forAll(specieData, i)
{
specieData.set
(
i,
new gasHThermoPhysics
(
dynamic_cast<const reactingMixture<gasHThermoPhysics>&>
(thermo).speciesData()[i]
)
);
}
scalarList Y0(nSpecie, 0.0); scalarList Y0(nSpecie, 0.0);
scalarList X0(nSpecie, 0.0); scalarList X0(nSpecie, 0.0);
@ -49,12 +37,12 @@
forAll(Y, i) forAll(Y, i)
{ {
X0[i] /= mTot; X0[i] /= mTot;
mw += specieData[i].W()*X0[i]; mw += W[i]*X0[i];
} }
forAll(Y, i) forAll(Y, i)
{ {
Y0[i] = X0[i]*specieData[i].W()/mw; Y0[i] = X0[i]*W[i]/mw;
} }
} }
else // mass fraction else // mass fraction
@ -73,21 +61,21 @@
forAll(Y, i) forAll(Y, i)
{ {
Y0[i] /= mTot; Y0[i] /= mTot;
invW += Y0[i]/specieData[i].W(); invW += Y0[i]/W[i];
} }
const scalar mw = 1.0/invW; const scalar mw = 1.0/invW;
forAll(Y, i) forAll(Y, i)
{ {
X0[i] = Y0[i]*mw/specieData[i].W(); X0[i] = Y0[i]*mw/W[i];
} }
} }
scalar h0 = 0.0; const scalar h0 = ::h0(thermo, Y0, p[0], T0);
forAll(Y, i) forAll(Y, i)
{ {
Y[i] = Y0[i]; Y[i] = Y0[i];
h0 += Y0[i]*specieData[i].Hs(p[0], T0);
} }
thermo.he() = dimensionedScalar("h", dimEnergy/dimMass, h0); thermo.he() = dimensionedScalar("h", dimEnergy/dimMass, h0);

View File

@ -2,5 +2,6 @@ atomicWeights/atomicWeights.C
specie/specie.C specie/specie.C
reaction/reactions/makeReactions.C reaction/reactions/makeReactions.C
reaction/reactions/makeLangmuirHinshelwoodReactions.C reaction/reactions/makeLangmuirHinshelwoodReactions.C
reaction/reactions/makeMichaelisMentenReactions.C
LIB = $(FOAM_LIBBIN)/libspecie LIB = $(FOAM_LIBBIN)/libspecie

View File

@ -584,7 +584,6 @@ void Foam::Reaction<ReactionThermo>::dwdc
const List<label>& c2s const List<label>& c2s
) const ) const
{ {
scalar pf, cf, pr, cr; scalar pf, cf, pr, cr;
label lRef, rRef; label lRef, rRef;
@ -706,7 +705,7 @@ void Foam::Reaction<ReactionThermo>::dwdc
this->dcidc(p, T, c, dcidc); this->dcidc(p, T, c, dcidc);
forAll(this->beta(), j) forAll(this->beta(), j)
{ {
label sj = this-> beta()[j].first(); label sj = this->beta()[j].first();
sj = reduced ? c2s[sj] : sj; sj = reduced ? c2s[sj] : sj;
if (sj != -1) if (sj != -1)
{ {

View File

@ -0,0 +1,165 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::MichaelisMentenReactionRate
Description
Michaelis-Menten reaction rate for enzymatic reactions.
Reference:
\verbatim
Michaelis, L., & Menten, M. L. (1913).
Die Kinetik der InwertinWirkung.
Biochem., (49), 333-369.
\endverbatim
SourceFiles
MichaelisMentenReactionRateI.H
\*---------------------------------------------------------------------------*/
#ifndef MichaelisMentenReactionRate_H
#define MichaelisMentenReactionRate_H
#include "Reaction.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of friend functions and operators
class MichaelisMentenReactionRate;
Ostream& operator<<(Ostream&, const MichaelisMentenReactionRate&);
/*---------------------------------------------------------------------------*\
Class MichaelisMentenReactionRate Declaration
\*---------------------------------------------------------------------------*/
class MichaelisMentenReactionRate
{
// Private data
//- List of specie names present in reaction system
const speciesTable& species_;
//- The maximum reaction rate at saturating substrate concentration
scalar Vmax_;
//- The Michaelis constant
// the substrate concentration at which the reaction rate is half Vmax_
scalar Km_;
//- The substrate specie index
label s_;
List<Tuple2<label, scalar>> beta_;
public:
// Constructors
//- Construct from dictionary
inline MichaelisMentenReactionRate
(
const speciesTable& species,
const dictionary& dict
);
// Member Functions
//- Return the type name
static word type()
{
return "MichaelisMenten";
}
inline scalar operator()
(
const scalar p,
const scalar T,
const scalarField& c
) const;
inline scalar ddT
(
const scalar p,
const scalar T,
const scalarField& c
) const;
//- Third-body efficiencies (beta = 1-alpha)
// non-empty only for third-body reactions
// with enhanced molecularity (alpha != 1)
inline const List<Tuple2<label, scalar>>& beta() const;
//- Species concentration derivative of the pressure dependent term
inline void dcidc
(
const scalar p,
const scalar T,
const scalarField& c,
scalarField& dcidc
) const;
//- Temperature derivative of the pressure dependent term
inline scalar dcidT
(
const scalar p,
const scalar T,
const scalarField& c
) const;
//- Write to stream
inline void write(Ostream& os) const;
// Ostream Operator
inline friend Ostream& operator<<
(
Ostream&,
const MichaelisMentenReactionRate&
);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "MichaelisMentenReactionRateI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,116 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
inline Foam::MichaelisMentenReactionRate::MichaelisMentenReactionRate
(
const speciesTable& st,
const dictionary& dict
)
:
species_(st),
Vmax_(readScalar(dict.lookup("Vmax"))),
Km_(readScalar(dict.lookup("Km"))),
s_(st[dict.lookup("S")])
{
beta_.append(Tuple2<label, scalar>(s_, 1.0));
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
inline Foam::scalar Foam::MichaelisMentenReactionRate::operator()
(
const scalar p,
const scalar T,
const scalarField& c
) const
{
return Vmax_/(Km_ + c[s_]);
}
inline Foam::scalar Foam::MichaelisMentenReactionRate::ddT
(
const scalar p,
const scalar T,
const scalarField& c
) const
{
return 0;
}
inline const Foam::List<Foam::Tuple2<Foam::label, Foam::scalar>>&
Foam::MichaelisMentenReactionRate::beta() const
{
return beta_;
}
inline void Foam::MichaelisMentenReactionRate::dcidc
(
const scalar p,
const scalar T,
const scalarField& c,
scalarField& dcidc
) const
{
dcidc[0] = -1.0/(Km_ + c[s_]);
}
inline Foam::scalar Foam::MichaelisMentenReactionRate::dcidT
(
const scalar p,
const scalar T,
const scalarField& c
) const
{
return 0;
}
inline void Foam::MichaelisMentenReactionRate::write(Ostream& os) const
{
os.writeKeyword("Vmax") << Vmax_ << token::END_STATEMENT << nl;
os.writeKeyword("Km") << Km_ << token::END_STATEMENT << nl;
os.writeKeyword("S") << species_[s_] << token::END_STATEMENT << nl;
}
inline Foam::Ostream& Foam::operator<<
(
Ostream& os,
const MichaelisMentenReactionRate& mmrr
)
{
mmrr.write(os);
return os;
}
// ************************************************************************* //

View File

@ -0,0 +1,49 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "makeReaction.H"
#include "reactionTypes.H"
#include "MichaelisMentenReactionRate.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
makeReaction
(
constFluidHThermoPhysics,
IrreversibleReaction,
MichaelisMentenReactionRate
)
makeReaction
(
constFluidEThermoPhysics,
IrreversibleReaction,
MichaelisMentenReactionRate
)
}
// ************************************************************************* //