3.2.2 Implicit Schemes 隐式格式[cfd-3-2-2]

在方程(3.4)中令\(\beta\neq 0\),便得到一族隐式时间积分格式。对于非定常流动的模拟,非常流行的是\(\beta=1\)、\(\omega=1/2\)的三点隐式后向差分格式,它在时间上具有二阶精度。此时,该格式大多在所谓的双时间步进(dual time-stepping)方法[148]-[150]、[110]、[111]中使用,即在每一物理时间步内,以伪时间(pseudo-time)求解一个定常问题。en

A family of implicit time integration schemes is obtained from Eq. (3.4) by setting \(\beta\neq 0\). Very popular for the simulation of unsteady flows is the 3-point implicit backward-difference scheme with \(\beta=1\) and \(\omega=1/2\), which is 2nd-order accurate in time. In this case, the scheme is mostly employed within the so-called dual time-stepping approach [148]-[150], [110], [111], where a steady-state problem is solved in pseudo-time at each physical time step.

对于定常流动问题的求解,\(\omega=0\)的格式更为合适,因为它所需的计算机内存更少。此时,若把方程(3.4)中的残差\(\vec{R}^{n+1}\)在当前时间层上线性化,便得到格式en

For the solution of stationary flow problems, a scheme with \(\omega=0\) is more suitable, since it requires less computer memory. Herewith, if we linearise the residual \(\vec{R}^{n+1}\) in Eq. (3.4) about the current time level, we obtain the scheme

\[\left(\overline{M}\,\frac{\Omega}{\Delta t}+\beta\,\frac{\partial\vec{R}}{\partial\vec{W}}\right)\Delta\vec{W}^{n}=-\vec{R}^{n}\,. \tag{3.8}\]

项\(\partial\vec{R}/\partial\vec{W}\)称为通量雅可比矩阵(flux Jacobian),它构成一个大型稀疏矩阵。方程(3.8)左端括号内的表达式也称为隐式算子(implicit operator)。如前文所述,质量矩阵\(\overline{M}\)可以用单位矩阵代替,而不影响定常解。方程(3.8)中的参数\(\beta\)一般取1,这给出时间上一阶精度的离散;\(\beta=1/2\)时可得到时间二阶精度的格式。不过并不建议这样做,因为\(\beta=1\)的格式稳健得多,而且对定常问题来说,时间精度本来就无关紧要。en

The term \(\partial\vec{R}/\partial\vec{W}\) is denoted as the flux Jacobian. It constitutes a large sparse matrix. The expression enclosed in parenthesis on the left-hand side of Eq. (3.8) is also referred to as the implicit operator. As already discussed above, the mass matrix \(\overline{M}\) can be replaced by the identity matrix, without influencing the steady state solution. The parameter \(\beta\) in Eq. (3.8) is generally set to 1, which results in a 1st-order accurate temporal discretisation. A 2nd-order time accurate scheme is obtained for \(\beta=1/2\). However, this is not advised since the scheme with \(\beta=1\) is much more robust, and the time accuracy plays no role for steady problems anyway.

与显式格式相比,隐式格式的主要优点是可以使用大得多的时间步长,而不损害时间积分过程的稳定性。事实上,当\(\Delta t\rightarrow\infty\)时,格式(3.8)就转化为标准的Newton法,后者具有二次收敛性。但二次收敛的条件是通量雅可比矩阵包含残差的完整线性化。隐式格式的另一重要优点是:对于刚性方程组和/或源项——它们常出现在真实气体模拟、湍流建模或高度拉伸网格(高雷诺数流动)的情形中——隐式格式具有更优的稳健性与收敛速度。另一方面,隐式格式越快(以时间步数或迭代次数计)、越稳健,每时间步或每迭代的计算量通常也越大。因此,经多重网格加速的显式格式可能同样高效,甚至更高效。此外,隐式格式比显式格式难于向量化或并行化得多。en

The principal advantage of implicit schemes as compared to explicit ones is that significantly larger time steps can be used, without hampering the stability of the time integration process. In fact, for \(\Delta t\rightarrow\infty\) the scheme (3.8) transforms into standard Newton's method, which exhibits quadratic convergence. However, the condition for quadratic convergence is that the flux Jacobian contains the complete linearisation of the residual. Another important advantage of implicit schemes is their superior robustness and convergence speed in the case of stiff equation systems and/or source terms, which are often encountered in real gas simulations, turbulence modelling, or in the case of highly stretched grids (high Reynolds number flows). On the other hand, the faster (in terms of time steps or iterations) and the more robust an implicit scheme is, the higher is usually the computational effort per time step or iteration. Therefore, an explicit scheme accelerated by multigrid can be equally or even more efficient. Furthermore, implicit schemes are significantly more difficult to vectorise or to parallelise than their explicit counterparts.

