[petsc-users] Creating a DMNetwork from a DMPlex

Matthew Knepley knepley at gmail.com
Tue May 21 07:13:20 CDT 2019


On Mon, May 20, 2019 at 11:34 PM Swarnava Ghosh <swarnava89 at gmail.com>
wrote:

> Hi Matt,
>
> I am trying to code my interpolation in parallel using
> DMInterpolationEvaluate. Do you have an example which I could refer to?
>

 https://bitbucket.org/petsc/petsc/src/master/src/snes/examples/tests/ex2.c

   Matt


> Thanks,
> Swarnava
>
> On Mon, May 20, 2019 at 2:00 PM Matthew Knepley <knepley at gmail.com> wrote:
>
>> On Mon, May 20, 2019 at 12:51 PM Swarnava Ghosh <swarnava89 at gmail.com>
>> wrote:
>>
>>> Hi Barry and Matt,
>>>
>>> Maybe try building by hand in a DMNetwork using a handrawn mesh with
>>> just a few vertices and endless and see if what you want to do makes sense
>>> > Okay, will try to do that. Do you have any DMNetwork example which I
>>> could follow.
>>>
>>> I think DMNetwork is not buying you anything here. It seems to make more
>>> sense to do it directly in Plex.
>>> You can easily lay down a P1 element for each field so that you can
>>> interpolate wherever you want.
>>> > Okay, then will it be possible to do vertex partitioning with plex?
>>> Essentially two processes can share an element but not vertex.
>>>
>>
>> We can worry about that when everything works. Some things are easy but
>> that breaks a lot of the model, so it
>> unclear what all would have to change in order to do what you want. The
>> partitioning of vertices, however, is trivial.
>>
>>
>>> I would start from a clean example, such as SNES ex17. That solves
>>> elasticity, so it has multiple fields and FEM.
>>> The change is that you don't want to use any of the assembly functions,
>>> so you keep the code that does data layout
>>> and FEM discretization, but it ignore the residual/Jacobian stuff. Feel
>>> free to ask about using the lower-level
>>> interpolation stuff which is not as documented.
>>> >Thanks for pointing out the reference. Could you please share the
>>> functions for interpolation?
>>>
>>
>> There are at least two ways to do it:
>>
>>   1) Locally: DMPlexEvaluateFieldJets_Internal() or DMFieldEvaluate()
>> which is newer
>>
>>   2) Globally:
>> https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/SNES/DMInterpolationEvaluate.html
>>
>>   Thanks,
>>
>>     Matt
>>
>>
>>> Sincerely,
>>> SG
>>>
>>>
>>> On Mon, May 20, 2019 at 4:02 AM Matthew Knepley <knepley at gmail.com>
>>> wrote:
>>>
>>>> On Mon, May 20, 2019 at 3:05 AM Swarnava Ghosh via petsc-users <
>>>> petsc-users at mcs.anl.gov> wrote:
>>>>
>>>>> Hi Barry,
>>>>>
>>>>> Thank you for your email. My planned discretization is based on the
>>>>> fact that I need a distributed unstructured mesh, where at each vertex
>>>>> point I perform local calculations. For these calculations, I do NOT need
>>>>> need to assemble any global matrix. I will have fields defined at the
>>>>> vertices, and using linear interpolation, I am planing to find the values
>>>>> of these fields at some spatial points with are within a ball around each
>>>>> vertex. Once the values of these fields are known within the compact
>>>>> support around each vertex, I do local computations to calculate my unknown
>>>>> field. My reason for having the a mesh is essentially to 1) define fields
>>>>> at the vertices and 2) perform linear interpolation (using finite elements)
>>>>> at some spatial points. Also the local computations around at each vertex
>>>>> is computationally the most expensive step. In that case, having a cell
>>>>> partitioning will result in vertices being shared among processes, which
>>>>> will result in redundant computations.
>>>>>
>>>>> My idea is therefore to have DMNetwork to distribute vertices across
>>>>> processes and use finite elements for the linear interpolation part.
>>>>>
>>>>
>>>> I think DMNetwork is not buying you anything here. It seems to make
>>>> more sense to do it directly in Plex.
>>>> You can easily lay down a P1 element for each field so that you can
>>>> interpolate wherever you want.
>>>>
>>>> I would start from a clean example, such as SNES ex17. That solves
>>>> elasticity, so it has multiple fields and FEM.
>>>> The change is that you don't want to use any of the assembly functions,
>>>> so you keep the code that does data layout
>>>> and FEM discretization, but it ignore the residual/Jacobian stuff. Feel
>>>> free to ask about using the lower-level
>>>> interpolation stuff which is not as documented.
>>>>
>>>>   Thanks,
>>>>
>>>>      Matt
>>>>
>>>>
>>>>> Thanks,
>>>>> SG
>>>>>
>>>>>
>>>>>
>>>>> On Sun, May 19, 2019 at 6:54 PM Smith, Barry F. <bsmith at mcs.anl.gov>
>>>>> wrote:
>>>>>
>>>>>>
>>>>>>   I am not sure you want DMNetwork, DMNetwork has no geometry; it
>>>>>> only has vertices and edges. Vertices are connected to other vertices
>>>>>> through the edges. For example I can't see how one would do vertex centered
>>>>>> finite volume methods with DMNetwork. Maybe if you said something more
>>>>>> about your planned discretization we could figure something out.
>>>>>>
>>>>>> > On May 19, 2019, at 8:32 PM, Swarnava Ghosh <swarnava89 at gmail.com>
>>>>>> wrote:
>>>>>> >
>>>>>> > Hi Barry,
>>>>>> >
>>>>>> > No, the gmesh file contains a mesh and not a graph/network.
>>>>>> > In that case, is it possible to create a DMNetwork first from the
>>>>>> DMPlex and then distribute the DMNetwork.
>>>>>> >
>>>>>> > I have this case, because I want a vertex partitioning of my mesh.
>>>>>> Domain decomposition of DMPlex gives me cell partitioning. Essentially what
>>>>>> I want is that no two processes can share a vertex BUT that can share an
>>>>>> edge. Similar to how a DMDA is distributed.
>>>>>> >
>>>>>> > Thanks,
>>>>>> > Swarnava
>>>>>> >
>>>>>> > On Sun, May 19, 2019 at 4:50 PM Smith, Barry F. <bsmith at mcs.anl.gov>
>>>>>> wrote:
>>>>>> >
>>>>>> >    This use case never occurred to us. Is the gmesh file containing
>>>>>> a graph/network (as opposed to a mesh)? There seem two choices
>>>>>> >
>>>>>> > 1) if the gmesh file contains a graph/network one could write a
>>>>>> gmesh reader for that case that reads directly for and constructs a
>>>>>> DMNetwork or
>>>>>> >
>>>>>> > 2) write a converter for a DMPlex to DMNetwork.
>>>>>> >
>>>>>> >    I lean toward the first
>>>>>> >
>>>>>> >    Either way you need to understand the documentation for
>>>>>> DMNetwork and how to build one up.
>>>>>> >
>>>>>> >
>>>>>> >    Barry
>>>>>> >
>>>>>> >
>>>>>> > > On May 19, 2019, at 6:34 PM, Swarnava Ghosh via petsc-users <
>>>>>> petsc-users at mcs.anl.gov> wrote:
>>>>>> > >
>>>>>> > > Hi Petsc users and developers,
>>>>>> > >
>>>>>> > > I am trying to find a way of creating a DMNetwork from a DMPlex.
>>>>>> I have read the DMPlex from a gmesh file and have it distributed.
>>>>>> > >
>>>>>> > > Thanks,
>>>>>> > > SG
>>>>>> >
>>>>>>
>>>>>>
>>>>
>>>> --
>>>> 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/>
>>>>
>>>
>>
>> --
>> 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/>
>>
>

-- 
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/20190521/e270e7dc/attachment.html>


More information about the petsc-users mailing list