FEniCS/dolfinx

[BUG]: wrong output of interpolation_points() method for higher order N1curl elements (tetrahedra)?

Closed this issue · 1 comments

Summarize the issue

Related to a recent question (https://fenicsproject.discourse.group/t/tabulate-dof-coordinates-of-n1curl-space/16090/2), I noticed an unexpected behavior testing the described mechanics to calculate the locations of the dofs for higher order (tested p2 and p3) N1curl elements: The lengths of the output arrays of the method

element.interpolation_points() are 24 (p2) and 47(p3)

does not match the expected numbers 20(p2) or 45 (p3). For p2, first 12 entries appear correct to me, but the remaing 12 appear wrong, and there should be only 8 further entries for the dofs associated with the four faces according to the common definition I know, e.g. (https://defelement.com/elements/examples/tetrahedron-nedelec1-lagrange-2.html)

I have not looked into detail for the p3 elements tested higher order or other element types. Just tested for P-elements and the output looks absolutely fine.

How to reproduce the bug

run minimum example provided

Minimal Example (Python)

import dolfinx as dfx
from basix.ufl import element, mixed_element
from mpi4py import MPI

mesh = dfx.mesh.create_unit_cube(MPI.COMM_WORLD, 1, 1, 1)

for elemtype in ["P", "N1curl"]:
    for p in [1, 2, 3]:
        ele = element(elemtype, mesh.basix_cell(), p)
        V = dfx.fem.functionspace(mesh, ele)
        print("Type: " + elemtype, 'polynomial order: ' + str(p))
        print('expected len: ', V.element.space_dimension)
        print('len of interpolation points: ', len(V.element.interpolation_points()))
        print(V.element.interpolation_points())
        print('"'*80)

Output (Python)

Type: P polynomial order: 1
expected len:  4
len of interpolation points:  4
[[0. 0. 0.]
 [1. 0. 0.]
 [0. 1. 0.]
 [0. 0. 1.]]
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
Type: P polynomial order: 2
expected len:  10
len of interpolation points:  10
[[0.  0.  0. ]
 [1.  0.  0. ]
 [0.  1.  0. ]
 [0.  0.  1. ]
 [0.  0.5 0.5]
 [0.5 0.  0.5]
 [0.5 0.5 0. ]
 [0.  0.  0.5]
 [0.  0.5 0. ]
 [0.5 0.  0. ]]
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
Type: P polynomial order: 3
expected len:  20
len of interpolation points:  20
[[0.         0.         0.        ]
 [1.         0.         0.        ]
 [0.         1.         0.        ]
 [0.         0.         1.        ]
 [0.         0.7236068  0.2763932 ]
 [0.         0.2763932  0.7236068 ]
 [0.7236068  0.         0.2763932 ]
 [0.2763932  0.         0.7236068 ]
 [0.7236068  0.2763932  0.        ]
 [0.2763932  0.7236068  0.        ]
 [0.         0.         0.2763932 ]
 [0.         0.         0.7236068 ]
 [0.         0.2763932  0.        ]
 [0.         0.7236068  0.        ]
 [0.2763932  0.         0.        ]
 [0.7236068  0.         0.        ]
 [0.33333333 0.33333333 0.33333333]
 [0.         0.33333333 0.33333333]
 [0.33333333 0.         0.33333333]
 [0.33333333 0.33333333 0.        ]]
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
Type: N1curl polynomial order: 1
expected len:  6
len of interpolation points:  6
[[0.  0.5 0.5]
 [0.5 0.  0.5]
 [0.5 0.5 0. ]
 [0.  0.  0.5]
 [0.  0.5 0. ]
 [0.5 0.  0. ]]
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
Type: N1curl polynomial order: 2
expected len:  20
len of interpolation points:  24
[[0.         0.78867513 0.21132487]
 [0.         0.21132487 0.78867513]
 [0.78867513 0.         0.21132487]
 [0.21132487 0.         0.78867513]
 [0.78867513 0.21132487 0.        ]
 [0.21132487 0.78867513 0.        ]
 [0.         0.         0.21132487]
 [0.         0.         0.78867513]
 [0.         0.21132487 0.        ]
 [0.         0.78867513 0.        ]
 [0.21132487 0.         0.        ]
 [0.78867513 0.         0.        ]
 [0.66666667 0.16666667 0.16666667]
 [0.16666667 0.16666667 0.66666667]
 [0.16666667 0.66666667 0.16666667]
 [0.         0.16666667 0.16666667]
 [0.         0.16666667 0.66666667]
 [0.         0.66666667 0.16666667]
 [0.16666667 0.         0.16666667]
 [0.16666667 0.         0.66666667]
 [0.66666667 0.         0.16666667]
 [0.16666667 0.16666667 0.        ]
 [0.16666667 0.66666667 0.        ]
 [0.66666667 0.16666667 0.        ]]
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
Type: N1curl polynomial order: 3
expected len:  45
len of interpolation points:  47
[[0.         0.88729833 0.11270167]
 [0.         0.5        0.5       ]
 [0.         0.11270167 0.88729833]
 [0.88729833 0.         0.11270167]
 [0.5        0.         0.5       ]
 [0.11270167 0.         0.88729833]
 [0.88729833 0.11270167 0.        ]
 [0.5        0.5        0.        ]
 [0.11270167 0.88729833 0.        ]
 [0.         0.         0.11270167]
 [0.         0.         0.5       ]
 [0.         0.         0.88729833]
 [0.         0.11270167 0.        ]
 [0.         0.5        0.        ]
 [0.         0.88729833 0.        ]
 [0.11270167 0.         0.        ]
 [0.5        0.         0.        ]
 [0.88729833 0.         0.        ]
 [0.09157621 0.81684757 0.09157621]
 [0.09157621 0.09157621 0.81684757]
 [0.81684757 0.09157621 0.09157621]
 [0.44594849 0.10810302 0.44594849]
 [0.44594849 0.44594849 0.10810302]
 [0.10810302 0.44594849 0.44594849]
 [0.         0.81684757 0.09157621]
 [0.         0.09157621 0.81684757]
 [0.         0.09157621 0.09157621]
 [0.         0.10810302 0.44594849]
 [0.         0.44594849 0.10810302]
 [0.         0.44594849 0.44594849]
 [0.81684757 0.         0.09157621]
 [0.09157621 0.         0.81684757]
 [0.09157621 0.         0.09157621]
 [0.10810302 0.         0.44594849]
 [0.44594849 0.         0.10810302]
 [0.44594849 0.         0.44594849]
 [0.81684757 0.09157621 0.        ]
 [0.09157621 0.81684757 0.        ]
 [0.09157621 0.09157621 0.        ]
 [0.10810302 0.44594849 0.        ]
 [0.44594849 0.10810302 0.        ]
 [0.44594849 0.44594849 0.        ]
 [0.25       0.25       0.25      ]
 [0.5        0.16666667 0.16666667]
 [0.16666667 0.5        0.16666667]
 [0.16666667 0.16666667 0.5       ]
 [0.16666667 0.16666667 0.16666667]]
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

Version

main branch

DOLFINx git commit

No response

Installation

used dolfin version 0.8.0 via conda installation

Additional information

No response

Invalid bug. The whole point is that one doesn’t use a single node for interpolation for higher order nedelec dofs. To properly represent the dual basis, which is an integral, one require several points per edge.
See for instance chapter 7.3 and figure 10 of:
https://orbilu.uni.lu/bitstream/10993/59327/1/dolfinx-paper-zenodo.10447666.pdf