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

Lagrange Higher order triangular elements

0 votes

Hi,

I had to use a 15-Node element with point values and I specified it as follows and it worked.

V = FunctionSpace(mesh, 'Lagrange', 4)

  • since 5 nodes per side and a 4th order polynomial for interpolatiom

However, I got the below warning :

Question: How to specify such an element in the future?

Thanks, Vas

  • Warning: Automatic determination of degree for Expressions has been deprecated in FEniCS version 2016.1.
    *** It will (likely) be removed in the next FEniCS release.
    *** Specify the polynomial degree for interpolation of Expression, or provide a FiniteElement
asked Aug 7, 2016 by vas FEniCS Novice (330 points)

1 Answer

0 votes
 
Best answer

The warning probably comes from a line like this

f = Expression("x[0]*x[1]")

Do rather

f = Expression("x[0]*x[1]", degree=2)

or

e = FiniteElement("Lagrange", mesh.ufl_cell(), 2)
f = Expression("x[0]*x[1]", element=e)

or similar.

answered Aug 8, 2016 by Jan Blechta FEniCS Expert (51,420 points)
selected Aug 17, 2016 by johannr

Hi Jan,
I explored both suggestions, both worked and thanks. The first suggestion being shorter was used to explore the issue more deeper.
These are my observations: Say my pde was as follows: Laplace = f(x) with u(x) = u0(x)
In my problem, u0(x) =0.
I explored three Lagrange elements, V = FunctionSpace(mesh, 'Lagrange', 1); linear
V = FunctionSpace(mesh, 'Lagrange', 2);quadratic
V = FunctionSpace(mesh, 'Lagrange', 4);quartic
In all cases, I had, u0 = Expression('0',degree=2) as suggested.
In each situation, I did not get the below warning, the reason for my original question.
When I first raised the question, I thought I had to specify something extra for higher order elements. It does not appear to be so now. The common, "degree=2 " can only specify the order of the pde.
Although it worked, I am not sure why it worked? Any clarification is appreciated.
*** Warning: Automatic determination of degree for Expressions has been deprecated in FEniCS version 2016.1.
*** It will (likely) be removed in the next FEniCS release.
*** Specify the polynomial degree for interpolation of Expression, or provide a FiniteElement

degree=2 is not the order of PDE. It is a shortcut for Lagrange degree 2 element, i.e.

f = Expression("x[0]*x[1]", degree=2)

is equivalent to

e = FiniteElement("Lagrange", mesh.ufl_cell(), 2)
f = Expression("x[0]*x[1]", element=e)

Thanks, Jan. Your clarification is greatly appreciated.
Regards vas.

...