The shape function on physical cell in hexahedral is not parallel with the edge (FeNedelecSZ and FENedelec)

24 views
Skip to first unread message

Phạm Ngọc Kiên

unread,
Apr 11, 2019, 11:17:19 PM4/11/19
to deal.II User Group
Hi colleagues,
When using FE_NedelecSZ in my code.
Testing for an edge whose global vertices located from (0,0,0) to (0,0,1) in real coordinates.
With a cube I get the shape function vectors at the dof related to the edge, for examples, (0,0,0), (0,0,-0.25), (0,0,-0.5), (0,0,-1), which are parallel to the edge.
However, if I create a mesh with GMSH and check the shape function vectors, some of them are: (-0.0868383, -0.428, 1), (-0.129933, -0.402772, 1),  (-0.052103 -0.2568 0.6),..,
which are not parallel to the edge.

In my limited opinion, I will get the wrong solution as the shape functions created by my code are not parallel to the edge in my model.
Could you please tell me why this happen and how to fix it?

I would like to thank you very much in advance.
Best regards,.

Wolfgang Bangerth

unread,
Apr 15, 2019, 8:48:32 AM4/15/19
to dea...@googlegroups.com
On 4/11/19 9:17 PM, Phạm Ngọc Kiên wrote:
> Testing for an edge whose global vertices located from (0,0,0) to (0,0,1) in
> real coordinates.
> With a cube I get the shape function vectors at the dof related to the edge,
> for examples, (0,0,0), (0,0,-0.25), (0,0,-0.5), (0,0,-1), which are parallel
> to the edge.
> However, if I create a mesh with GMSH and check the shape function vectors,
> some of them are: (-0.0868383, -0.428, 1), (-0.129933, -0.402772, 1),
> (-0.052103 -0.2568 0.6),..,
> which are not parallel to the edge.
>
> In my limited opinion, I will get the wrong solution as the shape functions
> created by my code are not parallel to the edge in my model.
> Could you please tell me why this happen and how to fix it?

Good question. This does sound wrong. To figure out what is happening exactly,
we typically construct small test cases that try to illustrate one particular
issue. In your case, I would try to create a mesh with exactly one cell --
either the one you have above, or maybe even simpler a cube that is just
rotated. Then create a DoFHandler on it and output the values of the shape
functions. This way, you really have only one thing that could go wrong, and
it's easy to demonstrate what you see and how it differs from expectations.

Do you think you could come up with a small program that does this?

Best
WB

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

Phạm Ngọc Kiên

unread,
Apr 16, 2019, 1:43:27 AM4/16/19
to dea...@googlegroups.com
Hi,
I have written this code for testing purpose.
In case of a rotated cube, the shape functions seemed to be good as they were parallel to the edge, although there was some small round-off errors at the value 0.
However, when I tested with the grid which was loaded from GMSH, the shape functions failed.
In the attachment, I showed the information for the first active cell only. It is easy to get information of other cells with the codes.

I think that there exists something wrong with the cell that are not a cube, but a hexahedron when initializing the shape functions (fe_values).

I think it would be easier for you to help me with the attachment below.
Thank you very much.
Best regards.
Pham Ngoc Kien

Vào Th 2, 15 thg 4, 2019 vào lúc 21:48 Wolfgang Bangerth <bang...@colostate.edu> đã viết:
--
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see https://groups.google.com/d/forum/dealii?hl=en
---
You received this message because you are subscribed to the Google Groups "deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dealii+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
test_shape_function.cc
untitled.msh

Phạm Ngọc Kiên

unread,
May 7, 2019, 9:08:23 PM5/7/19
to dea...@googlegroups.com
Hi all,
It was a long time since the last time I posted my test for shape function in 3D here.
This time I send you the results when testing with a more simple model in 2D, and the shape functions are still wrong with non-rectangle mesh.
The codes print results in this form:
dof i_th: 7
edge number: 3
edge vertices:
1 -1 and 0.5 -1
vector from first to second vertex of the edge: -0.5 0
shape functions on real cell:
0 0
0 0
0 0
1.2 1.29551
1.25 0.81524
1.33333 0.0147947
2 2.15918
2 1.30438
2 0.022192

Here I use QGaussLobatto to get a certain shape function on the edge of a cell.
It takes me so many times for testing where my codes return wrong solutions.
I think, in deal.II 9.0, the shape functions, defined in the two classes FE_Nedelec and FE_NedelecSZ, are only work with structured grid (i.e. cube in 3D and rectangle in 2D).
I hope it worth mentioning to fix this problem as we all want to carry out finite element method with unstructured grid.

Best,
Pham Ngoc Kien

Vào Th 3, 16 thg 4, 2019 vào lúc 14:43 Phạm Ngọc Kiên <ngockie...@gmail.com> đã viết:
2d testing.msh
model.eps
test_shape_functions_2d.cc
Reply all
Reply to author
Forward
0 new messages