firedrakeproject/firedrake — pull request #310 by wence- (2014-05-19 11:24:23+00:00)
Title: User-defined values in Expressions

This change adds the ability for users to provide extra values that are available by name in Expression code snippets. They may be updated on the Expression such that subsequent re-use picks up the new value (and in particular doesn't force recompilation). This is wired into bcs such that the recommended way of building bcs that are both space and time-dependent is:

```python

t = 0
e = Expression('sin(2*pi*x[0]*t)', t=t)
bc = DirichletBC(V, e, ...)
while t < T:
solve(..., bcs=[bc])
t += dt
e.t = t # update expression with new t value
```

Note that we still recommend using `Constant` objects for bcs that are purely time-dependent (with no spatial variation).