[Gmsh] How to add a Point to a Surface with the gmsh Python API?

lepy at mailbox.org lepy at mailbox.org
Tue Aug 20 15:05:25 CEST 2019


Hi,

I want to use the Python API from gmsh to mesh a 2D surface with a local mesh refinement.

How can I add a point to a surface to get a finer mesh around some inner points?

It should be the Python version of   

Point{5} In Surface{6};

Thanks

Lepy

gmsh.initialize()

gmsh.option.setNumber("General.Terminal", 1)
gmsh.option.setNumber("Mesh.Algorithm", 6)
gmsh.option.setNumber("Mesh.RecombineAll", 1)

gmsh.model.add("square")
gmsh.model.geo.addPoint(0, 0, 0, 0.6, 1)
gmsh.model.geo.addPoint(1, 0, 0, 0.6, 2)
gmsh.model.geo.addPoint(1, 1, 0, 0.5, 3)
gmsh.model.geo.addPoint(0, 1, 0, 0.4, 4)
gmsh.model.geo.addLine(1, 2, 1)
gmsh.model.geo.addLine(2, 3, 2)
gmsh.model.geo.addLine(3, 4, 3)
line4 = gmsh.model.geo.addLine(4, 1)

gmsh.model.geo.addCurveLoop([1, 2, 3, line4], 1)
gmsh.model.geo.addPlaneSurface([1], 6)

gmsh.model.geo.addPoint(.5, .5, 0, 0.1, 5)

??? gmsh.model.geo.addPoint2Surface(???)

gmsh.model.geo.synchronize()
gmsh.model.mesh.generate(2)



More information about the gmsh mailing list