[Gmsh] Beginner Gmsh Questions

Felix Salazar felix.salazar at polymtl.ca
Thu Jun 1 18:29:51 CEST 2017


The mesh size in the points is optional. It gives you the size of the
elements adjacent to the point. Gmsh is bon dimentional. Hence, if you have
a square of side 1, it is up to you to decide wether that's inches, meters
or kilometers. And based upon that you can select the size of your
elements, taking into account the physics of the phenomenon of interest.
For example, a square plate of 1 ft per side, and you want to study stress
distribution. In your FEM code support shell elements, and large
deformation are not expected, you could use only one element, depending of
boundary conditions. But if you want to solve the heat distribution in the
same plaque using linear elements and strong gradients are expected due to
boundary conditions, you will need much more. The meshSize value for that
4th parameter is a fraction of the size 1 defined by the geometry. So, in
the same square plate of 1 ft per side, the coordinates specified as
 {0,0,0,0.1};{0,1,0,0.1}; {1,0,0,0.1}{1,1,0,0.1}. The 0.1 in each point
will split the plate in a 10x10 grid, each elements slightly larger than 1

The line loops are ordered in the sense that the index should be continuos
in the order you'd see if you walked over the loop, returning to the
starting point. Using my coordinates, and assuming those are the only 4
points, and they were specified in that order, the lines could be {1,2};
{1,3}; {2,4}; {4,3}. And the loop would be {1,3,4,-2}. Remember that each
line can be interpreted as a vector and has an implicit direction depending
of the order the points were specified.

The extrude command question. It will return the index of the newly created
entities. The behavior can be modified with advanced options to return more
information. The format of the returned object (at least from what I
remember) depends of the type of the extrusion. If it's a point, line or
surface. The extrude will create more entities and hence, will return a
larger array.

>From my experience, I always used physical entities. Easier to group
surfaces for Boundary conditions. But it depends on the FEM code you'll use.

Hope this helps. My apologies for the format of my numbers. Typing from
cellphone from a parking lot.

Best of lucks


On Jun 1, 2017 10:40 AM, "chase" <sharmalay at gmail.com> wrote:


I have a few questions regarding gmsh usage.

What is the meaning of the mesh element size when supplied to points? Does
this value provide a mapping between gmsh coordinates and physical units?
If I would like to describe the geometry in thousandths of an inch, what
value should be given to the fourth argument of elementary Point?

Also, the documentation describes Line Loops as being ordered and oriented.
I assume ordered means the indices (IDs) of the lines are increasing in the
expression list. What makes a Line Loop oriented? If I am manually creating
geometry files, how can I ensure a Line Loop is oriented?

Also, the Extrude command can be used in an expression, where the results
can be referred to by indexing into a variable. The documentation shows an
example of an extrusion of a line to a surface, and how the indices map to
the different lines and surface of the extrusion. What about an extrusion
of a surface into a volume? What indices map to what surfaces when
extruding a surface?

Ultimately the goal is to create an axisymmetric mesh that can be used with
OpenFOAM. I am currently using the following simple geometry to try and
understand gmsh (I am uncertain about the Physical Surfaces and Volume):


meshSize = 1;

Point(1) = {0, 0, 0, meshSize};
Point(2) = {0, 266, 0, meshSize};
Point(3) = {266, 266, 0, meshSize};
Point(4) = {266, 15, 0, meshSize};

Point(5) = {5830, 15, 0, meshSize};
Point(6) = {5830, 645, 0, meshSize};
Point(7) = {10264, 645, 0, meshSize};
Point(8) = {10264, 0, 0, meshSize};

Line(1) = {1, 2};
Line(2) = {2, 3};
Line(3) = {3, 4};
Line(4) = {4, 5};
Line(5) = {5, 6};
Line(6) = {6, 7};
Line(7) = {7, 8};
Line(8) = {8, 1};

Line Loop(9) = {1, 2, 3, 4, 5, 6, 7, 8};

Plane Surface(1) = {9};


Rotate {{1, 0, 0}, {0, 0, 0}, -.04363323129985824} {

out[] = Extrude {{1, 0, 0}, {0, 0, 0}, .08726646259971647} {

Physical Surface("Front") = out[0];
Physical Surface("Back") = out[5];
Physical Surface("Atmos") = out[2];
Physical Surface("Vac") = out[3];
Physical Surface("Top") = out[4];

Physical Volume(1) = {out[1]};



Chase Leslie

gmsh mailing list
gmsh at onelab.info
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://onelab.info/pipermail/gmsh/attachments/20170601/ab6b150c/attachment.html>

More information about the gmsh mailing list