[petsc-users] KSPSetOptionsPrefix usage

Hong Zhang hzhang at mcs.anl.gov
Tue Mar 27 10:30:34 CDT 2012


2012/3/27 Gong Ding <gdiso at ustc.edu>

> Hi
> I now use KSPSetOptionsPrefix to avoid option conflict to several KSP
> objects.
> I know KSPSetOptionsPrefix will call PCSetOptionsPrefix, PC options can be
> safely added the same prefix.
> However, what about the matrix prefix? i.e. I would like to use following
> code
>
> ierr = PCSetType (pc, (char*) PCILU);
> ierr = PCFactorSetMatSolverPackage (pc, "superlu");
> ierr = PetscOptionsSetValue("-mat_superlu_rowperm","LargeDiag");
> ierr = PetscOptionsSetValue("-mat_superlu_ilu_droptol","1e-4");
> ierr = PetscOptionsSetValue("-mat_superlu_ilu_filltol","1e-2");
> ierr = PetscOptionsSetValue("-mat_superlu_ilu_fillfactor","20");
>
> Suppose I use prefix as "KSP1_", should I change mat option name to, i.e.
> -KSP1_mat_superlu_rowperm?
>
No, you still use '-mat_superlu_rowperm'.
You can add
ierr = MatSetOptionsPrefix(mat,"KSP1_");CHKERRQ(ierr);
to use '-KSP1_mat_superlu_rowperm'.

Hong

>
> Gong Ding
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20120327/b145a420/attachment.htm>


More information about the petsc-users mailing list