Added in a new Residual evaluation type, Base_LaggedSolutionComponents,

to properly handle Picard iterations within the damping algorithm.
This commit is contained in:
Harry Moffat 2010-11-08 22:22:13 +00:00
parent 154b234da9
commit 12b6f572e6
3 changed files with 16 additions and 6 deletions

View file

@ -465,9 +465,9 @@ namespace Cantera {
* @param ydot_curr Current value of the time derivative of the solution vector
*/
void NonlinearSolver::doResidualCalc(const doublereal time_curr, const int typeCalc, const doublereal * const y_curr,
const doublereal * const ydot_curr)
const doublereal * const ydot_curr, const ResidEval_Type_Enum evalType)
{
m_func->evalResidNJ(time_curr, delta_t_n, y_curr, ydot_curr, DATA_PTR(m_resid), Base_ResidEval);
m_func->evalResidNJ(time_curr, delta_t_n, y_curr, ydot_curr, DATA_PTR(m_resid), evalType);
m_nfe++;
m_resid_scaled = false;
}
@ -955,9 +955,9 @@ namespace Cantera {
* -> m_resid[] contains the result of the residual calculation
*/
if (solnType_ != NSOLN_TYPE_STEADY_STATE) {
doResidualCalc(time_curr, solnType_, y1, ydot1);
doResidualCalc(time_curr, solnType_, y1, ydot1, Base_LaggedSolutionComponents);
} else {
doResidualCalc(time_curr, solnType_, y1, ydot0);
doResidualCalc(time_curr, solnType_, y1, ydot0, Base_LaggedSolutionComponents);
}
m_normResidTrial = residErrorNorm(DATA_PTR(m_resid));

View file

@ -141,9 +141,12 @@ namespace Cantera {
* @param typeCalc Type of the calculation
* @param y_curr Current value of the solution vector
* @param ydot_curr Current value of the time derivative of the solution vector
* @param evalType Base evalulation type
* Defaults to Base_ResidEval
*/
void doResidualCalc(const doublereal time_curr, const int typeCalc, const doublereal * const y_curr,
const doublereal * const ydot_curr);
const doublereal * const ydot_curr,
const ResidEval_Type_Enum evalType = Base_ResidEval);
//! Compute the undamped Newton step
/*!

View file

@ -38,7 +38,14 @@ namespace Cantera {
/*!
* We calculate this when we want to display a solution
*/
Base_ShowSolution
Base_ShowSolution,
//! Base residual calculation containing any lagged components
/*!
* We use this to calculate residuals when doing line searches along
* directions determined by Jacobians that are missing contributions
* from lagged entries.
*/
Base_LaggedSolutionComponents
};
//! Wrappers for the function evaluators for Nonlinear solvers and Time steppers