[Gmsh] python wrappers : how to specify the Mesh algorithm and mesh size?

Vladimir Popescu vladimir.popescu at logilab.fr
Fri Dec 7 10:54:07 CET 2012


Hello,

For specifying the meshing algorithm, along with the various
meshing options (including the mesh size), it suffices to add
lines such as the following to your Python script,
between the GmshInitialize() line and the GModel() line:

// Delaunay 2D meshing algorithm:
GmshSetOption("Mesh", "Algorithm", 5.)

// Delaunay 3D meshing algorithm:
GmshSetOption("Mesh", "Algorithm3D", 1.)

// minimal mesh element size; pay attention to the dot after the (0) 
integer:
GmshSetOption("Mesh", "CharacteristicLengthMin", 0.)

// maximal mesh element size; no dots after floats in exp notation:
GmshSetOption("Mesh", "CharacteristicLengthMax", 1e+22)

Alternatively, for specifying mesh element sizes, you can use

// mesh element sizes deduced from the values given at Geometry points:
GmshSetOption("Mesh", "CharacteristicLengthFromPoints", 2.)

In general,

GmshSetOption("<Processing>", "<Option>", <Value>) is equivalent to

<Processing>.<Option> = <Value>;

in the Gmsh scripting language, except for the dot that has to be put after
<Value> in the Python script, if <Value> is an integer.

I hope this helps,

Vladimir Popescu


Le 06/12/2012 11:56, trophime a écrit :
> Hi,
> I would like to use python wrappers.
>  From the example posted in the mailing list I manage to build my
> geometry but I wonder how to specify the Mesh algorithm and the mesh
> size?
>
> Could you give me some hints or examples?
> Best
>
> C
>
>
> _______________________________________________
> gmsh mailing list
> gmsh at geuz.org
> http://www.geuz.org/mailman/listinfo/gmsh
>