[petsc-users] Projection preconditioner as PCMG

Abdul Hanan Sheikh hanangul12 at yahoo.co.uk
Thu Mar 8 12:57:28 CST 2012


Dear, 

Thank you Jed for reply! 
I dont want to try snes, since my problem is linear, but I successfully applied the KSP
preconditioned with PCMG (not kaskade, but multiplicative; for some reasons) .
I make pre-smoother dummy by setting KSP_PRE context as  PREONLY alongwith PCNONE. 

CGC and post-smoother serves my purpose to apply preconditioner
Prec = I - A*P*(A_H)^-1 * R   with KSP_POST as RICHARDSON alongwith PCNONE. 

I hope PCNONE make smoother S = I in the framework you suggested earlier i.e. 

C b + S (b - A C b)~~~~~~ where C is read as CGC. 

It seems working well with levels 2, but when I force RICHARDSON_max_it 0. To my understanding, it should work with RICHARDSON_max_it = 1; 


What if I want to approximate my all coarse matrices with any Krylov iteration ? 

Appreciations for helping out! 


Abdul H. 


TechnischeUniversiteit Delft
Faculteit Elektrotechniek, Wiskunde en Informatica
Numerical Analysis 
Room No. HB.07.050
Mekelweg 4, 2628 CD Delft
Tel: (015) - 27 81692
Fax: (015) - 27 87209
E-mail: hanangul12 at yahoo.co.uk (Primary)
          a.h.sheikh at tudelft.nl 



