<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, May 17, 2016 at 12:21 PM, Pratapa, Phanisri P <span dir="ltr"><<a href="mailto:ppratapa@gatech.edu" target="_blank">ppratapa@gatech.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">




<div dir="ltr">
<div style="font-size:12pt;color:rgb(0,0,0);font-family:Calibri,Arial,Helvetica,sans-serif;background-color:rgb(255,255,255)">
<p>Hi,</p>
<p><span style="font-size:12pt">I am trying to find out if one can use a user defined linear solver function in PCMG (instead of the default GMRES). According to the petsc manual, I can change the solver/smoother through the KSP context and the available solvers, but I am interested in
 using my own function (solver). </span><br></p>
<p><span style="font-size:12pt"></span></p></div></div></blockquote><div>You can do this the Right Way:</div><div><br></div><div>  1) Implement your solver as a PETSc KSP (see any of the implementations, like KSPCG)</div><div><br></div><div>  2) Then just use -pc_mg_levels_ksp_type mysolver</div><div><br></div><div>or the Hard Way</div><div><br></div><div>  1) Pull out each level KSP (<a href="http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/PC/PCMGGetSmoother.html">http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/PC/PCMGGetSmoother.html</a>)<br></div><div><br></div><div>  2) Set the type to KSPREPONLY</div><div><br></div><div>  3) Set the preconditioner to PCSHELL</div><div><br></div><div>  4) Set your solver to the apply function for the PCSHELL</div><div><br></div><div>  Thanks,</div><div><br></div><div>    Matt</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div style="font-size:12pt;color:rgb(0,0,0);font-family:Calibri,Arial,Helvetica,sans-serif;background-color:rgb(255,255,255)"><p><span style="font-size:12pt">Thank you,</span><br></p>
<p><br>
</p>
<p>Regards,</p>
<p><br>
</p>
<p>Pradeep<br>
</p>
</div>
</div>

</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature">What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener</div>
</div></div>