adding SNESSetLinearSolve()

Lisandro Dalcin dalcinl at
Mon Oct 29 13:04:01 CDT 2007

Yes, Barry, I know we can do this, but this trick is not fully
fuctional, or you have to make a lot of more trickery:

- You have to explicitely use a KSPPREONLY, thus you cannot reuse this
ksp in your 'LinearSolve' routine. Then, you cannot get EW method work
in a easy way.

- PCSHELL to currently have some deficiencies. For example, there is
not a easy way to get matrix operators inside user-defined PCSHELL
routines, unless you implement PCPreSolve, which gives access to KSP.
And PCSHELL does not have a SetFromOptions() feature.

Barry, why do you really resist this idea? Do you believe it is an
example of 'too many ways to do it'? All I am asking for is let users
replace the call to KSPSolve for a custom call, wich in fact CAN
internally call KSPSolve after getting the KSP from SNES.

On 10/29/07, Barry Smith <bsmith at> wrote:
>   KSPSetType(ksp,KSPPREONLY)
>   KSPGetPC(
>   PCSetType(pc,PCSHELL);
>   PCShellSetApply(pc,YourSolver);
> On Mon, 29 Oct 2007, Lisandro Dalcin wrote:
> > Some time ago I made a request for adding SNESSetLinearSolve(), in
> > order to let users set a custom linear solve routine to SNES. I was
> > not clear to me if this idea was finally accepted, so I want to ask
> > again.
> >
> > I really needs this feature in the near future, I I would like this to
> > go in the next petsc release. My use case is rather simple: I'm
> > helping a coworker to use SNES for solving a nonlinear optimization
> > problem related to mesh movement (that is, move nodes retaining
> > element connectivities). This problem uses a regularized functional,
> > wich introduces a global degree of freedom coupled with all others
> > dofs. To avoid assembling a sparse parallel AIJ matrix with a dense
> > column and row, we endup needing to solve two linear systems with the
> > same matrix for actually solving the Hessian of the regularized
> > functional.
> >
> >
> >
> >

Lisandro Dalcín
Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC)
Instituto de Desarrollo Tecnológico para la Industria Química (INTEC)
Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET)
PTLC - Güemes 3450, (3000) Santa Fe, Argentina
Tel/Fax: +54-(0)342-451.1594

More information about the petsc-dev mailing list