:PROPERTIES: :ID: f2d9ff98-f926-442e-ae9b-fc1023e15b07 :END: #+title: GMSH Gmsh is a software for grid generation or meshing for the finite element method. The free software was programmed by Christophe Geuzaine and Jean-François Remacle under the GNU General Public License (GPL) and contains 4 modules: - a graphics module to create 3-dimensional shapes - a meshing module - an equation solver module - a postprocessor module Gmsh is considered one of the best 3D file viewers and is used and described scientifically. Gmsh is used after [[id:a4953b2b-81de-4c15-91e7-10d0cb5f22dd][freeCAD]] & [[id:6acf9122-b289-44e4-87e1-c3dfb5c7aeb2][salome]] to mesh the brep file after export in salome. For better performance, Gmsh should be compiled with [[id:e56e90b1-ae5b-4344-97eb-993e5a81263e][openmpi]] in [[id:408e8348-778a-4fbd-a14d-9f3d9c595b4a][cluster]]. After meshing the Mesh is imported to [[id:2d45175d-7fcc-4a55-b81c-14da72247eef][FEA-Tool]] (as standalone-app or in [[id:e336814a-3a58-4b25-8d02-0af07623ce45][matlab]]). An [[id:5f1df0e1-384f-4685-ae1e-fec2431b04e5][emacs]] mode for GMSH and GetDP languages to provide indentation and nice coloring. Add the following lines your emacs configuration file (probably ~/home///.emacs.d/init.el~): (load "~/home//.emacs.d/path/to/gmsh_getdp.el~") * GMSH command line flags #+begin_src bash gmsh - .geo #+end_src ** Geometry: ~-0~ Output model, then exit ~-tol value~ Set geometrical tolerance (Geometry.Tolerance) ~-match~ Match geometries and meshes ** Mesh: ~-1, -2, -3~ Perform 1D, 2D or 3D mesh generation, then exit ~-format string~ Select output mesh format: auto, msh1, msh2, msh22, msh3, msh4, msh40, msh41, msh, unv, vtk, wrl, mail, stl, p3d, mesh, bdf, cgns, med, diff, ir3, inp, ply2, celum, su2, x3d, dat, neu, m, key, off, rad (Mesh.Format) ~-bin~ Create binary files when possible (Mesh.Binary) ~-refine~ Perform uniform mesh refinement, then exit ~-barycentric_refine~ Perform barycentric mesh refinement, then exit ~-reclassify angle~ Reclassify surface mesh, then exit ~-reparam angle~ Reparametrize surface mesh, then exit ~-part int~ Partition after batch mesh generation (Mesh.NbPartitions) ~-part_weight [tri,quad,tet,hex,pri,pyr,trih] int~ Weight of a triangle/quad/etc. during partitioning (Mesh.Partition[Tri,Quad,...]Weight) ~-part_split~ Save mesh partitions in separate files (Mesh.PartitionSplitMeshFiles) ~-part_[no_]topo~ Create the partition topology (Mesh.PartitionCreateTopology) ~-part_[no_]ghosts~ Create ghost cells (Mesh.PartitionCreateGhostCells) ~-part_[no_]physicals~ Create physical groups for partitions (Mesh.PartitionCreatePhysicals) ~-part_topo_pro~ Save the partition topology .pro file (Mesh.PartitionTopologyFile) ~-preserve_numbering_msh2~ Preserve element numbering in MSH2 format (Mesh.PreserveNumberingMsh2) ~-save_all~ Save all elements (Mesh.SaveAll) ~-save_parametric~ Save nodes with their parametric coordinates (Mesh.SaveParametric) ~-save_topology~ Save model topology (Mesh.SaveTopology) ~-algo string~ Select mesh algorithm: auto, meshadapt, del2d, front2d, delquad, quadqs, initial2d, del3d, front3d, mmg3d, hxt, initial3d (Mesh.Algorithm and Mesh.Algorithm3D) ~-smooth int~ Set number of mesh smoothing steps (Mesh.Smoothing) ~-order int~ Set mesh order (Mesh.ElementOrder) ~-optimize[_netgen]~ Optimize quality of tetrahedral elements (Mesh.Optimize[Netgen]) ~-optimize_threshold~ Optimize tetrahedral elements that have a quality less than a threshold (Mesh.OptimizeThreshold) ~-optimize_ho~ Optimize high order meshes (Mesh.HighOrderOptimize) ~-ho_[min,max,nlayers]~ High-order optimization parameters (Mesh.HighOrderThreshold[Min,Max], Mesh.HighOrderNumLayers) ~-clscale value~ Set mesh element size factor (Mesh.MeshSizeFactor) ~-clmin value~ Set minimum mesh element size (Mesh.MeshSizeMin) ~-clmax value~ Set maximum mesh element size (Mesh.MeshSizeMax) ~-clextend value~ Extend mesh element sizes from boundaries (Mesh.MeshSizeExtendFromBoundary) ~-clcurv value~ Compute mesh element size from curvature, with value the target number of elements per 2*pi radians (Mesh.MeshSizeFromCurvature) ~-aniso_max value~ Set maximum anisotropy for bamg (Mesh.AnisoMax) ~-smooth_ratio value~ Set smoothing ration between mesh sizes at nodes of a same edge for bamg (Mesh.SmoothRatio) ~-epslc1d value~ Set accuracy of evaluation of mesh size field for 1D mesh (Mesh.LcIntegrationPrecision) ~-swapangle value~ Set the threshold angle (in degrees) between two adjacent faces below which a swap is allowed (Mesh.AllowSwapAngle) ~-rand value~ Set random perturbation factor (Mesh.RandomFactor) ~-bgm file~ Load background mesh from file ~-check~ Perform various consistency checks on mesh ~-ignore_periocity~ Ignore periodic boundaries (Mesh.IgnorePeriodicity) ** Post-processing: ~-link int~ Select link mode between views (PostProcessing.Link) ~-combine~ Combine views having identical names into multi-time-step views ** Solver: ~-listen string~ Always listen to incoming connection requests (Solver.AlwaysListen) on the given socket (uses Solver.SocketName if not specified) ~-minterpreter string~ Name of Octave interpreter (Solver.OctaveInterpreter) ~-pyinterpreter string~ Name of Python interpreter (Solver.OctaveInterpreter) ~-run~ Run ONELAB solver(s) ** Display: ~-n~ Hide all meshes and post-processing views on startup (View.Visible, Mesh.[Points,Lines,SurfaceEdges,...]) ~-nodb~ Disable double buffering (General.DoubleBuffer) ~-numsubedges~ Set num of subdivisions for high order element display (Mesh.NumSubEdges) ~-fontsize int~ Specify the font size for the [[id:a08570b0-8fe8-45a8-8f60-e45ea6b31a34][GUI]] (General.FontSize) ~-theme string~ Specify FLTK GUI theme (General.FltkTheme) ~-display string~ Specify display (General.Display) ~-camera~ Use camera mode view (General.CameraMode) ~-stereo~ OpenGL quad-buffered stereo rendering (General.Stereo) ~-gamepad~ Use gamepad controller if available ** Other: ~-, -parse_and_exit~ Parse input files, then exit ~-save~ Save output file, then exit ~-o file~ Specify output file name ~-new~ Create new model before merge next file ~-merge~ Merge next files ~-open~ Open next files ~-log filename~ Log all messages to filename ~-a, -g, -m, -s, -p~ Start in automatic, geometry, mesh, solver or post-processing mode (General.InitialModule) ~-pid~ Print process id on stdout ~-watch pattern~ Pattern of files to merge as they become available (General.WatchFilePattern) ~-bg file~ Load background (image or PDF) file (General.BackgroundImageFileName) ~-v int~ Set verbosity level (General.Verbosity) ~-string "string"~ Parse command string at startup ~-setnumber name value~ Set constant, ONELAB or option number name=value ~-setstring name value~ Set constant, ONELAB or option string name=value ~-nopopup~ Don’t popup dialog windows in scripts (General.NoPopup) ~-noenv~ Don’t modify the environment at startup ~-nolocale~ Don’t modify the locale at startup ~-option file~ Parse option file at startup ~-convert files~ Convert files into latest binary formats, then exit ~-nt int~ Set number of threads (General.NumThreads) ~-cpu~ Report CPU times for all operations ~-version~ Show version number ~-info~ Show detailed version information ~-help~ Show command line usage ~-help_options~ Show all options * Convert a gmsh mesh to openfoam - [[id:34c4e594-2aee-42d6-803a-6f843176d3b9][openFoam]] mesh conversion/manipulation tools ** ~gmshToFoam .msh~ in OpenFOAM terminal within the case directory ** ~splitMeshRegions -cellZonesOnly -overwrite~ (this is only used if there are multiple parts (volumes) to be split up) works only in main case folder, where ~.msh~ is present