# [Gmsh] 2D: physical volume tags

Nico Schlömer nico.schloemer at gmail.com
Fri Nov 2 15:51:56 CET 2012

```Hi all,

I'm trying to define a 2D mesh with regions. To this end

=================== *snip* ===================
Function Rectangle
// Points.
cp1 = newp;
Point(cp1) = {xmin,ymin,z,lcar};
cp2 = newp;
Point(cp2) = {xmax,ymin,z,lcar};
cp3 = newp;
Point(cp3) = {xmax,ymax,z,lcar};
cp4 = newp;
Point(cp4) = {xmin,ymax,z,lcar};

// Lines.
cl1 = newreg;
Line(cl1) = {cp1,cp2};
cl2 = newreg;
Line(cl2) = {cp2,cp3};
cl3 = newreg;
Line(cl3) = {cp3,cp4};
cl4 = newreg;
Line(cl4) = {cp4,cp1};

loop = newreg;
Line Loop(loop) = {cl1,cl2,cl3,cl4};
surf = newreg;
Plane Surface(surf) = {loop};

Physical Volume(Sprintf("rectangle %g", t)) = surf;

Return

// Build two rectangles.
lcar = 0.1;
z = 0;
ymin = -1.0;
ymax= 1.0;

t = 0;
xmin = -1.0;
xmax = 0.0;
Call Rectangle;

t = 1;
xmin = 0.0;
xmax = 1.0;
Call Rectangle;

Coherence;
=================== *snap* ===================

Meshing this works well, and when saving the data as MSH-file, I get

=================== *snip* ===================
\$MeshFormat
2.2 0 8
\$EndMeshFormat
\$PhysicalNames
2
3 1 "rectangle 0"
3 2 "rectangle 1"
\$EndPhysicalNames
\$Nodes
504
1 -1 -1 0
2 0 -1 0
3 0 1 0
[...]
\$EndNodes
\$Elements
1031
1 15 2 0 1 1
[...]
1023 2 2 0 12 344 455 494
1024 2 2 0 12 355 476 464
1025 2 2 0 12 344 441 501
1026 2 2 0 12 344 494 441
[...]
=================== *snap* ===================

I'm wondering about the tags for the elements here. It seems that the tags
are "0" and "12", one of which I would expect to correspond with a
PhysicalName.
Can anyone enlighten me about the meaning of the tags here and how they
correspond with physical volumes?

Cheers,
Nico
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.geuz.org/pipermail/gmsh/attachments/20121102/1ded71db/attachment.html>
```