[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

8. Running Gmsh

8.1 Interactive vs. non-interactive mode  
8.2 Command-line options  
8.3 Mouse actions  
8.4 Keyboard shortcuts  


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

8.1 Interactive vs. non-interactive mode

There are several ways to actually run Gmsh on your computer(5). The first working mode of Gmsh is the interactive graphical mode. To launch Gmsh in interactive mode, just click or double-click on the Gmsh icon (Windows and Mac), or type

 
> gmsh

at your shell prompt on the command line (Unix). This will open two windows: the graphic window (with a status bar at the bottom) and the menu window (with a menu bar and some context dependent buttons). To open the first tutorial file (see section 7. Tutorial), select the `File->Open' menu, and choose `t1.geo' in the input field. To perform the mesh generation, go to the mesh module (by selecting `Mesh' in the module menu) and choose the required dimension in the context-dependent buttons (`1D' will mesh all the lines; `2D' will mesh all the surfaces--as well as all the lines if `1D' was not called before; `3D' will mesh all the volumes--and all the surfaces if `2D' was not called before). To save the resulting mesh in the current mesh format, choose `Save' in the context-dependent buttons, or select the appropriate format with the `File->Save as' menu. The default mesh file name is based on the name of the first input file on the command line (or `untitled' if there wasn't any input file given), with an appended extension depending on the mesh format.

Note that nearly all the interactive commands have shortcuts: see 8.4 Keyboard shortcuts, or select `Help->Shortcuts' in the menu bar to learn about these.

Instead of opening the tutorial with the `File->Open' menu, it is often more convenient to put the file name on the command line, for example with:

 
> gmsh t1.geo

Note that, even if it is often handy to define the variables and the points directly in the ASCII input files (you can use any text editor for this purpose, e.g. Wordpad on Windows, or Emacs on Unix), it is almost always simpler to define the lines, the surfaces and the volumes interactively. To do so, just follow the context dependent buttons in the Geometry module. For example, to create a spline, select `Geometry' in the module menu, and then select `Elementary, Add, New, Spline'. You will then be asked (in the status bar of the graphic window) to select a list of points, and to type e to finish the selection (or q to abort it). Once the interactive command is completed, a string is automatically added at the end of the currently opened project file.

Gmsh's second operating mode is the non-interactive mode. In this mode, there is no graphical user interface, and all operations are performed without any user interaction(6). To mesh the first tutorial in non-interactive mode, just type:

 
> gmsh t1.geo -2

To mesh the same example, but with the background mesh available in the file `bgmesh.pos', just type:

 
> gmsh t1.geo -2 -bgm bgmesh.pos

You should read the notes in the file `bgmesh.pos' if you intend to use background meshes.

