<div dir="ltr"><div dir="ltr">On Fri, Dec 11, 2020 at 12:02 PM Nicolas Barral <<a href="mailto:nicolas.barral@math.u-bordeaux.fr">nicolas.barral@math.u-bordeaux.fr</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi all (and probably more specifically Matt ?)<br>
<br>
I am trying to understand how the class IDs of a DM field are set, and <br>
can't find it in the documentation.<br>
<br>
A little background, I am mimicking <br>
SNES/utils/dmadapt.c/DMAdaptorAdapt_Sequence_Private for a specific case <br>
(I'm trying to build the same kind of metric from a single sensor field, <br>
without all the SNES layer).<br>
<br>
I need to compute the gradient of the sensor field, using <br>
DMPlexComputeGradientClementInterpolant, for which I create a DM, to <br>
which I associate a PetscFE, a DS, like in existing code:<br>
<br>
PetscFE  feGrad<br>
PetscDS  probGrad<br>
<br>
ierr = PetscFECreateDefault(PetscObjectComm((PetscObject) dmGrad), dim, <br>
coordDim, PETSC_TRUE, NULL, -1, &feGrad);CHKERRQ(ierr);<br>
ierr = PetscDSSetDiscretization(probGrad, f, (PetscObject) <br>
feGrad);CHKERRQ(ierr);<br></blockquote><div><br></div><div>Jacobi is correct, so let me give the history. Originally, you were to call PetscDSSetDiscretization() as you have done.</div><div>However, now it is possible to have different discretization within the same domain, So now we want you to call</div><div>DMAddField(dm, feGrad), and then DMCreateDS(), which will call PetscDSSetDiscretization() for you. I changed the</div><div>examples, but I did not have another place to document this.</div><div><br></div><div>  Thanks,</div><div><br></div><div>     Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
ierr = PetscFEDestroy(&feGrad);CHKERRQ(ierr);<br>
<br>
Yet, when I call DMPlexComputeGradientClementInterpolant, I get the <br>
following error:<br>
[0]PETSC ERROR: Unknown discretization type for field 0<br>
<br>
I don't fully understand what all these objects are (FE, DS and Field), <br>
and how they are related, where would that be documented ?<br>
And what else do I need to do to make my example work ?<br>
<br>
Thanks<br>
<br>
-- <br>
Nicolas<br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener</div><div><br></div><div><a href="http://www.cse.buffalo.edu/~knepley/" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br></div></div></div></div></div></div></div></div>