From 8078712e2a729ed255498f6f7038ee06a556e533 Mon Sep 17 00:00:00 2001 From: Ray Speth Date: Mon, 16 Apr 2012 20:59:58 +0000 Subject: [PATCH] Fixed some more problems with overconstrained equilibrum problems --- src/equil/MultiPhaseEquil.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/equil/MultiPhaseEquil.cpp b/src/equil/MultiPhaseEquil.cpp index c37f7a653..b5d506a3e 100644 --- a/src/equil/MultiPhaseEquil.cpp +++ b/src/equil/MultiPhaseEquil.cpp @@ -512,7 +512,7 @@ void MultiPhaseEquil::getComponents(const std::vector& order) // The left m_nel columns of A are now upper-diagonal. Now // reduce the m_nel columns to diagonal form by back-solving - for (m = nRows-1; m > 0; m--) { + for (m = std::min(nRows,nColumns)-1; m > 0; m--) { for (size_t n = m-1; n != npos; n--) { if (m_A(n,m) != 0.0) { fctr = m_A(n,m); @@ -683,7 +683,9 @@ stepComposition(int loglevel) doublereal grad0 = computeReactionSteps(m_dxi); // compute the mole fraction changes. - multiply(m_N, DATA_PTR(m_dxi), DATA_PTR(m_work)); + if (nFree()) { + multiply(m_N, DATA_PTR(m_dxi), DATA_PTR(m_work)); + } // change to sequential form unsort(m_work);