Moukalled F., Mangani L., Darwish M. The finite volume method in computational fluid dynamics. An advanced introduction with OpenFOAM and Matlab (811443), страница 55
Текст из файла (страница 55)
A cell is selected as the seed element into which a certain number of neighboring elements satisfying the set criteria are fused to form a coarse element. Themaximum number of fine elements to be fused into a coarse element is decided apriori. If the chosen seed element fails to form a coarse element, it is added to theleast populated coarse element among its neighbors.An efficient agglomeration algorithm is the directional agglomeration (DA)algorithm developed by Mavriplis [47]. In the DA, agglomeration is performed bystarting with a seed element and merging with it the neighboring fine grid elementsbased on the strength of their geometric connectivity.
The procedure needs to beperformed only once at the start of the solution.10.4.2 The Restriction Step and Coarse Level CoefficientsThe solution starts at the fine grid level. After performing few iterations, the error istransferred or restricted to a coarser grid level and the solution is found at that level.Then after performing few iterations at that level the error is restricted again to ahigher level and the sequence of events repeated until the highest or coarsest gridlevel is reached. Let ðkÞ denotes some level at which the solution has been found bysolving the following system of equations in correction form:AðkÞ eðkÞ ¼ rðkÞð10:125ÞThe next coarser level is ðk þ 1Þ to which the error will be restricted.
Let GIrepresents the set of cells i on the fine grid level ðk Þ that are agglomerated to formcell I of the coarse grid level ðk þ 1Þ. Then, the system to be solved on the coarsegrid at level ðk þ 1Þ isAðkþ1Þ eðkþ1Þ ¼ rðkþ1Þð10:126Þwith the residuals on the RHS of Eq. (10.126) computed asrðkþ1Þ ¼ Ikkþ1 rðkÞð10:127Þwhere Ikkþ1 is the restriction operator (i.e., the interpolation matrix) from the finegrid to the coarse grid as defined by the agglomeration process. In AMG therestriction operator is defined in a linear manner to yield a summation of the finegrid residuals asðkþ1ÞrI¼Xi2GIðk Þrið10:128Þ10.4The Multigrid Approach347Moreover, the coefficients of the coarse element are constructed by adding theappropriate coefficients of the constituting fine elements.
Recalling that a linearequation after discretization has the formXaC /C þaF /F ¼ bCð10:129ÞF¼NBðCÞwhich, for the current purpose, is written for the fine grid level in a more suitableform asðk Þðk Þai /i þXðk Þðk Þaij /jðk Þ¼ bið10:130Þj¼NBðiÞwhere NBðiÞ refers to the neighbors of element i. Initially Eq. (10.130) is notsatisfied resulting in the following residual:0X¼ bi @ai /i þðk Þðk Þriðk Þðk Þ1ðk Þ ðk Þaij /j Að10:131Þj¼NBðiÞðkþ1ÞDenoting by /Ithe solution on the coarse mesh element I that is parent to thefine mesh element i, the correction on the fine mesh from the coarse mesh can bewritten as0ðk Þ/iðkþ1Þ¼ /Iðk Þ /ið10:132ÞIt is desired for the correction to result in zero residuals over the coarse meshðk Þelement I.
These new residuals denoted by ~ri are calculated as0ðk Þ~ri¼ðk Þbi@ að k Þi1X ðk Þ ðk Þðk Þ0ðk Þ0ðk Þ A/i þ /iaij /j þ /jþð10:133Þj¼NBðiÞor equivalently as0ðk Þ~ri¼ bi @ai /i þðk Þðk Þðk ÞX1 0ðkÞ ðk Þðk Þ 0ðk Þaij /j A @ai /i þj¼NBðiÞ|fflfflfflfflfflfflfflfflfflfflfflfflfflfflfflfflfflfflfflfflfflfflfflfflfflfflfflfflfflffl{zfflfflfflfflfflfflfflfflfflfflfflfflfflfflfflfflfflfflfflfflfflfflfflfflfflfflfflfflfflffl}X1ðk Þ 0ðkÞaij /j Aj¼NBðiÞðk Þ0¼ðk Þri@aðkÞ /0ðkÞiiriþXj¼NBðiÞ1ðk Þ 0ðk Þaij /j Að10:134Þ34810Solving the System of Algebraic EquationssmoothA ( k )e( k ) = r ( k )Restriction( k+1)aIai( k ) +=i GIaij( k )i GI j GIaIJ( k+1) =aij( k )i GIrI( k+1) =A ( k+1)e( k+1) = r ( k+1)j GIj NB( I )smoothri( k )i GIFig. 10.7 The restriction step and assembly of coarse grid level coefficientsEnforcing the residual sum in I to zero, i.e.,X~rði kÞ ¼ 0ð10:135Þi2GIand substituting Eq. (10.134) in Eq.
(10.135) yields0¼X0ri @ðk Þi2GIXðk Þ0ðkÞai / i þX X1ðkÞ 0ðkÞaij /j Að10:136Þi2GI j¼NBðiÞi2GIRewriting Eq. (10.136) using coarse mesh numbering, the coarse mesh correctionequation becomesðkþ1ÞaI0ðkþ1Þ/IþXðkþ1ÞaIJ0ðkþ1Þ/Jðkþ1Þ¼ rIð10:137ÞJ¼NBðI Þðkþ1Þwhere aIðkþ1Þ; aIJðkþ1Þ; and rIðkþ1ÞaIare derived directly from fine grid coefficients as¼Xðk Þai þi2GIðkþ1ÞaIJ¼X Xi2GIðkþ1Þ¼Xi2GIThis is illustrated in Fig. 10.7.ðk Þðk Þaijj62GIriðk Þaiji2GI j2GIj2NBðI ÞrIXXð10:138Þ10.4The Multigrid Approach34910.4.3 The Prolongation Step and Fine Grid LevelCorrectionsThe prolongation operator is used to transfer the correction from a coarse to a finegrid level. Many options may be used. One possibility, depicted in Fig.
10.8, is azero order prolongation operator that yields the same value of the error on the finegrid, i.e., the error at a coarse grid cell will be inherited by all the children of thiscell on the fine grid level.Fig. 10.8 The prolongationstep and fine grid levelcorrectionscorrect(k)(k)+ e( k )Prolongationke(k ) = I k+1e(k+1)The correction is basically obtained from the solution of the system of equationsat the coarse grid. The interpolation or prolongation to the fine grid level isdenote askeðkÞ ¼ Ikþ1eðkþ1Þð10:139Þkwhere Ikþ1is an interpolation matrix from the coarse grid to the fine grid. Finally,the fine grid solution is corrected as/ðkÞ/ðkÞ þ eðkÞð10:140ÞThe number of grid levels used depends on the size of the grid.
For a larger numberof grid levels, the procedure is the same as sketched in Fig. 10.8.10.4.4 Traversal Strategies and Algebraic Multigrid CyclesTraversal strategies refer to the way by which coarse grids are visited during thesolution process, which are also known as multigrid cycles [48]. The usual cyclesused in the AMG method are the V cycle, the W cycle, and the F cycle [35, 36, 49, 50]displayed in Fig. 10.9.35010Solving the System of Algebraic Equations(a)L=0L=1L=2L=3RestrictionProlongationL=4(c)L=0L=1L=2L=3L=4(b)L=0L=1L=2L=3L=4Fig. 10.9 a V, b W, and c F multigrid cyclesThe simplest AMG cycle, illustrated in Fig. 10.9a, is the V cycle [49, 50] andconsists of visiting each of the grid levels only once. The usual practice is toperform few iterative sweeps in the restriction phase and then to inject the residualto a coarser grid until reaching the coarsest level.
For very stiff systems, the V cyclemay not be sufficient for accelerating the solution and therefore, more iterations onthe coarse level are required. The W cycle is based on applying smaller V cycles oneach visited coarse grid level. In this manner, the W cycle (Fig. 10.9b) consists ofnested coarse and fine grid level sweeps with the complexity increasing as thenumber of AMG levels increases.
The F cycle is a variant of the W cycle and can bethought of as splitting the W cycle in half as shown in Fig. 10.9c. The F cyclerequires less coarse level sweeps than the W cycle but more sweeps than the Vcycle. Therefore, it lies in between the V and W cycling strategies.10.5 Computational Pointers10.5.1 uFVMIn uFVM, two linear algebraic solvers are implemented. The successive overrelaxation method (SOR) and the ILU(0) method. The implementation of these10.5Computational Pointers351methods follows the procedures described earlier.
The SOR is located in the file“cfdSORSolver.m” while the ILU(0) implementation can be found in“cfdILUSolver.m”.10.5.2 OpenFOAM®The organizational structure of iterative linear algebraic solvers in OpenFOAM®[51] follows the usual approach. It starts by defining the base classes from whicheach type of algebraic matrix solvers is established. These algebraic solvers aregrouped under three main categories denoted by solvers, preconditioners, andsmoothers. Smoothers and preconditioners are differentiated by relating to smoothers the fixed point relation and embedding them within the preconditionersframework.
Recalling Eq. (10.81), the preconditioners classes implement theproduct P1 r while the smoothers classes advance the solution. Moreover, thesolvers category collects the necessary information related to the implementation ofthe conjugate gradient and multigrid algorithms.The source codes of the linear algebraic solvers reside within the lduMatrixfolder located at “…/src/OpenFOAM/matrices/lduMatrix/” in the following threesubfolders:• solvers• preconditioners• smoothersThe name of each subfolder reflects its functionality. The folder solvers containsthe main codes of the iterative solvers implemented in OpenFOAM®, which are• diagonalSolver: a diagonal solver for both symmetric and asymmetric problems.• GAMG: a geometric agglomerated algebraic multigrid solver (also namedGeneralized geometric- algebraic multi-grid in the manual).• ICC: an incomplete Cholesky preconditioned conjugate gradient solver.• PBiCG: a preconditioned bi-conjugate gradient solver for asymmetric matrices.• PCG: a preconditioned conjugate gradient solver for symmetric matrices.• smoothSolver: an iterative solver using smoother for symmetric and asymmetric matrices based on preconditioners.The folder preconditioners contains various implementations of the diagonalILU denoted by• diagonalPreconditioner: a diagonal preconditioner.• DICPreconditioner, DILUPreconditioner: a diagonal Incomplete Choleskypreconditioner for symmetric and asymmetric matrices respectively.• FDICPreconditioner: a faster version of the DICPreconditioners diagonalbased incomplete Cholesky preconditioner for symmetric matrices in which thereciprocal of the preconditioned diagonal and the upper coefficients divided bythe diagonal are calculated and stored.35210Solving the System of Algebraic Equations• GAMGPreconditioner: a geometric agglomerated algebraic multigrid preconditioner.
It uses a mutigrid cycle as preconditioner to execute the second part ofEq. (10.81).• noPreconditioner: a null preconditioner for both symmetric and asymmetricmatrices.Finally the smoothers folder contains the following:• DIC, DILU: a diagonal-based incomplete Cholesky smoother for symmetricand asymmetric matrices.• DICGaussSeidel, DILUGaussSeidel: a combined DIC, DILU/Gauss-Seidelsmoother for symmetric and asymmetric matrices in which DIC, DILUsmoothing is followed by Gauss-Seidel to ensure that any “spikes” created bythe DIC, DILU sweeps are smoothed out.• DILU: a diagonal-based incomplete LU smoother for asymmetric matrices.• GaussSeidel: The Gauss-Seidel method for both symmetric and asymmetricmatrices.Furthermore OpenFOAM® defines inside the lduMatrix class three additionalbase classes that wrap the three corresponding categories.