对每个控制体写出,方程(3.8)中的隐式格式便代表一个大型线性方程组,在每个时间步\(\Delta t\)内都须对其求解以得到增量\(\Delta\vec{W}^{n}\)。这一任务既可以用直接法(direct),也可以用迭代法(iterative)完成。en

Written down for each control volume, the implicit scheme in Eq. (3.8) represents a large system of linear equations, which has to be solved for the update \(\Delta\vec{W}^{n}\) at each time step \(\Delta t\). This task can be accomplished using either a direct or an iterative method.

直接法基于用Gaussian消元或某种直接稀疏矩阵方法[151]、[152]对方程(3.8)的左端作精确求逆。尽管二次收敛性在结构网格[153]-[156]以及非结构网格[157]上都已得到证明,但对三维问题而言,直接法并不可行,因为它们需要过高的计算量和海量的计算机内存。en

The direct methods are based on the exact inversion of the left-hand side of Eq. (3.8) using either the Gaussian elimination or some direct sparse matrix method [151], [152]. Although quadratic convergence was demonstrated on structured [153]-[156] as well as on unstructured grids [157], direct methods are not an option for 3-D problems because they require an excessively high computational effort and a huge amount of computer memory.

因此,对较大的网格或三维问题,唯一实用的方法是迭代法。此时,线性方程组在每个时间步内用某种迭代矩阵求逆方法对\(\Delta\vec{W}^{n}\)求解。为了减少内存需求并增大对角占优,通量雅可比矩阵\(\partial\vec{R}/\partial\vec{W}\)大多基于右端项一阶精度空间离散的线性化。这一近似带来两个主要后果:一是无法达到Newton法的二次收敛性,二是最大时间步长受到限制。但另一方面,每次迭代的数值工作量显著减少,从而得到数值上非常高效的格式。en

Thus, the only practical method for larger grids or 3-D problems are iterative methods. Here, the linear system is solved for \(\Delta\vec{W}^{n}\) at each time step using some iterative matrix inversion methodology. In order to reduce the memory requirements and also to increase the diagonal dominance, the flux Jacobian \(\partial\vec{R}/\partial\vec{W}\) is mostly based on linearisation of a 1st-order accurate spatial discretisation of the right-hand side. The two main consequences of this approximation are that the quadratic convergence of Newton's scheme cannot be achieved and that the maximum time step becomes limited. On the other hand, the numerical effort of an iteration step is significantly reduced, which leads to a numerically highly efficient scheme.

对结构网格,主要采用如下迭代方法:交替方向隐式(Alternating Direction Implicit,ADI)格式[158]-[161]、(线)Jacobi或Gauss-Seidel松弛格式[162]-[166],特别是下上对称Gauss-Seidel(Lower-Upper Symmetric Gauss-Seidel,LU-SGS;也称LU-SSOR——Lower-Upper Symmetric Successive Overrelaxation)格式[167]-[171]。这些方法都基于把隐式算子分裂为若干部分的和或积,使每一部分都更容易求逆。由于存在随之而来的因子化误差(factorisation error)(相对于原矩阵的差异),再加上通量雅可比矩阵的简化,把线性方程组解得非常精确并不划算。事实上,ADI方法与LU-SGS方法在每个时间步只进行一次迭代。en

In the case of structured grids, iterative methods like the Alternating Direction Implicit (ADI) scheme [158]-[161], the (line) Jacobi or the Gauss-Seidel relaxation scheme [162]-[166], and particularly the Lower-Upper Symmetric Gauss-Seidel (LU-SGS; also referenced to as LU-SSOR - Lower-Upper Symmetric Successive Overrelaxation) scheme [167]-[171] are mainly employed. All these methods are based on splitting of the implicit operator into a sum or product of parts, which can be each inverted more easily. Because of the associated factorisation error (the difference with respect to the original matrix) and also the simplification of the flux Jacobian, it does not pay off to solve the linear system very accurately. In fact, only one iteration is carried out at each time step of the ADI and the LU-SGS method.

