[petsc-users] DMPlex general questions

Matthew Knepley knepley at gmail.com
Tue Jul 7 11:04:07 CDT 2015

On Sun, Jul 5, 2015 at 11:57 AM, Filippo Leonardi <
filippo.leonardi at sam.math.ethz.ch> wrote:

>  Hi all,
> I'm starting to migrate my code to DMDAs to use DMPlex but I have troubles
> that neither the documentation nor google can answer.
> 1) I want to to traverse the DAG associated to the DMPlex in the following
> way: assuming I have a DMPlex of dimension 2, I have a point representing a
> cell (2 dimensional) and I want to find all neighbouring 2-dim cells. A way
> to do this may be to GetCone and then follow the arrows in reverse in the
> DAG from height 2 to height 1. Any routine to do that? I looked at the DM
> documentation page but cannot find the proper one. I tried all the
> GetAdjacency routines but none of them seems to give the right
> implementation. I am thinking of something like GetCone or GetSupport, but
> from 2-dim cell to adjacent 2-dim cell.

You would use


Note that the default is for FEM style adjacency. If you want FVM style,
you need to call



> 2) I've noticed that the numbering concerning the Height in the BFS search
> of the DMPlex section is a bit inconsistent. What I mean is that if want
> all the 2-dim cells of my DMPlex I should do:
> DMPlexGetHeightStratum(dm, d, &pStart, &pEnd);
> with d = 0, but if I'd like to call
> DMPlexCreateSection
> and create DOFs on the 2-dim cell, I have to do:
> numDof[f*(dim+1)+d] = 2;
> with d = 2.
> Is there any reason behind that? I was trying with some mock example and
> fell into this trap a couple of times.

There are two measures, the 'depth' which matches the idea of dimension,
and the 'height' which matches
the idea of co-dimension. In CreateSection() I have gone with input by
depth, mostly because a prior
implementation in the FIAT package did it that way.

> 3) This brings me to the following: I've noticed that the documentation is
> a bit "sparse", and I'd really like to contribute, especially improving the
> APIs documentation. I am not native speaker and new to all the DMPlex
> business but if you devs think this may be useful, I'll be glad to help.
> Would this be of any use to you?

Sure, pull requests are the best way to do this since we can review them. I
am trying to have all
the functions documented. I do hold off on some of the more experimental
ones in order to see
how we like the interface before advertising it.

> 4) I had problems loading meshes from Gmsh and, as far as I understood, it
> seems that is not PETSc preferred mesher (got problems with boundaries IS).
> PETSc seems to like this ExodusII format, any suggestion of a tool similar
> to Gmsh that creates ExodusII meshes?

The Gmsh problems should be fixed in the latest release due to hard work
from MIchael Lange. Report the problems
and we will see what can be done.



> Sorry for the length and thanks in advance.
> Best,
> Filippo

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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20150707/0cc22f05/attachment.html>

More information about the petsc-users mailing list