Added the change for the bugfix to HMWSoln to the main branch.
The function getActivityConcentration in the HMWSoln object had a bug in it that caused it to be incompatible with standardConcentration and getActivities(). This meant that the ROP in kinetics managers for this object was being calculated incorrectly.
This commit is contained in:
parent
392683283a
commit
20c74f21af
19 changed files with 119 additions and 29 deletions
0
Cantera/src/thermo/ConstDensityThermo.cpp
Executable file → Normal file
0
Cantera/src/thermo/ConstDensityThermo.cpp
Executable file → Normal file
0
Cantera/src/thermo/ConstDensityThermo.h
Executable file → Normal file
0
Cantera/src/thermo/ConstDensityThermo.h
Executable file → Normal file
0
Cantera/src/thermo/Constituents.cpp
Executable file → Normal file
0
Cantera/src/thermo/Constituents.cpp
Executable file → Normal file
0
Cantera/src/thermo/Constituents.h
Executable file → Normal file
0
Cantera/src/thermo/Constituents.h
Executable file → Normal file
|
|
@ -917,10 +917,14 @@ namespace Cantera {
|
|||
* reaction rate expressions within the phase.
|
||||
*/
|
||||
void HMWSoln::getActivityConcentrations(doublereal* c) const {
|
||||
double c_solvent = standardConcentration();
|
||||
double cs_solvent = standardConcentration();
|
||||
getActivities(c);
|
||||
for (int k = 0; k < m_kk; k++) {
|
||||
c[k] *= c_solvent;
|
||||
c[0] *= cs_solvent;
|
||||
if (m_kk > 1) {
|
||||
double cs_solute = standardConcentration(1);
|
||||
for (int k = 1; k < m_kk; k++) {
|
||||
c[k] *= cs_solute;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1027,10 +1027,12 @@ namespace Cantera {
|
|||
* this phase equal to the default concentration of the solvent at the system temperature
|
||||
* and pressure multiplied by Mnaught (kg solvent / gmol solvent). The solvent
|
||||
* standard concentration is just equal to its standard state concentration.
|
||||
*
|
||||
*
|
||||
* This means that the
|
||||
* kinetics operator essentially works on an generalized concentration basis (kg / m3),
|
||||
* kinetics operator essentially works on an generalized concentration basis (kmol / m3),
|
||||
* with units for the kinetic rate constant specified
|
||||
* as if all reactants (solvent or solute) are on a concentration basis (kg /m3).
|
||||
* as if all reactants (solvent or solute) are on a concentration basis (kmol /m3).
|
||||
* The concentration will be modified by the activity coefficients.
|
||||
*
|
||||
* For example, a bulk-phase binary reaction between liquid solute species
|
||||
|
|
@ -1039,39 +1041,50 @@ namespace Cantera {
|
|||
* following equation for its rate of progress variable, \f$ R^1 \f$, which has
|
||||
* units of kmol m-3 s-1.
|
||||
*
|
||||
* \f[
|
||||
* R^1 = k^1 C_j^a C_k^a = k^1 (C^o_o \tilde{M}_o a_j) (C^o_o \tilde{M}_o a_k)
|
||||
* \f]
|
||||
*
|
||||
* where
|
||||
*
|
||||
* \f[
|
||||
* R^1 = k^1 C_j^a C_k^a = k^1 (C_o \tilde{M}_o a_j) (C_o \tilde{M}_o a_k)
|
||||
* \f]
|
||||
* where
|
||||
* \f[
|
||||
* C_j^a = C_o \tilde{M}_o a_j \quad and \quad C_k^a = C_o \tilde{M}_o a_k
|
||||
* C_j^a = C^o_o \tilde{M}_o a_j \quad and \quad C_k^a = C^o_o \tilde{M}_o a_k
|
||||
* \f]
|
||||
*
|
||||
* \f$ C_j^a \f$ is the activity concentration of species <I>j</I>, and
|
||||
* \f$ C_k^a \f$ is the activity concentration of species <I>k</I>. \f$ C_o \f$
|
||||
* is the concentration of water at 298 K and 1 atm. \f$ \tilde{M}_o \f$ is
|
||||
* \f$ C_k^a \f$ is the activity concentration of species <I>k</I>. \f$ C^o_o \f$
|
||||
* is the concentration of water at 298 K and 1 atm. \f$ \tilde{M}_o \f$
|
||||
* has units of kg solvent per gmol solvent and is equal to
|
||||
*
|
||||
* \f[
|
||||
* \tilde{M}_o = \frac{M_o}{1000}
|
||||
* \f]
|
||||
*
|
||||
*
|
||||
* \f$ a_j \f$ is
|
||||
* the activity of species <I>j</I> at the current temperature and pressure
|
||||
* and concentration of the liquid phase is given by the molality based
|
||||
* activity coefficient multiplied by the molality of the jth species.
|
||||
*
|
||||
* \f[
|
||||
* a_j = \gamma_j^\triangle m_j
|
||||
* a_j = \gamma_j^\triangle m_j = \gamma_j^\triangle \frac{n_j}{\tilde{M}_o n_o}
|
||||
* \f]
|
||||
*
|
||||
* \f$k^1 \f$ has units of m<SUP>3</SUP> kmol<SUP>-1</SUP> s<SUP>-1</SUP>.
|
||||
*
|
||||
* Therefore the generalized activity concentration of a solute species has the following form
|
||||
*
|
||||
* \f[
|
||||
* C_j^a = C^o_o \frac{\gamma_j^\triangle n_j}{n_o}
|
||||
* \f]
|
||||
*
|
||||
* The generalized activity concentration of the solvent has the same units, but its a simpler form
|
||||
*
|
||||
* \f[
|
||||
* C_o^a = C^o_o a_o
|
||||
* \f]
|
||||
*
|
||||
* The reverse rate constant can then be obtained from the law of microscopic reversibility
|
||||
* and the equilibrium expression for the system.
|
||||
* and the equilibrium expression for the system.
|
||||
*
|
||||
* \f[
|
||||
* \frac{a_j a_k}{ a_l} = K^{o,1} = \exp(\frac{\mu^o_l - \mu^o_j - \mu^o_k}{R T} )
|
||||
|
|
@ -1587,18 +1600,31 @@ namespace Cantera {
|
|||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* This method returns an array of generalized concentrations
|
||||
* \f$ C_k\f$ that are defined such that
|
||||
* \f$ a_k = C_k / C^0_k, \f$ where \f$ C^0_k \f$
|
||||
|
||||
//! This method returns an array of generalized activity concentrations
|
||||
/*!
|
||||
* The generalized activity concentrations, \f$ C_k^a\f$, are defined such that
|
||||
* \f$ a_k = C^a_k / C^0_k, \f$ where \f$ C^0_k \f$
|
||||
* is a standard concentration
|
||||
* defined below. These generalized concentrations are used
|
||||
* by kinetics manager classes to compute the forward and
|
||||
* reverse rates of elementary reactions.
|
||||
*
|
||||
* The generalized activity concentration of a solute species has the following form
|
||||
*
|
||||
* \f[
|
||||
* C_j^a = C^o_o \frac{\gamma_j^\triangle n_j}{n_o}
|
||||
* \f]
|
||||
*
|
||||
* The generalized activity concentration of the solvent has the same units, but its a simpler form
|
||||
*
|
||||
* \f[
|
||||
* C_o^a = C^o_o a_o
|
||||
* \f]
|
||||
*
|
||||
*
|
||||
* @param c Array of generalized concentrations. The
|
||||
* units depend upon the implementation of the
|
||||
* reaction rate expressions within the phase.
|
||||
* units are kmol m-3 for both the solvent and the solute species
|
||||
*/
|
||||
virtual void getActivityConcentrations(doublereal* c) const;
|
||||
|
||||
|
|
@ -1607,12 +1633,73 @@ namespace Cantera {
|
|||
* The standard concentration \f$ C^0_k \f$ used to normalize
|
||||
* the activity (i.e., generalized) concentration for use
|
||||
*
|
||||
* For the time being, we will use the concentration of pure
|
||||
* solvent at the temperature and pressure of the solution
|
||||
* for the the standard concentration of all species.
|
||||
* This has the effect of making mass-action reaction rates
|
||||
* based on the molality of species proportional to the
|
||||
* molality of the species.
|
||||
* We have set the standard concentration for all solute species in
|
||||
* this phase equal to the default concentration of the solvent at the system temperature
|
||||
* and pressure multiplied by Mnaught (kg solvent / gmol solvent). The solvent
|
||||
* standard concentration is just equal to its standard state concentration.
|
||||
*
|
||||
* \f[
|
||||
* C_j^0 = C^o_o \tilde{M}_o \quad and C_o^0 = C^o_o
|
||||
* \f]
|
||||
*
|
||||
* The consequence of this is that the standard concentrations have unequal units
|
||||
* between the solvent and the solute. However, both the solvent and the solute
|
||||
* activity concentrations will have the same units of kmol kg<SUP>-3</SUP>.
|
||||
*
|
||||
* This means that the
|
||||
* kinetics operator essentially works on an generalized concentration basis (kmol / m3),
|
||||
* with units for the kinetic rate constant specified
|
||||
* as if all reactants (solvent or solute) are on a concentration basis (kmol /m3).
|
||||
* The concentration will be modified by the activity coefficients.
|
||||
*
|
||||
* For example, a bulk-phase binary reaction between liquid solute species
|
||||
* <I>j</I> and <I>k</I>, producing
|
||||
* a new liquid solute species <I>l</I> would have the
|
||||
* following equation for its rate of progress variable, \f$ R^1 \f$, which has
|
||||
* units of kmol m-3 s-1.
|
||||
*
|
||||
* \f[
|
||||
* R^1 = k^1 C_j^a C_k^a = k^1 (C^o_o \tilde{M}_o a_j) (C^o_o \tilde{M}_o a_k)
|
||||
* \f]
|
||||
*
|
||||
* where
|
||||
*
|
||||
* \f[
|
||||
* C_j^a = C^o_o \tilde{M}_o a_j \quad and \quad C_k^a = C^o_o \tilde{M}_o a_k
|
||||
* \f]
|
||||
*
|
||||
* \f$ C_j^a \f$ is the activity concentration of species <I>j</I>, and
|
||||
* \f$ C_k^a \f$ is the activity concentration of species <I>k</I>. \f$ C^o_o \f$
|
||||
* is the concentration of water at 298 K and 1 atm. \f$ \tilde{M}_o \f$
|
||||
* has units of kg solvent per gmol solvent and is equal to
|
||||
*
|
||||
* \f[
|
||||
* \tilde{M}_o = \frac{M_o}{1000}
|
||||
* \f]
|
||||
*
|
||||
* \f$ a_j \f$ is
|
||||
* the activity of species <I>j</I> at the current temperature and pressure
|
||||
* and concentration of the liquid phase is given by the molality based
|
||||
* activity coefficient multiplied by the molality of the jth species.
|
||||
*
|
||||
* \f[
|
||||
* a_j = \gamma_j^\triangle m_j = \gamma_j^\triangle \frac{n_j}{\tilde{M}_o n_o}
|
||||
* \f]
|
||||
*
|
||||
* \f$k^1 \f$ has units of m<SUP>3</SUP> kmol<SUP>-1</SUP> s<SUP>-1</SUP>.
|
||||
*
|
||||
* Therefore the generalized activity concentration of a solute species has the following form
|
||||
*
|
||||
* \f[
|
||||
* C_j^a = C^o_o \frac{\gamma_j^\triangle n_j}{n_o}
|
||||
* \f]
|
||||
*
|
||||
* The generalized activity concentration of the solvent has the same units, but its a simpler form
|
||||
*
|
||||
* \f[
|
||||
* C_o^a = C^o_o a_o
|
||||
* \f]
|
||||
*
|
||||
*
|
||||
* @param k Optional parameter indicating the species. The default
|
||||
* is to assume this refers to species 0.
|
||||
|
|
|
|||
0
Cantera/src/thermo/NasaPoly1.h
Executable file → Normal file
0
Cantera/src/thermo/NasaPoly1.h
Executable file → Normal file
0
Cantera/src/thermo/NasaThermo.h
Executable file → Normal file
0
Cantera/src/thermo/NasaThermo.h
Executable file → Normal file
0
Cantera/src/thermo/Phase.cpp
Executable file → Normal file
0
Cantera/src/thermo/Phase.cpp
Executable file → Normal file
0
Cantera/src/thermo/Phase.h
Executable file → Normal file
0
Cantera/src/thermo/Phase.h
Executable file → Normal file
0
Cantera/src/thermo/ShomatePoly.h
Executable file → Normal file
0
Cantera/src/thermo/ShomatePoly.h
Executable file → Normal file
0
Cantera/src/thermo/ShomateThermo.h
Executable file → Normal file
0
Cantera/src/thermo/ShomateThermo.h
Executable file → Normal file
0
Cantera/src/thermo/SpeciesThermo.h
Executable file → Normal file
0
Cantera/src/thermo/SpeciesThermo.h
Executable file → Normal file
0
Cantera/src/thermo/SpeciesThermoFactory.cpp
Executable file → Normal file
0
Cantera/src/thermo/SpeciesThermoFactory.cpp
Executable file → Normal file
0
Cantera/src/thermo/SpeciesThermoFactory.h
Executable file → Normal file
0
Cantera/src/thermo/SpeciesThermoFactory.h
Executable file → Normal file
0
Cantera/src/thermo/SpeciesThermoMgr.h
Executable file → Normal file
0
Cantera/src/thermo/SpeciesThermoMgr.h
Executable file → Normal file
|
|
@ -215,7 +215,6 @@ namespace Cantera {
|
|||
* @param k Index of species
|
||||
*/
|
||||
doublereal concentration(const int k) const;
|
||||
|
||||
|
||||
//! Set the concentrations to the specified values within the
|
||||
//! phase.
|
||||
|
|
|
|||
|
|
@ -495,8 +495,8 @@ namespace Cantera {
|
|||
|
||||
|
||||
// Parameters for the viscosityWater() function
|
||||
|
||||
//@{
|
||||
//! parameter
|
||||
const double H[4] = {1.,
|
||||
0.978197,
|
||||
0.579829,
|
||||
|
|
|
|||
0
Cantera/src/thermo/speciesThermoTypes.h
Executable file → Normal file
0
Cantera/src/thermo/speciesThermoTypes.h
Executable file → Normal file
Loading…
Add table
Reference in a new issue