[Gmsh] Combine-1d_and_2d-Elements

Geordie McBain gdmcbain at freeshell.org
Mon Jul 26 04:03:23 CEST 2010


2010/7/24 Fernando Diego <fslack at gmail.com>:
> Hi people,
> i have a question: ¿How do I combine 1d and 2d elements in the same mesh?.
> I must generate a mesh with two elements (it's a didactic example only), one
> in 2d (quadrilateral) and on the edge of it one element in 1d.
> I sketched it:
>
> (node_4) _ _ _ _ _ _ _ _  _ (node_1)        (node_1)  x
>             x                         x                                   |
>             |                          |
> |
>             |  element_1 (2d)   |                            element_2 (1d)
>             |                          |
> |
>             x_ _ _ _ _ _ _ _ _ x                      (node_2) x
> (node_3)                         (node_2)
>
> Thnaks in advanced.

There's no restriction in the Gmsh .msh format on mixing elements of
different shapes.

http://geuz.org/gmsh/doc/texinfo/gmsh.html#MSH-ASCII-file-format

So the following solves your didactic example problem:

$MeshFormat
2.2 0 8
$EndMeshFormat
$Nodes
4
1 0 1 0
2 0 0 0
3 -1 0 0
4 -1 1 0
$EndNodes
$Elements
2
1 1 2 1 4 2 1
2 3 2 2 6 2 1 4 3
$EndElements

I wrote that by hand.  To generate it, probably the key step is
defining the line for element_2 as a Physical Line and the square for
element_1 as a Physical Surface.  If the line is defined as a Physical
Line, then your generated mesh file will automatically contain the
corresponding one-dimensional elements.

http://geuz.org/gmsh/doc/texinfo/gmsh.html#Elementary-vs-physical-entities