Thanks Matt and Jacob,

There's still something not working yet, but I'm trying to build a MFE before asking.

Matt, what you say is consistent with plex/tutorials/ex8.c, but not with DMAdaptorAdapt_Sequence_Private. Does that mean that the latter is broken ?

Thanks

--
Nicolas

On 11/12/2020 18:39, Matthew Knepley wrote:
On Fri, Dec 11, 2020 at 12:02 PM Nicolas Barral <[email protected] <mailto:[email protected]>> 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.

   Thanks,

      Matt

    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/>

Reply via email to