[petsc-users] User defined solver for PCMG

Matthew Knepley knepley at gmail.com
Tue May 17 12:28:31 CDT 2016


On Tue, May 17, 2016 at 12:21 PM, Pratapa, Phanisri P <ppratapa at gatech.edu>
wrote:

> Hi,
>
> 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).
>
> You can do this the Right Way:

  1) Implement your solver as a PETSc KSP (see any of the implementations,
like KSPCG)

  2) Then just use -pc_mg_levels_ksp_type mysolver

or the Hard Way

  1) Pull out each level KSP (
http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/PC/PCMGGetSmoother.html
)

  2) Set the type to KSPREPONLY

  3) Set the preconditioner to PCSHELL

  4) Set your solver to the apply function for the PCSHELL

  Thanks,

    Matt



> Thank you,
>
>
> Regards,
>
>
> Pradeep
>



-- 
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20160517/11b85cc1/attachment.html>


More information about the petsc-users mailing list