Hi,
I am new on Fenics and i face a problem when I want to import meshes. I use Fenics on Google Colaboratory. In the following lines, i present what i have done :
step 1. I created the geometry (.geo) of my mesh using the script which follows…
Jt = 0.2 ;
Ht = 0.2 ;
D = 1. ;
B = 3*D ;
L = 5*D ;
S = D ;
H = Ht*D ;
jmax = Sqrt( ((D/2)^2)+H^2) ;
j = Jt*jmax ;
xI = -(((j/2)/jmax)*D)/2 ;
yI = -Sqrt(((j/2)^2)-(xI^2)) ;
xJ = -xI ;
yJ = -yI ;
xF = xI-Sqrt(((jmax-j)^2)-(H-2*yJ)^2) ;
yF = yI-(H-2*yJ) ;
xM = xJ + Sqrt(((jmax-j)^2)-(H-2*yJ)^2) ;
yM = yJ + (H-2*yJ) ;
xL = xM-D ;
yL = yM ;
xG = xF+D ;
yG = yF ;
xE = -(L/2) ;
yE = yF ;
xH = L/2 ;
yH = yF ;
xK = xE ;
yK = yL ;
xN = xH ;
yN = yL ;
xC = xE ;
yC = yE-S ;
xD = xH ;
yD = yH-S ;
xO = xK ;
yO = yK+S ;
xP = xN ;
yP = yN+S ;
xA = xC ;
yA = yC-(B-S) ;
xB = xD ;
yB = yD-(B-S) ;
xQ = xO ;
yQ = yO+(B-S) ;
xR = xP ;
yR = yP+(B-S) ;
Point(1) = {xA, yA, 0, 1};
Point(2) = {xB, yB, 0, 1};
Point(3) = {xC, yC, 0, 1};
Point(4) = {xD, yD, 0, 1};
Point(5) = {xE, yE, 0, 1};
Point(6) = {xF, yF, 0, 1};
Point(7) = {xG, yG, 0, 1};
Point(8) = {xH, yH, 0, 1};
Point(9) = {xI, yI, 0, 1};
Point(10) = {xJ, yJ, 0, 1};
Point(11) = {xK, yK, 0, 1};
Point(12) = {xL, yL, 0, 1};
Point(13) = {xM, yM, 0, 1};
Point(14) = {xN, yN, 0, 1};
Point(15) = {xO, yO, 0, 1};
Point(16) = {xP, yP, 0, 1};
Point(17) = {xQ, yQ, 0, 1};
Point(18) = {xR, yR, 0, 1};
Line(1) = {1, 2};
Line(2) = {2, 4};
Line(3) = {8, 7};
Line(4) = {7, 10};
Line(5) = {10, 6};
Line(6) = {6, 5};
Line(7) = {3, 1};
Line(8) = {9, 12};
Line(9) = {12, 11};
Line(10) = {15, 17};
Line(11) = {17, 18};
Line(12) = {18, 16};
Line(13) = {14, 13};
Line(14) = {13, 9};
Line(15) = {15, 16};
Line(16) = {4, 3};
Line(17) = {11, 15};
Line(18) = {14, 16};
Line(19) = {5, 3};
Line(20) = {4, 8};
Line(21) = {12, 13};
Line(22) = {7, 6};
Line(55) = {10, 13};
Line(144) = {9, 6};
Line Loop(23) = {1, 2, 16, 7};
Line Loop(24) = {-16, 20, 3, 22, 6, 19};
Line Loop(25) = {-22, 4, 5};
Line Loop(26) = {21, 8, 14};
Line Loop(27) = {-15, -17, -9, 21, -13, 18};
Line Loop(28) = {15, -12, -11, -10};
Plane Surface(29) = {23};
Plane Surface(30) = {24};
Plane Surface(31) = {25};
Plane Surface(32) = {26};
Plane Surface(33) = {27};
Plane Surface(34) = {28};
Transfinite Line {1, 11} = 5 ;
Transfinite Line {-12, 10, 7, -2} = 2*5 Using Progression 1;
Transfinite Line {15, 16} = 500 ;
Transfinite Line {17, 18, 19, 20, 21, 22, 8, 14, 5, 4} = 100;
Transfinite Line {9, 13, 6, 3} = 200;
Physical Line(35) = {1} ;
Physical Line(36) = {2} ;
Physical Line(37) = {20} ;
Physical Line(38) = {3} ;
Physical Line(39) = {6} ;
Physical Line(40) = {19} ;
Physical Line(41) = {7} ;
Physical Line(42) = {10} ;
Physical Line(43) = {11} ;
Physical Line(44) = {12} ;
Physical Line(45) = {18} ;
Physical Line(46) = {13} ;
Physical Line(47) = {9} ;
Physical Line(48) = {17} ;
Physical Line(49) = {8} ;
Physical Line(50) = {4} ;
Physical Line(51) = {55} ;
Physical Line(52) = {144} ;
Physical Surface(53) = {29};
Physical Surface(54) = {30};
Physical Surface(56) = {31};
Physical Surface(57) = {32};
Physical Surface(58) = {33};
Physical Surface(59) = {34};
step 2. I created the mesh (.msh) from the previous geometry using the “2D mesh” button in Gmsh.
step 3. I would like to use the mesh (.msh) previously created in fenics (colab). I saw in some previous topics that I have to convert my (.msh) file to an (.xdmf) file so that it could be handled by Fenics. So i tried the following in order to install meshio and convert the file into xdmf :
!pip install -U meshio
!apt-get install python-lxml
!meshio-convert perfect_contact.msh perfect_contact.xdmf
step 4. Then I tried this in order to define the mesh for the FE simulation and plot the mesh in colab :
mesh = Mesh(“perfect_contact.xdmf”)
plt.figure(figsize=(10, 10))
plot(mesh)
Question : Please do you know a simple way for me to do this in google colab ? The error message is “Unable to open the file […] Unknown file type” I am a newbie, so please tell me on which step you give the correction… Or specify “everything” if i am completely wrong Please, find enclosed a picture of the domain…