This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

Is there a way to create a TensorFunctionSpace with tensors of 4th order

+2 votes

I need a tensor 4th order in every quadrature point. Is there a TensorFunctionSpace that supports tensors of 4th order?

asked Jul 27, 2014 by andrew2748 FEniCS Novice (220 points)

1 Answer

0 votes
 
Best answer

Try

from dolfin import *
mesh = UnitSquareMesh(42, 42)
family = 'Lagrange'
degree = 1
shape = 4*(mesh.geometry().dim(),)
V = TensorFunctionSpace(mesh, family, degree, shape=shape)

But I warn you that working with Functions being tensors of rank>1 isn't much tested and probably not well-handled in DOLFIN (and UFL) e.g. because of issue 242. So you may consider flattening your space like

V = VectorFunctionSpace(mesh, family, degree, dim=4*mesh.geometry().dim())

and then handle component indices by yourself.

answered Aug 5, 2014 by Jan Blechta FEniCS Expert (51,420 points)
selected Aug 5, 2014 by andrew2748

Yes, I already worked on my Problam myself. I solved it with the VectorFunctionSpace you also mentioned. I had to implementate things like tensormultiplikation by myself but in te end it worked.
I will try the other Method too. Thank you.

Please, post the answer and close the topic if you have the solution to save others' time.

...