Using MeshWorker to compute norms -- loss of accuracy?

55 views
Skip to first unread message

Sean Carney

unread,
May 7, 2024, 1:57:05 AM5/7/24
to deal.II User Group
Hi all,

I am brand new to deal.II, so please excuse me if this question has an obvious answer.
So far, I am quite enjoying the library and working through the different Step tutorials.

I've been working through Step-47 and in particular am trying to better understand the MeshWorker class.

In particular, I'm interested in using MeshWorker::mesh_loop to compute a norm--this norm has integrals of jumps and averages over interior cell faces. I know there is already an example in Step-82 that does just this. However, if I understand correctly, the logic used in that example becomes more challenging when using local refinement (which I'm aiming towards). But MeshWorker handles the logic quite seamlessly, and (if I'm not mistaken) automatically does it in parallel (this is just a bonus).

As a consistency check, I decided to use the MeshWorker class to compute the L2 norm of my solution and compare it against the result using:

    (1) VectorTools::integrate_difference and  VectorTools::compute_global_error (to be clear, I integrated the difference between my computed solution and the zero function)

and

    (2) the method used in Step-82.

Note, the results from (1) and (2) agree with each other to 15 digits of accuracy. However, the result from the MeshWorker method only agrees with these two up to 6 digits of accuracy.

Is there any reason why this would be true?

To be clear, "the MeshWorker method" entails computing (the square root of) u^T A u, where u is my computed solution and A is the matrix whose entries correspond to the integrals of the i-th and j-th shape functions, assembled with MeshWorker::mesh_loop.

(Happy to post my code if it helps resolve the query, but for now wanted to keep the post relatively clean.)

Thank you very much in advance for the assistance--
Regards,
-Sean

Sean Carney

unread,
May 7, 2024, 10:33:58 AM5/7/24
to deal.II User Group
Update -- the question had an obvious answer!

The reason for the discrepancy was simply the order of quadrature used.     =D

Hopefully this can help someone else who is a beginner and thinking about something similar.
Best regards,
-Sean

blais...@gmail.com

unread,
May 8, 2024, 9:32:40 AM5/8/24
to deal.II User Group
Glad you found the issue :)
Subtles things often make differences which are hard to capture!

Reply all
Reply to author
Forward
0 new messages