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

Error on UFL Exception

–2 votes

Hi
I tried it, but no improvement

y*div(p2)*dx

Error on UFL Exception: Trying to integrate expression of rank 1 with free indices ().

I clearly edit my question in main page seeing below

asked Jan 21, 2014 by Manickam FEniCS Novice (450 points)
edited Jan 21, 2014 by Manickam

1 Answer

+3 votes

Hi, if you run

X.element().value_rank()

somewhere before the code crashes, you'll see that the rank is 2 and consequently
the terms in your form are vectors and not scalars as they should be. The problem lies in your definition of X. It should be

X = FunctionSpace(mesh, "RT", 2)

This gives you vectors already. There are no scalar RT elements.

answered Jan 21, 2014 by MiroK FEniCS Expert (80,920 points)

Can you see Error on Interpolate and projection discussion about RT is a vector-element.
In my case, taking inner product after it should be scalar term, but her combination of vector.

Hi, I saw that discussion and the comments there are the same as I gave you here.
If X is FunctionSpace(..., "RT", ...) and u is a function in X, then div(u) is scalar and grad(u) is a tensor of order 2. On the other hand, If X is VectorFunctionSpace(..., "RT", ...) and u is a function in X, then div(u) is vector and grad(u) is a tensor of order 3. You should keep this in mind when projecting, interpolating and writing the variational form.

Hi, This concept more fine to me, but space is not problem.
Problem occur inner product, while taking div(p) in RT space, then it should be a scalar. After, that inner product with another one scalar in test function, it doesn't work in FEniCS.

See inner product

...