非结构网格的隐式迭代方法大多基于Gauss-Seidel松弛格式[172]-[175]。为了改进收敛,可以采用红黑(red-black)Gauss-Seidel方法,其在非结构网格上的推广见文献[176]-[178]。另一个特别有趣的可能性是在非结构网格上实现LU-SGS格式[18]、[179]、[180],其内存需求和数值工作量都非常低。en

Implicit iterative methods for unstructured grids are in the most cases based on the Gauss-Seidel relaxation scheme [172]-[175]. In order to improve the convergence, it is possible to use the red-black Gauss-Seidel methodology. Its extension to unstructured grids was demonstrated in Refs. [176]-[178]. A particularly interesting possibility is also offered by an implementation of the LU-SGS scheme on unstructured grids [18], [179], [180], because of its very low memory requirements and numerical effort.

由于线隐式方法在结构网格上的成功,也有一些尝试把这一方法学移植到非结构网格上[181]、[182]。其做法是构造连续的"线",使每个网格点或每个网格单元(格心格式情形)只被访问一次——即所谓的哈密顿回路(Hamiltonian tour)[183]。这些线主要沿坐标方向布置,但在边界处及必要处需要折叠(因此被戏称为"蛇"(snakes))。随后用三对角求解器对方程(3.8)的左端求逆。后来人们认识到,折叠线会减慢收敛;为克服这一点,每条线被拆分成多个线段(linelet)[184]。然而,其在向量计算机上的性能相当差。线段的思想还被用来改进显式格式在高度拉伸的黏性非结构网格上的收敛性,即在横穿边界层的方向上使用隐式求解器[145]。en

Because of the success of the line-implicit methods on structured grids, a few attempts were made to adopt this methodology on unstructured grids [181], [182]. The approach was to construct continuous lines such that each grid point or each grid cell (in the case of a cell-centred scheme) is visited only once - the so-called Hamiltonian tour [183]. The lines were oriented primarily in coordinate directions, but they were folded at the boundaries and where necessary (therefore they were nicknamed "snakes"). A tri-diagonal solver was then employed to invert the left-hand side of Eq. (3.8). Later on, it was recognised that folding the lines can slow down the convergence. To overcome this, each line was broken up into multiple linelets [184]. However, the performance on a vector computer was rather poor. The idea of linelets was also employed to improve the convergence of an explicit scheme on highly stretched viscous unstructured grids using an implicit solver in the direction across the boundary layer [145].

更精细的迭代技术以更全局的方式处理线性方程组,即所谓的Krylov子空间(Krylov subspace)方法。其发展源于Hestenes和Stiefel[185]提出的一种求解大型稀疏线性方程组的高效迭代格式——共轭梯度法(conjugate gradient method)。原始的共轭梯度法只限于Hermite正定矩阵,但对\(n\times n\)矩阵,它至多\(n\)次迭代即收敛。此后,为求解CFD应用中出现的任意非奇异矩阵,人们提出了多种Krylov子空间方法。例如:共轭梯度平方法(Conjugate Gradient Squared,CGS)[186]、稳定双共轭梯度法(Bi-Conjugate Gradient Stabilised,Bi-CGSTAB)[187],以及无转置拟最小残量法(Transpose-Free Quasi-Minimum Residual,TFQMR)[188]格式等。en

More sophisticated iterative techniques, which treat the linear equation system in a more global way, are the so-called Krylov subspace methods. Their development was triggered by the introduction of an efficient iterative scheme for solving large, sparse linear systems - namely the conjugate gradient method by Hestenes and Stiefel [185]. The original conjugate gradient method is restricted to Hermitian positive definite matrices only, but for an \(n\times n\) matrix it converges in at most \(n\) iterations. Since then, a variety of Krylov subspace methods was proposed for the solution of arbitrary non-singular matrices, as they occur in CFD applications. For example, there are methods like the Conjugate Gradient Squared (CGS) [186], the Bi-Conjugate Gradient Stabilised (Bi-CGSTAB) [187], or the Transpose-Free Quasi-Minimum Residual (TFQMR) [188] scheme.

然而,使用最广泛的方法是Saad和Schultz[189]发展的广义最小残量(Generalised Minimal Residual,GMRES)格式。若把方程(3.8)中的隐式格式改写为en

However, the most widely employed method is the Generalised Minimal Residual (GMRES) scheme developed by Saad and Schultz [189]. If we rewrite the implicit scheme in Eq. (3.8) as

\[\bar{J}\,\Delta\vec{W}^{n}=-\vec{R}^{n}\ , \tag{3.9}\]

