[Dune] topology of triangles clockwise/anticlockwise

Dedner, Andreas A.S.Dedner at warwick.ac.uk
Fri Jul 30 10:43:18 CEST 2021


Hi.
Dune guarantees a certain structure of the reference element For example, the reference triangle is oriented as you expect, i.e., counterclockwise. For a finite element method, one only needs to know the orientation for the reference element together with the local to global mapping ('entity.geometry()'). The orientation of the 'global' triangle will then also be counterclockwise if the integration element of this transformation is positive and clockwise if negative. Since the geometry is continuously differentiable and invertible the sign of the integration element doesn't change so you can test if the orientation is maintained by checking the integration element in a single point. So, in your example I would expect that for ALUGrid 'entity.integrationElement(x)<0' holds while for UG you have '>0'. In most cases it is not necessary to check this but if your post/preprocessing depends on the orientation this check will be required.
Best
Andreas
________________________________
From: Dune <dune-bounces at lists.dune-project.org> on behalf of Leopold Stadler <23poldi23 at mailbox.org>
Sent: 30 July 2021 08:32
To: dune at lists.dune-project.org <dune at lists.dune-project.org>
Subject: [Dune] topology of triangles clockwise/anticlockwise

Dear Dune developers and users,

writing out the topology for triangular mesh I noticed that ALUGrid uses a clockwise orientation for triangles while UGGrid uses the more common anticlockwise orientation. I use a XDMF/HDF5 writer, since vtk will produces too many single files when running large simulations (1000+ ranks).

The clockwise orientation of triangles can be a problem for some pre-/postprocessing tools (e.g. Matplotlib.tri), wich assume that all triangles are sorted anticlockwise. It looks like the anticlockwise orientation is sometimes seen as a defacto standard. It is not a big deal for me to flip two nodes of each triangle during my python postprocesing to have an anticlockwise topology.

I thought it would be a great idea to write out the topology with anticlockwise ordering when using ALUGrid. However, I'm not sure if this is true.

1.) Can one assume that the orientation of the cells within a gridView is always clockwise/anticlockwise for all triangles? If so, is there a simple check for this?

2.) Why is the orientation (clockwise/anticlockwise) no issue for Dune? Are all methods/alogrithms independent from the orientation of elements? Or is there some magic method that flips the orientation if needed?

3.) Do you think it is a bad habit to assume that triangles are anticlockwise oriented?

Best regards,

Leo

_______________________________________________
Dune mailing list
Dune at lists.dune-project.org
https://lists.dune-project.org/mailman/listinfo/dune
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.dune-project.org/pipermail/dune/attachments/20210730/eb79c0bd/attachment.htm>


More information about the Dune mailing list