Hello,
I am running a simple elasticity problem and this may serve as a MWE for my question. According to the FEniCS tutorial (Section 5.4.3 Function evalution) functions can be evaluated in different ways, which vary in compuational cost: A Function object u
can be evaluated via
-
u(x)
for a pointx
-
u.vector().array()[i]
for a dof numberi
-
u.compute_vertex_values()[i]
at vertex numberi
This works for scalar function, but how does this translate to vector valued functions? If I take
V = VectorFunctionSpace(mesh, 'Largrange', 2)
u = Function(V)
and let FEniCS solve the problem, i.e. filling u
with the solution values, the evaluation method
- gives me a vector (as expected but it takes time to evaluate all vertices or even all nodes)
- throws an error (
AttributeError: 'dolfin.cpp.la.PETScVector' object has no attribute 'array'
) butu.vector()[i]
works yet gives me a number (instead of a vector) - gives me a number (as for method 2. I have no idea what this number is (it’s not the norm of the vector))
How do these function evaluation methods translate to functions on a VectorFunctionSpace?
Thanks!