我一直试图使用GMSH(v.3.0.6)创建3D SURFACE网格而没有成功。
我遇到的问题是,在创建曲面并生成网格后,当我读取.MSH文件时,我得到一个奇怪的节点编号,即并非所有法线向量都朝向外,有些点向内。我试图创建一个立方体和一个球体,但我总是面临同样的问题。
下面是我使用GMSH GUI为多维数据集创建的.GEO文件。
// 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。任何想法我怎样才能做到正确(或者我需要的方式)?
提前全部谢谢,
答案 0 :(得分:2)
Line Loop
中行的排序会影响从Surface
创建的Line Loop
中使用的法线。您要么必须在所有Line Loops
中对行的顺序保持一致 - 或者您可以按顺序翻转导致问题的行。
对于向外指向的法线,对于此特定示例,您只需更改两行:
Plane Surface(3) = {-3};
Plane Surface(4) = {-4};
告诉GMSH,要反转Line Loop
中行的顺序,从而得到相反的法线。
作为参考,这里是整体校正的GMSH脚本,它生成具有正确法线的网格:
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};