firedrakeproject/firedrake — pull request #57 by wence- (2013-11-03 15:55:40+00:00)
Title: DirichletBC.homogenize() not implemented

Firedrake is currently lacking the functionality to generate homogeneous version of a Dirichlet boundary condition.

Dolfin implements that functionality in DirichletBC.homogenize(). Following piece of code demonstrates how a compatible implementation should work:

```
from firedrake import *

# Create mesh and define function space
mesh = UnitSquareMesh(10, 10)
V = FunctionSpace(mesh, "CG", 1)

# Define variational problem
u = Function(V)
v = TestFunction(V)
a = dot(grad(v), grad(u)) * dx

bcs = [DirichletBC(V, 32, 1)]

[bc.homogenize() for bc in bcs]
# Compute solution - this should have the solution u = 0
solve(a == 0, u, bcs=bcs)

assert max(abs(u.vector().array())) == 0.0
```

I need this since the adjoint boundary conditions of a Dirichlet bc is its homogeneous version (expect of the special case where the parameter of interest is the boundary value itself).