[petsc-users] Roles of ksp_type and pc_type

Matthew Knepley knepley at gmail.com
Thu Nov 13 05:59:17 CST 2014


On Thu, Nov 13, 2014 at 5:39 AM, Massimiliano Leoni <
leoni.massimiliano1 at gmail.com> wrote:

> Hi petsc-users,
>   I am relatively new to PETSc and so a few things that you'd call obvious
> still puzzle me. I hope someone can help me clarify this.
>
> Consider the system Ax = b and
>         KSPSetOperators(ksp,A,A,...);
>
> now, please correct me wherever I'm wrong:
> [1] if I set -ksp_type preonly, -pc_type lu   it solves Ax = b with direct
> LU
>
> [2] if I set -ksp_type preonly, -pc_type hypre   it solves Px = b where P
> is
>         the AMG preconditioner of A build by HYPRE
>         § Question: how does PETSc solve this?
>

We call Hypre directly to apply P^{-1}.


>
> [3] if I set -ksp_type gmres, -pc_type hypre   it solves Ax = b as
>         P^{-1}Ax = P^{-1}b with gmres, where P is again the AMG prec build
> by
>         HYPRE.
>
> [4] suppose I have the classic Stokes matrix A = [[C,B^T],[B,O]] and want
> to
>         use the block preconditioner P = [[C,O],[O,Mp/nu]]. What I'm doing
> now is
>         KSPSetOperators(ksp,A,P,...);
>         set ksp_type gmres, pc_type fieldsplit, inner ksps gmres and inner
> pcs
>         hypre, so I expect PETSc to solve Pz = r by blocks,
>         C z_u = r_u first, as in [3]
>         Mp/nu z_p = r_p later, again as in [3]
>         Is this what is actually happening?
>

It should be. Send -ksp_view and we can verify. You should use

  -pc_fieldsplit_schur_factorization_type diag


> [5] what happens instead if I set, in the same situation,
>         ksp_type preonly, pc_type fieldsplit, inner ksps gmres and inner
> pcs ?
>         I expect PETSc to solve Px = b with a block method as before. [This
>         doesn't actually solve Stokes].
>

Yes.

   Thanks,

      Matt


> I'm sorry for the many questions, I am trying to go through the User Manual
> and will be glad if anyone points me to further resources.
>
> Thanks in advance for any help,
> Massimiliano
>



-- 
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/20141113/6a72c108/attachment.html>


More information about the petsc-users mailing list