[petsc-dev] TS alpha parameter for preconditioner function

Jed Brown jedbrown at mcs.anl.gov
Sat Oct 15 09:24:28 CDT 2011


On Sat, Oct 15, 2011 at 08:08, Ben Dudson <benjamin.dudson at york.ac.uk>wrote:

> I'm using the petsc-dev TS system to solve a system
>
> u' = F(u)
>
> and would like to supply my own preconditioner to the KSP linear solver
> inside the SNES nonlinear solver. The Jacobian of the system is difficult to
> evaluate, so I would like to remain matrix-free. I have however got an
> approximate inverse operator of the linear system being solved by KSP:
>
> (I - alpha*J)
>
> In SUNDIALS it's possible to supply a preconditioner function which is then
> called passing the system state, vector to be preconditioned, and the alpha
> parameter. To do this in PETSc, should I define a MatShell or PCShell, and
> is there a way to get alpha from the TS?
>

You supply a PCShell that implements your custom preconditioner and set a
callback for TSSetIJacobian(). That callback gives you the shift parameter
that you can cache in your context.

If you have complicated nesting (e.g. several different PCShells on
different multigrid levels or in different subdomains), you can make your
software more modular if you create MatShells to hold the shift and perhaps
other information that belongs in each context. For simpler cases, it's
common to just have a shared application context in which case the PCShell
knows what levels/subdomain/physics it is supposed to operate on.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20111015/47789b91/attachment.html>


More information about the petsc-dev mailing list