Hi, I'm trying to solve time dependent problem with adjoint equation for backward difference scheme. For that case assemble matrix b not assigning properly. Here is a program that shows the problem.
from dolfin import*
mesh = UnitSquare(8,8)
X = FunctionSpace(mesh, "RT", 2)
Y = FunctionSpace(mesh, "CG", 1)
W = MixedFunctionSpace([X,Y,Y,Y])
(p, y, p1, z) = TrialFunctions(W)
(pt, yt, p1t, zt) = TestFunctions(W)
#Define Dirichlet boundary conditions here, then assumed some value for pd, yd
dt = 0.02
T = 2
z_0 = 0.0
pd0 = Expression(('(sin(2*pi*x[0])+2*pi*x[0]*cos(2*pi*x[0]))*x[1]*sin(2*pi*x[1])*sin(pi*t0)','(sin(2*pi*x[1])+2*pi*x[1]*cos(2*pi*x[1]))*x[0]*sin(2*pi*x[0])*sin(pi*t0)'), t0 = 0.0)
pd = interpolate(pd0, X)
yd = y + ((z-z_0)/dt) - div(grad(z) - p + pd)
a1 = inner(zt, p1t)*dx
a2 = inner(z_0, p1t)*dx
a3 = inner(dt*grad(z),grad(p1t))*dx
a4 = inner(dt*div(p-pd),p1t)*dx
a5 = inner(dt*(y-yd),p1t)*dx
A1 = a1 - a2 + a3 - a4 + a5
a6 = inner(zt, p3)*dx
a7 = inner(z_0, p3)*dx
a8 = inner(dt*grad(zt),grad(p3))*dx
A2 = a6 - a7 + a8
form = A1+A2
a = lhs(form)
L = rhs(form)
A = assemble(a)
while t <= T:
b = assemble(L)
t0 = t
bc.apply(A, b)
solve(A, u.vector(), b)
t += dt
u0.assign(u)
p, y, p1, z = u.split()
With the above code I get the following error message.
Calling FFC just-in-time (JIT) compiler, this may take some time.
Unable to extract all indices.
Traceback (most recent call last):
File "time.py", line 72, in
b = assemble(L)
File "/usr/lib/python2.7/dist-packages/dolfin/fem/assembling.py", line 169, in assemble
common_cell=common_cell)
File "/usr/lib/python2.7/dist-packages/dolfin/fem/form.py", line 56, in init
common_cell)
File "/usr/lib/python2.7/dist-packages/dolfin/compilemodules/jit.py", line 66, in mpi_jit
return local_jit(*args, **kwargs)
File "/usr/lib/python2.7/dist-packages/dolfin/compilemodules/jit.py", line 154, in jit
return jit_compile(form, parameters=p, common_cell=common_cell)
Something like this. Could someone explain to me what's i am do wrongly with this code or I have misunderstood something?
Thank You