Skip to content

Commit

Permalink
[Kinetics] Fix third body concentrations for non-ideal gases
Browse files Browse the repository at this point in the history
From the discussion on Cantera#967, the calcuation of [M] should be based on
the physical concentrations of the 3rd body colliders, not their
"activity concentrations".
  • Loading branch information
speth authored and ischoegl committed Apr 15, 2021
1 parent 81cffde commit 918aeeb
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 7 deletions.
7 changes: 6 additions & 1 deletion include/cantera/kinetics/BulkKinetics.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,12 @@ class BulkKinetics : public Kinetics
//! valued stoichiometries.
vector_fp m_dn;

vector_fp m_conc;
//! Activity concentrations, as calculated by
//! ThermoPhase::getActivityConcentrations
vector_fp m_act_conc;

//! Physical concentrations, as calculated by ThermoPhase::getConcentrations
vector_fp m_phys_conc;
vector_fp m_grt;

bool m_ROP_ok;
Expand Down
1 change: 1 addition & 0 deletions include/cantera/kinetics/GasKinetics.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ class GasKinetics : public BulkKinetics
vector_fp falloff_work;
vector_fp concm_3b_values;
vector_fp concm_falloff_values;

//!@}

void processFalloffReactions();
Expand Down
3 changes: 2 additions & 1 deletion src/kinetics/BulkKinetics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,8 @@ void BulkKinetics::modifyElementaryReaction(size_t i, ElementaryReaction& rNew)
void BulkKinetics::resizeSpecies()
{
Kinetics::resizeSpecies();
m_conc.resize(m_kk);
m_act_conc.resize(m_kk);
m_phys_conc.resize(m_kk);
m_grt.resize(m_kk);
}

Expand Down
11 changes: 6 additions & 5 deletions src/kinetics/GasKinetics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,17 +68,18 @@ void GasKinetics::update_rates_T()

void GasKinetics::update_rates_C()
{
thermo().getActivityConcentrations(m_conc.data());
thermo().getActivityConcentrations(m_act_conc.data());
thermo().getConcentrations(m_phys_conc.data());
doublereal ctot = thermo().molarDensity();

// 3-body reactions
if (!concm_3b_values.empty()) {
m_3b_concm.update(m_conc, ctot, concm_3b_values.data());
m_3b_concm.update(m_phys_conc, ctot, concm_3b_values.data());
}

// Falloff reactions
if (!concm_falloff_values.empty()) {
m_falloff_concm.update(m_conc, ctot, concm_falloff_values.data());
m_falloff_concm.update(m_phys_conc, ctot, concm_falloff_values.data());
}

// P-log reactions
Expand Down Expand Up @@ -187,10 +188,10 @@ void GasKinetics::updateROP()
}

// multiply ropf by concentration products
m_reactantStoich.multiply(m_conc.data(), m_ropf.data());
m_reactantStoich.multiply(m_act_conc.data(), m_ropf.data());

// for reversible reactions, multiply ropr by concentration products
m_revProductStoich.multiply(m_conc.data(), m_ropr.data());
m_revProductStoich.multiply(m_act_conc.data(), m_ropr.data());

for (size_t j = 0; j != nReactions(); ++j) {
m_ropnet[j] = m_ropf[j] - m_ropr[j];
Expand Down

0 comments on commit 918aeeb

Please sign in to comment.