qlearner的个人博客分享 http://blog.sciencenet.cn/u/qlearner

博文

Gmsh的msh格式解析

已有 6068 次阅读 2014-1-13 16:01 |个人分类:专业学习|系统分类:科研笔记

每一部分都是用$KeyWord和$EndKeyWord来定义。注释可以用$Comments和$EndComments来实现。

The format is defined as follows:

    $MeshFormat        
version-number file-type data-size
    $EndMeshFormat
    $Nodes
number-of-nodes node-number x-coord y-coord z-coord
    ...
    $EndNodes
     $Elements
number-of-elements elm-number elm-type number-of-tags < tag > ... node-number-list
    ...
    $EndElements
    $Periodic
number-of-periodic-entities dimension slave-entity-tag master-entity-tag number-of-nodes slave-node-number master-node-number
    ...
    $EndPeriodic
     $PhysicalNames 
number-of-names physical-dimension physical-number "physical-name"
 ...
    $EndPhysicalNames
    $NodeData 
number-of-string-tags    
< "string-tag" >
    ...
number-of-real-tags    
< real-tag>
    ... 
number-of-integer-tags  
 < integer-tag>
    ...
node-number value ...
    ...
    $EndNodeData
   $ElementData
number-of-string-tags
    < "string-tag" >
    ...
 number-of-real-tags 
   < real-tag>
    ...
 
number-of-integer-tags 
   < integer-tag>
    ...
 elm-number value...
    ...
    $EndElementData
    $ElementNodeData
number-of-string-tags    
< "string-tag" >
    ...
 number-of-real-tags 
   < real-tag>
    ...
 number-of-integer-tags  
  < integer-tag>
    ...
 
elm-number number-of-nodes-per-element value...
    ...
    $EndElementNodeData
    $InterpolationScheme
    "name"
 number-of-element-topologies elm-topology number-of-interpolation-matrices 
num-rows num-columns value...
    ...
    $EndInterpolationScheme

where

version-number             //网格格式的版本号,不同于主程序的版本号,有自己的一套is a real number equal to 2.2
file-type                           //整型,等于0is an integer equal to 0 in the ASCII file format.
data-size                         //整型,浮点数的大小,目前为8is an integer equal to the size of the floating point numbers used in the file (currently only data-size = sizeof(double) is supported).
number-of-nodes          //节点个数is the number of nodes in the mesh.
node-number                //节点编号,必须是正整型数,从1开始计数的,这里与一般编程的不同is the number (index) of the n-th node in the mesh; node-number must be a postive (non-zero) integer. Note that the node-numbers do not necessarily have to form a dense nor an ordered sequence.
x-coord y-coord z-coord   //第n个节点的x、y、z坐标,与上面的节点编号是一行的are the floating point values giving the X, Y and Z coordinates of the n-th node.
number-of-elements         //元素的个数is the number of elements in the mesh.
elm-number                       //元素编号,必须是正整型数,也是从1开始计数is the number (index) of the n-th element in the mesh; elm-number must be a postive (non-zero) integer. Note that the elm-numbers do not necessarily have to form a dense nor an ordered sequence.
elm-type                           //定义第n个元素的几何类型defines the geometrical type of the n-th element:1                     //1代表有两个节点的线2-node line.                              
2                     //2代表有三个节点的三角形3-node triangle.
3                     //3代表有4个节点的四边形4-node quadrangle.
4                     //4代表有4个节点的四面体4-node tetrahedron.
5                     //5代表有8个节点的六面体8-node hexahedron.
6                     //6代表有6个节点的棱柱6-node prism.
7                     //7代表有5个节点的锥体5-node pyramid.
8                     3-node second order line (2 nodes associated with the vertices and 1 with the edge).
96-node second order triangle (3 nodes associated with the vertices and 3 with the edges).
109-node second order quadrangle (4 nodes associated with the vertices, 4 with the edges and 1 with the face).
1110-node second order tetrahedron (4 nodes associated with the vertices and 6 with the edges).
1227-node second order hexahedron (8 nodes associated with the vertices, 12 with the edges, 6 with the faces and 1 with the volume).
1318-node second order prism (6 nodes associated with the vertices, 9 with the edges and 3 with the quadrangular faces).
1414-node second order pyramid (5 nodes associated with the vertices, 8 with the edges and 1 with the quadrangular face).
15                    //15代表一个节点1-node point.

