From 229ef825f0d842d45326e613018668741f6f891c Mon Sep 17 00:00:00 2001 From: Ray Speth Date: Mon, 4 Mar 2013 17:31:32 +0000 Subject: [PATCH] [Kinetics] Refactored GasKinetics to more easily support derived classes --- include/cantera/kinetics/GasKinetics.h | 11 ++++------- src/kinetics/GRI_30_Kinetics.cpp | 2 +- src/kinetics/GasKinetics.cpp | 27 +++++++------------------- 3 files changed, 12 insertions(+), 28 deletions(-) diff --git a/include/cantera/kinetics/GasKinetics.h b/include/cantera/kinetics/GasKinetics.h index c95dcf0e6..e1b048adf 100644 --- a/include/cantera/kinetics/GasKinetics.h +++ b/include/cantera/kinetics/GasKinetics.h @@ -322,12 +322,8 @@ public: virtual void finalize(); virtual bool ready() const; - virtual void update_T(); - virtual void update_C(); - void updateROP(); - const std::vector& reactantGroups(size_t i) { return m_rgroups[i]; } @@ -335,14 +331,15 @@ public: return m_pgroups[i]; } - - void _update_rates_T(); + //! Update temperature-dependent portions of reaction rates and falloff + //! functions. + virtual void update_rates_T(); //! Update properties that depend on concentrations. //! Currently the enhanced collision partner concentrations are updated //! here, as well as the pressure-dependent portion of P-log and Chebyshev //! reactions. - void _update_rates_C(); + virtual void update_rates_C(); //@} diff --git a/src/kinetics/GRI_30_Kinetics.cpp b/src/kinetics/GRI_30_Kinetics.cpp index 4cf368641..c8b13d480 100644 --- a/src/kinetics/GRI_30_Kinetics.cpp +++ b/src/kinetics/GRI_30_Kinetics.cpp @@ -63,7 +63,7 @@ void GRI_30_Kinetics::gri30_updateROP() { gri30_update_rates_T(); - _update_rates_C(); + update_rates_C(); if (m_ROP_ok) { return; diff --git a/src/kinetics/GasKinetics.cpp b/src/kinetics/GasKinetics.cpp index 612bc42ad..5630519db 100644 --- a/src/kinetics/GasKinetics.cpp +++ b/src/kinetics/GasKinetics.cpp @@ -144,19 +144,7 @@ Kinetics* GasKinetics::duplMyselfAsKinetics(const std::vector & tpVec return gK; } //==================================================================================================================== -/** - * Update temperature-dependent portions of reaction rates and - * falloff functions. - */ -void GasKinetics::update_T() -{ -} -//==================================================================================================================== -void GasKinetics:: -update_C() {} -//==================================================================================================================== -void GasKinetics:: -_update_rates_T() +void GasKinetics::update_rates_T() { doublereal T = thermo().temperature(); m_logStandConc = log(thermo().standardConcentration()); @@ -187,8 +175,7 @@ _update_rates_T() //==================================================================================================================== -void GasKinetics:: -_update_rates_C() +void GasKinetics::update_rates_C() { thermo().getActivityConcentrations(&m_conc[0]); doublereal ctot = thermo().molarDensity(); @@ -247,7 +234,7 @@ void GasKinetics::updateKc() */ void GasKinetics::getEquilibriumConstants(doublereal* kc) { - _update_rates_T(); + update_rates_T(); thermo().getStandardChemPotentials(&m_grt[0]); fill(m_rkcn.begin(), m_rkcn.end(), 0.0); @@ -501,8 +488,8 @@ void GasKinetics::processFalloffReactions() //==================================================================================================================== void GasKinetics::updateROP() { - _update_rates_C(); - _update_rates_T(); + update_rates_C(); + update_rates_T(); if (m_ROP_ok) { return; @@ -558,8 +545,8 @@ void GasKinetics::updateROP() void GasKinetics:: getFwdRateConstants(doublereal* kfwd) { - _update_rates_C(); - _update_rates_T(); + update_rates_C(); + update_rates_T(); // copy rate coefficients into ropf copy(m_rfn.begin(), m_rfn.end(), m_ropf.begin());