Hi, everyone,
I set term G and f in variational form as two functions, because in future, I will assign other value of G and f at each node based on calculation result u. I applied these two terms in variational form. For term f, when it product with v, I can write as inner(f, v). However, for term G, when I product G with sym(grad(u)), it always does not work and I tried different method then got errors mentioned in title.
I write a small sample only included my problem.
from dolfin import *
import numpy
parameters["form_compiler"]["cpp_optimize"] = True
parameters["form_compiler"]["optimize"] = True
# Define mesh
mesh = UnitSquareMesh(3, 3)
# Define vector function space
V = VectorFunctionSpace(mesh, "CG", 1)
u = TrialFunction(V)
v = TestFunction(V)
G = interpolate(Expression(('1', '1')), V)
plot(G, title='G')
f = interpolate(Expression(('1', '1')), V)
# f = Expression(('1', '1'))
a = G*inner(sym(grad(u)), grad(v))*dx # does not works
L = inner(f, v)*dx
bc = DirichletBC(V, Constant((0.0, 0.0)), DomainBoundary())
u = Function(V)
solve(a == L, u, bc)
plot(u, title='solution')