"Sun, Hui" <[email protected]> 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.

Attachment: pgpaHnnfWEaaK.pgp
Description: PGP signature

Reply via email to