ufl team mailing list archive
-
ufl team
-
Mailing list archive
-
Message #01185
Re: A basic non-linear problem
On Wed, Apr 15, 2009 at 9:44 PM, Harish Narayanan
<harish.mlists@xxxxxxxxx> wrote:
> I am trying to learn how to set up a simple non-linear problem using a
> UFL form. In order to solve the following (the non-linear Poisson demo
> in DOLFIN),
>
> - div[(1+u^2)*grad(u)] = f,
>
> does something like the following look like the right approach?
>
> element = FiniteElement("Lagrange", "triangle", 1)
>
> v = TestFunction(element)
> u = TrialFunction(element)
> f = Function(element)
> U = Function(element)
>
> L = ((1 + U*U)*inner(grad(U), grad(v)) - f*v)*dx
> a = derivative(L, U, u)
>
> I have not yet fully understood how derivative() functions.
>
> Harish
This looks right.
Alternative (equivalent) notation:
L = (1 + U**2)*dot(grad(U), grad(v))*dx - f*v*dx
a = derivative(L, U)
Unless you need the trial function u for something
else, derivative can make one for you.
That would only be the case if you linearize part
of the form manually, something like:
a = derivative(L, U, u) + foo*u*v*dx
Martin
Follow ups
References