Hello,

I am trying to solve an equation involving 2-form (tensor with two indices). I can’t figure out from the tutorial how should I introduce the finite element for it, could you please give an example? Ideally, it should be symmetric. Also, it should be incorporatable into mixed element, since I also have an unknown vector function to find. Thank you!

Firstly, the terminology “2-form” usually refers specifically to a differential form of rank 2, i.e., an *anti*-symmetric mapping from two vectors to a scalar. In finite element calculations, it is most common to represent differential forms via their classical vector calculus proxies, e.g., Tables 2.1–2.3 here, for which special H(\operatorname{div})- and H(\operatorname{curl})-conforming elements are implemented in FEniCS (e.g., Raviart–Thomas and Nédélec elements).

However, since you mention that you want a symmetric tensor, I assume you mean an ordinary rank-2 tensor. FEniCS does nominally support `TensorElement`

s, although forum discussions from a few years ago suggest that the option to enforce symmetry may be buggy. See, e.g., this thread. Another option is to just use a `VectorElement`

with the optional keyword argument `dim`

set to the right number of unique scalar components. These components can then be manually packaged into a matrix before defining variational forms, using the UFL `as_matrix`

function.

Thank you! Could you please give and example how to create a tensor of the rank 2? I looked here https://fenicsproject.org/olddocs/dolfin/1.4.0/python/programmers-reference/functions/functionspace/TensorFunctionSpace.html and don’t see examples. Thank you!

If the symmetry is buggy, I am ok without it.

So how does it determine that I need tensor of rank 2, not 1 or 3 or whatever else? Because I don’t see it in the line you referenced to.