- Gmsh can be run interactively by double-clicking the icon or typing "gmsh" at the command prompt to open the GUI. Files can be opened, geometry created/modified, and meshes generated within the GUI.
- It can also be run non-interactively in "batch mode" from the command line to generate meshes without opening the GUI. Command line options allow specifying input/output files, meshing dimensions and formats, algorithms, and more.
- All interactive functions can also be controlled from script files, allowing more complex and automated workflows. Scripts can be executed with Gmsh by specifying the script file name.
- Gmsh can be run interactively by double-clicking the icon or typing "gmsh" at the command prompt to open the GUI. Files can be opened, geometry created/modified, and meshes generated within the GUI.
- It can also be run non-interactively in "batch mode" from the command line to generate meshes without opening the GUI. Command line options allow specifying input/output files, meshing dimensions and formats, algorithms, and more.
- All interactive functions can also be controlled from script files, allowing more complex and automated workflows. Scripts can be executed with Gmsh by specifying the script file name.
- Gmsh can be run interactively by double-clicking the icon or typing "gmsh" at the command prompt to open the GUI. Files can be opened, geometry created/modified, and meshes generated within the GUI.
- It can also be run non-interactively in "batch mode" from the command line to generate meshes without opening the GUI. Command line options allow specifying input/output files, meshing dimensions and formats, algorithms, and more.
- All interactive functions can also be controlled from script files, allowing more complex and automated workflows. Scripts can be executed with Gmsh by specifying the script file name.
- Gmsh can be run interactively by double-clicking the icon or typing "gmsh" at the command prompt to open the GUI. Files can be opened, geometry created/modified, and meshes generated within the GUI.
- It can also be run non-interactively in "batch mode" from the command line to generate meshes without opening the GUI. Command line options allow specifying input/output files, meshing dimensions and formats, algorithms, and more.
- All interactive functions can also be controlled from script files, allowing more complex and automated workflows. Scripts can be executed with Gmsh by specifying the script file name.
Download as TXT, PDF, TXT or read online from Scribd
Download as txt, pdf, or txt
You are on page 1of 4
Running Gmsh on your system
3.1 Interactive mode
To launch Gmsh in interactive mode, just double-click on the Gmsh icon, or type > gmsh at your shell prompt in a terminal. This will open the main Gmsh window, with a tree-like menu on the left, a graphic area on the right, and a status bar at the bottom. (You can detach the tree menu using ‘Window->Attach/Detach Menu’.) To open the first tutorial file (see Appendix A [Tutorial], page 121), select the ‘File->Open’ menu, and choose t1.geo. When using a terminal, you can specify the file name directly on the command line, i.e.: > gmsh t1.geo To perform the mesh generation, go to the mesh module (by selecting ‘Mesh’ in the tree) and choose the dimension (‘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 click on ‘Save’, or select the appropriate format and file name with the ‘File->Export’ menu. The default mesh file name is based on the name of the current active model, with an appended extension depending on the mesh format1. To create a new geometry or to modify an existing geometry, select ’Geometry’ in the tree. For example, to create a spline, select ‘Elementary’, ‘Add’, ‘New’ and ‘Spline’. You will then be asked 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 text string is automatically added at the end of the current script file. You can edit the script file by hand at any time by pressing the ‘Edit’ button in the ‘Geometry’ menu and then reloading the model by pressing ‘Reload’. For example, it is often faster to define variables and points directly in the script file, and then use the GUI to define the lines, the surfaces and the volumes interactively. Several files can be loaded simultaneously in Gmsh. When specified on the command line, the first one defines the active model and the others are ‘merged’ into this model. You can merge such files with the ‘File->Merge’ menu. For example, to merge the post- processing views contained in the files view1.pos and view5.msh together with the geometry of the first tutorial Section A.1 [t1.geo], page 121, you can type the following command: > gmsh t1.geo view1.pos view5.msh In the Post-Processing module (select ‘Post-Processing’ in the tree), three items will appear, respectively labeled ‘A scalar map’, ‘Nodal scalar map’ and ‘Element 1 vector’. In this example the views contain several time steps: you can loop through them with the small “remote-control” icons in the status bar. A mouse click on the view 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. 1 Nearly all the interactive commands have keyboard shortcuts: see Section 3.5 [Keyboard shortcuts], page 16, or select ‘Help->Keyboard and Mouse Usage’ in the menu. For example, to quickly save a mesh, you can press Ctrl+Shift+s.12 Gmsh 3.0 Note that all the options specified interactively can also be directly specified in the script files. You can save the current options of the current active model with the ‘File- >Save Model Options’. This will create a new option file with the same filename as the active model, but with an extra ‘.opt’ extension added. The next time you open this model, the associated options will be automatically loaded, too. To save the current options as your default preferences for all future Gmsh sessions, use the ‘File->Save Options As Default’ menu instead. Finally, you can also save the current options in an arbitrary file by choosing the ‘Gmsh options’ format in ‘File->Export’. For more information about available options (and how to reset them to their default values), see Appendix B [Options], page 151. A full list of options with their current values is also available in the ‘Help->Current Options’ menu. 3.2 Non-interactive mode Gmsh can be run non-interactively in ‘batch’ mode, without GUI2. For example, to mesh the first tutorial in batch mode, just type: > gmsh t1.geo -2 To mesh the same example, but with the background mesh available in the file bgmesh.pos, type: > gmsh t1.geo -2 -bgm bgmesh.pos For the list of all command-line options, see Section 3.3 [Command-line options], page 12. In particular, any complicated workflow can be written in a .geo file, and this file can be executed as a script using > gmsh script.geo - The script can contain e.g. meshing commands, like Mesh 3;. 3.3 Command-line options Geometry options: -0 Output model, then exit -tol float Set geometrical tolerance -match Match geometries and meshes Mesh options: -1, -2, -3 Perform 1D, 2D or 3D mesh generation, then exit -o file Specify output file name -format string Select output mesh format (auto (default), msh, msh1, msh2, unv, vrml, ply2, stl, mesh, bdf, cgns, p3d, diff, med, ...) 2 If you compile Gmsh without the GUI (see Appendix C [Compiling the source code], page 229), this is the only mode you have access to.Chapter 3: Running Gmsh on your system 13 -bin Use binary format when available -refine Perform uniform mesh refinement, then exit -part int Partition after batch mesh generation -partWeight tri|quad|tet|prism|hex int Weight of a triangle/quad/etc. during partitioning -saveall Save all elements (discard physical group definitions) -parametric Save vertices with their parametric coordinates -algo string Select mesh algorithm (meshadapt, del2d, front2d, delquad, del3d, front3d, mmg3d, pack) -smooth int Set number of mesh smoothing steps -order int Set mesh order (1, ..., 5) -optimize[_netgen] Optimize quality of tetrahedral elements -optimize_threshold Optimize tetrahedral elements that have a qulaity less than a threshold -optimize_ho Optimize high order meshes -ho_[min,max,nlayers] High-order optimization parameters -optimize_lloyd Optimize 2D meshes using Lloyd algorithm -clscale float Set global mesh element size scaling factor -clmin float Set minimum mesh element size -clmax float Set maximum mesh element size -anisoMax float Set maximum anisotropy (only used in bamg for now) -smoothRatio float Set smoothing ration between mesh sizes at nodes of a same edge (only used in bamg) -clcurv Automatically compute element sizes from curvatures -epslc1d Set accuracy of evaluation of LCFIELD for 1D mesh14 Gmsh 3.0 -swapangle Set the threshold angle (in degree) between two adjacent faces below which a swap is allowed -rand float Set random perturbation factor -bgm file Load background mesh from file -check Perform various consistency checks on mesh -ignorePartBound Ignore partitions boundaries Post-processing options: -link int Select link mode between views (0, 1, 2, 3, 4) -combine Combine views having identical names into multi-time-step views Solver options: -listen Always listen to incoming connection requests -minterpreter string Name of Octave interpreter -pyinterpreter string Name of Python interpreter -run Run ONELAB solver(s) Display options: -n Hide all meshes and post-processing views on startup -nodb Disable double buffering -numsubedges Set num of subdivisions for high order element display -fontsize int Specify the font size for the GUI -theme string Specify FLTK GUI theme -display string Specify display -camera Use camera mode view; -stereo OpenGL quad-buffered stereo rendering (requires special graphic card) -gamepad Use gamepad controller if available Other options: -, -parse_and_exit Parse input files, then exitChapter 3: Running Gmsh on your system 15 -new Create new model before merge next file -merge Merge next files -open Open next files -a, -g, -m, -s, -p Start in automatic, geometry, mesh, solver or post-processing mode -pid Print process id on stdout -watch pattern Pattern of files to merge as they become available -bg file Load background (image or PDF) file -v int Set verbosity level -nopopup Don’t popup dialog windows in scripts -string "string" Parse command string at startup -setnumber name value Set constant number name=value -setstring name value Set constant string name=value -option file Parse option file at startup -convert files Convert files into latest binary formats, then exit -cpu Report CPU times for all operations -version Show version number -info Show detailed version information -help Show command line usage