GMSH 3D表面网格 [英] GMSH 3D surface mesh

查看:402
本文介绍了GMSH 3D表面网格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在尝试使用GMSH(v.3.0.6)创建3D SURFACE网格而没有成功.

I've been trying without success to create a 3D SURFACE mesh using GMSH (v.3.0.6).

我遇到的问题是,在创建曲面并生成网格之后,当我读取.MSH文件时,我得到了一个奇怪的节点编号,即,并非所有法线向量都朝外,有些点朝内.我试图创建一个立方体和一个球体,但是我总是面临着同样的问题.

The problem that I am having is, after creating the surface and generating the mesh, when I read the .MSH file, I get a bizarre node numbering, i.e., not all the normal vectors are oriented outward, some points inward. I tried to create a cube and a sphere, but I always face the very same problem.

下面是我使用GMSH GUI为多维数据集创建的.GEO文件.

Below is the .GEO file I created using the GMSH GUI for the cube.

    // Gmsh project created on Fri Apr 20 17:08:44 2018
//+
Point(1) = {1, 0, 0, 1.0};
//+
Point(2) = {1, 1, 0, 1.0};
//+
Point(3) = {0, 1, 0, 1.0};
//+
Point(4) = {0, 0, 1, 1.0};
//+
Point(5) = {1, 0, 1, 1.0};
//+
Point(6) = {1, 1, 1, 1.0};
//+
Point(7) = {0, 1, 1, 1.0};
//+
Point(8) = {0, 0, 0, 1.0};
//+
Line(1) = {7, 6};
//+
Line(2) = {6, 5};
//+
Line(3) = {5, 1};
//+
Line(4) = {1, 8};
//+
Line(5) = {8, 3};
//+
Line(6) = {3, 7};
//+
Line(7) = {7, 4};
//+
Line(8) = {4, 8};
//+
Line(9) = {4, 5};
//+
Line(10) = {2, 1};
//+
Line(11) = {2, 6};
//+
Line(12) = {2, 3};
//+
Line Loop(1) = {6, 1, -11, 12};
//+
Plane Surface(1) = {1};
//+
Line Loop(2) = {11, 2, 3, -10};
//+
Plane Surface(2) = {2};
//+
Line Loop(3) = {2, -9, -7, 1};
//+
Plane Surface(3) = {3};
//+
Line Loop(4) = {6, 7, 8, 5};
//+
Plane Surface(4) = {4};
//+
Line Loop(5) = {8, -4, -3, -9};
//+
Plane Surface(5) = {5};
//+
Line Loop(6) = {10, 4, 5, -12};
//+
Plane Surface(6) = {6};
//+
Physical Surface(1) = {4, 3, 2, 6};
//+
Physical Surface(2) = {1};
//+
Physical Surface(3) = {5};
//+
Surface Loop(1) = {6, 2, 1, 4, 3, 5};
//+
Volume(1) = {1};

由于我还定义了一个体积,因此所有法向矢量都应指向OUTWARD.知道我该怎么做(或我需要的方式)吗?

Since I also define a volume, all the normal vectors are supposed to point OUTWARD. Any idea how can I make it right (or the way I need it to be)?

预先感谢

推荐答案

Line Loop中各行的顺序会影响从该Line Loop创建的Surface中将使用的常规内容.您要么必须在所有Line Loops中的行顺序上保持一致–否则您可以翻转引起麻烦的行的顺序.

The ordering of the lines in Line Loop affects what normal is going to be used in the Surface created from this Line Loop. You either have to be consistent in the ordering of the lines in ALL of your Line Loops – or you can flip the ordering for the ones causing troubles.

对于法线指向外部,对于此特定示例,您只需更改两行即可:

For the normals to point outwards, for this particular example, you can just change two lines:

Plane Surface(3) = {-3};
Plane Surface(4) = {-4};

这告诉GMSH反转Line Loop中各行的顺序,从而获得相反的法线.

That tells GMSH, to invert the ordering of the lines in the Line Loop, therefore obtaining the opposite normal.

作为参考,下面是整体更正的GMSH脚本,该脚本生成具有正确法线的网格:

For reference, here is the overall corrected GMSH script that generates the mesh with correct normals:

Point(1) = {1, 0, 0, 1.0};
Point(2) = {1, 1, 0, 1.0};
Point(3) = {0, 1, 0, 1.0};
Point(4) = {0, 0, 1, 1.0};
Point(5) = {1, 0, 1, 1.0};
Point(6) = {1, 1, 1, 1.0};
Point(7) = {0, 1, 1, 1.0};
Point(8) = {0, 0, 0, 1.0};
Line(1) = {7, 6};
Line(2) = {6, 5};
Line(3) = {5, 1};
Line(4) = {1, 8};
Line(5) = {8, 3};
Line(6) = {3, 7};
Line(7) = {7, 4};
Line(8) = {4, 8};
Line(9) = {4, 5};
Line(10) = {2, 1};
Line(11) = {2, 6};
Line(12) = {2, 3};
Line Loop(1) = {6, 1, -11, 12};
Plane Surface(1) = {1};
Line Loop(2) = {11, 2, 3, -10};
Plane Surface(2) = {2};
Line Loop(3) = {2, -9, -7, 1};
Plane Surface(3) = {-3};
Line Loop(4) = {6, 7, 8, 5};
Plane Surface(4) = {-4};
Line Loop(5) = {8, -4, -3, -9};
Plane Surface(5) = {5};
Line Loop(6) = {10, 4, 5, -12};
Plane Surface(6) = {6};
Physical Surface(1) = {4, 3, 2, 6};
Physical Surface(2) = {1};
Physical Surface(3) = {5};
Surface Loop(1) = {6, 2, 1, 4, 3, 5};
Volume(1) = {1};

这篇关于GMSH 3D表面网格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