是否有混合二维网格(三角形和四边形)的开源代码?

计算科学 网格生成 非结构化网格
2021-12-10 10:31:11

这个问题几乎就是标题。请注意,我有很多使用开源网格工具的经验,例如 Gmsh 和 OpenFoam blockMesh 和 snappyHexMesh。不过,在 SU2(CFD 代码)中进行一些简单测试时,我不知道如何生成如下所示的 2D 网格。

我相信一些商业网格工具可以完成这项工作,但没有使用任何商业代码的经验,因为我主要使用开源网格/CFD 代码。

知道哪些网格库(例如 CGAL、OpenMesh)可以制作混合 2D 三/四网格吗?


更新 1:矩形周围的四边形网格看起来像漂亮的 O-Grid 样式。有什么想法可以实现吗?

在此处输入图像描述

2个回答

为此,您可以使用 Gmsh。我在下面展示一个例子。

// Points
Point(1) = {-2, -2, 0, 1.0};
Point(2) = {2, -2, 0, 1.0};
Point(3) = {2, 2, 0, 1.0};
Point(4) = {-2, 2, 0, 1.0};
Point(5) = {-10, -10, 0, 2.0};
Point(6) = {10, -10, 0, 2.0};
Point(7) = {10, 10, 0, 2.0};
Point(8) = {-10, 10, 0, 2.0};

// Lines
Line(1) = {1, 2};
Line(2) = {2, 3};
Line(3) = {3, 4};
Line(4) = {4, 1};
Line(5) = {5, 6};
Line(6) = {6, 7};
Line(7) = {7, 8};
Line(8) = {8, 5};

// Surfaces
Line Loop(1) = {3, 4, 1, 2};
Plane Surface(1) = {1};
Line Loop(2) = {7, 8, 5, 6};
Plane Surface(2) = {-1, -2};

// Meshing
Transfinite Line {3, 4, 1, 2} = 10 Using Progression 1;
Transfinite Surface {1};
Recombine Surface {1};

获得以下网格。 在此处输入图像描述

更新

// Points
Point(1) = {0, 0, 0, 1.0};
Point(2) = {-1, -1, 0, 1.0};
Point(3) = {1, -1, 0, 1.0};
Point(4) = {1, 1, 0, 1.0};
Point(5) = {-1, 1, 0, 1.0};
Point(6) = {-5*Sqrt(2)/2, -5*Sqrt(2)/2, 0, 1.0};
Point(7) = {5*Sqrt(2)/2, -5*Sqrt(2)/2, 0, 1.0};
Point(8) = {5*Sqrt(2)/2, 5*Sqrt(2)/2, 0, 1.0};
Point(9) = {-5*Sqrt(2)/2, 5*Sqrt(2)/2, 0, 1.0};
Point(10) = {-10, -10, 0, 2.0};
Point(11) = {10, -10, 0, 2.0};
Point(12) = {10, 10, 0, 2.0};
Point(13) = {-10, 10, 0, 2.0};

// Lines
Line(1) = {2, 3};
Line(2) = {3, 4};
Line(3) = {4, 5};
Line(4) = {5, 2};
Line(5) = {6, 2};
Line(6) = {7, 3};
Line(7) = {8, 4};
Line(8) = {9, 5};
Line(9) = {10, 11};
Line(10) = {11, 12};
Line(11) = {12, 13};
Line(12) = {13, 10};
Circle(13) = {8, 1, 9};
Circle(14) = {9, 1, 6};
Circle(15) = {6, 1, 7};
Circle(16) = {7, 1, 8};

// Surfaces
Line Loop(1) = {11, 12, 9, 10};
Line Loop(2) = {13, 14, 15, 16};
Plane Surface(1) = {1, 2};
Line Loop(3) = {7, 3, -8, -13};
Plane Surface(2) = {-3};
Line Loop(4) = {14, 5, -4, -8};
Plane Surface(3) = {4};
Line Loop(5) = {1, -6, -15, 5};
Plane Surface(4) = {-5};
Line Loop(6) = {6, 2, -7, -16};
Plane Surface(5) = {-6};

// Meshing
Transfinite Line {8, 7, 6, 5} = 10 Using Progression 1;
Transfinite Line {14, 13, 16, 15, 1, 4, 3, 2} = 10 Using Progression 1;
Transfinite Surface {3};
Transfinite Surface {2};
Transfinite Surface {5};
Transfinite Surface {4};
Recombine Surface {2, 3, 4, 5};

在此处输入图像描述

您在帖子中链接的图片无疑是由 Pointwise 生成的。O-grid 样式似乎是通过双曲线挤压生成的。

我不知道有任何开源软件可以实现这一点。但到目前为止我发现的最好的选择是使用莎乐美。