Divergence free vector field on ref-cube.mesh #3523
-
Dear community, clearly the vector field It doesnt seem to be divergence free in MFEM. To check, i start with implementing the vectorfield
i project this onto a
to find the (weak) divergence i use the ...which I then transpose and multiply with the vectorfield:
The output is smaller than |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 7 replies
-
Hello @markusrenoldner, When you perform integration by parts on the |
Beta Was this translation helpful? Give feedback.
-
Hello, @markusrenoldner, I agree with everything @pazner wrote but I was curious to visualize the results and see where the errors appear. First, I should point out that the data stored in After computing the necessary If accuracy in such a weak divergence is critical you may need to align the mesh with any interesting features of your expected solutions. In this example a mesh with edges aligned, or nearly aligned, with the sphere Best wishes, |
Beta Was this translation helpful? Give feedback.
-
Incidentally, producing H(curl) fields with zero divergence is a common issue in computational electromagnetics (often goes by the name "divergence cleaning"). MFEM has a class designed to accomplish this. It's located amongst the miniapp codes, see DivergenceFreeProjector. Unfortunately, I just noticed that there is a small issue with this code. I'll try to submit a fix, in the next day or two, to improve its effectiveness. |
Beta Was this translation helpful? Give feedback.
Hello @markusrenoldner,
When you perform integration by parts on the
MixedVectorGradientIntegrator
to get the divergence, you also pick up a boundary term. The periodic cube has no boundaries, so this term doesn't appear.