kinnala / scikit-fem

Simple finite element assemblers
https://scikit-fem.readthedocs.io
BSD 3-Clause "New" or "Revised" License
491 stars 79 forks source link

Nédélec element availble for MeshTet but not for MeshQuad #879

Closed learning-chip closed 1 year ago

learning-chip commented 2 years ago

There exist the lowest order Nédélec element skfem.element.ElementTetN0 for 3D tetrahedral mesh, but no such equivalent for other meshes like the 2D MeshQuad.

By looking at the file element_tet_n0.py, the code for defining a new element type seems relatively simple. But I am not sure how to verify the correctness of a new implementation (make sure it works with the rest of the codebases such as matrix assembly). The unit test file test_elements.py does not contain the class ElementTetN0 as of version 5.2.0

gdmcbain commented 2 years ago

but no such equivalent for other meshes like the 2D MeshQuad

The docstring for the superclass ElementHcurl does say

https://github.com/kinnala/scikit-fem/blob/04730d80d612470b7e802eed4c21dd96b89cef61/skfem/element/element_hcurl.py#L9

Do you have an application for H (curl) in two dimensions? I can sort of imagine it, but I don't think I've seen it before. It'd be much like ElementQuadRT0, wouldn't it, with all the vectors rotated through a right-angle? I wonder whether curl is different enough in two and three dimensions that it might make sense to treat these separately rather than trying to generalize the current three-dimensional ElementHcurl.

gdmcbain commented 2 years ago

The unit test file test_elements.py does not contain the class ElementTetN0 as of version 5.2.0

ElementTetN0 does appear in

https://github.com/kinnala/scikit-fem/blob/04730d80d612470b7e802eed4c21dd96b89cef61/docs/examples/ex33.py#L24

and so is tested indirectly to some extent in

https://github.com/kinnala/scikit-fem/blob/04730d80d612470b7e802eed4c21dd96b89cef61/tests/test_examples.py#L281

but yes something appropriate and more direct in tests.test_elements might be good too.

kinnala commented 2 years ago

I suggest we add also a convergence test for ElementTetN0. Could be a manufactured solution, any other suggestions?

gdmcbain commented 2 years ago

No, that seems best. I was looking at ex33 again in this context and then Schneebeli's ‘An H(curl; Ω)-conforming FEM’, on which it's based. I assume f in (33) for the PDE (1) is from a manufactured solution but I don't see the expression for u… an exercise for the reader? I'll see if I can reverse that next week if you haven't already.

This paper also treats the ElementQuadN0 (§2.3.1).

gdmcbain commented 2 years ago

I'll see if I can reverse that next week

No, too hard; I propose manufacturing a new u.

gdmcbain commented 2 years ago

Do you have an application for H (curl) in two dimensions?

I came across one: eq. 3.6 and §4.1 of

They do have a nice manufactured solution in Example 4.1 as well as more physically interesting examples in Examples 4.2 – 4.4. There's also a three-dimensional manufactured solution in Example 4.5; however the system is rather more involved than our ex33 so not so suitable for a test.

gdmcbain commented 2 years ago

Could be a manufactured solution, any other suggestions?

What about the eigenvalue problem curl curl u = λ u in Ω, n × u = 0 on ∂Ω? For the box 0 < (x/a, y/b, z/c) < π, the eigenvalues are λ = (k0/a)² + (k1/a)² + (k2/c)², where at most one of the ki can vanish at the same time; see (2.7) and (6.4) of

kinnala commented 1 year ago

This has moved forward; there is now ElementTriN0 also and ElementHcurl supports 2D meshes.

kinnala commented 1 year ago

Fixed in #959