Skip to content

Commit 78e660e

Browse files
spethanthony-walker
authored andcommitted
[Reactor] Fix species counting in case of user-defined solution components
1 parent ec40cd6 commit 78e660e

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/zeroD/IdealGasConstPressureMoleReactor.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,10 @@ void IdealGasConstPressureMoleReactor::buildJacobian(
125125
// d (dot(omega)) / d c_j, it is later transformed appropriately.
126126
Eigen::SparseMatrix<double> dnk_dnj = m_kin->netProductionRates_ddCi();
127127
// species size that accounts for surface species
128-
size_t ssize = m_nv - m_sidx;
128+
size_t ssize = m_nsp;
129+
for (auto surf : m_surfaces) {
130+
ssize += surf->thermo()->nSpecies();
131+
}
129132
// map derivatives from the surface chemistry jacobian
130133
// to the reactor jacobian
131134
if (!m_surfaces.empty()) {

src/zeroD/IdealGasMoleReactor.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,10 @@ void IdealGasMoleReactor::buildJacobian(vector<Eigen::Triplet<double>>& jacVecto
191191
// d (dot(omega)) / d c_j, it is later transformed appropriately.
192192
Eigen::SparseMatrix<double> dnk_dnj = m_kin->netProductionRates_ddCi();
193193
// species size that accounts for surface species
194-
size_t ssize = m_nv - m_sidx;
194+
size_t ssize = m_nsp;
195+
for (auto surf : m_surfaces) {
196+
ssize += surf->thermo()->nSpecies();
197+
}
195198
// map derivatives from the surface chemistry jacobian
196199
// to the reactor jacobian
197200
if (!m_surfaces.empty()) {

0 commit comments

Comments
 (0)