实体实体的Gmsh问题

实体实体的Gmsh问题

本文介绍了实体实体的Gmsh问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个用Python脚本编写的*.geo文件. *.geo文件的主要用途是构造和保存三角形网格.在gmsh中,您可以使用物理"命令标记兴趣实体.例如Physical PointPhysical Line

I have a *.geo file that I have written with a python script. The main use of this *.geo file is to construct and save a triangular mesh. In gmsh you can label interest entities with the command Physical. For example Physical Point, Physical Line, etc.

这是*.geo文件:

// This is a test for *.geo
h = 1.00E+01 ;

Point( 1 ) = { 1.00E+00 , 1.00E+00 , 0.00E+00 ,h};
Point( 2 ) = { 7.00E+01 , 1.00E+00 , 0.00E+00 ,h};
Point( 3 ) = { 7.00E+01 , 7.00E+01 , 0.00E+00 ,h};
Point( 4 ) = { 1.00E+00 , 7.00E+01 , 0.00E+00 ,h};
Point( 5 ) = { 3.80E+01 , 2.70E+01 , 0.00E+00 ,h*0.5};
Point( 6 ) = { 3.80E+01 , 2.80E+01 , 0.00E+00 ,h*0.5};
Point( 7 ) = { 3.80E+01 , 2.90E+01 , 0.00E+00 ,h*0.5};
Point( 8 ) = { 3.80E+01 , 3.00E+01 , 0.00E+00 ,h*0.5};
Point( 9 ) = { 3.80E+01 , 3.10E+01 , 0.00E+00 ,h*0.5};
Point( 10 ) = { 3.80E+01 , 3.20E+01 , 0.00E+00 ,h*0.5};
Point( 11 ) = { 3.80E+01 , 3.30E+01 , 0.00E+00 ,h*0.5};
Point( 12 ) = { 3.90E+01 , 3.30E+01 , 0.00E+00 ,h*0.5};
Point( 13 ) = { 3.90E+01 , 3.40E+01 , 0.00E+00 ,h*0.5};
Point( 14 ) = { 3.90E+01 , 3.50E+01 , 0.00E+00 ,h*0.5};
Point( 15 ) = { 3.90E+01 , 3.60E+01 , 0.00E+00 ,h*0.5};
Point( 16 ) = { 4.00E+01 , 3.60E+01 , 0.00E+00 ,h*0.5};
Point( 17 ) = { 4.00E+01 , 3.70E+01 , 0.00E+00 ,h*0.5};
Point( 18 ) = { 4.10E+01 , 3.70E+01 , 0.00E+00 ,h*0.5};
Point( 19 ) = { 4.10E+01 , 3.80E+01 , 0.00E+00 ,h*0.5};
Point( 20 ) = { 4.10E+01 , 3.90E+01 , 0.00E+00 ,h*0.5};
Point( 21 ) = { 4.20E+01 , 3.90E+01 , 0.00E+00 ,h*0.5};
Point( 22 ) = { 4.20E+01 , 4.00E+01 , 0.00E+00 ,h*0.5};
Point( 23 ) = { 4.30E+01 , 4.00E+01 , 0.00E+00 ,h*0.5};
Point( 24 ) = { 4.40E+01 , 4.00E+01 , 0.00E+00 ,h*0.5};
Point( 25 ) = { 4.40E+01 , 4.10E+01 , 0.00E+00 ,h*0.5};
Point( 26 ) = { 4.50E+01 , 4.10E+01 , 0.00E+00 ,h*0.5};
Point( 27 ) = { 4.50E+01 , 4.20E+01 , 0.00E+00 ,h*0.5};
Point( 28 ) = { 4.60E+01 , 4.20E+01 , 0.00E+00 ,h*0.5};
Point( 29 ) = { 4.70E+01 , 4.20E+01 , 0.00E+00 ,h*0.5};
Point( 30 ) = { 4.80E+01 , 4.20E+01 , 0.00E+00 ,h*0.5};
Point( 31 ) = { 4.80E+01 , 4.30E+01 , 0.00E+00 ,h*0.5};
Point( 32 ) = { 4.90E+01 , 4.30E+01 , 0.00E+00 ,h*0.5};
Point( 33 ) = { 5.00E+01 , 4.30E+01 , 0.00E+00 ,h*0.5};
Point( 34 ) = { 5.10E+01 , 4.30E+01 , 0.00E+00 ,h*0.5};
Point( 35 ) = { 5.20E+01 , 4.30E+01 , 0.00E+00 ,h*0.5};
Point( 36 ) = { 5.30E+01 , 4.30E+01 , 0.00E+00 ,h*0.5};
Point( 37 ) = { 5.40E+01 , 4.30E+01 , 0.00E+00 ,h*0.5};
Point( 38 ) = { 5.40E+01 , 4.20E+01 , 0.00E+00 ,h*0.5};
Point( 39 ) = { 5.50E+01 , 4.20E+01 , 0.00E+00 ,h*0.5};
Point( 40 ) = { 5.60E+01 , 4.20E+01 , 0.00E+00 ,h*0.5};
Point( 41 ) = { 5.70E+01 , 4.20E+01 , 0.00E+00 ,h*0.5};
Point( 42 ) = { 5.70E+01 , 4.10E+01 , 0.00E+00 ,h*0.5};
Point( 43 ) = { 5.80E+01 , 4.10E+01 , 0.00E+00 ,h*0.5};
Point( 44 ) = { 5.80E+01 , 4.00E+01 , 0.00E+00 ,h*0.5};
Point( 45 ) = { 5.90E+01 , 4.00E+01 , 0.00E+00 ,h*0.5};
Point( 46 ) = { 6.00E+01 , 4.00E+01 , 0.00E+00 ,h*0.5};
Point( 47 ) = { 6.00E+01 , 3.90E+01 , 0.00E+00 ,h*0.5};
Point( 48 ) = { 6.10E+01 , 3.90E+01 , 0.00E+00 ,h*0.5};
Point( 49 ) = { 6.10E+01 , 3.80E+01 , 0.00E+00 ,h*0.5};
Point( 50 ) = { 6.10E+01 , 3.70E+01 , 0.00E+00 ,h*0.5};
Point( 51 ) = { 6.20E+01 , 3.70E+01 , 0.00E+00 ,h*0.5};
Point( 52 ) = { 6.20E+01 , 3.60E+01 , 0.00E+00 ,h*0.5};
Point( 53 ) = { 6.30E+01 , 3.60E+01 , 0.00E+00 ,h*0.5};
Point( 54 ) = { 6.30E+01 , 3.50E+01 , 0.00E+00 ,h*0.5};
Point( 55 ) = { 6.30E+01 , 3.40E+01 , 0.00E+00 ,h*0.5};
Point( 56 ) = { 6.30E+01 , 3.30E+01 , 0.00E+00 ,h*0.5};
Point( 57 ) = { 6.40E+01 , 3.30E+01 , 0.00E+00 ,h*0.5};
Point( 58 ) = { 6.40E+01 , 3.20E+01 , 0.00E+00 ,h*0.5};
Point( 59 ) = { 6.40E+01 , 3.10E+01 , 0.00E+00 ,h*0.5};
Point( 60 ) = { 6.40E+01 , 3.00E+01 , 0.00E+00 ,h*0.5};
Point( 61 ) = { 6.40E+01 , 2.90E+01 , 0.00E+00 ,h*0.5};
Point( 62 ) = { 6.40E+01 , 2.80E+01 , 0.00E+00 ,h*0.5};
Point( 63 ) = { 6.40E+01 , 2.70E+01 , 0.00E+00 ,h*0.5};
Point( 64 ) = { 6.30E+01 , 2.70E+01 , 0.00E+00 ,h*0.5};
Point( 65 ) = { 6.30E+01 , 2.60E+01 , 0.00E+00 ,h*0.5};
Point( 66 ) = { 6.30E+01 , 2.50E+01 , 0.00E+00 ,h*0.5};
Point( 67 ) = { 6.30E+01 , 2.40E+01 , 0.00E+00 ,h*0.5};
Point( 68 ) = { 6.20E+01 , 2.40E+01 , 0.00E+00 ,h*0.5};
Point( 69 ) = { 6.20E+01 , 2.30E+01 , 0.00E+00 ,h*0.5};
Point( 70 ) = { 6.10E+01 , 2.30E+01 , 0.00E+00 ,h*0.5};
Point( 71 ) = { 6.10E+01 , 2.20E+01 , 0.00E+00 ,h*0.5};
Point( 72 ) = { 6.10E+01 , 2.10E+01 , 0.00E+00 ,h*0.5};
Point( 73 ) = { 6.00E+01 , 2.10E+01 , 0.00E+00 ,h*0.5};
Point( 74 ) = { 6.00E+01 , 2.00E+01 , 0.00E+00 ,h*0.5};
Point( 75 ) = { 5.90E+01 , 2.00E+01 , 0.00E+00 ,h*0.5};
Point( 76 ) = { 5.80E+01 , 2.00E+01 , 0.00E+00 ,h*0.5};
Point( 77 ) = { 5.80E+01 , 1.90E+01 , 0.00E+00 ,h*0.5};
Point( 78 ) = { 5.70E+01 , 1.90E+01 , 0.00E+00 ,h*0.5};
Point( 79 ) = { 5.70E+01 , 1.80E+01 , 0.00E+00 ,h*0.5};
Point( 80 ) = { 5.60E+01 , 1.80E+01 , 0.00E+00 ,h*0.5};
Point( 81 ) = { 5.50E+01 , 1.80E+01 , 0.00E+00 ,h*0.5};
Point( 82 ) = { 5.40E+01 , 1.80E+01 , 0.00E+00 ,h*0.5};
Point( 83 ) = { 5.40E+01 , 1.70E+01 , 0.00E+00 ,h*0.5};
Point( 84 ) = { 5.30E+01 , 1.70E+01 , 0.00E+00 ,h*0.5};
Point( 85 ) = { 5.20E+01 , 1.70E+01 , 0.00E+00 ,h*0.5};
Point( 86 ) = { 5.10E+01 , 1.70E+01 , 0.00E+00 ,h*0.5};
Point( 87 ) = { 5.00E+01 , 1.70E+01 , 0.00E+00 ,h*0.5};
Point( 88 ) = { 4.90E+01 , 1.70E+01 , 0.00E+00 ,h*0.5};
Point( 89 ) = { 4.80E+01 , 1.70E+01 , 0.00E+00 ,h*0.5};
Point( 90 ) = { 4.80E+01 , 1.80E+01 , 0.00E+00 ,h*0.5};
Point( 91 ) = { 4.70E+01 , 1.80E+01 , 0.00E+00 ,h*0.5};
Point( 92 ) = { 4.60E+01 , 1.80E+01 , 0.00E+00 ,h*0.5};
Point( 93 ) = { 4.50E+01 , 1.80E+01 , 0.00E+00 ,h*0.5};
Point( 94 ) = { 4.50E+01 , 1.90E+01 , 0.00E+00 ,h*0.5};
Point( 95 ) = { 4.40E+01 , 1.90E+01 , 0.00E+00 ,h*0.5};
Point( 96 ) = { 4.40E+01 , 2.00E+01 , 0.00E+00 ,h*0.5};
Point( 97 ) = { 4.30E+01 , 2.00E+01 , 0.00E+00 ,h*0.5};
Point( 98 ) = { 4.20E+01 , 2.00E+01 , 0.00E+00 ,h*0.5};
Point( 99 ) = { 4.20E+01 , 2.10E+01 , 0.00E+00 ,h*0.5};
Point( 100 ) = { 4.10E+01 , 2.10E+01 , 0.00E+00 ,h*0.5};
Point( 101 ) = { 4.10E+01 , 2.20E+01 , 0.00E+00 ,h*0.5};
Point( 102 ) = { 4.10E+01 , 2.30E+01 , 0.00E+00 ,h*0.5};
Point( 103 ) = { 4.00E+01 , 2.30E+01 , 0.00E+00 ,h*0.5};
Point( 104 ) = { 4.00E+01 , 2.40E+01 , 0.00E+00 ,h*0.5};
Point( 105 ) = { 3.90E+01 , 2.40E+01 , 0.00E+00 ,h*0.5};
Point( 106 ) = { 3.90E+01 , 2.50E+01 , 0.00E+00 ,h*0.5};
Point( 107 ) = { 3.90E+01 , 2.60E+01 , 0.00E+00 ,h*0.5};
Point( 108 ) = { 3.90E+01 , 2.70E+01 , 0.00E+00 ,h*0.5};
Point( 109 ) = { 3.80E+01 , 2.70E+01 , 0.00E+00 ,h*0.5};

