PetscFECreateLagrange(comm, dim, 1, simplex, 1, PETSC_DETERMINE, &fe);

The default may be qorder = 0.
Replace   PETSC_DETERMINE with 1, 2, etc, and see.

Thanks,
Mark


On Fri, Sep 8, 2023 at 6:26 PM David Andrs <[email protected]> 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
>
> --
>
>
>

Reply via email to