point_value FE_Nedelec

52 views
Skip to first unread message

John Smith

unread,
Apr 18, 2021, 9:43:24 PM4/18/21
to deal.II User Group

Hello,

Is VectorTools::point_value supposed to work with FE_Nedelec?

The documentation looks very promising:

Evaluate a possibly vector-valued finite element function defined by the given DoFHandler and nodal vector fe_function at the given point point, and return the (vector) value of this function through the last argument.

Best,

John.

Wolfgang Bangerth

unread,
Apr 18, 2021, 10:59:25 PM4/18/21
to dea...@googlegroups.com
On 4/18/21 7:43 PM, John Smith wrote:
>
> Is VectorTools::point_value supposed to work with FE_Nedelec?
>
> The documentation looks very promising:
>
> Evaluate a possibly vector-valued finite element function defined by the given
> DoFHandler
> <https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.dealii.org%2Fcurrent%2Fdoxygen%2Fdeal.II%2FclassDoFHandler.html&data=04%7C01%7CWolfgang.Bangerth%40colostate.edu%7C39054f37290545641e5608d902d486d0%7Cafb58802ff7a4bb1ab21367ff2ecfc8b%7C0%7C0%7C637543934089426552%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=cfNPiGUOk%2BsIlssgAev6wBAmMiD%2BsZHYrl32blPab0E%3D&reserved=0>
> and nodal vector fe_function at the given point point, and return the (vector)
> value of this function through the last argument.

John -- have you tried? Oftentimes, just giving it a try is going to answer
your question :-)
Best
W.


--
------------------------------------------------------------------------
Wolfgang Bangerth email: bang...@colostate.edu
www: http://www.math.colostate.edu/~bangerth/

John Smith

unread,
Apr 19, 2021, 12:50:04 AM4/19/21
to deal.II User Group

Yes, I have. Thus the question.

I would like to have a simple silly test to see that the FE_Nedelec elements are what I expect them to be. So, I made a simple program similar to step-3 that sets up a test. The program uses FE_Nedelec<2>. It does all the steps similarly to step-3. However, it does not solve the system of linear equations. It substitutes all zeros into the solution vector and then makes solution(0) = 1.

Then I have fed this solution together with the dof handler to the VectorTools::point_value on a grid of regularly spaced points. The results were written into a *.csv file. Then I have made the vector plot out of it. The 0-th order, FE_Nedelec<2> fe(0), looks just as what I would expect. The 2-nd order, however, looks just like the 0-th order. I opened the files in spreadsheet and indeed – the shape functions of the 0-th and 2-nd order are the same. I ruled out the possibility of mistake (the program prints fe.degree) and began worrying. I think VectorTools::point_value is to blame probably…

Is there a replacement for it?

Best,

John

Wolfgang Bangerth

unread,
Apr 19, 2021, 11:49:24 AM4/19/21
to dea...@googlegroups.com
On 4/18/21 10:50 PM, John Smith wrote:
> Then I have fed this solution together with the dof handler to the
> VectorTools::point_value on a grid of regularly spaced points. The results
> were written into a *.csv file. Then I have made the vector plot out of it.
> The 0-th order, FE_Nedelec<2> fe(0), looks just as what I would expect. The
> 2-nd order, however, looks just like the 0-th order. I opened the files in
> spreadsheet and indeed – the shape functions of the 0-th and 2-nd order are
> the same. I ruled out the possibility of mistake (the program prints
> fe.degree) and began worrying. I think VectorTools::point_value is to blame
> probably…
>
> Is there a replacement for it?

You too quickly jump to the conclusion that the function you called must have
a bug. While that's not impossible, you should first run more tests.

All you have shown is that the very first of the shape functions of
FE_Nedelec(0) may be the same as the very first shape function of
FE_Nedelec(1). But is this really the case? And even if that were so, would
that constitute a bug?

For the first question, when you use DataOut to output a finite element field,
remember that all you get is a piecewise linear representation of the field.
Take a look at the documentation of DataOut::build_patches() to see one would
get a more accurate representation.

For the second question: All you need is that the shape functions for higher
polynomial degrees are linearly independent of the ones for lower polynomial
degrees. While it is true that, for example, for the FE_Q(2) element *all*
shape functions are different from the ones of FE_Q(1), this is not a
requirement. Take a look at FE_QHierarchical, for example. I don't recall
which approach FE_Nedelec takes, but it is at least conceivable that it has
the same hierarchical structure.

John Smith

unread,
Apr 19, 2021, 5:43:51 PM4/19/21
to deal.II User Group

Dear Wolfgang,

I do not think it is a bug. I think it may very well be that VectorTools::point_value it is not meant to be used with FE_Nedelec.

The first question: in this instance I do not use DataOut at all. I use VectorTools::point_value to get data point-by-point and save it into a *.csv file.

For the second question: You are absolutely right. I do expect two edge elements of different degree to be different. So, I must conclude that my knowledge of the edge elements is not correct or is not complete. The last brings me to the following quesition:

Is there a paper or a book which describes the exact FE_Nedelec implementation of deal.ii?

Best,

John

Wolfgang Bangerth

unread,
Apr 22, 2021, 7:21:42 PM4/22/21
to dea...@googlegroups.com

> For the second question: You are absolutely right. I do expect two edge
> elements of different degree to be different.

Right, but that does not mean that every shape function of FE_Nedelec(1) must
be different from all of the FE_Nedelec(0) shape functions. Some of them may
in fact be the same. (c.f. the example of FE_QHierarchical.)

I ran your program, and the shape functions for FE_Nedelec(0) look correct to
me, but there are two small mistakes you are making:
(i) in the figure you show in the other email, your assumptions about
the order of edges is not correct. It should be this:

*--3--*
| |
0 1
| |
*--2--*

(ii) in your little test code, you have these lines where you (try to) reset
the solution vector:

for (unsigned int i; i < solution.size(); ++i)
solution(i) = 0;

In this loop, you forget to initialize 'i' to zero at the beginning of
the loop. If you do, you get the expected results and you will also
see how this will work for the FE_Nedelec(1).

Best
Wolfgang

John Smith

unread,
Apr 22, 2021, 9:11:07 PM4/22/21
to deal.II User Group

Dear Wolfgang,

I have made a silly mistake. Thank you for pointing out this mistake! The shape functions indeed look fine!

I apologize for wasting time your time like that …

Best wishes,

John

Wolfgang Bangerth

unread,
Apr 23, 2021, 12:00:37 AM4/23/21
to dea...@googlegroups.com
On 4/22/21 7:11 PM, John Smith wrote:
> I have made a silly mistake. Thank you for pointing out this mistake! The
> shape functions indeed look fine!
>
> I apologize for wasting time your time like that …

No worries -- we've all made these sorts of mistakes!
Best
W.
Reply all
Reply to author
Forward
0 new messages