### VectorFunctionSpace with Raviart-Thomas elements

340

views

0

Hello, I am trying to discretize matrix-valued H(div) functions with Raviart-Thomas elements. Unfortunately, I cannot assemble these functions. For example, the program below crushes.

```
from fenics import *
mesh = UnitSquareMesh(2,2)
f = Constant(((1,1),(1,1)))
RTxRT = VectorFunctionSpace(mesh,'RT',1)
sigma = interpolate(f,RTxRT)
res = assemble(inner(sigma,sigma)*dx)
```

Is there a way to circumvent this problem? Best regards, Johannes
Community: FEniCS Project

### 2 Answers

2

Sorry, did not understand the problem in the first answer. Behaviour is a bit non-intuitive, but as workaround try

Note that I am defining the whole space via MixedElement and also note, the Constant expression is now flattened.

```
from dolfin import *
mesh = UnitSquareMesh(2,2)
f = Constant((1, 1, 1, 1))
RT_elem = FiniteElement("RT", triangle, 1)
RTxRT = FunctionSpace(mesh, MixedElement([RT_elem, RT_elem]))
sigma = interpolate(f, RTxRT)
res = assemble(inner(sigma, sigma) * dx)
```

Note that I am defining the whole space via MixedElement and also note, the Constant expression is now flattened.

An alternative workaround reads:

written
5 months ago by
Johannes

1

`VectorFunctionSpace`

is a symbolic short-hand for saying: "give me n-tuple of the following space." For that reason, even though the Raviart-Thomas space is space of vector functions you must call`RT = FunctionSpace(mesh, "RT", 1)`

and keep in mind that members of `RT`

are functions with vector rank.
^{2}= H(div,Ω) x H(div,Ω). Therefore, I need a tupel of Raviart-Thomas functions. Interpolate seems to work. I do not understand, why assemble fails.

written
6 months ago by
Johannes

Please login to add an answer/comment or follow this question.