From 9630216f3e659575988ebe052af53c50424b2c53 Mon Sep 17 00:00:00 2001 From: Christopher Lueth Date: Wed, 13 Oct 2010 22:06:03 +0000 Subject: [PATCH] Fixed nan problem if m_normResid0 = 0.0 at line 965 --- Cantera/src/numerics/NonlinearSolver.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Cantera/src/numerics/NonlinearSolver.cpp b/Cantera/src/numerics/NonlinearSolver.cpp index 19faf2def..c816d3f2a 100644 --- a/Cantera/src/numerics/NonlinearSolver.cpp +++ b/Cantera/src/numerics/NonlinearSolver.cpp @@ -961,7 +961,12 @@ namespace Cantera { * We aren't going to solve the system if we don't need to. Therefore, return an estimate * of the next solution update based on the ratio of the residual reduction. */ - s1 = s0 * m_normResidTrial / m_normResid0; + if (m_normResid0 > 0.0) { + s1 = s0 * m_normResidTrial / m_normResid0; + } + else { + s1 = 0; + } if (m_normResidTrial < 1.0) { retnTrial = 3; } else {