Skip to content

Commit

Permalink
Fix issue with consistent initialization of LRM
Browse files Browse the repository at this point in the history
For models with nbound > 1, consistent initialization would fail. This
was due to a wrong indexer being called for the stationary state
(strideColCell() instead of strideColBound).
  • Loading branch information
schmoelder authored and sleweke committed Dec 2, 2021
1 parent ece80fc commit f40f239
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/libcadet/model/LumpedRateModelWithoutPores.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1359,7 +1359,7 @@ void LumpedRateModelWithoutPores::consistentInitialTimeDerivative(const Simulati

// Get iterators to beginning of solid phase
linalg::BandMatrix::RowIterator jacSolidOrig = _jac.row(idxr.strideColCell() * col + idxr.strideColLiquid());
linalg::FactorizableBandMatrix::RowIterator jacSolid = jac - idxr.strideColLiquid();
linalg::FactorizableBandMatrix::RowIterator jacSolid = jac - idxr.strideColBound();

int const* const mask = _binding[0]->reactionQuasiStationarity();
double* const qShellDot = vecStateYdot + idxr.offsetC() + col * idxr.strideColCell() + idxr.strideColLiquid();
Expand Down Expand Up @@ -1648,7 +1648,7 @@ void LumpedRateModelWithoutPores::consistentInitialSensitivity(const SimulationT
{
// Get iterators to beginning of solid phase
linalg::BandMatrix::RowIterator jacSolidOrig = _jac.row(idxr.strideColCell() * col + idxr.strideColLiquid());
linalg::FactorizableBandMatrix::RowIterator jacSolid = jac - idxr.strideColLiquid();
linalg::FactorizableBandMatrix::RowIterator jacSolid = jac - idxr.strideColBound();

int const* const mask = _binding[0]->reactionQuasiStationarity();
double* const qShellDot = sensYdot + idxr.offsetC() + idxr.strideColCell() * col + idxr.strideColLiquid();
Expand Down

0 comments on commit f40f239

Please sign in to comment.