[Gmsh] post procssing using the .msh file format

Shi Jin jinzishuai at yahoo.com
Sat Jul 5 02:50:28 CEST 2008


Hi there,

I am trying to use gmsh to visualize my FEM simulation results. The reason I want to use gmsh is that it is the only visualization software I found that is able to visualize 2nd order Taylor-Hood tetrahedral elements. (if you happen to know any other tools to do this, free or commercial, please let me know).

>From the tutorials, I learned to visualize with the View "string" { string < ( expression-list ) > { expression-list }; ... }; postprocessing  command. However, as mentioned in the manaul,"However this "parsed format" is read by Gmsh's script parser, which
makes it inefficient if there are many elements in the dataset. Also,
there is no connectivity information in parsed views and all the
elements are independent (all fields can be discontinuous), so a lot of
information can be duplicated. For large datasets, you should thus use
the mesh-based post-processing file format described in 9. File formats, or use one of the standard formats like MED.
"

Therefore, I decided to try with the mesh-based file format, i.e., the .msh file. Following the manual, I was able to get the post-processing window to show the views and the color map, however, my results does not seem to get visualized as it should.
Here is my .msh file.
$MeshFormat
2 0 8
$EndMeshFormat
$Nodes
39
12    1.00000    0.00000    0.00000
13    0.00000    1.00000    0.00000
14   -1.00000    0.00000    0.00000
15   -0.00000   -1.00000    0.00000
16    1.00000    0.00000    1.00000
17    0.00000    1.00000    1.00000
18   -1.00000    0.00000    1.00000
19   -0.00000   -1.00000    1.00000
20   -0.00000    0.00000    0.00000
21   -0.00000    0.00000    1.00000
22   -0.00000    0.00000    0.50000
23    0.50000    0.00000    0.50000
24    0.50000    0.00000    0.00000
26   -0.00000   -0.50000    0.50000
27   -0.00000   -0.50000    0.00000
29    0.50000   -0.50000    0.00000
32   -0.00000   -1.00000    0.50000
33   -0.00000   -0.50000    1.00000
35    0.50000   -0.50000    0.50000
36    0.50000    0.00000    1.00000
38    0.50000   -0.50000    1.00000
41    1.00000    0.00000    0.50000
44   -0.50000    0.00000    0.50000
45   -0.50000    0.00000    0.00000
47   -0.00000    0.50000    0.50000
48   -0.00000    0.50000    0.00000
50   -0.50000    0.50000    0.00000
53   -0.50000    0.50000    0.50000
54   -0.00000    0.50000    1.00000
56   -1.00000    0.00000    0.50000
57   -0.50000    0.00000    1.00000
59   -0.50000    0.50000    1.00000
62    0.00000    1.00000    0.50000
65    0.50000    0.50000    0.00000
68    0.50000    0.50000    0.50000
70    0.50000    0.50000    1.00000
74   -0.50000   -0.50000    0.00000
77   -0.50000   -0.50000    0.50000
79   -0.50000   -0.50000    1.00000
$EndNodes
$Elements
12
1 11 3 4 1 0   20 21 12 15 22 23 24 27 29 26
2 11 3 4 1 0   21 15 19 16 26 32 33 36 38 35
3 11 3 4 1 0   16 21 15 12 36 26 35 41 29 23
4 11 3 4 1 0   20 21 14 13 22 44 45 48 50 47
5 11 3 4 1 0   21 14 17 18 44 53 54 57 59 56
6 11 3 4 1 0   21 13 17 14 47 62 54 44 53 50
7 11 3 4 1 0   13 21 12 20 47 23 65 48 24 22
8 11 3 4 1 0   17 12 21 16 68 23 54 70 36 41
9 11 3 4 1 0   17 13 21 12 62 47 54 68 23 65
10 11 3 4 1 0   15 21 14 20 26 44 74 27 45 22
11 11 3 4 1 0   19 14 21 18 77 44 33 79 57 56
12 11 3 4 1 0   19 15 21 14 32 26 33 77 44 74
$EndElements
$NodeData
0
0
0
12   80.00000
13   80.00000
14   80.00000
15   80.00000
16    0.00000
17    0.00000
18    0.00000
19    0.00000
20   80.00000
21    0.00000
$EndNodeData

The key uncertainty I have is about the use of tags.
1. For the $Elements section, I use "3 4 1 0" following a .msh file generated by gmsh. However, I don't know whether they play any role since I don't have any physical names defined. Can i simply use "0" as the tag. It does not seem to matter for me in this case.
2. In the $NodeData section, there are three tags required: string, float and integer. I give them all 0s. Is this a correct way?. If I want to give a name to the field, I might do
1
"pressure"
0
0
as the three tags. Do I need to give any other tags?
3. What shall I do if I want to visualize a velocity vector field? Just like
node-number vx vy vz ?
4. I still can't see the visualized field. Please help me. It would be great if there is any example/tutorial on post-processing with the .msh file.
Thank you very much.


Shi
--
Shi Jin, PhD