Hi.
When working with mixed formulations, like VectorFunctionSpace
, you need to collapse the functions (see for example Meaning of .collapse() or here):
Taking
grad_uh_x=grad_uh_x.collapse()
grad_uh_y=grad_uh_y.collapse()
print(uh.x.array.shape, grad_uh_value.x.array.shape, grad_uh_y.x.array.shape)
gives
(81,) (162,) (81,)
as expected.
Cheers.