--
variable + facet restriction broken
https://bugs.launchpad.net/bugs/512425
You received this bug notification because you are a member of UFL Core
Team, which is the registrant for UFL.
Status in Unified Form Language: Invalid
Bug description:
UFL is doing something wrong when a Function which is made into a 'variable', e.g. u = variable(u), is used for a facet integral. The below code demonstrates the error.
from dolfin import *
from numpy import random
mesh = UnitSquare(24, 24)
n = FacetNormal(mesh)
V = FunctionSpace(mesh, "DG", 1)
v = TestFunction(V)
u = Function(V)
# Fill vector with some numbers
random.seed(2)
u.vector().set_local( random.rand(u.vector().size()) )
# Define flux. One without, and one with 'variable'
flux1 = grad(u)
flux2 = variable(grad(u))
# Define linear forms
L0 = dot(jump(v, n), avg(grad(u)))*dS
L1 = dot(jump(v, n), avg(flux1))*dS
L2 = dot(jump(v, n), avg(flux2))*dS
L3 = dot(jump(v, n), flux2('+'))*dS
L4 = dot(jump(v, n), flux2('-'))*dS
print "Testing matrix norms. All should be equal."
print "Norm case 0: ", assemble(L0).norm("l2")
print "Norm case 1: ", assemble(L1).norm("l2")
print "Norm case 2 (using variable): ", assemble(L2).norm("l2")
print "Norm case 3 (using variable): ", assemble(L3).norm("l2")
print "Norm case 4 (using variable): ", assemble(L4).norm("l2")