Adding expressions with different shapes

I am working with mixed formulations in fenics. While running the code it gives me an error: UFLException: Can’t add expressions with different shapes. I am new to fenics. Can anyone help me in this The complete code is
#Defining meshes and function spaces

mesh = UnitSquareMesh(10,10)
RT1 = VectorElement(“RT”, mesh.ufl_cell(), 1)
CG1 = FiniteElement(“CG”, mesh.ufl_cell(), 1)
RT2 = VectorElement(“RT”, mesh.ufl_cell(), 1)
mixed = MixedElement([RT1, CG1, RT1])
W = FunctionSpace(mesh, mixed)
(vpsi, vphi, vbigphi ) = TestFunctions(W)
trials_1 = TrialFunction(W)
Sol1, Sol0 = Function(W) , Function(W)
(psi1, phi1, bigphi1) = split(Sol1)
(psi0, phi0, bigphi0) = split(Sol0)
a11 = dot(psi1, vbigphi)*dx

I am unable to replicate your error from the code. I get another error however:

Can only integrate scalar expressions. The integrand is a tensor expression with value shape (2, 2) and free indices with labels ().
Traceback (most recent call last):
File “930_FEniCS_Test3.py”, line 20, in
a11 = dot(psi1, vbigphi) * dx
File “/usr/lib/python3/dist-packages/ufl/measure.py”, line 420, in rmul
(integrand.ufl_shape, integrand.ufl_free_indices))
File “/usr/lib/python3/dist-packages/ufl/log.py”, line 172, in error
raise self._exception_type(self._format_raw(*message))
ufl.log.UFLException: Can only integrate scalar expressions. The integrand is a tensor expression with value shape (2, 2) and free indices with labels ()

which you can get rid of by using inner instead of dot:

a11 = inner(psi1, vbigphi)*dx

Thanks.
Sorry I missed last line.

a12 = div(vbigphi)* phi1* dx.

It shows error as

Can only integrate scalar expressions. The integrand is a tensor expression with value shape (2,) and free indices with labels ().

I am not sure what your goal is. You defined a Raviart-Thomas VectorElement, which means your TestFunction vbigphi is a second order tensor. Its divergence thus is a first order tensor, i.e. a vector with two components, and as the error message says, you can only use scalar integrands.

I was trying to write the form
(psi, bigphi) + (phi, div(bigphi)) = 0
For this I write as:
inner(psi1, vbigphi)dx + div(vbigphi) phi1* dx.
phi is a trial function from CG1 and vbigphi is test RT 1 function.
My mixed space is like RT1 X CG1 X Rt1.

As I already said, a Raviart-Thomas VectorElement produces a function space of matrix-valued functions, as the Raviart-Thomas element is natively vector-valued. Depending on what you want to do, maybe try with

RT1 = FiniteElement('RT', mesh.ufl_cell(), 1)

Thanks !!
It worked.