我有一个用于gmsh的地理文件并将其网格化。然后,我想在选定曲面的节点处提取法线向量。这怎么可能?
下面是我的gmsh地理文件。
//Construct a cube in GMSH
//Build a line
Point(1) = {0, 0, 0, 1.0};
Point(2) = {0, 0, 10, 1.0};
Line(1) = {1, 2};
//Extrude line to create a surface (square)
Extrude {10, 0, 0} {
Line{1};
}
//Extrude surface to create a volume (cube)
Extrude {0, 10, 0} {
Surface{5};
}
//Six surfaces of the cube
Physical Surface(28) = {18};
Physical Surface(29) = {26};
Physical Surface(30) = {22};
Physical Surface(31) = {14};
Physical Surface(32) = {27};
Physical Surface(33) = {5};
//Volume of the cube
Physical Volume(34) = {1};
嗯,我不知道如何通过GEO文件脚本来做到这一点(尽管,如果存在的话,我也不会感到惊讶)。
但是,当然可以使用getNormal()
函数通过GMSH API完成。
getNormal()
在参数坐标
输入:getNormal()
处使用标签tag
获得表面的法线。parametricCoord
由成对的[[u和v坐标对给出:parametricCoord
。[p1u, p1v, p2u, ...]
作为x,y,z分量的三元组返回,并串联:normals
。[n1x, n1y, n1z, n2x, ...]
,tag
输出:
parametricCoord
GMSH API可通过Python,C / C ++和Julia使用。有关用法的详细信息,建议您直接查看normals
的用法。