Weakform of nonlinear equation

Asked by Jack on 2010-03-26

Dear all

How can I represent this pde using ufl.

-d/dx(du/dx) - 2u*du/dx = 0

I'm having trouble particularly with 2u*du/dx.

Thanks

Jack

Question information

Language:
English Edit question
Status:
Solved
For:
DOLFIN Edit question
Assignee:
No assignee Edit question
Solved by:
Jack
Solved:
2010-03-27
Last query:
2010-03-27
Last reply:
2010-03-27

This question was reopened

  • 2010-03-27 by Jack
Anders Logg (logg) said : #1

On Fri, Mar 26, 2010 at 10:11:24PM -0000, Jack wrote:
> New question #105644 on DOLFIN:
> https://answers.launchpad.net/dolfin/+question/105644
>
> Dear all
>
> How can I represent this pde using ufl.
>
> -d/dx(du/dx) - 2u*du/dx = 0
>
> I'm having trouble particularly with 2u*du/dx.
>
> Thanks
>
> Jack

Does it not work if you write 2*u*u.dx(0)*dx?

--
Anders

Jack (attacking-chess) said : #2

Thanks Anders Logg, that solved my question.

Jack (attacking-chess) said : #3

Thanks Anders.

Jack (attacking-chess) said : #4

I just spotted that ffc -l dolfin Nonlinear.ufl gives this error at the end:

Compiler stage 2: Computing intermediate representation
-------------------------------------------------------
  Computing representation of 1 elements
  Computing representation of 1 dofmaps
  Computing representation of integrals
  Computing tensor representation
  Extracting monomial form representation from UFL form
  Transforming monomial form to reference element
  Precomputing integrals on reference element
  Precomputing integrals on reference element
Unable to extract all indices.

*** FFC: Unable to extract all indices.
*** FFC: To get more information about this error, rerun FFC with --debug.

This is what I have in my UFL form file

element = FiniteElement("Lagrange", "interval", 2)

v = TestFunction(element)
du = TrialFunction(element)

u = Coefficient(element)

L = inner(grad(v), grad(u))*dx - 2*u*u.dx(0)*dx
a = derivative(L, u, du)

Thanks

Jack

Jack (attacking-chess) said : #5

I forgot to multiply the second term by the TestFunction.