[petsc-dev] How to precondition a direct solve ?

Franck Houssen franck.houssen at inria.fr
Fri Aug 25 12:51:07 CDT 2017


How to precondition a direct solve ? 

My understanding is that to solve AX=B with an iterative method (say GMRES + jacobi), I need to follow these steps: 
KSPSetType(ksp, KSPGMRES); 
PCSetType(pc, PCJACOBI); 
KSPSolve(ksp, B); 

Also, to solve AX=B with a direct method, my understanding is that I need to follow these steps: 
KSPSetType(ksp, KSPPREONLY); 
PCSetType(pc, PCLU); 
PCFactorSetMatSolverPackage(pc, "mumps"); // To choose the direct solver 
KSPSolve(ksp, B); 

OK, so far so good. 

Now what if I want to solve a preconditioned system (say MAX=MB that is AX=B "modified" by M) with a direct method : what is the "PETSc way" to do that ? What would be the "steps to follow" ? 
The short answer would be : replace A and B by MA and MB. But then, I'll have to compute M by myself which may not be an easy thing (if not a jacobi - ilu, sor, mg, ....). I wondered if there is a more natural way to do that with PETSc. 

My understanding is that KSPPREONLY is a "trick" to mimic a direct solve within an iterative solve. Is there such a trick to precondition a direct solve ? 

Franck 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20170825/8b83066b/attachment.html>


More information about the petsc-dev mailing list