I guess my problem is a bit similar to Read complex geometry using meshio. In short, I created a mesh with gmsh and it looks alright. However both dolfin-convert and meshio are unable to deal with it properly. (dolfin-convert isn’t able to convert the file.msh to file.xml).
Here’s the file.geo. Gmsh is able to produce the file.msh without any error nor warning, using the command gmsh file.geo -3.
SetFactory("OpenCASCADE");
Mesh.RandomFactor=1.0e-6;
lc = 0.0009;
c = 22.65e-6;
//Mesh.CharacteristicLengthFromPoints = 0;
//Mesh.CharacteristicLengthFromCurvature = 0;
//Mesh.CharacteristicLengthExtendFromBoundary = 0;
//Field[6] = Box;
//Field[6].VIn = lc;
//Field[6].VOut = lc;
//Field[6].XMin = 0.3;
//Field[6].XMax = 0.6;
//Field[6].YMin = 0.3;
//Field[6].YMax = 0.6;
//Field[7] = Min;
//Field[7].FieldsList = {6};
//Background Field = 7;
Point(0) = {0.0011406208862845065, 0.0032441065693525582, 0, lc};
Point(1) = {0.0009522202500376615, 0.003190862890708888, 0, lc};
Point(2) = {0.0007269586281744509, 0.002480947434039145, 0, lc};
Point(3) = {0.0007679153064410817, 0.0024440864018785255, 0, lc};
Point(4) = {0.0007392456285514899, 0.0023485209640607325, 0, lc};
Point(5) = {0.0007815675273583749, 0.0023007381675780795, 0, lc};
Point(6) = {0.0007761066451973581, 0.002262511992450962, 0, lc};
Point(7) = {0.0009604115887939379, 0.0020768416886813666, 0, lc};
Point(8) = {0.0009576811477134295, 0.002044076395715266, 0, lc};
Point(9) = {0.0011378904607187493, 0.0018474844827711498, 0, lc};
Point(10) = {0.001116046916559931, 0.001719153596839743, 0, lc};
Point(11) = {0.001116046916559931, 0.0016372402092769789, 0, lc};
Point(12) = {0.0011692905796888496, 0.0014761440769237256, 0, lc};
Point(13) = {0.0011651949180680869, 0.0014351873986570948, 0, lc};
Point(14) = {0.0012116124319514806, 0.001371021986720894, 0, lc};
Point(15) = {0.0012539343307583657, 0.0013464479704520648, 0, lc};
Point(16) = {0.0013003518601565108, 0.0013478131134185625, 0, lc};
Point(17) = {0.0013481346411244126, 0.0012877433631031244, 0, lc};
Point(18) = {0.001338578081827882, 0.0012440562437559853, 0, lc};
Point(19) = {0.0013071779628577819, 0.0012331344639192005, 0, lc};
Point(20) = {0.0012880648908089746, 0.0011703342725232538, 0, lc};
Point(21) = {0.0012621256695146423, 0.001117090593879584, 0, lc};
Point(22) = {0.0013194649632348207, 0.001070673064481439, 0, lc};
Point(23) = {0.0013221954198300804, 0.0010297163862148081, 0, lc};
Point(24) = {0.001395917453121817, 0.0010092380625962441, 0, lc};
Point(25) = {0.0014423349514904593, 0.0010297163862148081, 0, lc};
Point(26) = {0.0017699882379907442, 0.0009423421785500323, 0, lc};
Point(27) = {0.0017918317666348112, 0.0009682813998443644, 0, lc};
Point(28) = {0.001801388387990347, 0.0010024119443802215, 0, lc};
Point(29) = {0.0017877361825878054, 0.0011293775942566226, 0, lc};
Point(30) = {0.0017740839771852636, 0.0011921777856525695, 0, lc};
Point(31) = {0.0017426838271856608, 0.0012522475825122615, 0, lc};
Point(32) = {0.001729031621783119, 0.0013164129944484623, 0, lc};
Point(33) = {0.00176316221286323, 0.0014242655877908074, 0, lc};
Point(34) = {0.0017181098574610854, 0.0014747787788097148, 0, lc};
Point(35) = {0.0016949010307030078, 0.0014802396609707314, 0, lc};
Point(36) = {0.0016826141234144766, 0.0015389442217754181, 0, lc};
Point(37) = {0.0016553095574618796, 0.0015853616735998066, 0, lc};
Point(38) = {0.0016594052966563987, 0.0016413357933239847, 0, lc};
Point(39) = {0.0016785183842199577, 0.0017082316773701963, 0, lc};
Point(40) = {0.001745414268266169, 0.0017723971203358997, 0, lc};
Point(41) = {0.001947467218518815, 0.0019007280062673063, 0, lc};
Point(42) = {0.002032110892014575, 0.0019403194795084343, 0, lc};
Point(43) = {0.0021522504547044565, 0.0020317893332792215, 0, lc};
Point(44) = {0.0022177811957841704, 0.0020823025708423828, 0, lc};
Point(45) = {0.002291503104957897, 0.002161485362177126, 0, lc};
Point(46) = {0.002357033690890098, 0.002235207426498365, 0, lc};
Point(47) = {0.002434851339258343, 0.0023335034605441794, 0, lc};
Point(48) = {0.0024826341357409958, 0.0024727561107976198, 0, lc};
Point(49) = {0.0025918519341088437, 0.0028386355258807686, 0, lc};
Point(50) = {0.0026068692824778835, 0.002935566261812572, 0, lc};
Point(51) = {0.0025918519341088437, 0.002965601113698164, 0, lc};
Point(52) = {0.002570008405464777, 0.0029778880209866956, 0, lc};
Point(53) = {0.0025686431073507665, 0.0030024621458587843, 0, lc};
Point(54) = {0.0022614682530723044, 0.003335576267975832, 0, lc};
Point(55) = {0.0022532769298307795, 0.003354689355539391, 0, lc};
Point(56) = {0.00210992854038282, 0.0035171508325509086, 0, lc};
Point(57) = {0.001795927505829331, 0.003432507003907636, 0, lc};
Point(58) = {0.0017904666236683144, 0.0034243156806661105, 0, lc};
Point(59) = {0.001686709707461483, 0.0033806286233779765, 0, lc};
Point(60) = {0.0016580399985423888, 0.003383359064458485, 0, lc};
Line(0) = {0, 1};
Line(1) = {1, 2};
Line(2) = {2, 3};
Line(3) = {3, 4};
Line(4) = {4, 5};
Line(5) = {5, 6};
Line(6) = {6, 7};
Line(7) = {7, 8};
Line(8) = {8, 9};
Line(9) = {9, 10};
Line(10) = {10, 11};
Line(11) = {11, 12};
Line(12) = {12, 13};
Line(13) = {13, 14};
Line(14) = {14, 15};
Line(15) = {15, 16};
Line(16) = {16, 17};
Line(17) = {17, 18};
Line(18) = {18, 19};
Line(19) = {19, 20};
Line(20) = {20, 21};
Line(21) = {21, 22};
Line(22) = {22, 23};
Line(23) = {23, 24};
Line(24) = {24, 25};
Line(25) = {25, 26};
Line(26) = {26, 27};
Line(27) = {27, 28};
Line(28) = {28, 29};
Line(29) = {29, 30};
Line(30) = {30, 31};
Line(31) = {31, 32};
Line(32) = {32, 33};
Line(33) = {33, 34};
Line(34) = {34, 35};
Line(35) = {35, 36};
Line(36) = {36, 37};
Line(37) = {37, 38};
Line(38) = {38, 39};
Line(39) = {39, 40};
Line(40) = {40, 41};
Line(41) = {41, 42};
Line(42) = {42, 43};
Line(43) = {43, 44};
Line(44) = {44, 45};
Line(45) = {45, 46};
Line(46) = {46, 47};
Line(47) = {47, 48};
Line(48) = {48, 49};
Line(49) = {49, 50};
Line(50) = {50, 51};
Line(51) = {51, 52};
Line(52) = {52, 53};
Line(53) = {53, 54};
Line(54) = {54, 55};
Line(55) = {55, 56};
Line(56) = {56, 57};
Line(57) = {57, 58};
Line(58) = {58, 59};
Line(59) = {59, 60};
Line(60) = {60, 0};
Line Loop(61) = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60};
Point(62) = {0.0019101557000395766, 0.002561861206175936, 0, lc};
Point(63) = {0.001858843918227232, 0.002611120541539389, 0, lc};
Point(64) = {0.0018608963646761236, 0.0028738369450953013, 0, lc};
Point(65) = {0.001864700271398773, 0.0029079923597774854, 0, lc};
Point(66) = {0.001873211198516987, 0.0029005190592259196, 0, lc};
Point(67) = {0.001936837659022682, 0.0028451023845157916, 0, lc};
Point(68) = {0.0020047066282701522, 0.0028059183286436857, 0, lc};
Point(69) = {0.0019881495959825396, 0.0026542225375561675, 0, lc};
Point(70) = {0.0019471002015621663, 0.0025741760400168, 0, lc};
Line(62) = {62, 63};
Line(63) = {63, 64};
Line(64) = {64, 65};
Line(65) = {65, 66};
Line(66) = {66, 67};
Line(67) = {67, 68};
Line(68) = {68, 69};
Line(69) = {69, 70};
Line(70) = {70, 62};
Line Loop(71) = {62, 63, 64, 65, 66, 67, 68, 69, 70};
Plane Surface(72) = {71};
Point(73) = {0.001252912948136324, 0.0025895866873311816, 0, lc};
Point(74) = {0.0012533644273990251, 0.0025659660990737195, 0, lc};
Point(75) = {0.0011671605905129822, 0.0025926483683518502, 0, lc};
Point(76) = {0.0011671605905129822, 0.002693219485527648, 0, lc};
Point(77) = {0.0011775506643081164, 0.002687220706939214, 0, lc};
Line(73) = {73, 74};
Line(74) = {74, 75};
Line(75) = {75, 76};
Line(76) = {76, 77};
Line(77) = {77, 73};
Line Loop(78) = {73, 74, 75, 76, 77};
Plane Surface(79) = {78};
Point(80) = {0.0012529129326215725, 0.0025895866873311816, 0, lc};
Point(81) = {0.0012513120430091387, 0.0026480650430619783, 0, lc};
Point(82) = {0.0011775506643081166, 0.002687220706939214, 0, lc};
Line(80) = {80, 81};
Line(81) = {81, 82};
Line(82) = {82, 80};
Line Loop(83) = {80, 81, 82};
Plane Surface(84) = {83};
Point(85) = {0.001252912948136324, 0.0025895866873311816, 0, lc};
Point(86) = {0.0013334109249383927, 0.002483867310232973, 0, lc};
Point(87) = {0.001401142588636897, 0.002311459636460887, 0, lc};
Point(88) = {0.0013498306516770394, 0.002276567581387189, 0, lc};
Point(89) = {0.0012718367557340766, 0.002364823864722123, 0, lc};
Point(90) = {0.0011630557131299501, 0.0025105494243635906, 0, lc};
Point(91) = {0.001101481543925634, 0.002648065043061978, 0, lc};
Point(92) = {0.0010850617706427332, 0.002668589817845921, 0, lc};
Point(93) = {0.0011425310004050122, 0.0027301639870502374, 0, lc};
Point(94) = {0.001177550648793365, 0.0026872207069392135, 0, lc};
Point(95) = {0.0011671605749982309, 0.0026932194855276478, 0, lc};
Point(96) = {0.0011671605749982309, 0.00259264836835185, 0, lc};
Point(97) = {0.001253364427399025, 0.002565966099073719, 0, lc};
Line(85) = {85, 86};
Line(86) = {86, 87};
Line(87) = {87, 88};
Line(88) = {88, 89};
Line(89) = {89, 90};
Line(90) = {90, 91};
Line(91) = {91, 92};
Line(92) = {92, 93};
Line(93) = {93, 94};
Line(94) = {94, 95};
Line(95) = {95, 96};
Line(96) = {96, 97};
Line(97) = {97, 85};
Line Loop(98) = {85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97};
Plane Surface(99) = {98};
Point(100) = {0.0018773160914147703, 0.0030236675527820643, 0, lc};
Point(101) = {0.001992254644027836, 0.0030093001173447965, 0, lc};
Point(102) = {0.001992254644027836, 0.002971845956242147, 0, lc};
Point(103) = {0.0019347852125737902, 0.003007247670895905, 0, lc};
Point(104) = {0.001875917902028013, 0.003007247670895905, 0, lc};
Line(100) = {100, 101};
Line(101) = {101, 102};
Line(102) = {102, 103};
Line(103) = {103, 104};
Line(104) = {104, 100};
Line Loop(105) = {100, 101, 102, 103, 104};
Plane Surface(106) = {105};
Point(107) = {0.0020047066282701522, 0.002805918328643685, 0, lc};
Point(108) = {0.0021154028272889554, 0.002750688606686668, 0, lc};
Point(109) = {0.002160557269754625, 0.0028348399971238193, 0, lc};
Point(110) = {0.0021154028272889554, 0.002904624107271215, 0, lc};
Point(111) = {0.001992254644027836, 0.002971845956242147, 0, lc};
Line(107) = {107, 108};
Line(108) = {108, 109};
Line(109) = {109, 110};
Line(110) = {110, 111};
Line(111) = {111, 107};
Line Loop(112) = {107, 108, 109, 110, 111};
Plane Surface(113) = {112};
Point(114) = {0.001864700271398773, 0.002907992359777485, 0, lc};
Point(115) = {0.0018260043096024257, 0.0029682507229244234, 0, lc};
Point(116) = {0.0018567913166308272, 0.003011352563793688, 0, lc};
Point(117) = {0.001875917902028013, 0.003007247670895905, 0, lc};
Line(114) = {114, 115};
Line(115) = {115, 116};
Line(116) = {116, 117};
Line(117) = {117, 114};
Line Loop(118) = {114, 115, 116, 117};
Plane Surface(119) = {118};
Point(120) = {0.001875917902028013, 0.003007247670895905, 0, lc};
Point(121) = {0.001864700271398773, 0.002907992359777485, 0, lc};
Point(122) = {0.0019368376590226822, 0.0028451023845157907, 0, lc};
Point(123) = {0.0020047066282701522, 0.002805918328643685, 0, lc};
Point(124) = {0.001992254644027836, 0.002971845956242147, 0, lc};
Point(125) = {0.0019347852125737902, 0.003007247670895905, 0, lc};
Line(120) = {120, 121};
Line(121) = {121, 122};
Line(122) = {122, 123};
Line(123) = {123, 124};
Line(124) = {124, 125};
Line(125) = {125, 120};
Line Loop(126) = {120, 121, 122, 123, 124, 125};
Plane Surface(127) = {126};
// Create big surface to extrude.
Line Loop(128) = {81,80,85,86,87,88,89,90,91,92,93};
Plane Surface(129) = {128};
Line Loop(130) = {62,63,64,114,115,116,104,100,101,110,109,108,107,68,69,70};
Plane Surface(131) = {130};
Plane Surface(132) = {61, 128, 130};
Physical Surface("bottom")={132};
Physical Surface("bottom_contact_2a")={72};
Physical Surface("bottom_contact_3a")={79};
Physical Surface("bottom_contact_3b")={84};
Physical Surface("bottom_contact_1a")={99};
Physical Surface("bottom_contact_2b")={106};
Physical Surface("bottom_contact_4a")={113};
Physical Surface("bottom_contact_4b")={119};
Physical Surface("bottom_contact_2c")={127};
surfaceVector[] = Extrude {0, 0, c} {
Surface{132, 72, 79, 84, 99, 106, 113, 119, 127};
Layers{13};
};
Physical Surface("top") = {surfaceVector[0]};
Physical Volume("sample_volume") = {surfaceVector[1]};
Physical Surface("side0") = {surfaceVector[2]};
Physical Surface("side1") = {surfaceVector[3]};
Physical Surface("side2") = {surfaceVector[4]};
Physical Surface("side3") = {surfaceVector[5]};
Physical Surface("side4") = {surfaceVector[6]};
Physical Surface("side5") = {surfaceVector[7]};
Physical Surface("side6") = {surfaceVector[8]};
Physical Surface("side7") = {surfaceVector[9]};
Physical Surface("side8") = {surfaceVector[10]};
Physical Surface("side9") = {surfaceVector[11]};
Physical Surface("side10") = {surfaceVector[12]};
Physical Surface("side11") = {surfaceVector[13]};
Physical Surface("side12") = {surfaceVector[14]};
Physical Surface("side13") = {surfaceVector[15]};
Physical Surface("side14") = {surfaceVector[16]};
Physical Surface("side15") = {surfaceVector[17]};
Physical Surface("side16") = {surfaceVector[18]};
Physical Surface("side17") = {surfaceVector[19]};
Physical Surface("side18") = {surfaceVector[20]};
Physical Surface("side19") = {surfaceVector[21]};
Physical Surface("side20") = {surfaceVector[22]};
Physical Surface("side21") = {surfaceVector[23]};
Physical Surface("side22") = {surfaceVector[24]};
Physical Surface("side23") = {surfaceVector[25]};
Physical Surface("side24") = {surfaceVector[26]};
Physical Surface("side25") = {surfaceVector[27]};
Physical Surface("side26") = {surfaceVector[28]};
Physical Surface("side27") = {surfaceVector[29]};
Physical Surface("side28") = {surfaceVector[30]};
Physical Surface("side29") = {surfaceVector[31]};
Physical Surface("side30") = {surfaceVector[32]};
Physical Surface("side31") = {surfaceVector[33]};
Physical Surface("side32") = {surfaceVector[34]};
Physical Surface("side33") = {surfaceVector[35]};
Physical Surface("side34") = {surfaceVector[36]};
Physical Surface("side35") = {surfaceVector[37]};
Physical Surface("side36") = {surfaceVector[38]};
Physical Surface("side37") = {surfaceVector[39]};
Physical Surface("side38") = {surfaceVector[40]};
Physical Surface("side39") = {surfaceVector[41]};
Physical Surface("side40") = {surfaceVector[42]};
Physical Surface("side41") = {surfaceVector[43]};
Physical Surface("side42") = {surfaceVector[44]};
Physical Surface("side43") = {surfaceVector[45]};
Physical Surface("side44") = {surfaceVector[46]};
Physical Surface("side45") = {surfaceVector[47]};
Physical Surface("side46") = {surfaceVector[48]};
Physical Surface("side47") = {surfaceVector[49]};
Physical Surface("side48") = {surfaceVector[50]};
Physical Surface("side49") = {surfaceVector[51]};
Physical Surface("side50") = {surfaceVector[52]};
Physical Surface("side51") = {surfaceVector[53]};
Physical Surface("side52") = {surfaceVector[54]};
Physical Surface("side53") = {surfaceVector[55]};
Physical Surface("side54") = {surfaceVector[56]};
Physical Surface("side55") = {surfaceVector[57]};
Physical Surface("side56") = {surfaceVector[58]};
Physical Surface("side57") = {surfaceVector[59]};
Physical Surface("side58") = {surfaceVector[60]};
Physical Surface("side59") = {surfaceVector[61]};
Physical Surface("side60") = {surfaceVector[62]};
Physical Surface("side_contact_1_and_3_0") = {surfaceVector[63]};
Physical Surface("side_contact_1_and_3_1") = {surfaceVector[64]};
Physical Surface("side_contact_1_and_3_2") = {surfaceVector[65]};
Physical Surface("side_contact_1_and_3_3") = {surfaceVector[66]};
Physical Surface("side_contact_1_and_3_4") = {surfaceVector[67]};
Physical Surface("side_contact_1_and_3_5") = {surfaceVector[68]};
Physical Surface("side_contact_1_and_3_6") = {surfaceVector[69]};
Physical Surface("side_contact_1_and_3_7") = {surfaceVector[70]};
Physical Surface("side_contact_1_and_3_8") = {surfaceVector[71]};
Physical Surface("side_contact_1_and_3_9") = {surfaceVector[72]};
Physical Surface("side_contact_1_and_3_10") = {surfaceVector[73]};
Physical Surface("side_contact_2_and_4_0") = {surfaceVector[74]};
Physical Surface("side_contact_2_and_4_1") = {surfaceVector[75]};
Physical Surface("side_contact_2_and_4_2") = {surfaceVector[76]};
Physical Surface("side_contact_2_and_4_3") = {surfaceVector[77]};
Physical Surface("side_contact_2_and_4_4") = {surfaceVector[78]};
Physical Surface("side_contact_2_and_4_5") = {surfaceVector[79]};
Physical Surface("side_contact_2_and_4_6") = {surfaceVector[80]};
Physical Surface("side_contact_2_and_4_7") = {surfaceVector[81]};
Physical Surface("side_contact_2_and_4_8") = {surfaceVector[82]};
Physical Surface("side_contact_2_and_4_9") = {surfaceVector[83]};
Physical Surface("side_contact_2_and_4_10") = {surfaceVector[84]};
Physical Surface("side_contact_2_and_4_11") = {surfaceVector[85]};
Physical Surface("side_contact_2_and_4_12") = {surfaceVector[86]};
Physical Surface("side_contact_2_and_4_13") = {surfaceVector[87]};
Physical Surface("side_contact_2_and_4_14") = {surfaceVector[88]};
Physical Surface("side_contact_2_and_4_15") = {surfaceVector[89]};
Physical Surface("top_contact_2a") = {surfaceVector[90]};
Physical Volume("contact_2a") = {surfaceVector[91]};
Physical Surface("side_contact_2a0") = {surfaceVector[92]};
Physical Surface("side_contact_2a1") = {surfaceVector[93]};
Physical Surface("side_contact_2a2") = {surfaceVector[94]};
Physical Surface("side_contact_2a3") = {surfaceVector[95]};
Physical Surface("side_contact_2a4") = {surfaceVector[96]};
Physical Surface("side_contact_2a5") = {surfaceVector[97]};
Physical Surface("side_contact_2a6") = {surfaceVector[98]};
Physical Surface("side_contact_2a7") = {surfaceVector[99]};
Physical Surface("side_contact_2a8") = {surfaceVector[100]};
Physical Surface("top_contact_3a") = {surfaceVector[101]};
Physical Volume("contact_3a") = {surfaceVector[102]};
Physical Surface("side_contact_3a0") = {surfaceVector[103]};
Physical Surface("side_contact_3a1") = {surfaceVector[104]};
Physical Surface("side_contact_3a2") = {surfaceVector[105]};
Physical Surface("side_contact_3a4") = {surfaceVector[106]};
Physical Surface("side_contact_3a5") = {surfaceVector[107]};
Physical Surface("top_contact_3b") = {surfaceVector[108]};
Physical Volume("contact_3b") = {surfaceVector[109]};
Physical Surface("side_contact_3b0") = {surfaceVector[110]};
Physical Surface("side_contact_3b1") = {surfaceVector[111]};
Physical Surface("side_contact_3b2") = {surfaceVector[112]};
Physical Surface("top_contact_1a") = {surfaceVector[113]};
Physical Volume("contact_1a") = {surfaceVector[114]};
Physical Surface("side_contact_1a0") = {surfaceVector[115]};
Physical Surface("side_contact_1a1") = {surfaceVector[116]};
Physical Surface("side_contact_1a2") = {surfaceVector[117]};
Physical Surface("side_contact_1a3") = {surfaceVector[118]};
Physical Surface("side_contact_1a4") = {surfaceVector[119]};
Physical Surface("side_contact_1a5") = {surfaceVector[120]};
Physical Surface("side_contact_1a6") = {surfaceVector[121]};
Physical Surface("side_contact_1a7") = {surfaceVector[122]};
Physical Surface("side_contact_1a8") = {surfaceVector[123]};
Physical Surface("side_contact_1a9") = {surfaceVector[124]};
Physical Surface("side_contact_1a10") = {surfaceVector[125]};
Physical Surface("side_contact_1a11") = {surfaceVector[126]};
Physical Surface("side_contact_1a12") = {surfaceVector[127]};
Physical Surface("top_contact_2b") = {surfaceVector[128]};
Physical Volume("contact_2b") = {surfaceVector[129]};
Physical Surface("side_contact_2b0") = {surfaceVector[130]};
Physical Surface("side_contact_2b1") = {surfaceVector[131]};
Physical Surface("side_contact_2b2") = {surfaceVector[132]};
Physical Surface("side_contact_3b3") = {surfaceVector[133]};
Physical Surface("side_contact_3b4") = {surfaceVector[134]};
Physical Surface("top_contact_4a") = {surfaceVector[135]};
Physical Volume("contact_4a") = {surfaceVector[136]};
Physical Surface("side_contact_4a0") = {surfaceVector[137]};
Physical Surface("side_contact_4a1") = {surfaceVector[138]};
Physical Surface("side_contact_4a2") = {surfaceVector[139]};
Physical Surface("side_contact_4a3") = {surfaceVector[140]};
Physical Surface("side_contact_4a4") = {surfaceVector[141]};
Physical Surface("top_contact_4b") = {surfaceVector[142]};
Physical Volume("contact_4b") = {surfaceVector[143]};
Physical Surface("side_contact_4b0") = {surfaceVector[144]};
Physical Surface("side_contact_4b1") = {surfaceVector[145]};
Physical Surface("side_contact_4b2") = {surfaceVector[146]};
Physical Surface("side_contact_4b3") = {surfaceVector[147]};
Physical Surface("top_contact_2c") = {surfaceVector[148]};
Physical Volume("contact_2c") = {surfaceVector[149]};
Physical Surface("side_contact_2c0") = {surfaceVector[150]};
Physical Surface("side_contact_2c1") = {surfaceVector[151]};
Physical Surface("side_contact_2c2") = {surfaceVector[152]};
Physical Surface("side_contact_2c3") = {surfaceVector[153]};
Physical Surface("side_contact_2c4") = {surfaceVector[154]};
Physical Surface("side_contact_2c5") = {surfaceVector[155]};
Here’s the code that tries to read that mesh using meshio:
from dolfin import *
import meshio
the_file_name = 'file_gmsh'
msh = meshio.read(the_file_name + ".msh")
meshio.write("mesh.xdmf", meshio.Mesh(points=msh.points, cells={"tetra": msh.cells["tetra"]}))
meshio.write("mf.xdmf", meshio.Mesh(points=msh.points, cells={"triangle": msh.cells["triangle"]},
cell_data={"triangle": {"name_to_read": msh.cell_data["triangle"]["gmsh:physical"]}}))
meshio.write("cf.xdmf", meshio.Mesh(
points=msh.points, cells={"tetra": msh.cells["tetra"]},
cell_data={"tetra": {"name_to_read":
msh.cell_data["tetra"]["gmsh:physical"]}}))
mesh = Mesh()
with XDMFFile("mesh.xdmf") as infile:
infile.read(mesh)
mvc = MeshValueCollection("size_t", mesh, 2)
with XDMFFile("mf.xdmf") as infile:
infile.read(mvc, "name_to_read")
mf = cpp.mesh.MeshFunctionSizet(mesh, mvc)
mvc = MeshValueCollection("size_t", mesh, 3)
with XDMFFile("cf.xdmf") as infile:
infile.read(mvc, "name_to_read")
cf = cpp.mesh.MeshFunctionSizet(mesh, mvc)
dx = Measure("dx", domain=mesh,subdomain_data=cf)
ds = Measure("ds", domain=mesh, subdomain_data=mf)
subdomains = cf
boundary_parts = mf
But this yields the error:
Traceback (most recent call last):
File “mesh_test.py”, line 85, in
infile.read(mvc, “name_to_read”)
RuntimeError:*** -------------------------------------------------------------------------
*** DOLFIN encountered an error. If you are not able to resolve this issue
*** using the information listed below, you can ask for help at
*** fenics-support@googlegroups.com
*** Remember to include the error message listed below and, if possible,
*** include a minimal running example to reproduce the error.
*** -------------------------------------------------------------------------
*** Error: Unable to find entity in map.
*** Reason: Error reading MeshValueCollection.
*** Where: This error was encountered inside HDF5File.cpp.
*** Process: 0
*** DOLFIN version: 2019.1.0
*** Git changeset: 74d7efe1e84d65e9433fd96c50f1d278fa3e3f3f
*** -------------------------------------------------------------------------
I have absolutely no clue on how to fix the problem.