Hi guys,
Writing a symmetric tensor to a file fails with an error message. Can someone explain me this behavior?
Is there a way to output Functions defined on a TensorFunctionSpace (or constructed with TensorElement)?
Error:
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
in
12 v = Function(TensorFunctionSpace(mesh, "Lagrange", 1, symmetry=True))
13 v.vector()[:] = 1.0
---> 14 File("v.pvd") << v
15 print("wrote v")
/usr/local/lib/python3.6/dist-packages/dolfin/io/__init__.py in __lshift__(self, u)
12
13 if isinstance(u, dolfin.function.function.Function):
---> 14 self.write(u._cpp_object)
15 elif isinstance(u, tuple):
16 if isinstance(u[0], dolfin.function.function.Function):
RuntimeError: interpolate_vertex_values: Failed to set physical value size correctly for subelements.
MWE (as done in the test file dolfin/test/unit/python/io/test_vtk.py
):
from dolfin import *
mesh = UnitSquareMesh(16, 16)
# works
u = Function(TensorFunctionSpace(mesh, "Lagrange", 1))
u.vector()[:] = 1.0
File("u.pvd") << u
print("wrote u")
# fails
v = Function(TensorFunctionSpace(mesh, "Lagrange", 1, symmetry=True))
v.vector()[:] = 1.0
File("v.pvd") << v
print("wrote v")