From 3996c38b3c0045cde2a1096747cc1ca28f8acbb8 Mon Sep 17 00:00:00 2001 From: Harry Moffat Date: Wed, 16 Feb 2011 17:46:28 +0000 Subject: [PATCH] Changed the residual weights formula --- Cantera/src/numerics/NonlinearSolver.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/Cantera/src/numerics/NonlinearSolver.cpp b/Cantera/src/numerics/NonlinearSolver.cpp index 0e0f5f52b..cfc16b8a0 100644 --- a/Cantera/src/numerics/NonlinearSolver.cpp +++ b/Cantera/src/numerics/NonlinearSolver.cpp @@ -869,11 +869,10 @@ namespace Cantera { * HKM These have been shown to exactly match up. * The steepest direction is always largest even when there are variable solution weights */ - printf("descentComparison: rate of decrease in linearized cauchy dir = %g\n", residDL); - printf("descentComparison: rate of decrease in cauchy dir = %g\n", residDecrease2); - printf("\n"); - printf("descentComparison: rate of decrease in newtondir (expected) = %g\n", residDecreaseNewtExp2); - printf("descentComparison: rate of decrease in newtondir = %g\n", residDecreaseNewt2); + printf("descentComparison: initial rate of decrease in cauchy dir (expected) = %g\n", residDL); + printf("descentComparison: initial rate of decrease in cauchy dir = %g\n", residDecrease2); + printf("descentComparison: initial rate of decrease in newton dir (expected) = %g\n", residDecreaseNewtExp2); + printf("descentComparison: initial rate of decrease in newton dir = %g\n", residDecreaseNewt2); } //==================================================================================================================== @@ -904,6 +903,10 @@ namespace Cantera { //==================================================================================================================== double NonlinearSolver::expectedResid(double lambda) { if (lambda < dist_R0_ / dist_Total_) { + /* + * We are on the steepest descent line + */ + } else if (lambda < ((dist_R0_ + dist_R1_)/ dist_Total_)) { @@ -2130,7 +2133,7 @@ namespace Cantera { { doublereal sum = 0.0; for (int i = 0; i < neq_; i++) { - m_residWts[i] = m_rowWtScales[i]; + m_residWts[i] = m_rowWtScales[i] / neq_; sum += m_residWts[i]; } sum /= neq_;