Adding a tensor to a constant tensor, creating a 4-tensor from two 2-tensors and contracting tensors

You are mixing numpy and ufl.
A should be a ufl tensor; see for instance Slicing Tensors using subset of Free Indices or multiple free indices - #2 by dokken

1 Like