我有一个用于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()
在参数坐标处使用标记
tag
获取曲面的法线parametricCoord
。parametricCoord
由u和v坐标对给出,连接:[p1u, p1v, p2u, ...]
。normals
以x、y、z分量的三元组形式返回,串联:[n1x, n1y, n1z, n2x, ...]
。输入:
tag
,parametricCoord
输出:
normals
GMSH API 可通过 Python、C/C++ 和 Julia 获得。有关用法的详细信息,我建议直接研究如何在GMSH存储库中定义API。