<html><body><div style="color:#000; background-color:#fff; font-family:verdana, helvetica, sans-serif;font-size:10pt"><div style="font-family: verdana, helvetica, sans-serif; font-size: 10pt; "><span>Thanks for explaining all .&nbsp;</span></div><div style="font-family: verdana, helvetica, sans-serif; font-size: 10pt; "><span><br></span></div><div style="font-family: verdana, helvetica, sans-serif; font-size: 10pt; "><span>Purpose is to implement an adapted deflation preconditioner.&nbsp;</span></div><div style="font-family: verdana, helvetica, sans-serif; font-size: 10pt; "><span>Basically, it has nothing to do more with multigrid algorithm.&nbsp;</span></div><div style="font-family: verdana, helvetica, sans-serif; font-size: 10pt; ">To have PETSC codes, i was left out to use PCMG framework to implment this.&nbsp;</div><div style="font-family: verdana, helvetica, sans-serif; font-size: 10pt; "><br></div><div><div><font size="2" style="font-weight:
 bold;">&nbsp; If you truly want this form exactly; then it is 0 iterations of a pre-smooth and the KSP you set for the coarse mesh is C_c while you set the M^-1 apply shell to post-smooth KSP.</font></div><div style="font-family: verdana, helvetica, sans-serif; font-size: 10pt; "><br></div><div style="font-family: verdana, helvetica, sans-serif; font-size: 10pt; ">Does C_c mean recursive action ? if so, then fine!&nbsp;</div><div style="font-family: verdana, helvetica, sans-serif; font-size: 10pt; "><br></div><div style="font-family: verdana, helvetica, sans-serif; font-size: 10pt; ">Setting M^-1 preconditioner in ksp_post context with what ksp_type ? &nbsp;to my understanding, Richardson ?</div><div style="font-family: verdana, helvetica, sans-serif; font-size: 10pt; ">&nbsp;Just need an endorsement this time.&nbsp;</div></div><div style="font-family: verdana, helvetica, sans-serif; font-size: 10pt; "><br></div><div style="font-family: verdana,
 helvetica, sans-serif; font-size: 10pt; ">Thank you!</div><div style="font-family: verdana, helvetica, sans-serif; font-size: 10pt; ">regards, Abdul</div><div style="font-family: verdana, helvetica, sans-serif; font-size: 10pt; "><span><br></span></div><div style="font-family: verdana, helvetica, sans-serif; font-size: 10pt; "><br></div><div style="font-family: verdana, helvetica, sans-serif; font-size: 10pt; "><br></div><div style="font-family: verdana, helvetica, sans-serif; font-size: 10pt; "><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; margin-top: 5px; padding-left: 5px;">  <div style="font-size: 10pt; font-family: verdana, helvetica, sans-serif; "> <div style="font-size: 12pt; font-family: 'times new roman', 'new york', times, serif; "> <div dir="ltr"> <font size="2" face="Arial"> <hr size="1">  <b><span style="font-weight:bold;">From:</span></b> Barry Smith &lt;bsmith@mcs.anl.gov&gt;<br> <b><span
 style="font-weight: bold;">To:</span></b> Abdul Hanan Sheikh &lt;hanangul12@yahoo.co.uk&gt;; PETSc users list &lt;petsc-users@mcs.anl.gov&gt; <br><b><span style="font-weight: bold;">Cc:</span></b> Jed Brown &lt;jedbrown@mcs.anl.gov&gt; <br> <b><span style="font-weight: bold;">Sent:</span></b> Thursday, 5 April 2012, 20:27<br> <b><span style="font-weight: bold;">Subject:</span></b> Re: [petsc-users] Implementation of Multilevel preconditioner<br> </font> </div> <br><br>&nbsp; &nbsp; <br>On Apr 5, 2012, at 1:12 PM, Abdul Hanan Sheikh wrote:<br><br>&gt; Hi,, <br>&gt; Thanks for more details!! <br>&gt; Recursive two level multigrid&nbsp; (by using PCMG with my desired stuff in it, in PCSHELL) is okay. I will do it recursively. <br>&gt; No Problem with recursion and nested iterations. <br>&gt; Coming to two level, <br>&gt; How can I get exactly Prec = C +&nbsp; M^-1 (I - A*C) in a two level multigrid ? <br>&gt; What should be specific choice of
 pre_smoother_ksp_context and post_smoother_ksp_context <br>&gt; to get the "Prec" ? <br>&gt; what operators should be chosen in these two ksp contexts ? <br><br>&nbsp;  If you truly want this form exactly; then it is 0 iterations of a pre-smooth and the KSP you set for the coarse mesh is C_c while you set the M^-1 apply shell to post-smooth KSP.<br><br>&nbsp;  I see Jed just wrote "This is just -pc_mg_type kaskade (zero pre-smoothing iterations, one post-smoothing iteration)."&nbsp; This is also correct and just a different way of expressing the same thing.<br><br><br>&nbsp; &nbsp; Barry<br><br>What motivates you to use this form? It is non-standard. Normal multigrid with a pre-smooth and post-smooth (both M^-1) can be written algebraically as <br><br>M^-1&nbsp;  + (I - M^-1A)C(I- AM^-1)&nbsp; which also equals M^-1 + C - CAM^-1 - M^-1A C + M^-1 A C A M^-1<br><br>Note that I don't view writing the operations out this way as particularly informative (for
 example witing it as C +&nbsp; M^-1 (I - A*C)), it conceals the fact that your algorithm first projects the error onto the coarse grid space and then projects the new error onto some fine grid space. Normal multigrid with a pre and post first projects the error onto some fine grid space, then projects the new error onto the coarse grid space then projects the newest error onto the fine grid space again.<br>&nbsp; &nbsp; <br>&gt; <br>&gt; <br>&gt; Awiaitng, <br>&gt; with regards, Abdul<br>&gt; <br>&gt; <br>&gt; <br>&gt; <br>&gt; <br>&gt; <br>&gt; <br>&gt; <br>&gt; From: Jed Brown &lt;<a ymailto="mailto:jedbrown@mcs.anl.gov" href="mailto:jedbrown@mcs.anl.gov">jedbrown@mcs.anl.gov</a>&gt;<br>&gt; To: PETSc users list &lt;<a ymailto="mailto:petsc-users@mcs.anl.gov" href="mailto:petsc-users@mcs.anl.gov">petsc-users@mcs.anl.gov</a>&gt; <br>&gt; Cc: Abdul Hanan Sheikh &lt;<a ymailto="mailto:hanangul12@yahoo.co.uk"
 href="mailto:hanangul12@yahoo.co.uk">hanangul12@yahoo.co.uk</a>&gt; <br>&gt; Sent: Thursday, 5 April 2012, 17:56<br>&gt; Subject: Re: [petsc-users] Implementation of Multilevel preconditioner<br>&gt; <br>&gt; On Thu, Apr 5, 2012 at 08:38, Barry Smith &lt;<a ymailto="mailto:bsmith@mcs.anl.gov" href="mailto:bsmith@mcs.anl.gov">bsmith@mcs.anl.gov</a>&gt; wrote:<br>&gt;&nbsp; &nbsp; C +&nbsp; M^-1 (I - A*C)&nbsp;  is exactly a multiplicative Schwarz method with two preconditioners. Or in another way to put it it is exactly a two level multigrid so you can use PCMG in a straightforward way.<br>&gt; <br>&gt; It looks to me like he wants to do nested iteration with recursive coarse levels rather than just iteration in a smoother.<br>&gt; <br>&gt; I need the accuracy at first and somehow at second coarse level. <br>&gt; After these two levels, the number of iterations at each level till coarsest is constantly one.&nbsp; <br>&gt; <br>&gt; Okay, but one iteration
 of a preconditioned Krylov method is still two preconditioner applications, so the method would still be exponential in the number of levels. If Richardson iteration is okay, you can use -pc_mg_cycle_type w to do two iterations instead of 1. The code would actually work fine with increasing this further, but it looks like you would currently have to cheat a bit to get many recursive cycles.<br>&gt; <br>&gt; PCMGSetCycleType(pc,(PCMGCycleType)5);<br>&gt; <br>&gt; There is currently no interface for setting a different number of cycles on each level, but you could include mgimpl.h and change the levels-&gt;cycles manually.<br>&gt; <br>&gt; Note that W cycles are already often considered to be too much work on coarse levels to justify in a parallel setting, so it's somewhat unlikely that running more coarse level iterations will really be better than a more standard multigrid with stronger smoothers.<br>&gt; <br>&gt; <br><br><br><br> </div> </div>
 </blockquote></div>   </div></body></html>