From ae989985eb98e376213e9325bb29c6be38b30f57 Mon Sep 17 00:00:00 2001 From: Harry Moffat Date: Wed, 13 Oct 2010 16:58:34 +0000 Subject: [PATCH] Added a hook for specifying atol --- Cantera/src/numerics/NonlinearSolver.cpp | 14 ++++++++++++++ Cantera/src/numerics/NonlinearSolver.h | 15 ++++++++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/Cantera/src/numerics/NonlinearSolver.cpp b/Cantera/src/numerics/NonlinearSolver.cpp index e9ac2c248..19faf2def 100644 --- a/Cantera/src/numerics/NonlinearSolver.cpp +++ b/Cantera/src/numerics/NonlinearSolver.cpp @@ -1702,5 +1702,19 @@ namespace Cantera { return retn; } //===================================================================================================================== + // Set the absolute tolerances for the solution variables + /* + * Set the absolute tolerances used in the calculation + * + * @param atol Vector of length neq_ that contains the tolerances to be used for the solution variables + */ + void NonlinearSolver::setAtol(const doublereal * const atol) + { + for (int i = 0; i < neq_; i++) { + atolk_[i]= atol[i]; + } + } + //===================================================================================================================== + } diff --git a/Cantera/src/numerics/NonlinearSolver.h b/Cantera/src/numerics/NonlinearSolver.h index f7ff48f58..43ef2daea 100644 --- a/Cantera/src/numerics/NonlinearSolver.h +++ b/Cantera/src/numerics/NonlinearSolver.h @@ -385,6 +385,15 @@ namespace Cantera { */ int convergenceCheck(int dampCode, double s1); + + //! Set the absolute tolerances for the solution variables + /*! + * Set the absolute tolerances used in the calculation + * + * @param atol Vector of length neq_ that contains the tolerances to be used for the solution variables + */ + void setAtol(const doublereal * const atol); + private: //! Pointer to the residual and jacobian evaluator for the @@ -497,12 +506,16 @@ namespace Cantera { //! int indicating whether row scaling is turned on (1) or not (0) int m_rowScaling; + //! Total number of linear solves int m_numTotalLinearSolves; + //! Total number of newton iterations int m_numTotalNewtIts; + //! Minimum number of newton iterations to use int m_min_newt_its; + //! Boolean that turns on solution filtering int filterNewstep; //! Jacobian formation method @@ -512,8 +525,8 @@ namespace Cantera { */ int m_jacFormMethod; + //! Number of Jacobian evaluations int m_nJacEval; - //! Current system time /*!