On Tue, May 17, 2016 at 12:21 PM, Pratapa, Phanisri P <[email protected]> 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
