[Gmsh] Mesh Code/Source for Heat Transfer

Geordie McBain gdmcbain at freeshell.org
Thu Apr 7 03:12:36 CEST 2011


2011/4/6 Anthony Chong <Anthony.Chong at nottingham.ac.uk>:
> Thank you for your quick response, and it is really appreciated very
> much.

You're welcome.

> I did get to know those free software like GetDP and FreeFem++ during my
> search on mesh generation software, but I don't have a chance to explore
> them in detail.

These two packages aren't mesh generators (actually the latter does
have some basic functionality, but not such as to compete with Gmsh),
but solvers.  They take meshes as inputs and then with them you can
define partial differentiation equations and boundary conditions,
time-stepping algorithms, etc., and they'll give you a solution, e.g.
the evolving temperature field.

> Yes, I am now able to view/read the nodes and elements value from my
> (.msh) file by using Notepad, and it is interesting to see all the value
> for nodes and the value for elements. Can I ask, by having this nodes
> and elements value, how am I supposed to make use of these values and
> allow the C++ code to read/coordinate these values?

Ultimately with std::cin, but really, if you use a C++ code that has
already been written, such as one of those I referred to, then this
will usually already have a function for reading in a Gmsh msh; e.g.
FreeFem++ has the command "readmesh".

> I have looked into the "utils/api_demos/mainSimple.cpp" program; can you
> please advise what this code is about? Is this code used for generating
> the mesh or generating the geometry?

It's for generating the mesh.  The geometry is specified in a .geo
file called tutorial/t5.geo, not unlike your .geo file.  It reads this
in with the "readGEO" method of the GModel class.  It then meshes the
geometry with the "mesh" method.  The program is only a simple
example, so all it does after that is print some statistics and then
write out the mesh in two different formats.

> Another thing is, the mesh that I generated in (.msh) file of my
> 110404_model is an unstructured mesh, it should contains of 1026 Nodes
> on lines, 3006 Nodes on surfaces and 8008 Triangles. I am not sure why
> you see it as a structured mesh? Is it because the setting in
> Tools>Options>Mesh> General on Gmsh software different?

No, sorry, I do see your mesh as an unstructured mesh.  I was just
saying that since you have an unstructured mesh, you may as well work
in Cartesian coordinates; I was asking what benefit you saw in working
with polar coordinates.