[petsc-users] Tracking a NaN in FVM gradient computation

Ellen M. Price ellen.price at cfa.harvard.edu
Sun Jun 20 15:51:17 CDT 2021


Hi there PETSc,

I am working my way through ex11.c and have encountered a problem. On
the first pass through mesh adaption, the gradient computation in PETSc
triggers a NaN, even though none of the input data are NaN.

To reproduce:

PETSc v3.15 with latest MPICH, no external libraries, debugging on
Compile ex11.c using GCC 9.3 on Ubuntu 20.04
Run as: ./ex11 -ufv_use_amr -fp_trap

Running under GDB shows that the offending line is:
src/dm/impls/plex/plexfvm.c:111
This originates from the call to DMPlexReconstructGradientsFVM.

I only noticed this because I was trying to resolve a discontinuity in
my own initial condition for a Sod shock tube problem, but then I found
that it occurs in the example without any modification, too.

Is this somehow intended? If not, what steps can one take to make sure
the gradients are actual numeric values? It doesn't make sense to me
that they would be undefined on the first step when nothing else is NaN.
Or is it that AMR in ex11 doesn't quite work yet?

Thanks,
Ellen Price


More information about the petsc-users mailing list