[petsc-users] How to create a quadrature object?

Andrew Ho andrewh0 at uw.edu
Thu Jul 28 17:43:24 CDT 2016


I am trying to create a very simple quadrature object, but for some reason
PETSc keeps giving me an "invalid argument" error.

Relevant code:

#include <petsc.h>
> int main(int argc, char** argv)
> {
>   CHKERRQ(PetscInitialize(&argc, &argv, nullptr, "quadrature testing"));
>   PetscQuadrature quad;
>   CHKERRQ(PetscQuadratureCreate(PETSC_COMM_SELF, &quad));
>
  CHKERRQ(PetscQuadratureDestroy(&quad));

  CHKERRQ(PetscFinalize());
> }


Error message:

>
> [0]PETSC ERROR: --------------------- Error Message
> --------------------------------------------
> ------------------
>
> [0]PETSC ERROR: Invalid argument
> [0]PETSC ERROR: Invalid object classid 0
> This could happen if you compile with PETSC_HAVE_DYNAMIC_LIBRARIES, but
> link with static libraries.
>
> [0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html
> for troubleshooting.
> [0]PETSC ERROR: Petsc Release Version 3.7.2, unknown
> [0]PETSC ERROR: Configure options --with-debugging=0 COPTFLAGS="-O3
> -march=native" CXXOPTFLAGS="-O3 -march=native" FOPTFLAGS="-O3
> -march=native" --prefix=/usr/local
> [0]PETSC ERROR: #1 PetscClassRegLogGetClass() line 290 in
> /home/andrew/tools/petsc/petsc/src/sys/logging/utils/classlog.c
> [0]PETSC ERROR: #2 PetscLogObjCreateDefault() line 317 in
> /home/andrew/tools/petsc/petsc/src/sys/logging/utils/classlog.c
> [0]PETSC ERROR: #3 PetscQuadratureCreate() line 54 in
> /home/andrew/tools/petsc/petsc/src/dm/dt/interface/dt.c
>
> [0]PETSC ERROR: --------------------- Error Message
> --------------------------------------------------------------
>
> [0]PETSC ERROR: Invalid argument
> [0]PETSC ERROR: Invalid object classid 0
> This could happen if you compile with PETSC_HAVE_DYNAMIC_LIBRARIES, but
> link with static libraries.
>
> [0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html
> for troubleshooting.
> [0]PETSC ERROR: Petsc Release Version 3.7.2, unknown
> [0]PETSC ERROR: Configure options --with-debugging=0 COPTFLAGS="-O3
> -march=native" CXXOPTFLAGS="
> -O3 -march=native" FOPTFLAGS="-O3 -march=native" --prefix=/usr/local
> [0]PETSC ERROR: #4 PetscClassRegLogGetClass() line 290 in
> /home/andrew/tools/petsc/petsc/src/sys/logging/utils/classlog.c
>
> [0]PETSC ERROR: #5 PetscLogObjCreateDefault() line 317 in
> /home/andrew/tools/petsc/petsc/src/sys/logging/utils/classlog.c
>
> [0]PETSC ERROR: #6 PetscQuadratureCreate() line 54 in
> /home/andrew/tools/petsc/petsc/src/dm/dt/interface/dt.c
>
> [0]PETSC ERROR: #7 main() line 5 in /home/user/tests/pquad.cpp
> [0]PETSC ERROR: No PETSc Option Table entries
> [0]PETSC ERROR: ----------------End of Error Message -------send entire
> error message to petsc-maint at mcs.anl.gov----------


I've had no problems using other parts of PETSc with the exact same build
options/install (SNES, linear solvers), so I suspect this is likely just
user error. I have tried building PETSc both as a shared and static
library, and both methods fail in the same way.

As a related question, what is the "Order" of quadrature object suppose to
be? The documentation for "PetscQuadratureGetOrder" and
"PetscQuadratureSetOrder" says this is the highest degree polynomial that
is exactly integrated.

However, when I looked at the source code for
"PetscDTGaussTensorQuadrature", this appears to set the order to the number
of quadrature points, which for Gaussian quadrature means it can integrate
a 2*npoints-1 polynomial exactly.

If I wanted to implement my own quadrature scheme (Gauss-Lobatto) which is
exact for polynomials up to 2*npoints-3, what should I set the quadrature
order to?

-- 
Andrew Ho
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20160728/e3cd22ff/attachment-0001.html>


More information about the petsc-users mailing list