number-of-tags        //指定第n个元素的tag的个数,后面紧跟的就是tag类型。默认第一个tag是这个元素所属的物理实体,第二个tag是所属的基本实体,第三个tag是所属的网格分区的编号,接着是分区ids,一般要求至少前两个tag。gives the number of integer tags that follow for the n-th element. By default, the first tag is the number of the physical entity to which the element belongs; the second is the number of the elementary geometrical entity to which the element belongs; the third is the number of mesh partitions to which the element belongs, followed by the partition ids (negative partition ids indicate ghost cells). A zero tag is equivalent to no tag. Gmsh and most codes using the MSH 2 format require at least the first two tags (physical and elementary tags).
node-number-list      //第n个元素的节点列表,排序见Node orderingis the list of the node numbers of the n-th element. The ordering of the nodes is given in Node ordering.
number-of-string-tags     gives the number of string tags that follow. By default the first string-tag is interpreted as the name of the post-processing view and the second as the name of the interpolation scheme. The interpolation scheme is provided in the $InterpolationScheme section (see below).
number-of-real-tagsgives the number of real number tags that follow. By default the first real-tag is interpreted as a time value associated with the dataset.
number-of-integer-tagsgives the number of integer tags that follow. By default the first integer-tag is interpreted as a time step index (starting at 0), the second as the number of field components of the data in the view (1, 3 or 9), the third as the number of entities (nodes or elements) in the view, and the fourth as the partition index for the view data (0 for no partition).
number-of-nodes-per-elementsgives the number of node values for an element in an element-based view.
valueis a real number giving the value associated with a node or an element. For NodeData (respectively ElementData) views, there are ncomp values per node (resp. per element), where ncomp is the number of field components. For ElementNodeData views, there are ncomp times number-of-nodes-per-elements values per element.
number-of-element-topologiesis the number of element topologies for which interpolation matrices are provided
elm-topologyis the id tag of a given element topology: 1 for points, 2 for lines, 3 for triangles, 4 for quadrangles, 5 for tetrahedra, 6 for pyramids, 7 for prisms, 8 for hexahedra, 9 for polygons and 10 for polyhedra.
number-of-interpolation-matricesis the number of interpolation matrices provided for this element topology. Currently you should provide 2 matrices, i.e., the matrices that specify how to interpolate the data (they have the same meaning as in Post-processing commands). The matrices are specified by 2 integers (num-rows and num-columns) followed by the values.

Below is a small example (a mesh consisting of two quadrangles with an associated nodal scalar dataset; the comments are not part of the actual file!):

    $MeshFormat
    2.2 0 8
    $EndMeshFormat
    $Nodes
    6 six mesh nodes:    
    1 0.0 0.0 0.0            node #1: coordinates (0.0, 0.0, 0.0)  
    2 1.0 0.0 0.0            node #2: coordinates (1.0, 0.0, 0.0)  
    3 1.0 1.0 0.0            etc.
    4 0.0 1.0 0.0
    5 2.0 0.0 0.0
    6 2.0 1.0 0.0
    $EndNodes
    $Elements
    2  two elements:    
    1 3 2 99 2 1 2 3 4      quad #1: type 3, physical 99, elementary 2, nodes 1 2 3 4    
    2 3 2 99 2 2 5 6 3      quad #2: type 3, physical 99, elementary 2, nodes 2 5 6 3
    $EndElements
    $NodeData
    1 one string tag:    
    "A scalar view"          the name of the view ("A scalar view")  
    1                         one real tag:    
    0.0                      the time value (0.0)    
    3                        three integer tags: 
    0                        the time step (0; time steps always start at 0)
    1                        1-component (scalar) field
    6                        six associated nodal values
    1 0.0                  value associated with node #1 (0.0)
    2 0.1                  value associated with node #2 (0.1)
    3 0.2                  etc.
    4 0.0
    5 0.2
    6 0.4
    $EndNodeData


 




https://blog.sciencenet.cn/blog-441611-758751.html

上一篇:自己总结的几个wonderful网站(求补充!)
下一篇:OpenDX Paths to Visualization 学习笔记之第2章

0

该博文允许注册用户评论 请点击登录 评论 (0 个评论)

数据加载中...

Archiver|手机版|科学网 ( 京ICP备07017567号-12 )

GMT+8, 2022-5-20 09:54

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部