Hello Friends
I have to solve mixed function space with vector and scalar simultaneously in FEniCS. But still i getting error on shape mismatch.
Here i wrote programme code
X0 = FunctionSpace(mesh, "RT", 2)
X = VectorFunctionSpace(mesh, "RT", 2)
Y = FunctionSpace(mesh, "CG", 1)
W = MixedFunctionSpace([X,Y,Y,Y,X,Y,Y])
Test and Trial Functions
(p, y, u, p1, p2, p3, z) = TrialFunctions(W)
(pt, yt, ut, p1t, p2t, p3t, zt) = TestFunctions(W)
After i have some boundary conditions, then
pd0 = Expression(('-pi*(1+pi*pi)*cos(pi*x[1])*sin(pi*x[2])','-pi*(1+pi*pi)*sin(pi*x[1])*cos(pi*x[2])'))
k = interpolate(pd0, X0)
pd = project(grad(k), X)
a0 = inner(p-pd,pt)*dx + inner(div(pt),p1)*dx + inner(pt,p2)*dx - inner(div(pt),p3)*dx
Error occur on second term only, while taking scalar and vector as mixed space, then
Traceback (most recent call last):
File "optimal.py", line 49, in
a0 = inner(p-pd,pt)dx + inner(div(pt),p1)dx + inner(pt,p2)dx - inner(div(pt),p3)dx
File "/usr/lib/python2.7/dist-packages/ufl/operators.py", line 127, in inner
return Inner(a, b)
File "/usr/lib/python2.7/dist-packages/ufl/tensoralgebra.py", line 184, in new
ufl_assert(ash == bsh, "Shape mismatch.")
File "/usr/lib/python2.7/dist-packages/ufl/assertions.py", line 37, in ufl_assert
if not condition: error(message)
File "/usr/lib/python2.7/dist-packages/ufl/log.py", line 154, in error
raise self._exception_type(self._format_raw(message))
ufl.log.UFLException: Shape mismatch