← Back to team overview

dolfin team mailing list archive

Convection-diffusion module working

 

The convection-diffusion module has now been ported to the new system
(DOLFIN + FFC + PETSc), see attached image for the solution.

The variational form was compiled with FFC using the following code:

  scalar = FiniteElement("Lagrange", "triangle", 1)
  vector = FiniteElement("Lagrange", "triangle", 1, 2)

  v  = BasisFunction(scalar) # test function
  u1 = BasisFunction(scalar) # value at next time step
  u0 = Function(scalar)      # value at previous time step
  w  = Function(vector)      # convection
  f  = Function(scalar)      # source term
  k  = Constant()            # time step
  c  = Constant()            # diffusion

  a = v*u1*dx + 0.5*k*(v*w[i]*u1.dx(i)*dx + c*v.dx(i)*u1.dx(i)*dx)
  L = v*u0*dx - 0.5*k*(v*w[i]*u0.dx(i)*dx + c*v.dx(i)*u0.dx(i)*dx) + v*f*dx

The variational form a(v, u) = L(v) defines one time step with cG(1).
There is no stabilization (but it could easily be added).

Note that two different finite elements are used to define the form.

With this, I hope that most issues have been resolved: DOLFIN now
plays nicely with both FFC and PETSc. We'll be cleaning out some more
old stuff and then release version 0.5.5.

/Anders

Attachment: convdiff.png
Description: PNG image