# Facing an error in dimension matching

here I try to define boundary function for all faces except y=2, and the solution is defined in such a way it take a function at y=2 face except all faces

``````from dolfin import *
set_log_level(LogLevel.ERROR)
nx=32
mesh = UnitCubeMesh(nx,nx,nx)
# Define Function Spaces
V = VectorElement("CG", mesh.ufl_cell(), 2)
W= FiniteElement("CG", mesh.ufl_cell(), 1)
R = FiniteElement("Real", mesh.ufl_cell(), 0)
me = MixedElement([V, W, R])
Z= FunctionSpace(mesh,me)
tol=1E14
def boundary(x, on_boundary):
return on_boundary and (near(x[0],0,tol) or near(x[0],2,tol) or near(x[1],0,tol) or near(x[2],0,tol) or near(x[2],2,tol))
# Define Test and trial function
up = Function(Z)
u, p, rho  = split(up)
v, q, lamda = TestFunctions(Z)

class BoundaryCondition(UserExpression):
def eval(self, values, x):
if near(x[1], 2.0) and 0.0 <= x[0] <= 2.0 and 0.0 <= x[2] <= 2.0:
values[0] = x[0]*x[0]*(2-x[0])*(2-x[0])*x[2]*x[2]*(2-x[2])*(2-x[2])
values[1] = 0.0
values[2] = 0.0
else:
values[0] = 0.0
values[1] = 0.0
values[2] = 0.0

def value_shape(self):
return (3,)

# Example usage
u_exact = BoundaryCondition(degree=2)

p_exact = Expression('0', domain=mesh, degree=2)

error:

raceback (most recent call last):
File "/home/ayush/LID_DRIVEN_3D.py", line 37, in <module>