VolInt = 1000 ; SurfIntPhi0 = 1001 ; SurfIntPhi1 = 1002 ; SurfIntZ0 = 1003 ;
VolShell = 2000 ; SurfShellInt = 2001 ; SurfShellExt = 2002 ; SurfShellPhi0 = 2003 ; SurfShellPhi1 = 2004 ; SurfShellZ0 = 2005 ; LineShellIntPhi0 = 2006 ; LineShellIntPhi1 = 2007 ; LineShellIntZ0 = 2008 ; PointShellInt = 2009 ;
VolExt = 3000 ; VolInf = 3001 ; SurfInf = 3002 ; SurfExtInfPhi0 = 3003 ; SurfExtInfPhi1 = 3004 ; SurfExtInfZ0 = 3005 ; SurfInfRight = 3006 ; SurfInfTop = 3007 ;
Physical Volume (VolInt) = {129,131,133} ; Physical Surface (SurfIntPhi0) = {55,57,65} ; Physical Surface (SurfIntPhi1) = {73,75,83} ; Physical Surface (SurfIntZ0) = {91,121} ;
Physical Volume (VolShell) = {135,137} ; Physical Surface (SurfShellInt) = {105,107} ; Physical Surface (SurfShellExt) = {109,111} ; Physical Surface (SurfShellPhi0) = {59,67} ; Physical Surface (SurfShellPhi1) = {77,85} ; Physical Surface (SurfShellZ0) = {123} ; Physical Line (LineShellIntPhi0) = {1,2} ; Physical Line (LineShellIntPhi1) = {9,10} ; Physical Line (LineShellIntZ0) = 21 ; Physical Point (PointShellInt) = 6 ;
Physical Volume (VolExt) = {139,141} ; Physical Volume (VolInf) = {143,145} ;
Physical Surface (SurfExtInfPhi0) = {61,63,69,71} ;
Physical Surface (SurfExtInfPhi1) = {79,87,81,89} ; Physical Surface (SurfExtInfZ0) = {125,127} ; Physical Surface (SurfInfRight) = {117} ; Physical Surface (SurfInfTop) = {119} ;
例子 7
/********************************************************************* *
* Gmsh tutorial 7 *
* 各向异性网格、吸引子 *
*********************************************************************/
// 我们可以选择新的二维的各向异性网格生成器:
Mesh.Algorithm = 2 ;
// 我们强行使用 4 步 Laplacian 迭代将网格磨光:
Mesh.Smoothing = 4 ;
lc = .1;
Point(1) = {0.0,0.0,0,lc}; Point(2) = {1.2,-0.2,0,lc}; Point(3) = {1,1,0,lc}; Point(4) = {0,1,0,lc};
Line(1) = {3,2}; Line(2) = {2,1}; Line(3) = {1,4}; Line(4) = {4,3};
Line Loop(5) = {1,2,3,4}; Plane Surface(6) = {5};
Point(5) = {0.1,0.2,0,lc};
Point(11) = {0.5,0.5,-1,lc}; Point(12) = {0.5,0.5,0,lc}; Point(22) = {0.6,0.6,1,lc};
Line(5) = {11,22};
Spline(7) = {4,5,12,2};
// 各向异性的吸引子能够定义在点和线上:
Attractor Line{5} = {.1, 0.01, 17};
Attractor Line{1,2} = {0.1, 0.005, 3}; Attractor Line{7} = {0.1, 0.05, 3};
例子 8
/********************************************************************* *
* Gmsh tutorial 8 *
* 后处理、脚本、动画、选项 *
*********************************************************************/
// 先包含进来例 1,以及一些后处理视图(请参看 FORMATS 文件关于后处理 // 文件的格式):
Include \Include \Include \Include \
// 设定一些共同的选项:
General.Trackball = 0 ; General.RotationX = 0 ; General.RotationY = 0 ; General.RotationZ = 0 ;
General.Color.Background = White ; General.Color.Foreground = Black ; General.Color.Text = Black ; General.Orthographic = 0 ; General.Axes = 0 ;
General.SmallAxes = 0 ;
// 每个后处理视图还有一些各自的选项:
View[0].IntervalsType = 2 ; View[0].OffsetZ = 0.05 ; View[0].RaiseZ = 0 ; View[0].Light = 1 ; View[0].ShowScale = 0;
View[0].SmoothNormals = 1;
View[1].IntervalsType = 1 ;
View[1].ColorTable = { Green, Blue } ; View[1].NbIso = 10 ; View[1].ShowScale = 0;
View[2].Name = \View[2].IntervalsType = 2 ; View[2].Type = 2;
View[2].IntervalsType = 2 ; View[2].AutoPosition = 0; View[2].PositionX = 85; View[2].PositionY = 50; View[2].Width = 200; View[2].Height = 150;
View[3].Type = 3;
View[3].RangeType = 2;
View[3].IntervalsType = 4 ; View[3].ShowScale = 0; View[3].Grid = 0;
View[3].CustomMin = View[2].CustomMin; View[3].CustomMax = View[2].CustomMax; View[3].AutoPosition = 0;
View[3].PositionX = View[2].PositionX; View[3].PositionY = View[2].PositionY; View[3].Width = View[2].Width; View[3].Height = View[2].Height;
// 从 1 到 255 做循环,这里的语法和 Matlab 是相似的,您还可以 // 使用 {0.5:1.5:0.1} 表示从 0.5 到 1.5 做循环,步长为 0.1。
t = 0 ;
For num In {1:255}
View[0].TimeStep = t ; View[1].TimeStep = t ; View[2].TimeStep = t ; View[3].TimeStep = t ;
t = (View[0].TimeStep < View[0].NbTimeStep-1) ? t+1 : 0 ;
View[0].RaiseZ += 0.01*t ;
If (num == 3)
// 当 num == 3 的时候,我们使得图形的大小为 320x240 : General.GraphicsWidth = 320 ; General.GraphicsHeight = 240 ; EndIf
// 循环是可以嵌套的: For num2 In {1:50}
General.RotationX += 10 ;
General.RotationY = General.RotationX / 3 ; General.RotationZ += 0.1 ;
Sleep 0.01; // 等待 0.01 秒钟 Draw; // 重画
If ((num == 3) && (num2 < 10))
// Sprintf 函数能够用变量来产生复杂的字符串: Print Sprintf(\ Print Sprintf(\ EndIf
If ((num == 3) && (num2 >= 10))
Print Sprintf(\ Print Sprintf(\ EndIf
EndFor