UFL

Comment 1 for bug 1155210

Revision history for this message
Andrew McRae (andymc) wrote : Re: inconsistent behaviour of as_vector when too few arguments provided

Aside: the output seems to be crazy, at least compared to the related program where we move the rotation onto the RHS. Not sure if bug or genuine...

=============================
from dolfin import *
mesh = UnitSquareMesh(8,8)
S = FunctionSpace(mesh, "BDM", 1)
V = FunctionSpace(mesh, "DG", 0)
W = S*V

u0 = interpolate(Constant((-1.0,1.0)),S)
h0 = interpolate(Constant("1.0"),V)

u = TrialFunction(S)
v = TestFunction(S)
a = dot(u,v)*dx
#L = dot(as_vector([-u0[1]]),v)*dx # works
L = dot(as_vector([-u0[1],0.0]),v)*dx # also works
u = Function(S)
solve(a==L,u)
print "First part compiles"
plot(u)
interactive()

u,h = TrialFunctions(W)
v,phi = TestFunctions(W)
a = dot(u,v)*dx + h*phi*dx
#L = dot(as_vector([-u0[1]]),v)*dx + h0*phi*dx # fails
L = dot(as_vector([-u0[1],0.0]),v)*dx + h0*phi*dx # works
w = Function(W)
solve(a==L,w)
u,h = w.split(deepcopy=True)
print "Second part compiles"
plot(u)
interactive()