Several files can be loaded simultaneously in Gmsh. The first one defines the project, while the others are appended (`merged') to this project. You can merge such files with the `File->Merge' menu, or by directly specifying the names of the files on the command line. This is most useful for post-processing purposes. For example, to merge the post-processing views contained in the files `view1.pos' and `view2.pos' together with the first tutorial `t1.geo', you can type the following command:

 
> gmsh t1.geo view1.pos view2.pos

In the Post-Processing module (select `Post-Processing' in the module menu), two view buttons will appear, respectively labeled `a scalar map' and `a vector map'. A mouse click on the name will toggle the visibility of the selected view, while a click on the arrow button on the right will provide access to the view's options. If you want the modifications made to one view to affect also all the other views, select the `Apply next changes to all views' or `Force same options for all views' option in the `Tools->Options->Post-processing' menu.

Note that all the options specified interactively can also be directly specified in the ASCII input files. All available options, with their current values, can be saved into a file by selecting `File->Save as->Gmsh options', or simply viewed by pressing the `?' button in the status bar. To save the current options as your default preferences for all future Gmsh sessions, use the `Tools->Options->Save' button.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

8.2 Command-line options

Geometry options:

-0
parse input files, output unrolled geometry, and exit

Mesh options:

-1, -2, -3
perform batch 1D, 2D and 3D mesh generation
-saveall
save all elements (discard physical group definitions)
-o file
specify mesh output file name
-format msh|unv|gref
set output mesh format (default: msh)
-algo iso|tri|aniso
select 2D mesh algorithm (default: iso)
-smooth int
set mesh smoothing (default: 0)
-order int
set the order of the generated elements (default: 1)
-scale float
set global scaling factor (default: 1.0)
-meshscale float
set mesh scaling factor (default: 1.0)
-clscale float
set characteristic length scaling factor (default: 1.0)
-rand float
set random perturbation factor (default: 1.e-4)
-bgm file
load backround mesh from file
-constrain
constrain background mesh with characteristic lengths
-histogram
print mesh quality histogram
-extrude
use old extrusion mesh generator
-recombine
recombine meshes from old extrusion mesh generator
-interactive
display 2D mesh construction interactively

Post-processing options:

-dl
enable display lists
-noview
hide all views on startup
-link int
select link mode between views (default: 0)
-smoothview
smooth views
-combine
combine input views into multi time step ones
-convert file file
convert all views in a file into binary views

Display options:

-nodb
disable double buffering
-fontsize int
specify the font size for the GUI (default: 12)
-scheme string
specify FLTK scheme
-alpha
enable alpha blending
-notrack
don't use trackball mode for rotations
-display string
specify display
-perspective
set projection mode to perspective

Other options:

-a, -g, -m, -s, -p
start in automatic, geometry, mesh, solver or post-processing mode (default: automatic)
-v int
set verbosity level (default: 2)
-string "string"
parse string before project file
-option file
parse option file before GUI creation
-version
show version number
-info
show detailed version information
-help
show this message


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

8.3 Mouse actions

In the following, for a 2 button mouse, Middle button = Shift+Left button. For a 1 button mouse, Middle button = Shift+Left button and Right button = Alt+Left button.

Move the mouse:

Left button:

Ctrl+Left button: start (anisotropic) rubber zoom

Middle button:

Ctrl+Middle button: orthogonalize display

Right button:

Ctrl+Right button: reset to default viewpoint


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

8.4 Keyboard shortcuts

Menu bar shortcuts:

<
go back to previous context

>
go forward to next context

Shift+a
raise (show) all open windows

g
go to geometry module

Shift+g
show geometry options

Shift+i
show statistics window

m
go to mesh module

Shift+m
show mesh options

Ctrl+m
merge file

Shift+n
show general options

Ctrl+n
new file

Shift+o
show option window

Ctrl+o
open file

p
go to post-processor module

Shift+p
show general post-processing options

Ctrl+q
quit

Ctrl+s
save mesh in default format

Ctrl+Shift+s
save file as

Shift+w
show current post-processing view options

Other shortcuts:

0
Esc
reload geometry input file

1
F1
mesh curves

2
F2
mesh surfaces

3
F3
mesh volumes

Alt+a
hide/show small axes

Alt+Shift+a
hide/show big moving axes

Alt+b
hide/show all post-processing scales

Alt+c
loop through predefined color schemes

Alt+d
change mesh display mode (solid/wireframe)

Shift+d
decrease animation delay

Ctrl+Shift+d
increase animation delay

Alt+f
change redraw mode (fast/full)

Alt+h
hide/show all post-processing views

Alt+l
hide/show geometry lines

Alt+Shift+l
hide/show mesh lines

Alt+m
change visibility of all mesh entities

Alt+o
change projection mode (ortho/perspective)

Alt+p
hide/show geometry points

Alt+Shift+p
hide/show mesh points

Alt+s
hide/show geometry surfaces

Alt+Shift+s
hide/show mesh surfaces

Alt+t
loop through interval modes for all post-processing views

Alt+v
hide/show geometry volumes

Alt+Shift+v
hide/show mesh volumes

Alt+w
enable/disable all lighting

Alt+x
set X view

Alt+y
set Y view

Alt+z
set Z view

Left arrow
go to previous time step

Right arrow
go to next time step

Up arrow
make previous view visible

Down arrow
make next view visible


[ << ] [ >> ]           [Top] [Contents] [Index] [ ? ]

Back to geuz.org/gmsh