Skip to content
Snippets Groups Projects
FAQ 13.4 KiB
Newer Older
$Id: FAQ,v 1.54 2005-03-03 15:07:29 geuzaine Exp $
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed

This is the Gmsh FAQ
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
********************************************************************
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
Section 1: The basics

* 1.1 What is Gmsh?

Gmsh is an automatic three-dimensional finite element mesh generator,
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
primarily Delaunay, with built-in pre- and post-processing
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
facilities. Its design goal is to provide a simple meshing tool for
academic problems with parametric input and advanced visualization
capabilities.
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed

* 1.2 What are the terms and conditions of use?
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
Gmsh is distributed under the terms of the GNU General Public
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
License. See the file doc/LICENSE for more information, or go to the
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
GNU foundation's web site at http://www.gnu.org.

* 1.3 What does 'Gmsh' mean?
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
(Note that in the US, people tend to pronounce 'Gmsh' as
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
'Gee-mesh'. Yeehaa!)
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
* 1.4 Where can I find more information?
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
<http://www.geuz.org/gmsh/> is the primary location to obtain
information about Gmsh. You will for example find a complete reference
manual as well as a searchable archive of the Gmsh mailing list
(<gmsh@geuz.org>) on this webpage.
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
********************************************************************
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
Section 2: Installation
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
* 2.1 Which OSes does Gmsh run on?
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
Gmsh is known to run on Windows 95/98/NT/2000/XP, Linux, Mac OS X,
Compaq Tru64 Unix (aka OSF1, aka Digital Unix), Sun OS, IBM AIX, SGI
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
IRIX, FreeBSD and HP-UX. It should compile on any Unix-like operating
system, provided that you have access to a recent C and C++ compiler.
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
* 2.2 Are there additional requirements to run Gmsh?
Christophe Geuzaine's avatar
Christophe Geuzaine committed
You should have the OpenGL libraries installed on your system, and in
the path of the library loader. A free replacement for OpenGL can be
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
found at <http://www.mesa3d.org>.

* 2.3 What do I need to compile Gmsh from the sources?

