[Gmsh] plot a vector field in Gmsh

Geordie McBain gdmcbain at freeshell.org
Fri May 14 01:17:08 CEST 2010


2010/5/13 Marios Papadopoulos <mariospapa2008 at gmail.com>:
> I'm a PhD candidate student and i'm using your Gmsh enviroment to pre & post
> processing my FEA data. Until now, i managed to plot a scalar field
> (X-component of the Displacement) in a simple beam bending example like this
> example:
>
> $MeshFormat
> 2.1 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
>
>
>
>
> I want to write X, Y, Z Components of Displacement Field in the shame .msh
> file and plot them to Gmsh. How i can do this?

. You can still use a NodeData block.

- Change the "1" to a "3", for a 3-component (vector) field

- Put three floating-point values at each node instead of one.

. For example, simply append this NodeData block to your .msh file.

$NodeData
1
"A vector view"
1
0.0
3
0
3
6
1 0.0 0.0 0.0
2 0.1 0.1 0.1
3 0.2 0.2 0.2
4 0.0 0.0 0.0
5 0.2 0.2 0.2
6 0.4 0.4 0.4
$EndNodeData

. For more information, see
http://www.geuz.org/gmsh/doc/texinfo/gmsh.html#MSH-ASCII-file-format