[petsc-users] Compute integral using DMPlexComputeIntegralFEM

David Andrs andrsd at gmail.com
Sat Sep 9 08:01:06 CDT 2023


Hi Mark!

> On Sep 9, 2023, at 06:40, Mark Adams <mfadams at lbl.gov> wrote:
> 
>     PetscFECreateLagrange(comm, dim, 1, simplex, 1, PETSC_DETERMINE, &fe);
> 
> The default may be qorder = 0.
> Replace   PETSC_DETERMINE with 1, 2, etc, and see.

With PETSC_DETERMINE, I see 4 evaluations of the function per element, so I think that works as expected.
Even if I force a higher quadrature order, I still see the wrong value.

—
David

> 
> Thanks,
> Mark
> 
> 
> On Fri, Sep 8, 2023 at 6:26 PM David Andrs <andrsd at gmail.com <mailto:andrsd at gmail.com>> wrote:
>> 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 --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20230909/bb46eb24/attachment.html>


More information about the petsc-users mailing list