Skip to content

Commit

Permalink
[Reactor] Implement fixed temperature mode for FlowReactor
Browse files Browse the repository at this point in the history
  • Loading branch information
speth authored and ischoegl committed Jun 14, 2023
1 parent dbc84d4 commit 7206039
Showing 1 changed file with 22 additions and 14 deletions.
36 changes: 22 additions & 14 deletions src/zeroD/FlowReactor.cpp
Expand Up @@ -146,16 +146,20 @@ void FlowReactor::getState(double* y, double* ydot)
// - u * (perim / Ac) * sum(sk' * wk)
ydot[2] = -m_u * h_sk_wk;

// energy conservation, Kee 16.58, adiabatic
// -sum(wk' * Wk * hk) - (perim / Ac) * sum(sk' * Wk * hk)
// Note: the partial molar enthalpies are in molar units, while Kee uses mass
// units, where:
// h_mass = h_mole / Wk
// hence:
// h_mass * Wk = h_mol
m_thermo->getPartialMolarEnthalpies(m_hk.data());
for (size_t i = 0; i < m_nsp; ++i) {
ydot[3] -= m_hk[i] * (m_wdot[i] + hydraulic * m_sdot[i]);
if (m_energy) {
// energy conservation, Kee 16.58, adiabatic
// -sum(wk' * Wk * hk) - (perim / Ac) * sum(sk' * Wk * hk)
// Note: the partial molar enthalpies are in molar units, while Kee uses mass
// units, where:
// h_mass = h_mole / Wk
// hence:
// h_mass * Wk = h_mol
m_thermo->getPartialMolarEnthalpies(m_hk.data());
for (size_t i = 0; i < m_nsp; ++i) {
ydot[3] -= m_hk[i] * (m_wdot[i] + hydraulic * m_sdot[i]);
}
} else {
ydot[3] = 0;
}

// mass-fraction equations Kee 16.51
Expand Down Expand Up @@ -296,10 +300,14 @@ void FlowReactor::evalDae(double time, double* y, double* ydot, double* params,
// h_mass = h_mole / Wk
// hence:
// h_mass * Wk = h_mol
const double cp_mass = m_thermo->cp_mass();
residual[3] = m_rho * m_u * cp_mass * m_dTdz;
for (size_t i = 0; i < m_nsp; ++i) {
residual[3] += m_hk[i] * (m_wdot[i] + hydraulic * m_sdot[i]);
if (m_energy) {
const double cp_mass = m_thermo->cp_mass();
residual[3] = m_rho * m_u * cp_mass * m_dTdz;
for (size_t i = 0; i < m_nsp; ++i) {
residual[3] += m_hk[i] * (m_wdot[i] + hydraulic * m_sdot[i]);
}
} else {
residual[3] = m_dTdz;
}

//! species conservation equations
Expand Down

0 comments on commit 7206039

Please sign in to comment.