[Dune] topology of triangles clockwise/anticlockwise
Leopold Stadler
23poldi23 at mailbox.org
Fri Jul 30 17:54:44 CEST 2021
Hi Andreas,
thank you very much for the detailed answer. I was able to add a small check in my code, now I write always counterclockwise triangles.
The high level of abstraction in Dune is really great. Even after many years of using Dune I'm still fascinated how easy it is to switch between different gridmanangers, element types and dimensions. So the Dune developers did a great work!
Best regards,
Leo
> Dedner, Andreas <a.s.dedner at warwick.ac.uk> hat am 30.07.2021 10:43 geschrieben:
>
>
> 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
More information about the Dune
mailing list