Magnetostatic cur-curl formulation in 2D

Hello,

i want to compare H1-space and HCurl-space for 2D magnetostatics problems.
I got it running in 3D, but have a problem in 2D with HCurl-space with the current enforcement.

For the H1-space i defined the current like this:

curdens1_cf = CoefficientFunction([curdens if mat == "coil1" else 0 for mat in mesh.GetMaterials()])
...
f += SymbolicLFI(curdens1_cf*v)

For HCurl this can’t work, because v has dim=2.

Can anybody give me a hint, where i can find a clue to the right solution?

Hi creativeworker,

in 2D there are two curl operators, one scalar to vector and one vector to scalar curl. So there are also two different curl-curl problems
[tex]\text{curl}^{vs}\text{curl}^{sv}:\mathbb{R}\to\mathbb{R}[/tex]
and
[tex]\text{curl}^{sv}\text{curl}^{vs}:\mathbb{R}^2\to\mathbb{R}^2[/tex]
where “vs” and “sv” means vector-to-scalar and scalar-to-vector.

To use H(curl) elements I guess you will need the second equation, as the first one does only work for scalar fields. When using the second one the right-hand side should also be a vector.

Best
Michael

Thanks for your hint. I tried to work it out by myself, but couldn’t find the right way. Perhaps you can give me a minimal example? Thank you in advance!

Hi creativeworker,

attached you’ll find a minimal example of a 2D curl-curl formulation with H1 and HCurl.

I don’t know how physically this problem is, but it should be suitable for comparing H1 with HCurl in 2D.
For example if you change the order from 2 to 1 the H1 solution does not look correct, whereas the HCurl solution do.

Best
Michael

https://ngsolve.org/media/kunena/attachments/889/curlcurl_2d.py

Attachment: curlcurl_2d.py

Thank you, that help a lot for understanding!
Now, I see I need the opposite curl, so that I can solve a ScalarH1 (scalar source and scalar result) equation in HCurl Space. Do I have to define my own curl operator then?

Hi creativeworker,

to use the HCurl Space you need to have a vector-valued unknown and thus a vector-valued right-hand side.
As far as I know the vector-valued version is the right one for Maxwell-equations (in 3D the source is also a vector not a scalar).

The scalar version is “just” a rotated Laplace problem (instead of div(grad(u)) you have rotated div of rotated grad). In this case the H1 space should be a good choice. Here you cannot use HCurl for approximating a scalar u.

Best
Michael

Thank you very much for the clarification. Is it then correct to say that for 2D Magnetostatics it does depent on how my source structure is?

For example for a simple coil around an iron core:

  • I can cut the the coil saggital such that three rectangles are created. The current (load) is then a scalar and so is the solution (vector potential A). In this case using H1 (Lagrange nodal elements) is correct and there is no problem with the “jumping” field.

  • I can cut the system transversal such that a circle and a ring are created. Then the current is in plane and so will the vector field be. To bring that correct to finite elements, I would have to use HCurl-Space (Nedelec edge elements)?

Thanks again for your effort!

Yes, you are right.

In the first case H1 is the correct choice and the jumping coefficient doesn’t make problems. It is like a Poisson problem with e.g. a discontinuous heat conductivity coefficient
[tex]div(\lambda \nabla u)=f.[/tex]

Just a remark: If you want to use a Zienkiewicz-Zhu (ZZ) type error estimator you have to interpolate the “flux” into HCurl, not VectorH1, like is done here in HDiv.

In the second case HCurl will produce better results than VectorH1.

Best,
Michael