[petsc-users] Compute integral using DMPlexComputeIntegralFEM

David Andrs andrsd at gmail.com
Fri Sep 8 17:26:31 CDT 2023


Hi all!

I am trying to use DMPlexComputeIntegralFEM to compute an integral $\int_\Omega u d\Omega$. My domain is a square (-1, 1)^2 (2x2 QUAD4 elements), I add first order Lagrange FE field on it, set the solution vector (computed by a previous simulation).

The value I am seeing computed by PETSc is -4, but the hand-calculated value of this integral is -4.6. I also checked this in paraview using the ‘Integrate Variables’ filter and it also returns -4.6 (this was to double check that my hand-calculated value is correct).

So, I must be missing something obvious in my code. Attached is the minimal PETSc code to show what I am doing. This is against PETSc 3.19.4.

Thanks in advance for your help,

David

--


-------------- next part --------------
A non-text attachment was scrubbed...
Name: main.cpp
Type: application/octet-stream
Size: 2104 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20230908/572fcdcc/attachment.obj>


More information about the petsc-users mailing list