// Writing stuff for domain: 4

Line( 110 ) = { 1 , 2 , 3 , 4 , 1 };
Line Loop( 111 ) = { 110 };
Physical Line( "Border_0" ) = { 111 };

// Writing stuff for domain: 105

BSpline( 112 ) = {   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,  16,  17,  18,
  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,  32,
  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,
  47,  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,
  61,  62,  63,  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,
  75,  76,  77,  78,  79,  80,  81,  82,  83,  84,  85,  86,  87,  88,
  89,  90,  91,  92,  93,  94,  95,  96,  97,  98,  99, 100, 101, 102,
 103, 104, 105, 106, 107, 108, 109, 5};
Line Loop( 113 ) = { 112 };
Physical Line( "Border_1" ) = { 113 };
Plane Surface( 114 ) = { 113 };
Physical Surface( "Inclusion_1" ) = { 114 };

Plane Surface( 115 ) = {111,113};
Physical Surface( "Matrix_domain" ) = { 115 };

创建的*.msh文件(包含网格)已标识物理"标签,但找不到相应的元素集.

The created *.msh file, contains the mesh, has identified the Physical labels, but I can not find the corresponding element sets.

推荐答案

写入文件的方式肯定存在问题.在GMSH中,通常将Line(100) = {1,2};仅连接两个点,然后使用Line Loop连接线.在此,对于直线段(形成正方形)和BSplines(形成圆形)夹杂物,都违反了这一规定.

