[petsc-users] why a certain option cannot be used

Jed Brown jed at jedbrown.org
Fri Jul 18 12:23:07 CDT 2014


"Sun, Hui" <hus003 at ucsd.edu> writes:

> Thank you Jed. After reading ex15, I got some idea of how to define the PCShell with KSP solver. However, I want to verify with you if the following procedure is normally what one should do. 
> 1. Define a ShellPC struct, which includes a MAT object, say Pmat, and a KSP object, say innerKsp. 

The context should indeed contain innerKSP.  The ShellPC may not need a
Mat (you can just pass it down to innerKSP).

> 2. PCSetType(pc, PCSHELL)

> 3. Create a context for the user defined PC. It is here that we call KSPSetOperators(innerKsp, Pmat, Pmat)

You can do it eagerly or via PCShellSetSetUp(), if you want the shell PC
to be more reusable/independent.

> 4. Set the user defined routine for applying the preconditioner. It is in this user-define routine that we call KSPSolver(innerKsp, r, y)
>
> I'm wondering the way I set up the inner KSP for the PC is standard? Thank you! 

Pretty much.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20140718/3bb1b4f8/attachment.pgp>


More information about the petsc-users mailing list