【问题标题】:How to extract the normal vectors at the boundary nodes in gmsh?如何在gmsh中提取边界节点处的法线向量?
【发布时间】:2020-01-08 12:44:22
【问题描述】:

我有一个 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};

【问题讨论】:

  • 如何定义节点的法线?一般来说,节点属于几个曲面;因此,必须以某种方式定义法线的方向。您可以找到表面元素的法线(如果它是弯曲的 - 在属于表面元素的一点)。
  • 嗨安东,感谢您的留言!正如您所说,例如,我希望在位于该表面内的给定位置 (x,y,z) 处具有物理表面 (28) = {18} 的法线。如何在 gmsh 中找到它?

标签: mesh boundary fenics gmsh


【解决方案1】:

嗯,我不知道如何通过 GEO 文件脚本来实现(不过,如果它存在,我不会感到惊讶)。

但是,它当然可以通过 GMSH API 使用 getNormal() 函数来完成。

getNormal()

在参数坐标parametricCoord 处使用标签tag 获取曲面的法线。 parametricCoord 由成对的 uv 坐标给出,连接起来:[p1u, p1v, p2u, ...]normalsxyz 组件的三元组形式返回,串联:[n1x, n1y, n1z, n2x, ...]

输入: tag, parametricCoord

输出:normals

GMSH API 可通过 Python、C/C++ 和 Julia 获得。具体用法建议直接看API is defined in GMSH repository怎么用。

【讨论】:

    猜你喜欢
    • 2021-10-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-03-06
    • 1970-01-01
    • 2019-11-20
    • 2016-05-23
    • 1970-01-01
    相关资源
    最近更新 更多