← Back to team overview

dolfin team mailing list archive

Re: VariationalProblem interface

 

On Fri, Jun 17, 2011 at 12:55:05PM +0200, Anders Logg wrote:
> On Wed, Jun 15, 2011 at 01:51:08PM +0200, Anders Logg wrote:
> > On Wed, Jun 15, 2011 at 01:50:07PM +0200, Martin Sandve Alnæs wrote:
> > > Not sure, will have to get back to that.
> >
> > ok.
> >
> > > But wether we can use (a==L), (J==-F), (F==0) or just (a, L), (J, -F), (F, 0)
> > > is basically a purely aestetic difference with no functional difference.
> > > So the rest of the discussion can continue independently of this.
> >
> > Yes.
>
> Martin,
>
> Any more thoughts on whether a == L and F == 0 can work with UFL?
>
> To sum up, I think we are looking at the following two options:
>
> 1. fancy
>
> Solver classes:
>
>   solver = LinearVariationalSolver(a, L, ...)
>   solver.solve()
>
>   solver = NonlinearVariational(F, J, ...)
>   solver.solve()
>
> Free functions:
>
>   solve(a == L, ...)
>   solve(F == 0, J, ...)
>
> The free functions call the solver classes.

Just to motivate that this is not a completely crazy idea, both
(swi)ginac and Mathematica use the same interface:

http://library.wolfram.com/howtos/equations/Links/index_lnk_2.html

Both use this interface:

  solve(lhs(x) == rhs(x), x)

SymPy uses a similar interface by leaves out the == and expects an
expression that should be zero.

--
Anders


> 2. less fancy
>
> Solver classes: same as above
>
> Free functions:
>
>   solve(a, L, ...)
>   solve(F, 0, J, ...)
>
> Note that in both cases, we specify lhs = rhs which means the
> distinction is no longer the order of arguments. One always specifies
> first lhs, then rhs. And one can easily check for the expected rank of
> the arguments and give sensible error messages.
>


References