[Gmsh] Gmsh Python API

Alejandro Pina ajpina at gmail.com
Sun May 20 21:03:10 CEST 2018


Dear List,

I have been trying to use the Python API but my meshing does not respond to
the mesh size that I set when adding the points. I reproduced my problem in
the following example. So no matter what value I set on Œlc¹, the surface
always happens to have only four triangles.

Hope you can help me figure it out and be able to control the meshing. I am
also attaching the resulting 'MyTest.msh¹ file.

import gmsh

gmsh.initialize()
gmsh.option.setNumber("General.Terminal", 1)
gmsh.model.add("MyTest")
lc = 1e-4
gmsh.model.geo.addPoint(0, 0, 0, lc, 1)
gmsh.model.geo.addPoint(.1, 0,  0, lc, 2)
gmsh.model.geo.addPoint(.1, .3, 0, lc, 3)
gmsh.model.geo.addPoint(0, .3, 0, lc, 4)
gmsh.model.geo.addLine(1, 2, 1)
gmsh.model.geo.addLine(3, 2, 2)
gmsh.model.geo.addLine(3, 4, 3)
gmsh.model.geo.addLine(4, 1, 4)
gmsh.model.geo.addCurveLoop([4, 1, -2, 3], 1)
gmsh.model.geo.addPlaneSurface([1], 1)
gmsh.model.addPhysicalGroup(2, [1], 1)
gmsh.model.setPhysicalName(2, 1, "My surface")
gmsh.model.geo.synchronize()
gmsh.model.mesh.generate(2)
gmsh.write("MyTest.msh")
gmsh.finalize()

Thanks,
Alejandro




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://onelab.info/pipermail/gmsh/attachments/20180520/565d71b4/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: MyTest.msh
Type: application/octet-stream
Size: 249 bytes
Desc: not available
URL: <http://onelab.info/pipermail/gmsh/attachments/20180520/565d71b4/attachment.msh>


More information about the gmsh mailing list