<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;">
Can you send me the geo or msh file, or instruction on how to build your example? I am not familiar with the gmsh API
<div><br>
</div>
<div>Blaise</div>
<div><br>
<div><br>
<blockquote type="cite">
<div>On Sep 20, 2023, at 8:16 AM, Anna Dalklint via petsc-users <petsc-users@mcs.anl.gov> wrote:</div>
<br class="Apple-interchange-newline">
<div>
<table border="0" cellspacing="0" cellpadding="0" align="left" width="100%" style="caret-color: rgb(0, 0, 0); font-family: Helvetica; letter-spacing: normal; orphans: auto; text-transform: none; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;">
<tbody>
<tr>
<td style="background: rgb(122, 0, 60); padding: 5pt 2pt;"></td>
<td width="100%" cellpadding="7px 6px 7px 15px" style="padding: 5pt 4pt 5pt 12pt; overflow-wrap: break-word;">
<div style=""><span style="font-weight: bold;">Caution:<span class="Apple-converted-space"> </span></span>External email.<span class="Apple-converted-space"> </span></div>
</td>
</tr>
</tbody>
</table>
<br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;">
<div style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;">
<div id="divtagdefaultwrapper" dir="ltr" style="font-size: 12pt; font-family: Calibri, Helvetica, sans-serif;">
<p style="margin-top: 0px; margin-bottom: 0px;"></p>
<div>
<div style="margin-top: 0px; margin-bottom: 0px;">Hello,</div>
<div style="margin-top: 0px; margin-bottom: 0px;"><br>
</div>
<div style="margin-top: 0px; margin-bottom: 0px;">I am trying to load a mesh, created via the gmsh api, into a DMPlex. The code is seen below:<br>
<br>
</div>
<div> 6 gmsh::initialize(); <span class="Apple-converted-space"> </span><br>
</div>
<div> 7 elsize0 = 1.0;<br>
8 double a = 20.0; <br>
9 double b = 20.0; <br>
10 double c = 10.0; <br>
11 double d = 30.0; <br>
12 double e = 70.0; <br>
13 <br>
14 gmsh::model::geo::addPoint(0.0, 0.0, 0.0, elsize0, 1);<br>
15 gmsh::model::geo::addPoint(a, 0.0, 0.0, elsize0, 2);<br>
16 gmsh::model::geo::addPoint(0.0, d, 0.0, elsize0, 3);<br>
17 gmsh::model::geo::addPoint(a, c, 0.0, elsize0, 4);<br>
18 gmsh::model::geo::addPoint(e, d, 0.0, elsize0, 5);<br>
19 gmsh::model::geo::addPoint(e, c, 0.0, elsize0, 6);<br>
20 gmsh::model::geo::addPoint(a, 0.0, b, elsize0, 7);<br>
21 gmsh::model::geo::addPoint(0.0, 0.0, b, elsize0, 8);<br>
22 gmsh::model::geo::addPoint(0.0, d, b, elsize0, 9);<br>
23 gmsh::model::geo::addPoint(e, d, b, elsize0, 10);<br>
24 gmsh::model::geo::addPoint(e, c, b, elsize0, 11);<br>
25 gmsh::model::geo::addPoint(a, c, b, elsize0, 12);<br>
26<span class="Apple-converted-space"> </span><br>
27 // Define lines connecting points<br>
28 gmsh::model::geo::addLine(2, 1, 1);<br>
29 gmsh::model::geo::addLine(1, 3, 2);<br>
30 gmsh::model::geo::addLine(3, 5, 3);<br>
31 gmsh::model::geo::addLine(5, 6, 4);<br>
32 gmsh::model::geo::addLine(6, 4, 5);<br>
33 gmsh::model::geo::addLine(4, 2, 6);<br>
34 gmsh::model::geo::addLine(2, 7, 7);<br>
35 gmsh::model::geo::addLine(7, 8, 8);<br>
36 gmsh::model::geo::addLine(8, 1, 9);<br>
37 gmsh::model::geo::addLine(8, 9, 10);<br>
38 gmsh::model::geo::addLine(9, 3, 11);<br>
39 gmsh::model::geo::addLine(9, 10, 12);<br>
40 gmsh::model::geo::addLine(10, 11, 13);<br>
41 gmsh::model::geo::addLine(11, 12, 14);<br>
42 gmsh::model::geo::addLine(12, 7, 15);<br>
43 gmsh::model::geo::addLine(12, 4, 16);<br>
44 gmsh::model::geo::addLine(11, 6, 17);<br>
45 gmsh::model::geo::addLine(10, 5, 18);<br>
46<span class="Apple-converted-space"> </span><br>
47 // Define surfaces through their boundaries<br>
48 gmsh::model::geo::addCurveLoop({3, 4, 5, 6, 1, 2}, 1);<br>
49 gmsh::model::geo::addPlaneSurface({1}, 1);<br>
50 gmsh::model::geo::addCurveLoop({18, 4, -17, -13}, 2);<br>
51 gmsh::model::geo::addPlaneSurface({2}, 2);<br>
52 gmsh::model::geo::addCurveLoop({5, -16, -14, 17}, 3);<br>
53 gmsh::model::geo::addPlaneSurface({3}, 3);<br>
54 gmsh::model::geo::addCurveLoop({16, 6, 7, -15}, 4);<br>
55 gmsh::model::geo::addPlaneSurface({4}, 4);<br>
56 gmsh::model::geo::addCurveLoop({12, 13, 14, 15, 8, 10}, 5);<br>
57 gmsh::model::geo::addPlaneSurface({5}, 5);<br>
58 gmsh::model::geo::addCurveLoop({11, -2, -9, 10}, 6);<br>
59 gmsh::model::geo::addPlaneSurface({6}, 6);<br>
60 gmsh::model::geo::addCurveLoop({1, -9, -8, -7}, 7);<br>
61 gmsh::model::geo::addPlaneSurface({7}, 7);</div>
<div> 62 gmsh::model::geo::addCurveLoop({11, 3, -18, -12}, 8);<span class="Apple-converted-space"> </span><br>
63 gmsh::model::geo::addPlaneSurface({8}, 8);<span class="Apple-converted-space"> </span><br>
64 <br>
65 gmsh::model::geo::addSurfaceLoop({8, 1, 2, 3, 4, 7, 6, 5}, 1);<br>
66 gmsh::model::geo::addVolume({1}, 1);<br>
67<span class="Apple-converted-space"> </span><br>
68 gmsh::model::geo::synchronize();<br>
70<span class="Apple-converted-space"> </span><br>
72 gmsh::model::addPhysicalGroup(3, {1}, 1);<br>
74 gmsh::model::addPhysicalGroup(2, {7}, 101, "dir_y");</div>
<div><br>
</div>
<div><span> 98 gmsh::option::setNumber("Mesh.Algorithm", 6);</span><br>
<span> 99 gmsh::option::setNumber("Mesh.ElementOrder", 1);</span></div>
<div><span><span> 100 gmsh::model::mesh::generate(3);</span><br>
</span></div>
<div><span> 101 <span class="Apple-converted-space"> </span><span>gmsh::write("filename.msh");</span><br>
</span></div>
<p style="margin-top: 0px; margin-bottom: 0px;"></p>
<div style="margin-top: 0px; margin-bottom: 0px;"><br>
</div>
<div style="margin-top: 0px; margin-bottom: 0px;">The mesh is generated, but the Physical Group is not correctly loaded into the DMPlex. If I run a DMView on my dm, I get:</div>
<div style="margin-top: 0px; margin-bottom: 0px;"><br>
</div>
<p style="margin-top: 0px; margin-bottom: 0px;"></p>
<div>171 DM Object: Parallel Mesh 4 MPI processes<br>
172 type: plex<br>
173 Parallel Mesh in 3 dimensions:<br>
174 Number of 0-cells per rank: 7138 7192 7328 7171<br>
175 Number of 1-cells per rank: 45825 45992 46817 45824<br>
176 Number of 2-cells per rank: 74791 74901 76203 74568<br>
177 Number of 3-cells per rank: 36103 36100 36713 35914<br>
178 Labels:<br>
179 depth: 4 strata with value/size (0 (7138), 1 (45825), 2 (74791), 3 (36103))<br>
180 celltype: 4 strata with value/size (0 (7138), 1 (45825), 3 (74791), 6 (36103))<br>
181 Cell Sets: 1 strata with value/size (1 (36103))<br>
182 Face Sets: 0 strata with value/size ()<br>
183 Vertex Sets: 1 strata with value/size (1 (5200))</div>
<p style="margin-top: 0px; margin-bottom: 0px;"></p>
<div style="margin-top: 0px; margin-bottom: 0px;"><br>
</div>
<div style="margin-top: 0px; margin-bottom: 0px;">Why are the elements of the physicalGroup "dir_y" (Plane Surface 7) not loaded as a face set? If I change the Plane Surface to another surface, e.g. 8, it marks the elements as the correct face set. Another
weird thing is that the number of vertices in the above Vertex set is not correct.<span class="Apple-converted-space"> </span><br>
</div>
<div style="margin-top: 0px; margin-bottom: 0px;"><br>
</div>
<div style="margin-top: 0px; margin-bottom: 0px;">I have tried changing the numbering of Plane Surface 7 (to e.g. 70) but the issue remains.<br>
</div>
<div style="margin-top: 0px; margin-bottom: 0px;"><br>
</div>
<div style="margin-top: 0px; margin-bottom: 0px;">I run the code with the<span class="Apple-converted-space"> </span><span>-dm_plex_gmsh_mark_vertices and -dm_plex_gmsh_multiple_tags flags.</span><span class="Apple-converted-space"> </span><br>
</div>
<div style="margin-top: 0px; margin-bottom: 0px;"><br>
</div>
<div style="margin-top: 0px; margin-bottom: 0px;">Thank you,</div>
Anna</div>
</div>
</div>
</div>
</blockquote>
</div>
<br>
<div>
<div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;">
<div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;">
<div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;">
<div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;">
<div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;">
<div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;">
<div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;">
<div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;">
<div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;">
<div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;">
<div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;">
<div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;">
<div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;">
<div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;">
<div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;">
<div>— <br>
Canada Research Chair in Mathematical and Computational Aspects of Solid Mechanics (Tier 1)</div>
<div>Professor, Department of Mathematics & Statistics<br>
Hamilton Hall room 409A, McMaster University<br>
1280 Main Street West, Hamilton, Ontario L8S 4K1, Canada <br>
https://www.math.mcmaster.ca/bourdin | +1 (905) 525 9140 ext. 27243</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<br>
</div>
</body>
</html>