<html><body><div style="font-family: times new roman, new york, times, serif; font-size: 12pt; color: #000000"><div>How to precondition a direct solve ?</div><div><br></div><div>My understanding is that to solve AX=B with an iterative method (say GMRES + jacobi), I need to follow these steps:<br></div><div>KSPSetType(ksp, KSPGMRES);</div><div>PCSetType(pc, PCJACOBI);</div><div>KSPSolve(ksp, B);<br></div><div><br></div><div>Also, to solve AX=B with a direct method, my understanding is that I need to follow these steps:<br></div><div><div>KSPSetType(ksp, KSPPREONLY);</div><div>PCSetType(pc, PCLU);</div><div>PCFactorSetMatSolverPackage(pc, "mumps"); // To choose the direct solver<br></div><div>KSPSolve(ksp, B);</div><div><br></div><div>OK, so far so good.</div><div><br></div><div>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" ?<br></div><div>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.<br></div><div><br></div><div>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 ?<br></div><div><br></div></div><div>Franck<br></div></div></body></html>