Nonlinear Solver for One-dimensional Flows#
Overview#
Cantera uses a hybrid time stepping / steady-state algorithm to solve the discretized 1-dimensional flame equations. For both the time stepping and steady-state problems, a damped Newton’s method solver is used. The general principles of the solver used in Cantera are described in Kee et al. [2003](Chapter 15).
Problem Definition#
The solution to the 1-dimensional set of governing equations is expressed in the form
of a root finding equation for use with a Newton solver. The equation to be solved
takes the form of
The vector-value function
Residuals in this context, at interior grid points, are the difference between the left-hand side and right-hand side of the governing equations. If the perfect solution was obtained, then the difference between the left-hand side and right-hand side of the governing equations would be zero, and this is what the solver is trying to achieve by examining the residuals during each attempt at solving the system of equations.
One of the key components of the solver is the Jacobian matrix, which is the matrix of partial derivatives of the residuals with respect to the solution vector. The Jacobian matrix is used to determine the direction of the correction vector that will drive the solution towards zero error.
For the vector-value residual
Moving across a row of the Jacobian matrix encodes how the value of the residual at a grid point changes with respect to each solution component. The Jacobian is approximated numerically in the 1D solver instead of having analytical relations derived for each governing equation.
Damped Newton Method#
The damped Newton method starts with an initial guess for the solution,
For each iteration,
Here,
Another way to looking at the equation is:
Where
The damping parameter,
Each component of
must stay within a trust region, which is the bounds that are assigned to each solution component. These are bounds such as limitations on the magnitude or sign of the velocity, mass fractions, etc.The norms of succeeding undamped steps decrease in magnitude.
The following image visually illustrates the damped Newton method. In it, the undamped
Newton step
Representation of the damped Newton method. Adapted from Kee et al. [2003].#
For a more mathematical representation of the damped Newton method, we consider:
A value of
Where:
and,
During the search for the correct value of
During the damped Newton method, the Jacobian is kept at the
Convergence Criteria#
As was discussed earlier, the Newton method is an iterative method, and it’s important to assess when the method has reached a point where the iterations can be stopped. This point is called convergence. Cantera’s implementation uses a weighted norm of the step vector to determine convergence, rather than a simple absolute norm. A damped Newton step is considered to be converged when the weighted norm of the correction vector is less than 1. During the solution, the process of finding and taking a damped Newton step is repeated until the weighted norm of the correction vector is less than 1, if it is not, then the process continues.
In a multivariate system, different variables may have vastly different magnitudes
and units. A simple absolute norm could either be dominated by large components or fail
to account for smaller components effectively. By normalizing the step vector
components using
This approach provides a more robust and scale-invariant method for assessing convergence, making it especially useful in systems with diverse variables.
Definition of the Weighted Norm#
The weighted norm of the step vector
where:
is the Newton step vector component for the -th solution variable at the -th grid point. is the error weight for the -th solution component, given by:
Here:
is the relative error tolerance for the -th solution component. is the average magnitude of the -th solution component over all grid points, and is the total number of grid points. is the absolute error tolerance for the -th solution component.
Interpretation of the Weighted Norm#
The weighted norm is a relative measure that helps bring all components of the step vector into a comparable range, taking into account the scales of the different solution components. It can be interpreted as follows:
Relative Error Term
: Scales the step size relative to the average magnitude of the corresponding solution component. This means that larger components can tolerate larger steps.Absolute Error Term
: Ensures that even very small solution components are considered in the convergence check by providing a minimum threshold.
Convergence Criterion#
The Newton iteration is considered converged when the weighted norm is less than 1:
This criterion indicates that each component of the step vector
Transient Solution#
There will be times when the solution of the steady-state problem can not be found using the damped Newton method. In this case, a transient solution is solved and a specified number of time steps are taken before the steady-state damped Newton method is attempted again.
The equation that is being solved for the transient case is:
Where
Here the n+1
is the solution at the next time step, n
is the solution at the current
time step.
We consider a case where each element of the residual vector may not have a corresponding time derivative term. These equations without time derivative terms are referred to as algebraic equations, and the ones with time derivative terms are referred to as differential equations. A general way to express this is by writing the equation above in the following form.
Where
Moving all terms to the right hand side of the equation, we get our expression for the residual equation that we will by solving:
For the Newton method, we linearize the residual equation about the solution vector at the next iteration (not time step) by using a Taylor series expansion. The linearized equation is given by:
Where
Using the expression for the residual equation defined earlier, the Jacobian matrix can be written as:
Where
The linearized equation is set to zero to obtain the equation that will be used to send the residual equation to zero. This equation is:
Taking the full expression for the Jacobian and the residual equation, we get:
Recall that the original steady-state equation, solved using the damped Newton method had the form:
The transient equation has the same form as the steady-state equation, and so the same damped Newton method can be used to solve the transient problem for a single time step.