Nicolas Barral nicolas.barral at math.u-bordeaux.fr
Fri Dec 11 11:02:48 CST 2020

Hi all (and probably more specifically Matt ?)

I am trying to understand how the class IDs of a DM field are set, and 
can't find it in the documentation.

A little background, I am mimicking 
SNES/utils/dmadapt.c/DMAdaptorAdapt_Sequence_Private for a specific case 
(I'm trying to build the same kind of metric from a single sensor field, 
without all the SNES layer).

I need to compute the gradient of the sensor field, using 
DMPlexComputeGradientClementInterpolant, for which I create a DM, to 
which I associate a PetscFE, a DS, like in existing code:

PetscFE  feGrad
PetscDS  probGrad

ierr = PetscFECreateDefault(PetscObjectComm((PetscObject) dmGrad), dim, 
coordDim, PETSC_TRUE, NULL, -1, &feGrad);CHKERRQ(ierr);
ierr = PetscDSSetDiscretization(probGrad, f, (PetscObject) 
ierr = PetscFEDestroy(&feGrad);CHKERRQ(ierr);

Yet, when I call DMPlexComputeGradientClementInterpolant, I get the 
following error:
[0]PETSC ERROR: Unknown discretization type for field 0

I don't fully understand what all these objects are (FE, DS and Field), 
and how they are related, where would that be documented ?
And what else do I need to do to make my example work ?



More information about the petsc-users mailing list