convert Gmsh to fenics - not all physical regions are created in xml

119
views
0
11 weeks ago by
Dear all,

I am not sure that I am doing something wrong, I have just started to pay around with fenics project. I created two concentric cylinder, the external one has a hole to house the inner one. Both have physical surface associated. However, converting from *.msh to *.xml, only the outer cylinder is accessible and the inner is not identified in the *.xml, instead it is fused with the outer cylinder.

I joined both codes, Gmsh and fenics.

Best,

Frederic
// Gmsh

rin = 1;
rout = 10;

nn0 = rin/10;
nn1 = rin/10;
nn2 = rout/10;

x0 = 0;     y0 = 0;

x1 = rin;   y1 = 0;
x2 = 0;     y2 = rin;
x3 = -rin;  y3 = 0;
x4 = 0;  y4 = -rin;

x5 = rout;    y5 = 0;
x6 = 0;       y6 = rout;
x7 = -rout;   y7 = 0;
x8 = 0;       y8 = -rout;

Point(0) = {x0, y0, 0, nn0};
Point(1) = {x1, y1, 0, nn1};
Point(2) = {x2, y2, 0, nn1};
Point(3) = {x3, y3, 0, nn1};
Point(4) = {x4, y4, 0, nn1};
Point(5) = {x5, y5, 0, nn2};
Point(6) = {x6, y6, 0, nn2};
Point(7) = {x7, y7, 0, nn2};
Point(8) = {x8, y8, 0, nn2};

Circle(0) = {1, 0, 2};
Circle(1) = {2, 0, 3};
Circle(2) = {3, 0, 4};
Circle(3) = {4, 0, 1};

Circle(4) = {5, 0, 6};
Circle(5) = {6, 0, 7};
Circle(6) = {7, 0, 8};
Circle(7) = {8, 0, 5};

Line Loop(0) = {0, 1, 2, 3};
Line Loop(1) = {4, 5, 6, 7};

Plane Surface(0) = {0};
Plane Surface(1) = {0, 1};

Physical Surface(1) = {0};
Physical Surface(2) = {1};
Physical Line(1) = {4, 5, 6, 7};

// Fenics
from dolfin import *
import os
import matplotlib
matplotlib.use('TkAgg')
import matplotlib.pyplot as plt

// Run in bash
os.system('/Applications/Onelab-MacOSX/Gmsh.app/Contents/MacOS/gmsh -2 ehd.geo')
os.system('dolfin-convert ehd.msh ehd.xml')

mesh = Mesh("ehd.xml")

cd = MeshFunction('size_t', mesh, "ehd_physical_region.xml")
fd = MeshFunction('size_t', mesh, "ehd_facet_region.xml")

submesh1 = SubMesh(mesh, cd, 1)
submesh2 = SubMesh(mesh, cd, 2)

plot(submesh1)
plt.show()
plot(submesh2)
plt.show()

​
Community: FEniCS Project