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

Symmetric, zero-trace tensor space

+7 votes

Is there some way of creating function space for symmetric, zero-trace tensors? There's probably a solution of assembling it from 5 scalars (in 3D) like

 V = FunctionSpace(...) # scalar space

 t11 = Function(V)
 t22 = Function(V)
 t12 = Function(V)
 t23 = Function(V)
 t31 = Function(V)

 T = as_tensor(((t11, t12, t31),
                (t12, t22, t23),
                (t31, t23, -t11-t22)))

but it is not much elegant and needs a little thought to get it independent of dimension. Also incorporating this tensor into mixed space would be little awkward

 U = FunctionSpace(...) # some other space
 W = MixedFunctionSpace([U, V, V, V, V, V])
 u, v = TrialFunction(W), TestFunction(W)
 uT = as_tensor(((u[1], u[3], u[5]),
                 (u[3], u[2], u[4]),
                 (u[5], u[4], -u[1]-u[2])))
 vT = as_tensor(((v[1], v[3], v[5]),
                 (v[3], v[2], v[4]),
                 (v[5], v[4], -v[1]-v[2])))
 # now we can use uT, vT in some normal looking equations
asked Sep 25, 2013 by Jan Blechta FEniCS Expert (51,420 points)
edited Sep 25, 2013 by Jan Blechta
...