From 73d8df7f4c8bfdc3bc4d780af31d78e5485bda1c Mon Sep 17 00:00:00 2001 From: Harry Moffat Date: Wed, 15 Dec 2010 02:15:27 +0000 Subject: [PATCH] Tightend up the tolerances on the nonlinear solvers. --- Cantera/src/numerics/NonlinearSolver.cpp | 14 ++++++++++++-- Cantera/src/numerics/RootFind.cpp | 2 +- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/Cantera/src/numerics/NonlinearSolver.cpp b/Cantera/src/numerics/NonlinearSolver.cpp index b8df9939d..596d44cda 100644 --- a/Cantera/src/numerics/NonlinearSolver.cpp +++ b/Cantera/src/numerics/NonlinearSolver.cpp @@ -394,11 +394,21 @@ namespace Cantera { { int i; doublereal sum_norm = 0.0, error; + for (i = 0; i < neq_; i++) { +#ifdef DEBUG_HKM + mdp::checkFinite(resid[i]); +#endif error = resid[i] / m_residWts[i]; +#ifdef DEBUG_HKM + mdp::checkFinite(error); +#endif sum_norm += (error * error); } sum_norm = sqrt(sum_norm / neq_); +#ifdef DEBUG_HKM + mdp::checkFinite(sum_norm); +#endif if (printLargest) { const int num_entries = printLargest; doublereal dmax1, normContrib; @@ -588,7 +598,7 @@ namespace Cantera { { double oldVal = m_ScaleSolnNormToResNorm; if (m_normSolnFRaw > 1.0E-13) { - m_ScaleSolnNormToResNorm = m_normResid0 / m_normSolnFRaw * oldVal; + m_ScaleSolnNormToResNorm = 1.0E-2 * m_normResid0 / m_normSolnFRaw * oldVal; } m_normResid0 = m_normSolnFRaw; computeResidWts(); @@ -1769,7 +1779,7 @@ namespace Cantera { } sum /= neq_; for (int i = 0; i < neq_; i++) { - m_residWts[i] = m_ScaleSolnNormToResNorm * (m_residWts[i] + atolBase_ * sum); + m_residWts[i] = m_ScaleSolnNormToResNorm * (m_residWts[i] + atolBase_ * atolBase_ * sum); } } //===================================================================================================================== diff --git a/Cantera/src/numerics/RootFind.cpp b/Cantera/src/numerics/RootFind.cpp index efbda6b34..0bc16bd9d 100644 --- a/Cantera/src/numerics/RootFind.cpp +++ b/Cantera/src/numerics/RootFind.cpp @@ -224,7 +224,7 @@ namespace Cantera { if (x1 == 0.0) { x2 = 0.00001 * (xmax - xmin); } else { - x2 = x1 * 1.01; + x2 = x1 * 1.0001; } if (x2 > xmax) { x2 = x1 - (xmax - xmin) / 100.;