I was wondering how it is possible to extract the values of a tensor produced by outer product of two vectors. Let’s say we have 2 unit vectors and the outer product of these vectors creates a tensor. Now I want to extract the values of this tensor:
from fenics import * mesh = BoxMesh(Point(0, 0, 0), Point(1, 1, 1), 1, 1, 1) A = as_vector([, ,]) B = as_vector([, ,]) C = outer(A,B) T = TensorFunctionSpace(mesh, 'CG', 1) E = project(C, T) #Tensor components extraction print(E.vector().get_local())
Shapes do not match error. However it works if I change outer to inner and replace the TensorFunctionSpace with FunctionSpace but I want to know why it does not work for outer product.