[Gmsh] Mesh Code/Source for Heat Transfer

Anthony Chong Anthony.Chong at nottingham.ac.uk
Wed Apr 6 15:02:05 CEST 2011


Dear Geordie,

Thank you for your quick response, and it is really appreciated very
much.

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.

As mentioned early in my email, I am new/beginner in using the Gmsh or
the C++, therefore, I cannot fully understand a lot of things mentioned
in your email. You may find that my questions are very simple but I do
need experienced people like you to advise or direct me to the right
direction and tell me a bit more detailed on how I should deal with the
problems.

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?

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?

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?

Thank you for your help and look forward to hearing from you.

Kind regards,

Anthony Chong 
Research Fellow
Department of Architecture and Built Environment
Faculty of Engineering
The University of Nottingham
University Park
Nottingham
NG7 2RD, UK

Tel: +44 (0)115 846 7132
anthony.chong at nottingham.ac.uk



-----Original Message-----
From: gdmcbain at gmail.com [mailto:gdmcbain at gmail.com] On Behalf Of
Geordie McBain
Sent: 05 April 2011 00:51
To: Anthony Chong
Cc: gmsh at geuz.org
Subject: Re: [Gmsh] Mesh Code/Source for Heat Transfer

> I am currently working on a project which is about the ground-coupled
heat exchanger model. The model is used to simulate the heat transfer
process of surrounding soil of the circular pipe, where heat is
extracted or generated within the circular pipe. I will need to write a
code (in C++) to simulate the transient heat transfer for the pipe (i.e.
circular cylindrical) within soil (i.e. rectangular domain model).

While you can write a code in C++ for this, you don't really need to;
several serviceable C++ codes for the solving the heat equation, are
freely available.  Try GetDP, FreeFem++, OpenFOAM, or libMesh, for
example; the first of these enjoys close links with Gmsh.

> (1) After the mesh has been generated, can I read or view the mesh
code/source coordinate data?

Yes.  The 110404_Model in msh.msh file you generated and included in
the zip-archive is in an ASCII format, so you can read it yourself in
a text-editor (e.g. Emacs or vi) or parse it fairly easily in any
programming language.  The format is simple and is described in the
manual:

   http://geuz.org/gmsh/doc/texinfo/gmsh.html#MSH-ASCII-file-format

> (2) Once I have got the mesh code/source coordinate data, how would I
be able to transfer or link these data into my C++ program?

If you do decide to go this way, you'll find an example of reading a
Gmsh geometry .geo file, meshing it, and processing the resulting mesh
in utils/api_demos/mainSimple.cpp in the Gmsh source distribution.

> As mentioned, I will be using transient heat transfer equation in
cylindrical polar coordinate system to determine the heat transfer
effect of the circular pipe. The equation shows as below:

You may well be better off working with the equation in the Cartesian
coordinate system, despite the circular pipe.  It's much easier to
generate an unstructured mesh than a structured one which respects the
coordinate system, and once you've done that, I think you've lost
whatever advantages a special coordinate system might have.

> Another thing is that, I have downloaded the Gmsh 2.5.0 Source Code
from your website, and I am wondering how I shall read this source code,
and whether I can link/use one of the codes into my simulation model (or
mesh model) from the Source Code?

You probably don't need to read the Gmsh source code, except out of
curiosity or if you find later you need to fix or bug or extend the
program, but Gmsh is already in a sufficiently mature state that you
shouldn't need to for solving the heat equation in a reasonably
well-defined geometry.  But don't let me discourage you: see the other
examples in utils/api_demos.
This message and any attachment are intended solely for the addressee and may contain confidential information. If you have received this message in error, please send it back to me, and immediately delete it.   Please do not use, copy or disclose the information contained in this message or in any attachment.  Any views or opinions expressed by the author of this email do not necessarily reflect the views of the University of Nottingham.

This message has been checked for viruses but the contents of an attachment
may still contain software viruses which could damage your computer system:
you are advised to perform your own checks. Email communications with the
University of Nottingham may be monitored as permitted by UK legislation.