adding SNESSetLinearSolve()

Matthew Knepley knepley at gmail.com
Mon Oct 29 13:16:31 CDT 2007


On 10/29/07, Lisandro Dalcin <dalcinl at gmail.com> wrote:
> 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.

I do not understand this comment.

> - 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.

The PC contains the matrix which is user set with KSPSetOperators. It
does not have to refer back to the KSP. We can easily make the
SetFromOptions hook settable.

> 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.

I am against this change as well. KSP is meant to encapsulate any solver.
Thus, replacing KSPSolve() is duplicating the mechanism. It is better to
fix KSP to do what you want.

  Matt

> On 10/29/07, Barry Smith <bsmith at mcs.anl.gov> wrote:
> >
> >   SNESGetKSP(
> >   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
>
>


-- 
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which
their experiments lead.
-- Norbert Wiener




More information about the petsc-dev mailing list