Skip to content

Commit

Permalink
[Kinetics] Remove remaining 'bulk' references and add todo comments
Browse files Browse the repository at this point in the history
  • Loading branch information
ischoegl committed Jan 30, 2022
1 parent 4445676 commit 906afe7
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 34 deletions.
6 changes: 3 additions & 3 deletions include/cantera/kinetics/MultiRate.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
namespace Cantera
{

//! A class template handling all reaction rates specific to `BulkKinetics`.
//! A class template handling ReactionRate specializations.
template <class RateType, class DataType>
class MultiRate final : public MultiRateBase
{
Expand Down Expand Up @@ -108,8 +108,8 @@ class MultiRate final : public MultiRateBase
_update();
}

virtual bool update(const ThermoPhase& bulk, const Kinetics& kin) override {
bool changed = m_shared.update(bulk, kin);
virtual bool update(const ThermoPhase& phase, const Kinetics& kin) override {
bool changed = m_shared.update(phase, kin);
if (changed) {
// call helper function only if needed: implementation depends on whether
// ReactionRate::updateFromStruct is defined
Expand Down
8 changes: 5 additions & 3 deletions include/cantera/kinetics/MultiRateBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,12 @@ class MultiRateBase

//! Update data common to reaction rates of a specific type.
//! This update mechanism is used by Kinetics reaction rate evaluators.
//! @param bulk object representing bulk phase
//! @param phase object representing reacting phase
//! @param kin object representing kinetics
//! @returns flag indicating reaction rates need to be re-evaluated
virtual bool update(const ThermoPhase& bulk, const Kinetics& kin) = 0;
//! @returns flag indicating whether reaction rates need to be re-evaluated
//!
//! @todo remove Kinetics argument (which is no longer necessary)
virtual bool update(const ThermoPhase& phase, const Kinetics& kin) = 0;

//! Get the rate for a single reaction. Used to implement ReactionRate::eval,
//! which allows for the evaluation of a reaction rate expression outside of
Expand Down
18 changes: 10 additions & 8 deletions include/cantera/kinetics/ReactionData.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,15 @@ struct ReactionData
*/
virtual void update(double T, double extra);

//! Update data container based on *bulk* phase state
//! Update data container based on thermodynamic phase state
/**
* This update mechanism is used by Kinetics reaction rate evaluators.
* @returns A boolean element indicating whether the `evalFromStruct` method
* needs to be called (assuming previously-calculated values were cached)
*
* @todo Remove Kinetics argument
*/
virtual bool update(const ThermoPhase& bulk, const Kinetics& kin) = 0;
virtual bool update(const ThermoPhase& phase, const Kinetics& kin) = 0;

//! Perturb temperature of data container
/**
Expand Down Expand Up @@ -90,7 +92,7 @@ struct ReactionData
*/
struct ArrheniusData : public ReactionData
{
virtual bool update(const ThermoPhase& bulk, const Kinetics& kin);
virtual bool update(const ThermoPhase& phase, const Kinetics& kin);
using ReactionData::update;
};

Expand All @@ -104,7 +106,7 @@ struct TwoTempPlasmaData : public ReactionData
{
TwoTempPlasmaData() : electronTemp(1.), logTe(0.), recipTe(1.) {}

virtual bool update(const ThermoPhase& bulk, const Kinetics& kin) override;
virtual bool update(const ThermoPhase& phase, const Kinetics& kin) override;

virtual void update(double T) override;

Expand Down Expand Up @@ -132,7 +134,7 @@ struct BlowersMaselData : public ReactionData
{
BlowersMaselData();

virtual bool update(const ThermoPhase& bulk, const Kinetics& kin) override;
virtual bool update(const ThermoPhase& phase, const Kinetics& kin) override;

virtual void update(double T) override;

Expand Down Expand Up @@ -162,7 +164,7 @@ struct FalloffData : public ReactionData
{
FalloffData();

virtual bool update(const ThermoPhase& bulk, const Kinetics& kin) override;
virtual bool update(const ThermoPhase& phase, const Kinetics& kin) override;

virtual void update(double T) override;

Expand Down Expand Up @@ -216,7 +218,7 @@ struct PlogData : public ReactionData
logP = std::log(P);
}

virtual bool update(const ThermoPhase& bulk, const Kinetics& kin) override;
virtual bool update(const ThermoPhase& phase, const Kinetics& kin) override;

//! Perturb pressure of data container
/**
Expand Down Expand Up @@ -257,7 +259,7 @@ struct ChebyshevData : public ReactionData
log10P = std::log10(P);
}

virtual bool update(const ThermoPhase& bulk, const Kinetics& kin) override;
virtual bool update(const ThermoPhase& phase, const Kinetics& kin) override;

//! Perturb pressure of data container
/**
Expand Down
40 changes: 20 additions & 20 deletions src/kinetics/ReactionData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,20 @@ void ReactionData::restore()
m_temperature_buf = -1.;
}

bool ArrheniusData::update(const ThermoPhase& bulk, const Kinetics& kin)
bool ArrheniusData::update(const ThermoPhase& phase, const Kinetics& kin)
{
double T = bulk.temperature();
double T = phase.temperature();
if (T == temperature) {
return false;
}
update(T);
return true;
}

bool TwoTempPlasmaData::update(const ThermoPhase& bulk, const Kinetics& kin)
bool TwoTempPlasmaData::update(const ThermoPhase& phase, const Kinetics& kin)
{
double T = bulk.temperature();
double Te = bulk.electronTemperature();
double T = phase.temperature();
double Te = phase.electronTemperature();
bool changed = false;
if (T != temperature) {
ReactionData::update(T);
Expand Down Expand Up @@ -107,11 +107,11 @@ void BlowersMaselData::update(double T, double deltaH)
dH_direct = deltaH;
}

bool BlowersMaselData::update(const ThermoPhase& bulk, const Kinetics& kin)
bool BlowersMaselData::update(const ThermoPhase& phase, const Kinetics& kin)
{
double rho = bulk.density();
int mf = bulk.stateMFNumber();
double T = bulk.temperature();
double rho = phase.density();
int mf = phase.stateMFNumber();
double T = phase.temperature();
bool changed = false;
if (T != temperature) {
ReactionData::update(T);
Expand All @@ -120,7 +120,7 @@ bool BlowersMaselData::update(const ThermoPhase& bulk, const Kinetics& kin)
if (changed || rho != density || mf != m_state_mf_number) {
density = rho;
m_state_mf_number = mf;
bulk.getPartialMolarEnthalpies(grt.data());
phase.getPartialMolarEnthalpies(grt.data());
changed = true;
}
return changed;
Expand Down Expand Up @@ -148,11 +148,11 @@ void FalloffData::update(double T, double M)
conc_3b[0] = M;
}

bool FalloffData::update(const ThermoPhase& bulk, const Kinetics& kin)
bool FalloffData::update(const ThermoPhase& phase, const Kinetics& kin)
{
double rho_m = bulk.molarDensity();
int mf = bulk.stateMFNumber();
double T = bulk.temperature();
double rho_m = phase.molarDensity();
int mf = phase.stateMFNumber();
double T = phase.temperature();
bool changed = false;
if (T != temperature) {
ReactionData::update(T);
Expand Down Expand Up @@ -197,10 +197,10 @@ void PlogData::update(double T)
"Missing state information: 'PlogData' requires pressure.");
}

bool PlogData::update(const ThermoPhase& bulk, const Kinetics& kin)
bool PlogData::update(const ThermoPhase& phase, const Kinetics& kin)
{
double T = bulk.temperature();
double P = bulk.pressure();
double T = phase.temperature();
double P = phase.pressure();
if (P != pressure || T != temperature) {
update(T, P);
return true;
Expand Down Expand Up @@ -235,10 +235,10 @@ void ChebyshevData::update(double T)
"Missing state information: 'ChebyshevData' requires pressure.");
}

bool ChebyshevData::update(const ThermoPhase& bulk, const Kinetics& kin)
bool ChebyshevData::update(const ThermoPhase& phase, const Kinetics& kin)
{
double T = bulk.temperature();
double P = bulk.pressure();
double T = phase.temperature();
double P = phase.pressure();
if (P != pressure || T != temperature) {
update(T, P);
return true;
Expand Down

0 comments on commit 906afe7

Please sign in to comment.