[Gmsh] PhysicalNames

Mikhail Artemiev artemiev.mikhail at ngs.ru
Sat Oct 9 01:50:56 CEST 2010


Hi Paul.
Physical entities are necessary to define a group of 
elements which have a similar properties.
For example - a group of boundary lines for defining some 
boundary condition.
Or if you don't want to write in .msh-file whole mesh 
(i.e. all of points, lines et cetera).
See my example:

Point(1) = {0, 0, 0, 0.1};
Point(2) = {1, 0, 0, 0.1};
Point(3) = {0, 1, 0, 0.1};
Point(4) = {1, 1, 0, 0.1};
Line(1) = {1, 2};
Line(2) = {1, 3};
Line(3) = {2, 4};
Line(4) = {3, 4};
Line Loop(5) = {1, 3, -4, -2};
Plane Surface(1) = {5};
Physical Line(1001) = {1, 2, 3, 4};

In this example I define a rectangle. But in .msh-file I 
want to see only boundary lines. That is the way to do 
this.
To define a boundary I use a number '1001'. You can find 
this number in the first tag in every row in section 
$Elements$EndElements.
But instead a number you can use a string.
For example:

Physical Line("BoundLines") = {1, 2, 3, 4};

In this case Gmsh automatically creates a unique number 
for physical entity, and in .msh-file you'll see the 
section $PhysicalNames$EndPhysicalNames that have the 
following format:

$PhysicalNames
number-of-names
physical-dimension physical-number "physical-name"
...
$EndPhysicalNames

In my case I have:

$PhysicalNames
1
1 1 "BoundLines"
$EndPhysicalNames

Hope this helps
Mikhail Artemiev, PhD student, NSTU