美文网首页
Gmsh(1) 简介

Gmsh(1) 简介

作者: 九天学者 | 来源:发表于2018-11-05 20:52 被阅读76次
Gmsh: 三维网格生成软件(开源-免费)

我在德国留学期间,在课题组做了一个关于gmsh的讲座同时在我们课题组的gitlab上写了相应的教程。因为那个gitlab只能我们内部访问,因此直接将这几个教程搬过来,先凑合着看,等我有空了再改成中文版!

Introduction

Gmsh is a free 3D finite element mesh generator with a built-in CAD engine and post-processor. Its design goal is to provide a fast, light and user-friendly meshing tool with parametric input and advanced visualization capabilities. Gmsh is built around four modules: geometry, mesh, solver and post-processing. The specification of any input to these modules is done either interactively using the graphical user interface or in ASCII text files using Gmsh's own scripting language.

Install

It very easy to install Gmsh on your system. Just download and double click. It's not only a free but also a cross platform software.😎

Windows (32 bit),
Linux,
MacOS.

Of course, it can be installed from source, but I don't recommend it so far.

simple structure of a .geo file

The .geo file, in fact, is a Gmsh's scripting file. I just call this language as Gs=Gmsh's scripting. Gs files support both C and C++ style comments.

lc = 1e-2;

//points
Point(1) = {0, 0, 0, lc};
Point(2) = {.1, 0,  0, lc} ;
Point(3) = {.1, .3, 0, lc} ;
Point(4) = {0,  .3, 0, lc} ;

//lines
Line(1) = {1,2} ;
Line(2) = {3,2} ;
Line(3) = {3,4} ;
Line(4) = {4,1} ;

//line looped by points
Line Loop(1) = {4,1,-2,3} ;

//Plane surface is composed by line loop
Plane Surface(1) = {1} ;

//marke a specific point, line or surface
//format: Physical Point(number_label) = {point_index1,point_index_2};
Physical Point(1) = {1,2} ;

//label as a text
MY_LINE = 2;
Physical Line(MY_LINE) = {1,2} ;
Physical Line("My second line (automatic physical id)") = {3} ;
Physical Line("My third line (physical id 5)", 5) = {4} ;
Physical Surface("My surface") = {1} ;

How to display .geo

  • double-click will automatically show the geometry in Gmsh GUI.
  • command line: gmsh step-1.geo
  • result

generate mesh from .geo file

using following to mesh a .geo file.
gmsh my.geo -2 -o my.msh

export to figure file

gmsh support several figure format, e.g. eps,pdf,svg...

  • crop or cut the blank margins of a eps file: epstool --copy --bbox my.eps my_new.eps
  • convert eps to pdf: epstopdf my_new.eps
  • convert pdf to svg: pdf2svg my_new.pdf my.svg
step-1-box

代码

lc = 1e-2;

//points
Point(1) = {0, 0, 0, lc};
Point(2) = {.3, 0,  0, lc} ;
Point(3) = {.3, .3, 0, lc} ;
Point(4) = {0,  .3, 0, lc} ;

//+
Line(1) = {4, 1};
//+
Line(2) = {1, 2};
//+
Line(3) = {3,2};
//+
Line(4) = {3, 4};
//+

//+
Line Loop(1) = {1, 2, -3, 4};
//+
Plane Surface(1) = {1};

相关文章

  • Gmsh(1) 简介

    我在德国留学期间,在课题组做了一个关于gmsh的讲座同时在我们课题组的gitlab上写了相应的教程。因为那个git...

  • Gmsh笔记

    有限元网格生成器,地址: http://gmsh.info 四个模块:几何,网格,求解器,后处理 API没有文档...

  • 1简介

    线程优势 发挥多处理器的优势,提高系统吞吐率 简化系统建模通过使用线程,可以将复杂且异步的工作进一步分解为一组简单...

  • 1、简介

    docker组件 docker服务器和客户端,也称为docker引擎 docker镜像 registry dock...

  • 1 简介

    语法给出语言规则。这个词源于希腊名词的字母或标记 。这源于希腊语的书写动词,这是我们英语词汇表的来源。语法,更广泛...

  • 1 简介

    1、fMRI文章增长迅速。 原因:无创性、高空间/时间分辨率、速度快。 原理:脑内神经活动引起血氧增加,未...

  • 1 - 简介

    微信公众号开发 又称微信公众号二次开发。可以将公众账号由一个媒体型营销工具转化成提供服务的产品。 微信公众号开发的...

  • 1·简介

    (先给大家做个人物简介) 琉璃夏:丞相府嫡小姐,原是天上神尊。因得知慕容烨下凡渡劫,而跟着下来(没有被抹去记忆...

  • 1 简介

    #从韩顺平的B站引入 GO能做什么 如上图,可以分为区块链,后端,分布式文件系统等应用 对于区块链,核心要求分布式...

  • 1、redis简介

    参考链接:1)https://www.cnblogs.com/xiaoxi/p/7007695.html2)htt...

网友评论

      本文标题:Gmsh(1) 简介

      本文链接:https://www.haomeiwen.com/subject/bpjexqtx.html