>________________________________
> From: Jed Brown <jedbrown at mcs.anl.gov>
>To: Abdul Hanan Sheikh <hanangul12 at yahoo.co.uk>; PETSc users list <petsc-users at mcs.anl.gov> 
>Sent: Tuesday, 6 March 2012, 21:14
>Subject: Re: [petsc-users] Projection preconditioner as PCMG
> 
>
>On Tue, Mar 6, 2012 at 11:00, Abdul Hanan Sheikh <hanangul12 at yahoo.co.uk> wrote:
>
>I make my query simpler: how can I implement a preconditioner of form 
>>
>>
>>
>>P = I - A*P*(A_H)^-1 * R  
>>
>>with any Krylov , where
>>I : Identity
>>P : Prolongation
>>A_H : Galerkin coarse matrix
>>R : Restriction, 
>>
>>
>>
>>Can I exploit the CGC part of PCMG , by making its pre and post smoother null ? 
>
>You use P twice in the above, but I think I see what you mean. You can certainly use PCMG with no pre- or post-smoother or you could do the same here with PCComposite, but you probably don't want that extra application of A in the preconditioner unless you are going to use a post-smoother.
>
>
>That is, suppose C = P*A_H^{-1}*R is the coarse grid solver. Then with a post-smoother S, application of the preconditioner to the vector b would be C b + S (b - A C b). If you drop the post-smoother by setting S = I, you get C b + b - A C b. Keeping the extra multiplication with A and not using a post-smoother will likely destabilize the method. As an example, take src/snes/examples/tutorials/ex5.c and just look at the first linear solve with 2-level method. First, with an additive coarse grid correction and no fine grid smoother (i.e. the preconditioner is I + C where C is an Prolongate*Exact_Coarse_Solve*Restrict).
>
>
>$ ./ex5 -da_grid_x 201 -da_grid_y 201 -snes_max_it 1 -ksp_monitor_singular_value -pc_type mg -pc_mg_levels 2 -pc_mg_type additive -mg_levels_ksp_type preonly -mg_levels_pc_type  none
>    0 KSP Residual norm 1.991818008559e+01 % max 1.000000000000e+00 min 1.000000000000e+00 max/min 1.000000000000e+00
>    1 KSP Residual norm 8.562399481020e+00 % max 9.703742797548e-01 min 9.703742797548e-01 max/min 1.000000000000e+00
>    2 KSP Residual norm 1.547282124742e+00 % max 4.106911489507e+00 min 9.455565835409e-01 max/min 4.343379931984e+00
>    3 KSP Residual norm 5.193012838962e-01 % max 7.849972917628e+00 min 9.390711734984e-01 max/min 8.359294949267e+00
>    4 KSP Residual norm 1.844773292053e-01 % max 8.102437955088e+00 min 9.157291371635e-01 max/min 8.848072673744e+00
>    5 KSP Residual norm 6.904332859839e-02 % max 8.102847554075e+00 min 8.906430581537e-01 max/min 9.097749631454e+00
>    6 KSP Residual norm 3.747280928850e-02 % max 8.131998087718e+00 min 8.796142392701e-01 max/min 9.244959579630e+00
>    7 KSP Residual norm 1.781146506612e-02 % max 8.153370848515e+00 min 8.294602459028e-01 max/min 9.829730705949e+00
>    8 KSP Residual norm 7.506605928852e-03 % max 8.160488227056e+00 min 8.035220795876e-01 max/min 1.015589793282e+01
>    9 KSP Residual norm 3.771683771569e-03 % max 8.185296438244e+00 min 7.986463109034e-01 max/min 1.024896293452e+01
>   10 KSP Residual norm 1.900344739083e-03 % max 8.246526708637e+00 min 7.835579388152e-01 max/min 1.052446322107e+01
>   11 KSP Residual norm 8.969235041181e-04 % max 8.246542749144e+00 min 7.698718962697e-01 max/min 1.071157784704e+01
>   12 KSP Residual norm 3.771331016150e-04 % max 8.253249205705e+00 min 7.665454362492e-01 max/min 1.076681017904e+01
>   13 KSP Residual norm 1.998592159889e-04 % max 8.323950632412e+00 min 7.632295016946e-01 max/min 1.090622232753e+01
>   14 KSP Residual norm 9.624660396860e-05 % max 8.327354837686e+00 min 7.567183120253e-01 max/min 1.100456366042e+01 
>
>
>This is identical with one step of Richardson (-mg_levels_ksp_type richardson) because the "initial guess" is 0. The convergence is somewhat better if we improve the additive fine-grid smoother, e.g. ILU or SOR, though the condition number is actually worse in this case (because the preconditioned operator is now non-normal, the eigenvalues are well-clustered).
>
>
>$ ./ex5 -da_grid_x 201 -da_grid_y 201 -snes_max_it 1 -ksp_monitor_singular_value -pc_type mg -pc_mg_levels 2 -pc_mg_type additive -mg_levels_ksp_type preonly -mg_levels_pc_type ilu
>    0 KSP Residual norm 1.997267177320e+01 % max 1.000000000000e+00 min 1.000000000000e+00 max/min 1.000000000000e+00
>    1 KSP Residual norm 5.755612216067e+00 % max 9.658916552787e-01 min 9.658916552787e-01 max/min 1.000000000000e+00
>    2 KSP Residual norm 2.828695990580e-01 % max 2.491505412300e+00 min 9.583727874764e-01 max/min 2.599724705102e+00
>    3 KSP Residual norm 1.097671648754e-01 % max 7.900124346250e+00 min 5.695048906547e-01 max/min 1.387191659964e+01
>    4 KSP Residual norm 2.203949856452e-02 % max 9.291338218054e+00 min 3.581794670449e-01 max/min 2.594045464055e+01
>    5 KSP Residual norm 8.497097452426e-03 % max 1.013788428797e+01 min 3.272689944775e-01 max/min 3.097722197653e+01
>    6 KSP Residual norm 1.376443389574e-03 % max 1.055586782597e+01 min 2.933041209977e-01 max/min 3.598949714743e+01
>    7 KSP Residual norm 2.753520742081e-04 % max 1.061464021647e+01 min 2.893817762727e-01 max/min 3.668040314489e+01
>    8 KSP Residual norm 6.552848547677e-05 % max 1.062831125267e+01 min 2.883290857853e-01 max/min 3.686173812025e+01
>
>
>"Kaskade" multigrid applies no pre-smoother, but uses a multiplicative post-smoother. That is what I wrote above and probably what you wanted.
>
>
>$ ./ex5 -da_grid_x 201 -da_grid_y 201 -snes_max_it 1 -ksp_monitor_singular_value -pc_type mg -pc_mg_levels 2 -pc_mg_type kaskade -mg_levels_ksp_type richardson -mg_levels_pc_type none
>    0 KSP Residual norm 1.981089588505e+01 % max 1.000000000000e+00 min 1.000000000000e+00 max/min 1.000000000000e+00
>    1 KSP Residual norm 3.481667117996e+00 % max 9.904507054699e-01 min 9.904507054699e-01 max/min 1.000000000000e+00
>    2 KSP Residual norm 1.652167261481e+00 % max 5.608992736195e+00 min 9.879184804293e-01 max/min 5.677586609937e+00
>    3 KSP Residual norm 1.627219442360e+00 % max 6.798397388800e+00 min 9.550178771471e-01 max/min 7.118607464301e+00
>    4 KSP Residual norm 7.880741343988e-01 % max 7.451381264321e+00 min 7.145924145893e-01 max/min 1.042745642438e+01
>    5 KSP Residual norm 3.537498074218e-01 % max 7.663873901737e+00 min 5.751738420032e-01 max/min 1.332444791829e+01
>    6 KSP Residual norm 1.078704665358e-01 % max 7.800309555756e+00 min 5.120187805734e-01 max/min 1.523442079023e+01
>    7 KSP Residual norm 4.407455476078e-02 % max 7.855365072615e+00 min 5.037708740493e-01 max/min 1.559313068156e+01
>    8 KSP Residual norm 2.107104852559e-02 % max 7.893144033146e+00 min 5.025484383148e-01 max/min 1.570623532254e+01
>    9 KSP Residual norm 1.763159978441e-02 % max 7.912218583050e+00 min 5.024504696471e-01 max/min 1.574726079688e+01
>   10 KSP Residual norm 1.745405855993e-02 % max 7.928099602729e+00 min 5.023138582042e-01 max/min 1.578315922056e+01
>   11 KSP Residual norm 1.376977330994e-02 % max 7.939644155950e+00 min 5.017479535724e-01 max/min 1.582396918497e+01
>   12 KSP Residual norm 9.446347797152e-03 % max 7.949376050758e+00 min 5.015718142316e-01 max/min 1.584892895734e+01
>   13 KSP Residual norm 6.843342509359e-03 % max 7.956996132919e+00 min 4.969226601251e-01 max/min 1.601254434828e+01
>   14 KSP Residual norm 6.437072325338e-03 % max 7.961936315836e+00 min 4.932296836382e-01 max/min 1.614245164059e+01
>   15 KSP Residual norm 6.091589527973e-03 % max 7.966811508176e+00 min 4.932019218895e-01 max/min 1.615324505966e+01
>   16 KSP Residual norm 4.652185214024e-03 % max 7.970648347219e+00 min 4.916668205282e-01 max/min 1.621148309064e+01
>   17 KSP Residual norm 3.701849685772e-03 % max 7.973893800218e+00 min 4.915344876340e-01 max/min 1.622245030781e+01
>   18 KSP Residual norm 3.482133374032e-03 % max 7.976475806296e+00 min 4.911811815837e-01 max/min 1.623937582580e+01
>   19 KSP Residual norm 3.465608263872e-03 % max 7.978688479804e+00 min 4.898709616560e-01 max/min 1.628732687652e+01
>   20 KSP Residual norm 3.149472026786e-03 % max 7.980652326863e+00 min 4.891722853032e-01 max/min 1.631460441778e+01
>   21 KSP Residual norm 2.763464672775e-03 % max 7.982383839733e+00 min 4.891419493795e-01 max/min 1.631915612607e+01
>   22 KSP Residual norm 2.689646479190e-03 % max 7.983807057995e+00 min 4.876132849055e-01 max/min 1.637323531811e+01
>   23 KSP Residual norm 2.661061400431e-03 % max 7.985119113668e+00 min 4.836465184065e-01 max/min 1.651023797292e+01
>   24 KSP Residual norm 2.383953808700e-03 % max 7.986314359135e+00 min 4.718949191329e-01 max/min 1.692392529636e+01
>^C
>
>
>Okay, that didn't work. But it was because the Richardson step was too large. We can get away without a traditional smoothing step by fixing the relaxation parameter for Richardson:
>
>
>$ ./ex5 -da_grid_x 201 -da_grid_y 201 -snes_max_it 1 -ksp_monitor_singular_value -pc_type mg -pc_mg_levels 2 -pc_mg_type kaskade -mg_levels_ksp_type richardson -mg_levels_pc_type none -mg_levels_ksp_richardson_self_scale
>    0 KSP Residual norm 1.975857018746e+01 % max 1.000000000000e+00 min 1.000000000000e+00 max/min 1.000000000000e+00
>    1 KSP Residual norm 2.476038171898e+00 % max 9.622055302029e-01 min 9.622055302029e-01 max/min 1.000000000000e+00
>    2 KSP Residual norm 3.723935286980e-02 % max 1.019358214307e+00 min 8.790661889416e-01 max/min 1.159592107091e+00
>    3 KSP Residual norm 1.048082002961e-02 % max 2.231045830559e+00 min 2.203725693734e-01 max/min 1.012397249305e+01
>    4 KSP Residual norm 4.815690407780e-03 % max 3.167321755561e+00 min 1.859713575290e-01 max/min 1.703123425911e+01
>    5 KSP Residual norm 2.282674490066e-03 % max 5.220845319337e+00 min 1.603210979291e-01 max/min 3.256492992360e+01
>    6 KSP Residual norm 5.030060118813e-04 % max 6.078990414170e+00 min 1.535348150609e-01 max/min 3.959356326940e+01
>    7 KSP Residual norm 2.084516564815e-04 % max 6.195047474999e+00 min 1.466558297789e-01 max/min 4.224208123426e+01
>    8 KSP Residual norm 6.654981023267e-05 % max 6.379643313848e+00 min 1.442472810392e-01 max/min 4.422713043801e+01
>
>
>Unfortunately, convergence is very sensitive to that step and for variable coefficient problems, we won't be able to choose a good value. If we know the matrix diagonal, we can get a lot more robustness by post-smoothing with Jacobi, and now we don't need that pesky scaling parameter.
>
>
>$ ./ex5 -da_grid_x 201 -da_grid_y 201 -snes_max_it 1 -ksp_monitor_singular_value -pc_type mg -pc_mg_levels 2 -pc_mg_type kaskade -mg_levels_ksp_type richardson -mg_levels_pc_type jacobi
>    0 KSP Residual norm 1.975846409514e+01 % max 1.000000000000e+00 min 1.000000000000e+00 max/min 1.000000000000e+00
>    1 KSP Residual norm 2.482202615145e+00 % max 9.621966917526e-01 min 9.621966917526e-01 max/min 1.000000000000e+00
>    2 KSP Residual norm 4.457401425338e-02 % max 1.020264072916e+00 min 8.821750286291e-01 max/min 1.156532479163e+00
>    3 KSP Residual norm 1.637472997384e-02 % max 1.776622548172e+00 min 7.524631434334e-01 max/min 2.361075839629e+00
>    4 KSP Residual norm 3.644899164209e-03 % max 1.907783379671e+00 min 4.245698995769e-01 max/min 4.493449445127e+00
>    5 KSP Residual norm 1.443735788456e-03 % max 1.935858887793e+00 min 3.898702611314e-01 max/min 4.965392544111e+00
>    6 KSP Residual norm 3.929697132002e-04 % max 1.961850264833e+00 min 3.669296462786e-01 max/min 5.346666001861e+00
>    7 KSP Residual norm 1.446207699005e-04 % max 1.970859698383e+00 min 3.614358036844e-01 max/min 5.452862384670e+00
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20120308/c4292818/attachment.htm>


More information about the petsc-users mailing list