← Back to team overview

dolfin team mailing list archive

Re: VariationalProblem interface(s)

 

On Wednesday October 20 2010 10:39:11 Marie Rognes wrote:
> A while back (in connection with the blueprint
> https://blueprints.launchpad.net/dolfin/+spec/solver-interfaces) there
> was a discussion regarding the interface to VariationalProblem. Anders
> and Marie have discussed this a bit further, in particular with regard
> to the adaptive solution of variational problems, and suggest the
> interface outlined below. (This suggestion involves a change in the
> interface, and hence the double post to both the dolfin and
> fenics-mailinglists)

I guess this discussion comes on top of the previous one? Because that 
blueprint mentioned a lot more than what is mentioned here.

I also assume this is limited to the Python interface as doing stuff like 
derivative behind the scene is limited to PyDOLFIN?

> >From Marie's perspective, the main reasons for changing the interface are
> 
>     (a) The current "nonlinear=true" variable seems superfluous and
> suboptimal
>     (b) We should allow for automated computation of the Jacobian (when
> needed).
> 
> For (nonlinear) variational problems, the interface should read
> 
>       pde = VariationalProblem(Form F, Form jacobian=None, ...)
>       pde.solve(u)
> 
> where "F" is a Form of rank 1, "jacobian" is a Form of rank 2, and "u"
> is a Function. Such a pde will be treated as a nonlinear variational
> problem. The "jacobian" would be an optional argument. If not given,
> 
>     jacobian = derivative(F, u)
> 
> will be used for the nonlinear solve if needed (for instance as the
> left-hand side of the Newton iteration).
> 
> Additionally, we have the interface for linear problems (as before)
> 
>       pde = VariationalProblem(Form a, Form L, ...)
>       pde.solve(u) / u = pde.solve()
> 
> where "a" is a Form of rank 2 and "L" is a form of rank 1. Such as pde
> will be treated as a linear variational problem.

Some wild thoughts...

Couldn't we just lump a and L into one form F, and let VariationalProblem then 
figure out what kindoff problem the user would like to solve? Basically 
VariationalProblem then solve F=0.

Differentiate F if the form is of rank 1, (or take an optional Jacobian), or 
split it into a linear problem using lhs and rhs?

> Philosophical question: Should u be given as an argument to the
>   VariationalProblem instead of to the call to solve?

It is more natural to give u to solve, as that is what you solve for. Then you 
can differentiate wrt to u in the solve function. However, it makes it more 
difficult to make u an optional argument to solve.

Johan

> Comments welcome!
> 
> --
> Marie
> 
> 
> _______________________________________________
> 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