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()
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) Constant( "1.0"), V)
h0 = interpolate(
u = TrialFunction(S) vector( [-u0[1] ]),v)*dx # works vector( [-u0[1] ,0.0]), v)*dx # also works
v = TestFunction(S)
a = dot(u,v)*dx
#L = dot(as_
L = dot(as_
u = Function(S)
solve(a==L,u)
print "First part compiles"
plot(u)
interactive()
u,h = TrialFunctions(W) vector( [-u0[1] ]),v)*dx + h0*phi*dx # fails vector( [-u0[1] ,0.0]), v)*dx + h0*phi*dx # works deepcopy= True)
v,phi = TestFunctions(W)
a = dot(u,v)*dx + h*phi*dx
#L = dot(as_
L = dot(as_
w = Function(W)
solve(a==L,w)
u,h = w.split(
print "Second part compiles"
plot(u)
interactive()