There is definitely something wrong in how you write the file.In GMSH, you would usually have Line(100) = {1,2}; connecting only two points and then Line Loop that would create the loops out of the lines. Here, this is violated both for the straight segments (forming a square) and for the BSplines (forming a circular-like) inclusion.

我已经手动编辑了文件以达到(据说是预期的)结果:

I've manually edited the file to achieve the (supposedly, expected) result:

Line( 210 ) = { 1 , 2 };
Line( 211) = {2,3};
Line( 212) = {3,4};
Line(213) = {4,1};
Line Loop( 111 ) = { 210,211,212,213 };
Physical Line( "Border_0" ) = { 210,  211,212,213};

// Writing stuff for domain: 105

BSpline (310) = {8,   9,  10,  11,  12,  13,  14,  15,  16,  17,  18,
  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,  32,
  33,  34};
BSpline (311) = {34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,
  47,  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60};
BSpline (312) = {60,  61,  62,  63,  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,
  75,  76,  77,  78,  79,  80,  81,  82,  83,  84,  85,  86};
BSpline (313) = {86,  87,  88,
  89,  90,  91,  92,  93,  94,  95,  96,  97,  98,  99, 100, 101, 102,
 103, 104, 105, 106, 107, 108, 109, 5,6,7,8};


Line Loop( 113 ) = { 310,311,312,313 };
Physical Line( "Border_1" ) = { 310, 311,312,313};
Plane Surface( 114 ) = { 113 };
Physical Surface( "Inclusion_1" ) = { 114 };

Plane Surface( 115 ) = {111,113};
Physical Surface( "Matrix_domain" ) = { 115 };

现在,我建议将圆"分为4个部分,因为它建议在GMSH中的弧角小于180度.尽管BSpline不一定是Circle(GMSH中用于圆弧的命令),但我也倾向于在此使用该约定.

Now, I split the "circle" into 4 segments as it recommended to have arc angles <180 degrees in GMSH. And though BSpline is not necessarily a Circle (command for an arc in GMSH), I tend to use this convention here as well.

类似地,必须将实际的Line(而不是Line Loop)添加到Physical Line.

Similarly, the actual Lines (not Line Loops) have to be added to the Physical Line.

现在,我想您可以找到您的元素(如果我正确理解了您的问题).

Now, I guess, you can find your elements (if I correctly understood your question).

这篇关于实体实体的Gmsh问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 00:09