则\(\bar{J}\)表示一个大型、稀疏且非对称的矩阵(即左端)。从初始猜测\(\Delta\vec{W}_0^{n}\)出发,GMRES(\(m\))方法寻求形如\(\Delta\vec{W}^{n}=\Delta\vec{W}_0^{n}+\vec{y}_m\)的解\(\Delta\vec{W}^{n}\),其中\(\vec{y}_m\)属于Krylov子空间en

then \(\bar{J}\) represents a large, sparse, and non-symmetric matrix (the left-hand side). Starting from an initial guess \(\Delta\vec{W}_0^{n}\), the GMRES(\(m\)) method seeks a solution \(\Delta\vec{W}^{n}\) in the form \(\Delta\vec{W}^{n}=\Delta\vec{W}_0^{n}+\vec{y}_m\), where \(\vec{y}_m\) belongs to the Krylov subspace

\[\begin{aligned} &\mathcal{K}_m\equiv\mathrm{span}\left\{\vec{r}_0,\ \bar{J}\vec{r}_0,\ \bar{J}^{2}\vec{r}_0,\ \cdots,\ \bar{J}^{m-1}\vec{r}_0\right\}\\[4pt] &\vec{r}_0=\bar{J}\,\Delta\vec{W}_0^{n}+\vec{R}^{n}\ , \end{aligned} \tag{3.10}\]

以使残差\(\Vert\bar{J}\,\Delta\vec{W}^{n}+\vec{R}^{n}\Vert\)达到最小。参数\(m\)规定Krylov子空间的维数,换言之即搜索方向(search directions)\((\bar{J}^{i}\vec{r}_0)\)的数目。由于所有方向都必须存储,\(m\)通常取10到40之间;对于病态矩阵(出现在湍流流动、真实气体等的模拟中),需要取较大的数值。若在\(m\)次子迭代内未达到收敛,GMRES必须重启。GMRES方法所需的内存明显多于例如Bi-CGSTAB或TFQMR,但它更稳健、收敛平滑,通常也更快。关于各种方法学非常详细的比较见文献[190]。en

such that the residual \(\Vert\bar{J}\,\Delta\vec{W}^{n}+\vec{R}^{n}\Vert\) becomes a minimum. The parameter \(m\) specifies the dimension of the Krylov subspace, or in other words the number of search directions (\(\bar{J}^{i}\vec{r}_0\)). Since all directions have to be stored, \(m\) is usually chosen between 10 and 40, the higher number being necessary for poorly conditioned matrices (which arise in the simulation of turbulent flows, real gas, etc.). GMRES has to be restarted, if no convergence is achieved within \(m\) sub-iterations. The GMRES method requires significantly more memory than, e.g., Bi-CGSTAB or TFQMR, but it is more robust, smoothly converging and usually also faster. A very detailed comparison of the various methodologies can be found in Ref. [190].

尽管如此,与其他共轭梯度类方法一样,预处理(preconditioning)对CFD问题来说是绝对必不可少的。此时,我们求解en

Nevertheless, as with other conjugate gradient methods, preconditioning is absolutely essential for CFD problems. Here, we solve

\[\left(\bar{P}_L\,\bar{J}\right)\Delta\vec{W}^{n}=-\bar{P}_L\,\vec{R}^{n}\quad\mbox{, or}\quad \bar{J}\,\bar{P}_R\left(\bar{P}_R^{-1}\Delta\vec{W}^{n}\right)=-\vec{R}^{n} \tag{3.11}\]

来代替方程(3.9)中的方程组。矩阵\(\bar{P}_L\)和\(\bar{P}_R\)分别表示左预处理子和右预处理子。预处理子应尽可能逼近\(\bar{J}^{-1}\),以便把特征值聚集到1附近;当然,它同时应当容易求逆。一种特别高效的预处理子是零填充(zero fill-in)的不完全下上(Incomplete Lower Upper)分解方法[191],即ILU(0)。关于与GMRES配合使用的不同预处理技术的讨论,读者可参阅[97]、[192]-[195]。en

instead of the system in Eq. (3.9). The matrices \(\bar{P}_L\) and \(\bar{P}_R\) denote left and right preconditioners, respectively. The preconditioner should approximate \(\bar{J}^{-1}\) as close as possible, in order to cluster the eigenvalues near unity. On the other hand, it should be of course easy to invert. One particularly efficient preconditioner is the Incomplete Lower Upper factorisation method [191] with zero fill-in (ILU(0)). For the discussion of different preconditioning techniques in connection with GMRES the reader is referred to [97], [192]-[195].

