# Problem of shapes not matching Edit: Solved

Edit: Problem solved, I was looking at the wrong part of the equation.

Hello, I am trying to model an AM process using Fenics. Yet I struggle with this simple problem of unmatching shapes in an inner operator. Relevant code below:

``````from fenics import *
import numpy as np

mesh = BoxMesh(Point(0.,0.,0.),Point(x1,x1,e1),N1,N1,N2)
ndim = mesh.topology().dim()
V_temp = FunctionSpace(mesh, 'P', 1)
V_depl = VectorFunctionSpace(mesh, 'P', 1, dim=ndim)

T, u = TrialFunction(V_temp), TrialFunction(V_depl)
H, v = TestFunction(V_temp), TestFunction(V_depl)

def eps(disp):
def sigma(disp, temp):
return (lmbda*tr(eps(disp))-K*temp)*Identity(ndim)+2.*mu*eps(disp)

u_Form = inner(sigma(v, T), eps(u))*dx + inner(f,u)*dx
``````

I then got the following error:

``````Shapes do not match  < Coefficient id=140476698833288 > and < Argument id=140476661488656 >.
File "Passe_2_2.py", line 117, in <module>
u_Form = inner(sigma(v, T), eps(u))*dx + inner(f,u)*dx
File "/home/zacharie/anaconda3/envs/fenicsproject/lib/python3.6/site-packages/ufl/operators.py", line 144, in inner
return Inner(a, b)
File "/home/zacharie/anaconda3/envs/fenicsproject/lib/python3.6/site-packages/ufl/tensoralgebra.py", line 161, in __new__
error("Shapes do not match: %s and %s." % (ufl_err_str(a), ufl_err_str(b)))
File "/home/zacharie/anaconda3/envs/fenicsproject/lib/python3.6/site-packages/ufl/log.py", line 172, in error
raise self._exception_type(self._format_raw(*message))
ufl.log.UFLException: Shapes do not match: <Coefficient id=140476698833288> and <Argument id=140476661488656>.
``````

Yet, I have tried the different types of eps and sigma. If eps is of ufl.tensoralgebra.Sym class type, and sigma of ufl.algebra.Sum class type, the two elements that compose the sum of sigma are both ufl.tensors.ComponentTensor class types. So if they are both tensors, I do not understand why there would be a problem with unmatching shapes.

Do you have any suggestion?

Thanks,
Zacharie