← Back to team overview

ffc team mailing list archive

Discontinuous Galerkin

 

Discontinuous Galerkin is now supported by FFC and DOLFIN.

A demo is available in src/demo/pde/dg in DOLFIN.

Here's an example for implementation of an interior penalty method
for Poisson's equation:

  DG1 = FiniteElement("Discontinuous Lagrange", "triangle", 1)
  DG0 = FiniteElement("Discontinuous vector Lagrange", "triangle", 0)

  v = TestFunction(DG1)
  u = TrialFunction(DG1)
  f = Function(DG1)
  g = Function(DG1)
  n = Function(DG0) # facet normal
  alpha = Constant()

  a =  dot(grad(v), grad(u))*dx \
     - dot(avg(grad(v)), jump(u, n))*dS \
     - dot(jump(v, n), avg(grad(u)))*dS \
     - alpha*dot(jump(v, n), jump(u, n))*dS

  L = v*f*dx + v*g*ds 

Since this has not yet worked its way into the manual, here's a short
summary of the new supported operators:

  v('+')     - take value v^+ of v at the '+'-side of a facet
  v('-')     - take value v^- of v at the '-'-side of a facet
  avg(v)     - average 0.5*(v^+ + v^-)
  jump(v, n) - jump with respect to normal, either
               v^+n^+ + v^-n^- or v^+.n^+ + v^-.n^-
               depending on whether v is scalar or vector valued
  dS         - integral over an interior facet

Currently, only 2D is supported (triangular meshes), but 3D is not far
away.

Thanks to Kristian Oelgaard for a very good job on implementing DG in
FFC and DOLFIN!

/Anders


Follow ups