[petsc-users] How to get specific ordering
Matthew Knepley
knepley at gmail.com
Mon Sep 20 08:43:40 CDT 2021
On Sun, Sep 19, 2021 at 3:27 PM Carlos Velazquez <carlos.v.hd1 at gmail.com>
wrote:
> Hi there. I have a question whether I can get the DAG values in DMPlex in
> a different order.
>
> I am working on a code that uses the same node ordering to form the
> elements found in the mesh file. Example:
>
> If I use the file "doublet-tet.msh" that is inside the DMPlex mesh files
> folder, this file tells us that the elements are formed as follows:
>
> 1 - 2 4 3 1
> 2 - 2 3 4 5
> Element 1 by nodes 2, 4, 3, 1
> Element 2 by nodes 2, 3, 4, 5
>
> So what I'm doing to get this through DMPlex is getting the transitive
> closure with DMPlexGetTransitiveClosure and getting the points from level
> 0, which is the node level, but the ordering is different. Example:
>
> With DMPlexGetTransitiveClosure I obtain that the elements are formed as
> follows:
>
> 0 - 5 3 4 2
> 1 - 4 3 5 6
> Element 1 by nodes 5, 3, 4, 2
> Element 2 by nodes 4, 3, 5, 6
>
> But comparing this ordering with the previous one in the coordinate matrix
> I can see that the order is not equivalent.
>
> I would like to know if there is a way to modify the ordering of the graph
> to obtain the same ordering that is in the mesh file for the nodes that
> make up the elements or even if there is some way to configure it for a
> specific desired order.
>
The problem is that GMsh orients tetrahedra differently than Plex. We like
outward normals, whereas the GMsh convention has the normal for the
first face pointing inward. Thus, when we read in a GMsh tet, we flip the
first two vertices. So
0 - 5 3 4 2
but if we number from 1 instead of 0, and number cells and vertices
separately,
1 - 4 2 3 1
which if you flip vertices 1 and 2 is
1 - 2 4 3 1
which is what you read in.
Thanks,
Matt
--
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/20210920/9d12c6c3/attachment.html>
More information about the petsc-users
mailing list