gmsh中的元素可以分成两类:几何实体和物理实体。几何实体是网格元素的最基本组成,物理实体(物理组)则是在几何元素的基础上进行逻辑层上的分类。从架构上看,几何实体属于物理划分,物理实体则是逻辑划分。
gmsh支持根据物理性质将几何实体进行归类和划分。目前所知物理实体一个非常重要的性质是设定网格的边界条件:将相同边界条件的几何元素归到同一个组下,gmsh在生成网格的时候就将物理信息写入到生成的网格信息中。
物理实体的定义需要在定义的元素前加上”Physical”标识符,其余的同几何实体的定义相同。下面是一个二维机翼的gmsh定义:
cl_1 = 0.01; Point(1) = {1, 0, 0, cl_1}; Point(2) = {0.2906701309999999, 0, 0.059599889, cl_1}; Point(3) = {0.290670131, 0, 0.059599889, cl_1}; Point(4) = {-3.33066907387547e-016, 0, -2.775557561562891e-017, cl_1}; Point(5) = {0.290670131, 0, -0.059599889, cl_1}; Point(6) = {-1.110223024625156e-016, 0, 0, cl_1}; Point(7) = {1, 0, 0, cl_1}; Point(8) = {0.2906701309999999, 0, -0.059599889, cl_1}; p1 = newp; Point(p1 + 1) = {0.9578477628235885, 0, 0.005808055788066277}; Point(p1 + 2) = {0.9136001717514742, 0, 0.01159953317971515}; Point(p1 + 3) = {0.8678598741632115, 0, 0.01728526031819392}; Point(p1 + 4) = {0.8212779475631614, 0, 0.02277865740518693}; Point(p1 + 5) = {0.7745191250941298, 0, 0.02800031778249978}; Point(p1 + 6) = {0.7282262993505407, 0, 0.03288198060276357}; Point(p1 + 7) = {0.6829880771923493, 0, 0.0373694940386463}; Point(p1 + 8) = {0.6393125213400493, 0, 0.04142453011683183}; Point(p1 + 9) = {0.5976090881089672, 0, 0.04502500226786509}; Point(p1 + 10) = {0.5581794445899648, 0, 0.0481643117667218}; Point(p1 + 11) = {0.521216620190355, 0, 0.05084967643767647}; Point(p1 + 12) = {0.4868110356265319, 0, 0.05309985880292391}; Point(p1 + 13) = {0.4549614552219337, 0, 0.05494261362247144}; Point(p1 + 14) = {0.4255888082703554, 0, 0.05641213152223604}; Point(p1 + 15) = {0.3985510271977428, 0, 0.05754668640628761}; Point(p1 + 16) = {0.3736574289168878, 0, 0.05838661862754537}; Point(p1 + 17) = {0.3506816041400513, 0, 0.0589727173733007}; Point(p1 + 18) = {0.3293721908004415, 0, 0.05934501212155738}; Point(p1 + 19) = {0.309461241465114, 0, 0.0595419466863262}; Spline(1) = {1, p1 + 1, p1 + 2, p1 + 3, p1 + 4, p1 + 5, p1 + 6, p1 + 7, p1 + 8, p1 + 9, p1 + 10, p1 + 11, p1 + 12, p1 + 13, p1 + 14, p1 + 15, p1 + 16, p1 + 17, p1 + 18, p1 + 19, 2}; p2 = newp; Point(p2 + 1) = {0.2842729112131264, 0, 0.05959035601288155}; Point(p2 + 2) = {0.2761001220809002, 0, 0.0595451957195354}; Point(p2 + 3) = {0.2666300877434753, 0, 0.05944430161792291}; Point(p2 + 4) = {0.2560533097681484, 0, 0.05926870849763945}; Point(p2 + 5) = {0.2444412386433862, 0, 0.05899746041353254}; Point(p2 + 6) = {0.2318090344278302, 0, 0.058605806668528}; Point(p2 + 7) = {0.2181439021461914, 0, 0.05806365702589601}; Point(p2 + 8) = {0.2034209651627122, 0, 0.05733392771630338}; Point(p2 + 9) = {0.1876150065513268, 0, 0.0563705983368452}; Point(p2 + 10) = {0.1707120994729877, 0, 0.0551163616335265}; Point(p2 + 11) = {0.1527237978253341, 0, 0.05349978292686403}; Point(p2 + 12) = {0.1337063457254963, 0, 0.05143193572045287}; Point(p2 + 13) = {0.1137876774535901, 0, 0.04880258242681034}; Point(p2 + 14) = {0.09320552798189294, 0, 0.04547617760131762}; Point(p2 + 15) = {0.07236044644973513, 0, 0.04128836888014319}; Point(p2 + 16) = {0.05188730831459138, 0, 0.03604437967545813}; Point(p2 + 17) = {0.03274685573930983, 0, 0.02952182506630169}; Point(p2 + 18) = {0.01633265015110124, 0, 0.0214822334050408}; Point(p2 + 19) = {0.004575175047531102, 0, 0.01169763023104438}; Spline(2) = {3, p2 + 1, p2 + 2, p2 + 3, p2 + 4, p2 + 5, p2 + 6, p2 + 7, p2 + 8, p2 + 9, p2 + 10, p2 + 11, p2 + 12, p2 + 13, p2 + 14, p2 + 15, p2 + 16, p2 + 17, p2 + 18, p2 + 19, 4}; p3 = newp; Point(p3 + 1) = {0.2842687444062102, 0, -0.05959033995136771}; Point(p3 + 2) = {0.2760902965551228, 0, -0.05954510785780694}; Point(p3 + 3) = {0.2666128650422044, 0, -0.05944404536989124}; Point(p3 + 4) = {0.2560272811856329, 0, -0.05926814784851871}; Point(p3 + 5) = {0.2444053852046738, 0, -0.05899642178635941}; Point(p3 + 6) = {0.2317627182952431, 0, -0.05860407976787362}; Point(p3 + 7) = {0.2180868707188054, 0, -0.05806099563459484}; Point(p3 + 8) = {0.203353381935633, 0, -0.05733005183556716}; Point(p3 + 9) = {0.1875375094086677, 0, -0.05636519948112355}; Point(p3 + 10) = {0.1706258837914739, 0, -0.05510911382545057}; Point(p3 + 11) = {0.1526307187728704, 0, -0.05349036308954442}; Point(p3 + 12) = {0.1336090279833125, 0, -0.05142005881221923}; Point(p3 + 13) = {0.1136896084213433, 0, -0.0487880588136444}; Point(p3 + 14) = {0.09311108862650791, 0, -0.04545900258153844}; Point(p3 + 15) = {0.07227479757675123, 0, -0.04126885612468364}; Point(p3 + 16) = {0.05181599481494702, 0, -0.03602334947685121}; Point(p3 + 17) = {0.03269491843986368, 0, -0.02950085009913444}; Point(p3 + 18) = {0.01630296371554681, 0, -0.02146392080930703}; Point(p3 + 19) = {0.004565723668620725, 0, -0.01168586711270097}; Spline(3) = {5, p3 + 1, p3 + 2, p3 + 3, p3 + 4, p3 + 5, p3 + 6, p3 + 7, p3 + 8, p3 + 9, p3 + 10, p3 + 11, p3 + 12, p3 + 13, p3 + 14, p3 + 15, p3 + 16, p3 + 17, p3 + 18, p3 + 19, 6}; Reverse Line {3}; p4 = newp; Point(p4 + 1) = {0.9578371307341608, 0, -0.005809451776204171}; Point(p4 + 2) = {0.9135836204677359, 0, -0.01160162204700566}; Point(p4 + 3) = {0.8678423367489414, 0, -0.01728739358632329}; Point(p4 + 4) = {0.8212641228333738, 0, -0.02278029282335023}; Point(p4 + 5) = {0.7745130557952343, 0, -0.02800105787177528}; Point(p4 + 6) = {0.7282310363923532, 0, -0.03288159346440879}; Point(p4 + 7) = {0.6830054673847058, 0, -0.03736791477271506}; Point(p4 + 8) = {0.6393431339409602, 0, -0.04142184433789697}; Point(p4 + 9) = {0.5976522728176452, 0, -0.04502141572787306}; Point(p4 + 10) = {0.5582334954732195, 0, -0.04816011152865139}; Point(p4 + 11) = {0.5212790094647602, 0, -0.05084518927366299}; Point(p4 + 12) = {0.4868786787883632, 0, -0.05309541172223745}; Point(p4 + 13) = {0.4550309732288671, 0, -0.05493850005863926}; Point(p4 + 14) = {0.4256567607517621, 0, -0.05640858514472293}; Point(p4 + 15) = {0.398614100322739, 0, -0.05754386310405684}; Point(p4 + 16) = {0.373712570479338, 0, -0.05838458613465396}; Point(p4 + 17) = {0.3507261053773512, 0, -0.05897145133181579}; Point(p4 + 18) = {0.3294037189943399, 0, -0.05934439706944743}; Point(p4 + 19) = {0.3094778295903463, 0, -0.05954178043174179}; Spline(4) = {7, p4 + 1, p4 + 2, p4 + 3, p4 + 4, p4 + 5, p4 + 6, p4 + 7, p4 + 8, p4 + 9, p4 + 10, p4 + 11, p4 + 12, p4 + 13, p4 + 14, p4 + 15, p4 + 16, p4 + 17, p4 + 18, p4 + 19, 8}; Coherence; cl_2 = 2.0; Point(89) = {-20, 0, 20, cl_2}; Point(90) = {-20, 0, -20, cl_2}; Point(91) = {20, 0, -20, cl_2}; Point(92) = {20, 0, 20, cl_2}; Line(7) = {89, 92}; Line(8) = {92, 91}; Line(9) = {91, 90}; Line(10) = {90, 89}; Line Loop(11) = {10, 7, 8, 9}; Line Loop(12) = {1, 2, -3, -4}; Plane Surface(13) = {11, 12}; Physical Line(14) = {9, 7, 10, 8}; Physical Line(15) = {1, 2, 3, 4}; Physical Surface(1) = {13};
上述文件定义了一个二维机翼的几何实体和物理实体。将其使用gmsh则可生成二维的网格。
注意
如果需要导出msh格式,必须给出完整的physical定义!在上述例子中,如果没有给出最后的physical surface定义,保存成msh的格式则只有边界上的数据。话句话说,如果定义了物理实体,msh格式只会输出和physical信息的几何实体相关的网格!
发表回复