[Gmsh] How to create Surface from Discrete surface ?

Christophe Geuzaine cgeuzaine at uliege.be
Thu May 7 07:54:35 CEST 2020

> On 7 May 2020, at 01:01, Kenneth Assogba <kennethassogba at gmail.com> wrote:
> Dear GMSH developer,
> I'm using Gmsh Python API in version 4.5.6. I have some .msh file (with just points and line who define a surface) and I a want to create a 2D mesh on it. As it is not directly possible, i'm triying the gmsh.model.mesh.createGeometry() method and after that, doing
> gmsh.model.geo.synchronize()
> gmsh.model.mesh.generate(2)

createGeometry() creates a geometry for discrete curves and surfaces. If your mesh only contains points and line elements you don't have any surface, so createGeometry() will only create a geometry (a parametrization) for curves.

If you know that your surface is plane, just create a standard plane surface with the built-in kernel, that takes the discrete curves as boundaries.

See this tutorial for an example: http://gmsh.info/dev/doc/texinfo/gmsh.html#x2


> The result in the console is :
> Info    : Creating geometry of discrete curves...
> Info    : Done creating geometry of discrete curves (8e-06 s)
> Info    : Creating geometry of discrete surfaces...
> Info    : Done creating geometry of discrete surfaces (1e-06 s)
> But the 2D mesh isn't create. Do you have any idea of how I can do ?
> I see here (t13) that you recreate surface loop and volume before mesh, but in my case it is not possible since Gmsh return the error : Error   : GEO surface with tag 1 already exists.
> By reading information about the file (explore), I can see:
> Entity (2, 1) of type Discrete surface
>  - Mesh has 0 nodes and 0 elements
>  - Boundary entities: [(1, 1), (1, 2), (1, 3), (1, 4)]
> Please see attached the original .geo and the exported .msh.
> Thank you in advance,
> Best regards,
> Kenneth Assogba
> Master 2 Ingénierie Mathématique Pour l'Entreprise 
> Sorbonne Université - Faculté de Sciences et Ingénierie
> <model1.geo><model1.msh>_______________________________________________
> gmsh mailing list
> gmsh at onelab.info
> http://onelab.info/mailman/listinfo/gmsh

Prof. Christophe Geuzaine
University of Liege, Electrical Engineering and Computer Science 

More information about the gmsh mailing list