由于GMRES方法在存储搜索方向以及可能的预处理矩阵上需要相当多的计算机内存,最好能避免通量雅可比矩阵\(\partial\vec{R}/\partial\vec{W}\)的显式构造与存储。这正是所谓的无矩阵(matrix-free)方法所能做到的。其思想基于如下观察:GMRES(以及某些其他Krylov子空间方法)只使用如下形式的矩阵-向量乘积en

Since the GMRES method requires a considerable amount of computer memory for storing the search directions and possibly also the preconditioning matrix, it is a good idea to circumvent an explicit formation and storage of the flux Jacobian \(\partial\vec{R}/\partial\vec{W}\). This is offered by the so-called matrix-free approach. The idea is based on the observation that GMRES (and some other Krylov subspace methods) employs only matrix vector products of the form

\[\frac{\partial\vec{R}}{\partial\vec{W}}\,\Delta\vec{W}^{n}\,, \tag{5}\]

它可以用有限差分简单地近似为en

which can be simply approximated by finite-differences as

\[\frac{\partial\vec{R}}{\partial\vec{W}}\,\Delta\vec{W}^{n}=\frac{\vec{R}\left(\vec{W}+\epsilon\,\Delta\vec{W}^{n}\right)-\vec{R}\left(\vec{W}\right)}{\epsilon}\ , \tag{3.12}\]

因而只需要残差计算。参数\(\epsilon\)的选取须加小心,以使数值误差最小(参见例如[196]或[197])。无矩阵方法的另一个、甚至更重要的优点是:可以在隐式格式中方便地利用高阶残差\(\vec{R}^{n}\)的(数值上)精确线性化。于是,Newton格式的二次收敛性能够以适中的代价实现。这种情形称为Newton-Krylov方法[197]-[201]、[110]。实践经验表明,在所有Krylov子空间方法中,GMRES最适合无矩阵实现[202]。一个有趣的可能性是把LU-SGS格式用作无矩阵GMRES方法的预处理子。由于LU-SGS格式同样不需要显式存储通量雅可比矩阵,内存需求还可以进一步降低。最近已有工作在非结构网格上的三维无黏和层流流动中展示了这一方法的计算效率[203]。en

thus requiring only residual evaluations. The parameter \(\epsilon\) has to be chosen with some care, in order to minimise the numerical error (see, e.g., [196] or [197]). Another, and even more important, advantage of the matrix-free approach is that (numerically) accurate linearisation of a high-order residual \(\vec{R}^{n}\) can be easily utilised in the implicit scheme. Hence, the quadratic convergence of Newton's scheme can be achieved at moderate costs. In this case we speak of Newton-Krylov approach [197]-[201], [110]. Practical experience indicates that from all Krylov subspace methods, GMRES is best suited for the matrix-free implementation [202]. An interesting possibility is to utilise the LU-SGS scheme as a preconditioner for the matrix-free GMRES method. Since the LU-SGS scheme also does not require an explicit storage of the flux Jacobian, the memory requirements can be even further reduced. The computational efficiency of this approach was recently demonstrated for 3-D inviscid and laminar flows on unstructured grids [203].

隐式格式的收敛也可以借助多重网格来增强。基本上有两种可能的途径。第一,可以在隐式格式内部使用多重网格——作为每个时间步所产生的线性方程组(3.9)的求解器,或者作为某个共轭梯度类方法的预处理子[204]、[205]。第二,隐式格式本身可以作为FAS多重网格方法中的光滑子(smoother),直接作用于控制方程[206]-[209]、[178]。一些研究表明,至少对纯气动问题,"简单"的隐式格式(如Gauss-Seidel)与多重网格相结合,所得求解器在计算上(以CPU时间计)比例如GMRES更高效[178]、[198]。en

The convergence of an implicit scheme can also be enhanced by using multigrid. There are basically two possible ways. First, we can employ multigrid inside an implicit scheme - as a solver for the linear equation system (3.9) arising at each time step, or as a preconditioner for one of the conjugate gradient methods [204], [205]. Second, the implicit scheme itself can serve as a smoother within the FAS multigrid method, which is applied directly to the governing equations [206]-[209], [178]. Some investigations show that at least for purely aerodynamic problems, rather "simple" implicit schemes (like Gauss-Seidel) combined with multigrid result in computationally more efficient solvers (in terms of the CPU time) than, e.g., GMRES [178], [198].