mesh - 如何在gmsh中提取边界节点处的法线向量?
问题描述
我有一个 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 文件脚本来做到这一点(不过,如果它存在,我不会感到惊讶)。
但是,它当然可以通过 GMSH API 使用getNormal()
函数来完成。
getNormal()
tag
使用参数坐标处的标记获取曲面的法线parametricCoord
。parametricCoord
由成对的u和v坐标给出,连接起来:[p1u, p1v, p2u, ...]
. 以x、y、znormals
分量的三元组形式返回,串联:.[n1x, n1y, n1z, n2x, ...]
输入:
tag
,parametricCoord
输出:
normals
GMSH API 可通过 Python、C/C++ 和 Julia 获得。有关用法的详细信息,我建议直接查看GMSH 存储库中的 API 是如何定义的。
推荐阅读
- bash - 为什么我在发送标准输出后有一个空文件
- active-directory - 我们正在尝试使用 Azure AD SSO 使 Snowflake 工作 AD SSO 登录。Active Directory SSO 如何工作?
- apache-spark - spark order by 后跟 partition by
- bixby - 如何在缩略图上方插入布局宏
- javascript - 排序然后将数组中的每个项目相乘
- c# - 如何使用子元素触发父元素?
- python - 如何在不退出当前域的情况下重定向到外部链接?
- javascript - Chrome 中的 HighCharts 轴格式
- vuetify.js - 使用组合 api 和远程 api 进行 vuetify 自动完成?
- mysql - MySQL server has gone away 错误的罕见原因