You need a C and a C++ compiler (e.g. the GNU compilers gcc and g++)
as well as the GSL (version 1.2 or higher; freely available from
http://sources.redhat.com/gsl/) and FLTK (version 1.1.x, configured
with OpenGL support; freely available from http://www.fltk.org).
You'll also need the jpeg library if you want to save jpeg images, and
the libpng and zlib libraries if you want to save png images.
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed

Under Windows, you will need the Cygwin tools and compilers (freely
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
available from http://www.cygwin.com), as well as "cygwin-enabled"
version of FLTK (i.e., you have to configure FLTK with "./configure
--enable-cygwin").
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed

* 2.4 How to I compile Gmsh?
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
Just type 
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed

Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
./configure; make; make install
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
If you change some configuration options (type ./configure --help to
get the list of all available choices), don't forget to do 'make
clean' before rebuilding Gmsh.
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
********************************************************************
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
Section 3: General problems
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
* 3.1 Gmsh [from a binary distribution] complains about missing
libraries.
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
Try 'ldd gmsh' (or 'otool -L gmsh' on Mac OS X) to check if all the
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
required shared libraries are installed on your system. If not,
install them. If it still doesn't work, recompile Gmsh from the
sources.
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
* 3.2 Gmsh keeps re-displaying its graphics when other windows
partially hide the graphical window.

Disable opaque move in your window manager.

Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
* 3.3 The graphics display very slowly.

Are you are executing Gmsh from a remote host (via the network)
without GLX?  You should turn double buffering off (with the -nodb
command line option).

Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
********************************************************************
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
Section 4: Geometry module
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
* 4.1 Does Gmsh support NURBS curves/surfaces?
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
* 4.2 Gmsh is very slow when I use many transformations (Translate,
Rotate, Symmetry, Extrude, etc. ). What's wrong?

The default behavior of Gmsh is to check and suppress all duplicate
entities (points, lines and surfaces) each time a transformation
command is issued. This can slow down things a lot if many
transformations are performed. There are two solutions to this
problem:
- you may save the unrolled geometry in another file (e.g. with 
  gmsh file.geo -0 > flat.geo), and use this new file for subsequent
  computations;
- you may set the 'Geometry.AutoCoherence' option to 0. This will
  prevent any automatic duplicate check/replacement. If you still
  need to remove the duplicates entities, simply add 'Coherence;' at 
  strategic locations in your geo files (e.g. before the creation of
  line loops, etc.).

Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
********************************************************************
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
Section 5: Mesh module
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
* 5.1 What should I do when the 2D unstructured algorithm fails?
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
Try one of the other 2D algorithms, e.g.:
- on the command line: gmsh -algo tri
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
- in the interface: Tools->Options->Mesh->2D->Isotropic algorithm (Triangle)
- in input files: Mesh.Algorithm = 3
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
The old 2D algorithm may disappear once all its features are
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
integrated in the new ones, so please don't send bug reports on the
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
* 5.2 The new 2D unstructured algorithms also fail! Then what?
Christophe Geuzaine's avatar
Christophe Geuzaine committed

Send us your geometry, and we will investigate. Please keep the
following in mind though: 2D (surface) meshes are generated by
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
projecting the 2D mesh in a "mean plane" of the surface. This gives
nice results only if the surface curvature is small enough. Otherwise
you must cut the surface into several pieces (patches). For example,
using half circles to define a cylinder will fail with the
unstructured algorithm: you should define arcs with angles smaller
than Pi, and thus define the cylinder with at least three patches.
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
* 5.3 What should I do when the 3D unstructured algorithm fails?

The 3D algorithm is still very experimental. Try to change some
characteristic lengths in your input file to generate meshes that
better suit the geometrical details of your structure.
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
* 5.4 I changed the characteristic lengths, but the 3D algorithm still
does not work. What should I do?
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
Buy a professional mesh generator ;-) You can also try to use Netgen
instead of the default algorithm for the 3D mesh. Note that all
surface meshes have to be oriented with exterior normals in this case.
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
* 5.5 The 3D algorithm is reaaaaally slow. Can you improve it?
Christophe Geuzaine's avatar
Christophe Geuzaine committed

We are working on it. But since we have a (very) limited amount of
time to spend on the development of Gmsh, this may take a while. For
very big meshes, see the answer to the previous question...

Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
* 5.6 The quality of the elements generated by the 3D algorithm is
very bad.
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
Upgrade to Gmsh >= 1.54 and use "Optimize quality". If badly shaped
elements still exist due to the surface recovery step, you can try to
use Netgen instead of the default algorithm for the 3D mesh. Note that
all surface meshes have to be oriented with exterior normals in this
case.
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
* 5.7 Non-recombined 3D extruded meshes sometimes fail.
The swapping algorithm is not very clever at the moment. Try to change
the surface mesh a bit, or recombine your mesh to generate prisms or
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
hexahedra instead of tetrahedra.
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
* 5.8 Tools->Visibility does not seem to work with extruded meshes.
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed

Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
This is fixed in Gmsh >= 1.54. However, when region numbers are
explicitly assigned to mesh entities in the extrude commands (which
partially destroys the geometry/mesh relationship), the Visibility
tool will only work as expected when displaying Elementary
entities. In this particular case, the only solution to visualize
extruded Physical entities is to save the mesh, and to read it again.
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed

Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
* 5.9 Does Gmsh support curved elements?

Yes, Gmsh can generate both 1st order and 2nd order elements. To
generate second order elements, click on 'Second order elements' in
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
the mesh menu after the mesh is completed. To always generate 2nd
order elements, select 'Generate second order elements' in the mesh
option panel. From the command line, you can also use '-order 2'.
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed

Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
* 5.10 Can I import an existing surface mesh in Gmsh and use it to
build a 3D mesh?

Yes, either in the form of a STL triangulation, or by using the
"Discrete Surface" commands. Note that Gmsh cannot currently modify
the surface mesh you provide in this way, so the surface mesh has to
be conform (without gaps, hanging nodes, etc.) and must contain
surface elements having the (final) desired sizes.

Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
********************************************************************
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
Section 6: Solver module
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
* 6.1 How do I integrate my own solver with Gmsh?
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
If you want to simply launch a program from within Gmsh, just edit the
options to define your solver commands (e.g. Solver.Name0,
Solver.Executable0, etc.), and set the ClientServer option to zero
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
(e.g. Solver.ClientServer0 = 0).

If you want your solver to interact with Gmsh (for error messages,
option definitions, post-processing, etc.), you will need to link your
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
solver with the GmshClient routines and add the appropriate function
calls inside your program. You will of course also need to define your
solver commands in an option file, but this time you should set the
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
ClientServer variable to 1 (e.g. Solver.ClientServer = 1). C, C++,
Perl and Python solver examples are available in the source
distribution in the utils/solvers directory.
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
* 6.2 On Windows, Gmsh does not seem to find the solver
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
The solver executable (for example, 'getdp.exe') has to be in your
path. If not, simply go to the solver options (for example,
Solver->GetDP->Options->Executable) to specify its location.
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
On recent versions of Microsoft Windows (XP SP2), it seems that you
need to execute the solver (e.g. launch 'getdp.exe') at least once
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
independently first in order to authorize future executions.
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed

Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
* 6.3 Can I launch Gmsh from my solver (instead of launching my solver
from Gmsh) in order to monitor a solution?

Sure. A simple C program showing how to do this is given in
'utils/misc/callgmsh.c'.

Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
********************************************************************
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
Section 7: Post-processing module
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
* 7.1 How do I compute a section of a plot?

Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
Use 'View->Plugins->Cut Plane'.
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed

Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
* 7.2 Can I save isosurfaces to a files?

Yes: first run the CutMap plugin to extract the isosurface, then use
'View->Save As' to save the new view.

* 7.3 Can Gmsh generate isovolumes?

Yes, with the CutMap plugin (set the extractVolume to -1 or 1 to
extract the positive or negative levelset). 

* 7.4 How do I animate my plots?
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed

If the views contain multiple time steps, you can press the 'play'
button under the graphic window, or change the time step by hand in
the view option panel. You can also use the left and right arrow keys
to change the time step in all visible views in real time.

If you want to loop through different views instead of time steps, you
can use the 'Loop through views instead of time steps' option in the
view option panel, or use the up and down arrow keys.

Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
* 7.5 How do I visualize a deformed mesh?
Christophe Geuzaine's avatar
Christophe Geuzaine committed

Load a vector view containing the displacement field, and set 'Vector
display' to 'Displacement' in View->Options->Aspect. If the
displacement is too small (or too large), you can scale it with the
'Displacement factor' option. (Remember that you can drag the mouse in
all numeric input fields to slide the value!)
Christophe Geuzaine's avatar
Christophe Geuzaine committed

Another option is to use the "general transformation expressions" (in
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
View->Options->Offset) on a scalar view, with the displacement map
selected as the transformation data source.
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed

Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
* 7.6 Can I visualize a field on a deformed mesh?
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed

Yes, there are several ways to do that. 

The easiest is to load two views: the first one containing a
displacement field (a vector view that will be used to deform the
mesh), and the second one containing the field you want to display
(this view has to contain the same number of elements as the
displacement view). You should then set 'Vector display' to
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
'Displacement' in the first view, as well as set 'Data source' to
point to the second view. (You might want to make the second view
invisible, too. If you want to amplify or decrease the amount of
deformation, just modify the 'Displacement factor' option.)
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed

Another solution is to use the "general transformation expressions"
(in View->Options->Offset) on the field you want to display, with the
displacement map selected as the transformation data source.
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed

And yet another solution is to use the DiplacementRaise plugin.
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed

Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
* 7.7 Can I color the arrows representing a vector field with data
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
from a scalar field?

Yes: load both the vector and the scalar fields (the two views must
have the same number of elements) and, in the vector field options,
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
select the scalar view in 'Data source'.
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed

* 7.8 Can I color isovalue surfaces with data from another scalar
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
view?

Yes, using the CutMap plugin.

Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
* 7.9 Is there a way to save animations?
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed

Yes. For example, have a look at tutorial/t8.geo or
demos/anim.script.
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed

Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
* 7.10 Is there a way to visualize only certain components of
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
vector/tensor fields?
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed
Yes: use 'View->Plugin->Extract'.
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed

* 7.11 Can I do arithmetic operations on a view? Can I perform
operations involving different views?
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed

Yes, with the Evaluate plugin.

* 7.12 Some plugins seem to create empty views. What's wrong?

There can be several reasons:

- the plugin might be written for specific element types only (for
  example, only for scalar triangles or tetrahedra). In that case, you
  should transform your view before running the plugin (you can use
  Plugin(DecomposeinSimplex) to transform all quads, hexas, prisms and
  pyramids into triangles and tetrahedra).
Christophe Geuzaine's avatar
 
Christophe Geuzaine committed

- the plugin might expect a mesh while all you provide is a point
  cloud. In 2D, you can use Plugin(Triangulate) to transform a point
  cloud into a triangulated surface. A 3D version of this plugin is
  not available yet but it is on our TODO list.

- the input parameters are out of range.

In any case, you can automatically remove all empty views with
'View->Remove->Empty Views' in the GUI, or with "Delete Empty Views;"
in a script.