6.2.5 Newton-Krylov Method Newton-Krylov方法[cfd-6-2-5]
其中\(\bar{J}\)表示隐式算子(系统矩阵)。如前所述,\(\bar{J}\)是一个大型、稀疏且一般非对称的矩阵。在前几小节中ï¼我们讨论了把\(\bar{J}\)分解为若干因子的两种方法ï¼每个因子都比\(\bar{J}\)本身更易求逆。然而ï¼由于因式分解误差(以及\(\vec{R}^{n+1}\)的近似线性化)ï¼只能获得到定态的线性收敛。为了得到求解非线性方程的Newton法的二次收敛ï¼必须满足四个条件:
- 残差的线性化必须精确;
- \(\bar{J}\)必须被准确求逆;
- 时间步长须为\(\Delta t \to \infty\);
- 初始解在某种意义上必须接近最终解。
en
where \(\bar{J}\) represents the implicit operator (system matrix). As we already saw, \(\bar{J}\) constitutes a large, sparse, and generally non-symmetric matrix. In the previous subsections, we discussed two methods that decompose \(\bar{J}\) into several factors which can be each more easily inverted than \(\bar{J}\) itself. However, due to the factorisation error (and approximate linearisation of \(\vec{R}^{n+1}\)), only a linear convergence to steady state can be achieved. In order to obtain the quadratic convergence of Newton's method for the solution of non-linear equations, four conditions must be fulfilled:
- the linearisation of the residual must be exact,
- \(\bar{J}\) must be accurately inverted,
- the time step has to be \(\Delta t \to \infty\),
- initial solution must be, in some sense, close to the final solution.
显然ï¼必须克服的主要障碍是完整系统矩阵的线性化与求逆。en
Obviously, the main obstacles that have to be overcome are the linearisation and the inversion of the full system matrix.
对求解大型线性方程组而言ï¼一类特别合适的迭代技术是所谓的Krylov子空间(Krylov-subspace)方法。针对CFD中出现的矩阵求逆ï¼已有若干方法被提出ï¼例如平方共轭梯度(Conjugate Gradient Squared,CGS)法[76]、稳定双共轭梯度(Bi-Conjugate Gradient Stabilised,Bi-CGSTAB)格式[77]ï¼以及无转置准最小残差(Transpose-Free Quasi-Minimum Residual,TFQMR)方法[78]。然而ï¼最成功的Krylov子空间方法是广义最小残差(Generalised Minimal Residual,GMRES)技术ï¼它最初由Saad与Schulz[79]、[80]提出。此后,GMRES方法被多位研究者改进与扩充[81]-[84]。由于其流行程度ï¼下面将重点讨论GMRES方法。尽管如此ï¼我们将讨论的大部分内容同样适用于其他Krylov子空间方法。en
A particularly suitable class of iterative techniques for the solution of large linear equation systems are the so-called Krylov-subspace methods. Several were proposed for the inversion of matrices which arise in CFD. Examples are the Conjugate Gradient Squared (CGS) method [76], the Bi-Conjugate Gradient Stabilised (Bi-CGSTAB) scheme [77], or the Transpose-Free Quasi-Minimum Residual (TFQMR) approach [78]. However, the most successful Krylov subspace method became the Generalised Minimal Residual (GMRES) technique, which was originally suggested by Saad and Schulz [79], [80]. Since then, the GMRES method was improved and augmented by several researchers [81]-[84]. Because of its popularity, we shall focus on the GMRES approach in the following. Nevertheless, most of what we shall discuss also applies to the other Krylov subspace methods.
GMRES Method GMRES方法
如3.2.2小节所述(另见附录A.12),GMRES方法在一组\(m\)个正交归一向量(搜索方向)上最小化全局残差的范数ï¼即\(\|\bar{J}\Delta\vec{W}^{n} + \vec{R}^{n}\|\)ï¼这些向量张成式(3.10)给出的Krylov子空间\(\mathcal{K}_{m}\)。GMRES算法可概括如下:
- 猜测起始解\(\Delta\vec{W}^{n}_{0}\)并计算初始残差向量\(\vec{r}_{0} = \bar{J}\Delta\vec{W}^{n}_{0} + \vec{R}^{n}\);
- 生成\(m\)个搜索方向(通过Gram-Schmidt正交化);
- 求解最小化问题;
- 构造式(6.61)的近似解\(\Delta\vec{W}^{n} = \Delta\vec{W}^{n}_{0} + \vec{y}_{m}\)。
en
As we mentioned in Subsection 3.2.2 (see also Appendix A.12), the GMRES method minimises the norm of the global residual, i.e., \(\|\bar{J}\Delta\vec{W}^{n} + \vec{R}^{n}\|\) over a set of \(m\) orthonormal vectors (search directions), which span the Krylov subspace \(\mathcal{K}_{m}\) given by Eq. (3.10). The GMRES algorithm can be summarised as follows:
- guess a starting solution \(\Delta\vec{W}^{n}_{0}\) and evaluate the initial residual vector \(\vec{r}_{0} = \bar{J}\Delta\vec{W}^{n}_{0} + \vec{R}^{n}\),
- generate the \(m\) search directions (by Gram-Schmidt orthogonalisation),
- solve the minimisation problem,
- form an approximate solution of Eq. (6.61) as \(\Delta\vec{W}^{n} = \Delta\vec{W}^{n}_{0} + \vec{y}_{m}\).
由于内存需求随搜索方向数目线性增长ï¼实践中\(m\)被限制在10到40之间。这对收敛解\(\Delta\vec{W}^{n}\)而言可能并不足够。因此,GMRES方法必须重启ï¼即令\(\Delta\vec{W}^{n}_{0} = \Delta\vec{W}^{n}\)ï¼计算\(\vec{r}_{0}\)ï¼然后从第2步继续。文献[85]指出ï¼与其使用固定数目的搜索方向ï¼不如在全局残差范数降到给定容差以下时减小\(m\)。这样可以在Newton迭代的后期阶段节省大量运算。en
Since the memory requirements increase linearly with the number of search directions, \(m\) is restricted to values between 10 and 40 in practice. This might not be sufficient for a converged solution \(\Delta\vec{W}^{n}\). Thus, the GMRES method has to be restarted, i.e., we set \(\Delta\vec{W}^{n}_{0} = \Delta\vec{W}^{n}\), compute \(\vec{r}_{0}\) and proceed with step 2. As pointed out in Ref. [85], instead of working with a constant number of search directions, \(m\) should be reduced if the norm of the global residual drops below a specified tolerance. In this way, a large number of operations can be saved in later stages of the Newton iteration.
Computation of the Flux Jacobian 通量雅可比的计算
GMRES及其他Krylov子空间方法使我们得以避免显式计算与存储通量雅可比\(\partial\vec{R}/\partial\vec{W}\)。其想法基于如下观察:这些方法只依赖形如\(\bar{J}\Delta\vec{W}^{n}\)的矩阵-向量乘积ï¼并不需要矩阵\(\bar{J}\)本身。通量雅可比与解更新的乘积可以用简单的有限差分近似为en
GMRES and other Krylov subspace methods allow us to circumvent an explicit computation and storage of the flux Jacobian \(\partial\vec{R}/\partial\vec{W}\). The idea is based on the observation that the methods rely only on matrix-vector products of the form \(\bar{J}\Delta\vec{W}^{n}\) and do not need the matrix \(\bar{J}\) explicitly. The product of the flux Jacobian with the solution update can be approximated by a simple finite difference as
这只需要两次残差计算。为了使数值误差最小ï¼步长\(h\)的选择需要相当谨慎[36]。一种特别合适的公式为[86]en
which requires only two evaluations of the residual. The stepsize \(h\) has to be chosen with some care, in order to minimise the numerical error [36]. One particularly suitable formulation reads [86]
其中\(\epsilon\)为机器精度,\(d\)为标量积\(\vec{W}^{n}\cdot\Delta\vec{W}^{n}\),\(|\Delta\vec{W}^{n}|\)是所有元素取绝对值后的向量\(\Delta\vec{W}^{n}\)ï¼而\(\mathrm{typ}\,U\)表示\(U\)的典型大小。除了节省内存与运算量之外ï¼有限差分近似还有一个更重要的优点:可以容易地实现对高阶残差\(\vec{R}^{n}\)(包括边界条件、限制器、源项等)在数值上精确的线性化。en
where \(\epsilon\) denotes the machine accuracy, \(d\) the scalar product \(\vec{W}^{n}\cdot\Delta\vec{W}^{n}\), \(|\Delta\vec{W}^{n}|\) is the vector \(\Delta\vec{W}^{n}\) with all elements set to their absolute values, and finally \(\mathrm{typ}\,U\) represents a typical size of \(U\). Apart from saving memory and operations, there is an even more important advantage of the finite-difference approximation. Namely, numerically accurate linearisation of a high-order residual \(\vec{R}^{n}\) (including boundary conditions, limiters, source terms, etc.) can be easily achieved.
这样,Newton格式的二次收敛便能以适度的代价实现。因此ï¼我们把这类格式称为Newton-Krylov方法[86]-[88]。en
Thus, the quadratic convergence of Newton's scheme can be realised at moderate costs. For this reason, we speak of such a scheme as of Newton-Krylov approach [86]-[88].
Preconditioning 预条件
Krylov子空间方法的效率在很大程度上依赖于一个好的预条件子。其目的是使系统矩阵\(\bar{J}\)的特征值聚集在1附近。于是ï¼不再求解方程(6.61)ï¼而是按式(3.11)求解左预条件或右预条件系统。把式(6.61)与式(6.62)同条件\(\Delta t \to \infty\)相结合,Newton-Krylov方法成为en
The efficiency of Krylov-subspace methods depends strongly on a good preconditioner. Its purpose is to cluster the eigenvalues of the system matrix \(\bar{J}\) around unity. Thus, instead of Equation (6.61), the left- or right-preconditioned system according to Eq. (3.11) is solved. Using Eqs. (6.61) and (6.62) together with the condition \(\Delta t \to \infty\), the Newton-Krylov method becomes
此为左预条件;而en
with left preconditioning, and
为右预条件的情形。两种预条件方式的主要区别在于:左预条件会缩放残差\(\vec{R}^{n}\)ï¼而右预条件不会。在监测Krylov方法的收敛时须牢记这一点。en
in the case of right preconditioning, respectively. The main difference between the two preconditioning methodologies is that left preconditioning scales the residual \(\vec{R}^{n}\) whereas right preconditioning does not. This has to be kept in mind when the convergence of the Krylov method is monitored.
显然ï¼预条件子应尽可能接近系统矩阵的逆(\(\bar{P}_{L,R} \approx \bar{J}^{-1}\));但另一方面ï¼它又应以较低的数值代价可逆。因此ï¼我们必须在Krylov方法的收敛速度与求逆预条件矩阵所耗时间之间找到最优折中。最成功的预条件子之一是不完全下-上(Incomplete Lower Upper)分解方法[89]、[90]ï¼其填充水平可变(大多取零ï¼记为ILU(0))。ILU预条件子对黏性湍流(即刚性方程)[91]特别高效。为了在非结构网格上获得良好性能ï¼必须对系统矩阵的元素重新排序以减小带宽。RCM重编号策略[27]、[28]已在6.2.1节中讨论过。en
Obviously, the preconditioner should be as close as possible to the inverse of the system matrix (\(\bar{P}_{L,R} \approx \bar{J}^{-1}\)). But on the other hand, it should be invertible with low numerical effort. Therefore, we have to find an optimal tradeoff between the convergence speed of the Krylov method and the time spend for inverting the preconditioning matrix. One of the most successful preconditioners is the Incomplete Lower Upper factorisation method [89], [90] with varying level of fill-in (mostly with zero, designated as ILU(0)). The ILU preconditioner is especially efficient in the case of viscous, turbulent flows, i.e., for stiff equations [91]. In order to obtain a good performance on unstructured grids, it is necessary to reorder the elements of the system matrix such that the bandwidth is reduced. We already discussed the RCM renumbering strategy [27], [28] in Section 6.2.1.
ILU预条件格式的一个严重缺点是必须计算(见6.2.2小节)并存储矩阵\(\bar{J}\)的元素。因此ï¼一些作者建议采用LU-SGS格式作为预条件子[92]、[93]。这样ï¼应用式(6.62)时ï¼便可完全避免\(\bar{J}\)的组建与存储。然而ï¼文献[91]通过若干二维算例表明ï¼就CPU时间而言ï¼带LU-SGS的GMRES方法逊于与ILU(0)结合的GMRES。尽管如此,LU-SGS格式(与多重网格耦合时最佳)仍然是一种有吸引力的选择ï¼尤其在三维情形。en
A serious disadvantage of the ILU preconditioning scheme is that elements of the matrix \(\bar{J}\) have to be computed (see Subsection 6.2.2) and stored. Therefore, some authors suggested to employ the LU-SGS scheme as a preconditioner [92], [93]. Hence, when Eq. (6.62) is applied, the formation and storage of \(\bar{J}\) is completely avoided. However, it was demonstrated in Ref. [91] on behalf of several 2-D cases that the GMRES method with LU-SGS is inferior to GMRES combined with ILU(0) in terms of the CPU-time. Nevertheless, the LU-SGS scheme (best when coupled with multigrid) still represents an attractive alternative, particularly in 3D.
Start-Up Problem 启动问题
隐式Newton-Krylov方法的时间步长为无穷大。然而ï¼在Newton迭代过程的初期ï¼宜采用较小的时间步长。原因在于ï¼求解过程开始时流动解一般远离定态ï¼即非线性方程的根en
The time step of the implicit Newton-Krylov method is infinitely large. However, it is advisable to use small time steps at the beginning of the Newton iteration process. The reason is that the flow solution is in general far from the steady state at the beginning of the solution process, i.e., the root of the nonlinear equation
而这可能导致Newton迭代崩溃。一种可能的补救是所谓的开关演化松弛(Switched Evolution Relaxation,SER)技术[94]。此时ï¼式(6.61)中的\(\Omega/\Delta t\)项予以保留。时间步长按显式格式(式(6.14)或式(6.20)ï¼略去黏性特征值)同样方式计算。CFL数\(\sigma\)从一个较小的初值开始ï¼随残差2-范数的减小而增大ï¼即en
and this may cause a breakdown of the Newton iteration. One possible remedy is the so-called Switched Evolution Relaxation (SER) technique [94]. Here, the term \(\Omega/\Delta t\) is retained in Eq. (6.61). The time step is evaluated in the same way as presented for the explicit scheme (Eq. (6.14) or Eq. (6.20) without the viscous eigenvalue). The CFL number \(\sigma\) is increased starting from a small initial value correspondingly to the reduction of the 2-norm of the residual, i.e.,
这样ï¼迭代过程(6.61)的收敛起初是线性的ï¼但当CFL数较大时便趋近Newton法的二次收敛。时间项的另一个作用是增强\(\bar{J}\)的对角占优(与\(\Omega/\Delta t\)成反比)ï¼这有助于稳定迭代。文献[88]建议对式(6.66)中的\(\sigma^{n+1}\)加以限制ï¼使其最多增大到两倍、减小不超过十倍。en
Hence, the convergence of the iteration procedure (6.61) will be at first linear, but it approaches the quadratic convergence of Newton's method for large CFL numbers. A further effect of the time term is the increased diagonal dominance of \(\bar{J}\) (inverse proportional to \(\Omega/\Delta t\)), which will help to stabilise the iteration. In Ref. [88], it was suggested to clip \(\sigma^{n+1}\) in Eq. (6.66) such that it increases by maximum factor of two and decreases less than factor of ten.
另一种可用于克服Newton法启动问题的方法是网格序列化(grid sequencing)ï¼即在一系列较粗网格上获得初始解ï¼再插值到较细网格。另一种可能是用数值上廉价但稳健的迭代格式给出初始猜测。例如ï¼可以先运行由LU-SGS方法驱动的多重网格格式ï¼再切换到以LU-SGS为预条件子的GMRES。这对黏性湍流可能特别有吸引力ï¼因为多重网格格式的收敛在初始阶段之后通常会减慢ï¼而此时全局流动解已接近定态。en
A further approach which can be used to overcome the start-up problems of Newton's method consist of grid sequencing, where the initial solution is obtained on a sequence of coarser grids and interpolated onto finer grids. Another possibility is to use a numerically cheap but robust iteration scheme for the initial guess. For example, we could start with a multigrid scheme driven by the LU-SGS method and then switch to GMRES with LU-SGS as preconditioner. This might be particularly interesting for viscous turbulent flows, where the convergence of a multigrid scheme usually slows down after the initial phase. However, the global flow solution is then already close to the steady state.