[Gmsh] Extraction of elements whose edges are on the boundary

jeremy theler jeremy at talador.com.ar
Tue Feb 25 00:13:53 CET 2014


> In order to traverse the boundary segments, I extract the geometrical edges
> and, for each of them, I can then enumerate all the mesh edges that have
> been generated as their children (they are sort of subsegments of those
> edges). My question is: do you know if there is a direct method to extract
> the mesh element (i.e., the triangle with its global number) to which each
> boundary edge belongs? It's crucial, in order to prescribe the boundary
> conditions in my code!

I have been having the same issue, not only for boundary conditions with 
finite elements but also for the application of finite volumes methods to 
solve PDEs over gmsh-generated domains.

> Enumerating all the possible pairs of vertices (of the edges), storing them
> in a set (or something similar) and then traversing all the elements and
> comparing edges seems a solution to my problem, but quite inefficient and
> time-consuming. Is there something already implemented?

I had to resort to some scheme similar to what you propose (only for 1d and 2d 
domains so far) and you are right, even with list of nodes associated to each 
element all the elements have to be checked in order to find the ones located 
in the boundary (for FEM BCs) and which element is neighbor of which (for 
FVM). If somehow the relationship about first-neighbors could be directly 
computed by gmsh and incorporated into the mesh file, then both problems---
i.e. FEM with BCs that depend on bulk properties and the utilization of FVM---
could be efficiently solved.

So the question (probably aimed at Christophe) is:
Is this feature too hard to implement in gmsh?

--
jeremy