Matthew Knepley knepley at gmail.com
Fri Dec 11 11:39:45 CST 2020

On Fri, Dec 11, 2020 at 12:02 PM Nicolas Barral <
nicolas.barral at math.u-bordeaux.fr> wrote:

> 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)
> feGrad);CHKERRQ(ierr);

Jacobi is correct, so let me give the history. Originally, you were to
call PetscDSSetDiscretization() as you have done.
However, now it is possible to have different discretization within the
same domain, So now we want you to call
DMAddField(dm, feGrad), and then DMCreateDS(), which will
call PetscDSSetDiscretization() for you. I changed the
examples, but I did not have another place to document this.



> 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 ?
> Thanks
> --
> Nicolas

What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener

https://www.cse.buffalo.edu/~knepley/ <http://www.cse.buffalo.edu/~knepley/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20201211/b1016279/attachment-0001.html>

More information about the petsc-users mailing list