dolfin team mailing list archive
-
dolfin team
-
Mailing list archive
-
Message #22254
Re: [Question #149919]: PETScKrylovMatrix multiplication in Python
On Wednesday March 23 2011 14:20:16 Kent-Andre Mardal wrote:
> The SWIG wizard!
Well... copy/paste mostly :)
Johan
> Kent
>
> On 23 March 2011 22:01, Johan Hake <johan.hake@xxxxxxxxx> wrote:
> > This should be fixed now.
> >
> > Johan
> >
> > On Monday March 21 2011 10:12:52 Christian Clason wrote:
> > > New question #149919 on DOLFIN:
> > > https://answers.launchpad.net/dolfin/+question/149919
> > >
> > > I am trying to solve a nonlinear pde-constrained optimization problem
> >
> > with
> >
> > > a reduced Newton method, where instead of constructing the full
> > > Hessian,
> >
> > I
> >
> > > compute the action of the Hessian on a function for use in a Krylov
> >
> > solver
> >
> > > such as CG.
> > >
> > > I assume that this can be done by constructing a PETScKrylovMatrix and
> > > defining a suitable mult function. (If there is a more high-level way
> > > of doing this, I'd be grateful for a hint.) However, I'm a bit stumped
> > > by
> >
> > the
> >
> > > interface between PETSc and Dolfin here. The core step in the matrix
> > > multiplication would be something like
> > >
> > > def mult(self, *args) :
> > > du = Function(V,args[0])
> > > L = du*v*dx
> > > problem = VariationalProblem(a, L, bc)
> > > y = problem.solve()
> > > args[1] = y.vector()
> > >
> > > (assume that the function space V, test function v, boundary conditions
> >
> > bc
> >
> > > and bilinear form a have all been defined previously). This however
> > > doesn't work, since args[0] and args[1] are not of proper type. How do
> > > I need to massage args[0] and args[1] to make this work? Any hints
> > > would be appreciated, especially a template for the use of
> > > PETScKrylovMatrix in Python.
> > >
> > > (If I can get this working, I'd be happy to turn this into a documented
> > > demo. I'm sure there are more people interested in using FEniCS as a
> > > framework for pde-constrained optimization.)
> >
> > _______________________________________________
> > Mailing list: https://launchpad.net/~dolfin
> > Post to : dolfin@xxxxxxxxxxxxxxxxxxx
> > Unsubscribe : https://launchpad.net/~dolfin
> > More help : https://help.launchpad.net/ListHelp
Follow ups
References