1
- (* Content-type: application/vnd.wolfram.mathematica *)
2
-
3
- (*** Wolfram Notebook File ***)
4
- (* http://www.wolfram.com/nb *)
5
-
6
- (* CreatedBy='Mathematica 11.1' *)
7
-
8
- (*CacheID: 234*)
9
- (* Internal cache information:
10
- NotebookFileLineBreakTest
11
- NotebookFileLineBreakTest
12
- NotebookDataPosition[ 158, 7]
13
- NotebookDataLength[ 11138, 287]
14
- NotebookOptionsPosition[ 8744, 242]
15
- NotebookOutlinePosition[ 9086, 257]
16
- CellTagsIndexPosition[ 9043, 254]
17
- WindowFrame->Normal*)
18
-
19
- (* Beginning of Notebook Content *)
20
1
Notebook [{
21
2
22
3
Cell [CellGroupData [{
23
- Cell ["Load package" , "Subsection" ,ExpressionUUID -> "9e86b217-f3c6-4773-a30b-530130954cb2" ],
4
+ Cell ["Load GmshLink package" , \
5
+ "Subsection" ,ExpressionUUID -> "9e86b217-f3c6-4773-a30b-530130954cb2" ],
6
+
7
+ Cell ["Load pacakge from the same directory as this notebook." , \
8
+ "Text" ,ExpressionUUID -> "18b35fa7-ec7b-4cad-9d2e-6b60509b4a44" ],
24
9
25
10
Cell [BoxData [
26
11
RowBox [{"Get" , "[" ,
27
12
RowBox [{"\"\< GmshLink.wl\>\" " , "," ,
28
13
RowBox [{"Path" , "\[ Rule]" ,
29
14
RowBox [{"NotebookDirectory" , "[" , "]" }]}]}], "]" }]], "Input" ,
30
- CellLabel -> "In[69]:=" ,ExpressionUUID -> "af1fa4ed-6365-4604-adc6-ecb5ad4dadc8" ],
15
+ CellLabel -> "In[1]:=" ,ExpressionUUID -> "af1fa4ed-6365-4604-adc6-ecb5ad4dadc8" ],
16
+
17
+ Cell ["\< \
18
+ Set your path to your directory containing Gmsh executable. Do not include \
19
+ the name of executable itself.\
20
+ \> " , "Text" ,ExpressionUUID -> "c78cb9f7-840d-4625-820c-e046b481604f" ],
31
21
32
22
Cell [BoxData [
33
23
RowBox [{
34
- RowBox [{"(*" , " " ,
35
- RowBox [{
36
- "Set" , " " , "your" , " " , "path" , " " , "to" , " " , "Gmsh" , " " , "executable" ,
37
- " " ,
38
- RowBox [{"here" , "." }]}], " " , "*)" }], "\[ IndentingNewLine]" ,
39
- RowBox [{
40
- RowBox [{"$GmshDirectory" , "=" ,
41
- RowBox [{"FileNameJoin" , "[" ,
42
- RowBox [{"{" ,
43
- RowBox [{
44
- "$UserDocumentsDirectory" , "," , "\"\< Software\>\" " , "," , "\"\< GMSH\>\" " ,
45
- "," , "\"\< gmsh-4.1.4-Windows64\>\" " }], "}" }], "]" }]}],
46
- ";" }]}]], "Input" ,
47
- CellLabel -> "In[70]:=" ,ExpressionUUID -> "55cc1a10-36cd-4a4c-9bcf-316cf2b3de4c" ]
24
+ RowBox [{"$GmshDirectory" , "=" ,
25
+ RowBox [{"FileNameJoin" , "[" ,
26
+ RowBox [{"{" ,
27
+ RowBox [{
28
+ "$UserDocumentsDirectory" , "," , "\"\< Software\>\" " , "," , "\"\< GMSH\>\" " ,
29
+ "," , "\"\< gmsh-4.4.1-Windows64\>\" " }], "}" }], "]" }]}],
30
+ ";" }]], "Input" ,ExpressionUUID -> "55cc1a10-36cd-4a4c-9bcf-316cf2b3de4c" ],
31
+
32
+ Cell ["Check if \[ OpenCurlyDoubleQuote]ImportMesh\[ CloseCurlyDoubleQuote] \
33
+ package is also installed." , \
34
+ "Text" ,ExpressionUUID -> "810750e7-656b-447d-b386-dd7209159fd7" ],
35
+
36
+ Cell [BoxData [
37
+ RowBox [{"PacletInformation" , "[" , "\"\< ImportMesh\>\" " , "]" }]], "Input" ,
38
+ CellLabel -> "In[21]:=" ,ExpressionUUID -> "009c7b5a-46d0-44a1-b9c4-ae975cc4e965" ]
48
39
}, Open ]],
49
40
50
41
Cell [CellGroupData [{
51
42
52
- Cell ["Example" , "Subsection" ,ExpressionUUID -> "7a56a90d-0c47-4727-8fc2-650f30b3ab24" ],
43
+ Cell ["Example" , \
44
+ "Subsection" ,ExpressionUUID -> "7a56a90d-0c47-4727-8fc2-650f30b3ab24" ],
53
45
54
46
Cell [CellGroupData [{
55
47
56
- Cell ["Region" , "Subsubsection" ,ExpressionUUID -> "8c33aff5-1ee8-4009-810f-29462c088165" ],
48
+ Cell ["Define symbolic geometric Region" , \
49
+ "Subsubsection" ,ExpressionUUID -> "8c33aff5-1ee8-4009-810f-29462c088165" ],
50
+
51
+ Cell ["Define a symbolic region in 3D." , \
52
+ "Text" ,ExpressionUUID -> "3160b6f4-4820-47ed-bd3d-fbc0c80aaec4" ],
57
53
58
54
Cell [BoxData [
59
55
RowBox [{"reg" , "=" ,
@@ -94,16 +90,25 @@ Cell[BoxData[
94
90
RowBox [{"{" ,
95
91
RowBox [{"5" , "," , "2" , "," , "2" }], "}" }]}], "]" }]}],
96
92
"\[ IndentingNewLine]" , "]" }]}]], "Input" ,
97
- CellLabel -> "In[71]:=" ,ExpressionUUID -> "873f4626-5b8b-4da8-8bdd-bb5969984ae4" ],
93
+ CellLabel -> "In[3]:=" ,ExpressionUUID -> "873f4626-5b8b-4da8-8bdd-bb5969984ae4" ],
94
+
95
+ Cell ["\< \
96
+ Visualise region. This sometimes work poorly in case of more complicated \
97
+ regions (version 12.0).\
98
+ \> " , "Text" ,ExpressionUUID -> "40f7b4cd-4811-4ca5-86b5-209a45f5e78a" ],
98
99
99
100
Cell [BoxData [
100
101
RowBox [{"Region" , "[" , "reg" , "]" }]], "Input" ,
101
- CellLabel -> "In[72 ]:=" ,ExpressionUUID -> "dc37f934-78c4-4283-81fd-77a799d4f69c" ]
102
+ CellLabel -> "In[4 ]:=" ,ExpressionUUID -> "dc37f934-78c4-4283-81fd-77a799d4f69c" ]
102
103
}, Open ]],
103
104
104
105
Cell [CellGroupData [{
105
106
106
- Cell ["Mathematica" , "Subsubsection" ,ExpressionUUID -> "0c830c6b-61b2-4f54-8754-19bc621d45f6" ],
107
+ Cell ["Mathematica meshing method" , \
108
+ "Subsubsection" ,ExpressionUUID -> "0c830c6b-61b2-4f54-8754-19bc621d45f6" ],
109
+
110
+ Cell ["Create ElementMesh with build-in mesher. " , \
111
+ "Text" ,ExpressionUUID -> "7c7557c5-7b86-44ac-99a9-356d80af4a9e" ],
107
112
108
113
Cell [BoxData [
109
114
RowBox [{"mesh" , "=" ,
@@ -112,7 +117,10 @@ Cell[BoxData[
112
117
RowBox [{"\"\< MeshOrder\>\" " , "\[ Rule]" , "1" }], "," , "\[ IndentingNewLine]" ,
113
118
RowBox [{"MeshQualityGoal" , "\[ Rule]" , "\"\< Maximal\>\" " }]}],
114
119
"\[ IndentingNewLine]" , "]" }]}]], "Input" ,
115
- CellLabel -> "In[73]:=" ,ExpressionUUID -> "ce9f3e82-9335-42d3-bb9a-c470da973333" ],
120
+ CellLabel -> "In[18]:=" ,ExpressionUUID -> "ce9f3e82-9335-42d3-bb9a-c470da973333" ],
121
+
122
+ Cell ["Minimal and average quality of elemens is not very good." , \
123
+ "Text" ,ExpressionUUID -> "4823fc17-e3ec-492e-9c8d-9585f91f5be0" ],
116
124
117
125
Cell [BoxData [{
118
126
RowBox [{
@@ -123,16 +131,27 @@ Cell[BoxData[{
123
131
RowBox [{"Through" , "[" ,
124
132
RowBox [{
125
133
RowBox [{"{" ,
126
- RowBox [{"Min" , "," , "Mean" }], "}" }], "@" , "quality" }], "]" }]}], "Input" ,
127
- CellLabel -> "In[74]:=" ,ExpressionUUID -> "8fd7c7cf-8541-4688-9eee-770ae51fa545" ],
134
+ RowBox [{"Min" , "," , "Mean" , "," , "Max" }], "}" }], "@" , "quality" }],
135
+ "]" }]}], "Input" ,
136
+ CellLabel -> "In[19]:=" ,ExpressionUUID -> "8fd7c7cf-8541-4688-9eee-770ae51fa545" ],
137
+
138
+ Cell ["\< \
139
+ The ratio between the largest and the smallest element is huge and that is \
140
+ not good.\
141
+ \> " , "Text" ,ExpressionUUID -> "de2e48d9-41ee-4790-884b-defce60aabf9" ],
128
142
129
143
Cell [BoxData [
130
144
RowBox [{"Ratios" , "@" ,
131
145
RowBox [{"MinMax" , "[" ,
132
146
RowBox [{"Join" , "@@" ,
133
147
RowBox [{"mesh" , "[" , "\"\< MeshElementMeasure\>\" " , "]" }]}],
134
148
"]" }]}]], "Input" ,
135
- CellLabel -> "In[76]:=" ,ExpressionUUID -> "64c250ea-9085-4823-8744-99ce4dc4c345" ],
149
+ CellLabel -> "In[8]:=" ,ExpressionUUID -> "64c250ea-9085-4823-8744-99ce4dc4c345" ],
150
+
151
+ Cell ["\< \
152
+ Visualize resulting mesh. See uneven distribution of elements in some \
153
+ particular regions.\
154
+ \> " , "Text" ,ExpressionUUID -> "18fa2507-688d-4d5f-a1af-88eb1ed57c49" ],
136
155
137
156
Cell [BoxData [
138
157
RowBox [{"mesh" , "[" ,
@@ -146,20 +165,30 @@ Cell[BoxData[
146
165
RowBox [{"ImageSize" , "\[ Rule]" , "300" }], "," , "\[ IndentingNewLine]" ,
147
166
RowBox [{"PlotRange" , "\[ Rule]" , "All" }]}], "\[ IndentingNewLine]" , "]" }],
148
167
"]" }]], "Input" ,
149
- CellLabel -> "In[77 ]:=" ,ExpressionUUID -> "385be21a-bec2-4e90-bd1e-4f073f4fc8f8" ]
168
+ CellLabel -> "In[9 ]:=" ,ExpressionUUID -> "385be21a-bec2-4e90-bd1e-4f073f4fc8f8" ]
150
169
}, Open ]],
151
170
152
171
Cell [CellGroupData [{
153
172
154
- Cell ["Gmsh" , "Subsubsection" ,ExpressionUUID -> "a96e88eb-3367-4ecd-982c-8585a2e28f50" ],
173
+ Cell ["Gmsh meshing method" , \
174
+ "Subsubsection" ,ExpressionUUID -> "a96e88eb-3367-4ecd-982c-8585a2e28f50" ],
175
+
176
+ Cell ["\< \
177
+ This is basic method to define GMSH should be used as mesh generator.\
178
+ \> " , "Text" ,ExpressionUUID -> "c01cb354-fa3c-4ef6-b4d3-b659aa2d2ae6" ],
155
179
156
180
Cell [BoxData [
157
181
RowBox [{"mesh" , "=" ,
158
182
RowBox [{"ToElementMesh" , "[" , "\[ IndentingNewLine]" ,
159
183
RowBox [{"reg" , "," , "\[ IndentingNewLine]" ,
184
+ RowBox [{"\"\< BoundaryMeshGenerator\>\" " , "\[ Rule]" , "None" }], "," ,
185
+ "\[ IndentingNewLine]" ,
160
186
RowBox [{"\"\< ElementMeshGenerator\>\" " , "\[ Rule]" , "GmshGenerator" }]}],
161
187
"\[ IndentingNewLine]" , "]" }]}]], "Input" ,
162
- CellLabel -> "In[78]:=" ,ExpressionUUID -> "b83f96fc-9491-4e94-b273-b53e9b5c332e" ],
188
+ CellLabel -> "In[10]:=" ,ExpressionUUID -> "b83f96fc-9491-4e94-b273-b53e9b5c332e" ],
189
+
190
+ Cell ["Minimal element quality is much better." , \
191
+ "Text" ,ExpressionUUID -> "f2612389-a9ab-49d6-b436-e95e78c2e167" ],
163
192
164
193
Cell [BoxData [{
165
194
RowBox [{
@@ -171,15 +200,24 @@ Cell[BoxData[{
171
200
RowBox [{
172
201
RowBox [{"{" ,
173
202
RowBox [{"Min" , "," , "Mean" }], "}" }], "@" , "quality" }], "]" }]}], "Input" ,
174
- CellLabel -> "In[79]:=" ,ExpressionUUID -> "41da77ad-b373-4637-9d33-983738c56895" ],
203
+ CellLabel -> "In[11]:=" ,ExpressionUUID -> "41da77ad-b373-4637-9d33-983738c56895" ],
204
+
205
+ Cell ["\< \
206
+ Also the ratio between the largest and the smallest element is much better.\
207
+ \> " , "Text" ,ExpressionUUID -> "5ad58e15-9176-4bbe-8004-a4e5b4f63c0a" ],
175
208
176
209
Cell [BoxData [
177
210
RowBox [{"Ratios" , "@" ,
178
211
RowBox [{"MinMax" , "[" ,
179
212
RowBox [{"Join" , "@@" ,
180
213
RowBox [{"mesh" , "[" , "\"\< MeshElementMeasure\>\" " , "]" }]}],
181
214
"]" }]}]], "Input" ,
182
- CellLabel -> "In[81]:=" ,ExpressionUUID -> "7d173871-0675-496f-b8c0-264b513b3ff2" ],
215
+ CellLabel -> "In[13]:=" ,ExpressionUUID -> "7d173871-0675-496f-b8c0-264b513b3ff2" ],
216
+
217
+ Cell ["\< \
218
+ See the mesh with more uniform element size distribution and accurate \
219
+ representation of boundaries.\
220
+ \> " , "Text" ,ExpressionUUID -> "e6b6152d-cbad-401c-8f72-3df98f50cd21" ],
183
221
184
222
Cell [BoxData [
185
223
RowBox [{"mesh" , "[" ,
@@ -193,29 +231,46 @@ Cell[BoxData[
193
231
RowBox [{"ImageSize" , "\[ Rule]" , "300" }], "," , "\[ IndentingNewLine]" ,
194
232
RowBox [{"PlotRange" , "\[ Rule]" , "All" }]}], "\[ IndentingNewLine]" , "]" }],
195
233
"]" }]], "Input" ,
196
- CellLabel -> "In[82 ]:=" ,ExpressionUUID -> "d7dd982d-71bf-48d0-b05c-b17fb338d088" ]
234
+ CellLabel -> "In[14 ]:=" ,ExpressionUUID -> "d7dd982d-71bf-48d0-b05c-b17fb338d088" ]
197
235
}, Open ]],
198
236
199
237
Cell [CellGroupData [{
200
238
201
- Cell ["Options" , "Subsubsection" ,ExpressionUUID -> "105ed810-aaa6-4812-8974-47b492c6ab70" ],
239
+ Cell ["Options of GmshGenerator" , \
240
+ "Subsubsection" ,ExpressionUUID -> "105ed810-aaa6-4812-8974-47b492c6ab70" ],
241
+
242
+ Cell ["See al available options of GmshGenerator function." , \
243
+ "Text" ,ExpressionUUID -> "26db999c-974e-440d-9e61-d3702791f747" ],
202
244
203
245
Cell [BoxData [
204
246
RowBox [{"Options" , "@" , "GmshGenerator" }]], "Input" ,
205
- CellLabel -> "In[83]:=" ,ExpressionUUID -> "16201586-65a4-41fa-bcea-7bcb926e44c5" ],
247
+ CellLabel -> "In[15]:=" ,ExpressionUUID -> "16201586-65a4-41fa-bcea-7bcb926e44c5" ],
248
+
249
+ Cell ["\< \
250
+ Use some options to set mesh order to 2, larger element size (MaxCellMeasure) \
251
+ and not particularly optimized element shape.\
252
+ \> " , "Text" ,ExpressionUUID -> "5b608483-b6c5-41f3-8f56-6b93752ecdb7" ],
206
253
207
254
Cell [BoxData [
208
255
RowBox [{"mesh" , "=" ,
209
256
RowBox [{"ToElementMesh" , "[" , "\[ IndentingNewLine]" ,
210
257
RowBox [{"reg" , "," , "\[ IndentingNewLine]" ,
258
+ RowBox [{"\"\< BoundaryMeshGenerator\>\" " , "\[ Rule]" , "None" }], "," ,
259
+ "\[ IndentingNewLine]" ,
211
260
RowBox [{"\"\< ElementMeshGenerator\>\" " , "\[ Rule]" ,
212
261
RowBox [{"{" ,
213
262
RowBox [{"GmshGenerator" , "," ,
214
- RowBox [{"\"\< MeshOrder\>\" " , "\[ Rule]" , "2" }]}], "}" }]}], "," ,
215
- "\[ IndentingNewLine]" ,
263
+ RowBox [{"\"\< MeshOrder\>\" " , "\[ Rule]" , "2" }], "," ,
264
+ RowBox [{"\"\< OptimizeQuality\>\" " , "\[ Rule]" , "False" }]}], "}" }]}],
265
+ "," , "\[ IndentingNewLine]" ,
216
266
RowBox [{"MaxCellMeasure" , "\[ Rule]" ,
217
267
RowBox [{"1" , "/" , "2" }]}]}], "\[ IndentingNewLine]" , "]" }]}]], "Input" ,
218
- CellLabel -> "In[84]:=" ,ExpressionUUID -> "b9ecc46d-63bd-4845-8123-a6bfd0e9adba" ],
268
+ CellLabel -> "In[16]:=" ,ExpressionUUID -> "b9ecc46d-63bd-4845-8123-a6bfd0e9adba" ],
269
+
270
+ Cell ["\< \
271
+ Visualize this coarse mesh. Note that mesh order is 2 and additional nodes \
272
+ are present on tetrahedron edges.\
273
+ \> " , "Text" ,ExpressionUUID -> "afab4048-ea8e-4d61-81c3-7d5cdf4170f2" ],
219
274
220
275
Cell [BoxData [
221
276
RowBox [{"Show" , "[" , "\[ IndentingNewLine]" ,
@@ -236,60 +291,13 @@ Cell[BoxData[
236
291
RowBox [{"Point" , "[" ,
237
292
RowBox [{"mesh" , "[" , "\"\< Coordinates\>\" " , "]" }], "]" }], "}" }],
238
293
"]" }]}], "\[ IndentingNewLine]" , "]" }]], "Input" ,
239
- CellLabel -> "In[85 ]:=" ,ExpressionUUID -> "5eb7c855-ecac-4b61-abd7-6baded7688a8" ]
294
+ CellLabel -> "In[17 ]:=" ,ExpressionUUID -> "5eb7c855-ecac-4b61-abd7-6baded7688a8" ]
240
295
}, Open ]]
241
296
}, Open ]]
242
297
},
243
298
WindowSize -> {958 , 1086 },
244
299
WindowMargins -> {{Automatic , - 8 }, {Automatic , 0 }},
245
- FrontEndVersion -> "11.3 for Microsoft Windows (64-bit) (March 6, 2018)" ,
300
+ PrivateNotebookOptions -> {"FileOutlineCache" -> False },
301
+ FrontEndVersion -> "12.0 for Microsoft Windows (64-bit) (April 8, 2019)" ,
246
302
StyleDefinitions -> "Default.nb"
247
303
]
248
- (* End of Notebook Content *)
249
-
250
- (* Internal cache information *)
251
- (*CellTagsOutline
252
- CellTagsIndex->{}
253
- *)
254
- (*CellTagsIndex
255
- CellTagsIndex->{}
256
- *)
257
- (*NotebookFileOutline
258
- Notebook[{
259
- Cell[CellGroupData[{
260
- Cell[580, 22, 89, 0, 67, "Subsection",ExpressionUUID->"9e86b217-f3c6-4773-a30b-530130954cb2"],
261
- Cell[672, 24, 250, 5, 35, "Input",ExpressionUUID->"af1fa4ed-6365-4604-adc6-ecb5ad4dadc8"],
262
- Cell[925, 31, 571, 15, 84, "Input",ExpressionUUID->"55cc1a10-36cd-4a4c-9bcf-316cf2b3de4c"]
263
- }, Open ]],
264
- Cell[CellGroupData[{
265
- Cell[1533, 51, 84, 0, 67, "Subsection",ExpressionUUID->"7a56a90d-0c47-4727-8fc2-650f30b3ab24"],
266
- Cell[CellGroupData[{
267
- Cell[1642, 55, 86, 0, 56, "Subsubsection",ExpressionUUID->"8c33aff5-1ee8-4009-810f-29462c088165"],
268
- Cell[1731, 57, 1444, 39, 228, "Input",ExpressionUUID->"873f4626-5b8b-4da8-8bdd-bb5969984ae4"],
269
- Cell[3178, 98, 140, 2, 35, "Input",ExpressionUUID->"dc37f934-78c4-4283-81fd-77a799d4f69c"]
270
- }, Open ]],
271
- Cell[CellGroupData[{
272
- Cell[3355, 105, 91, 0, 56, "Subsubsection",ExpressionUUID->"0c830c6b-61b2-4f54-8754-19bc621d45f6"],
273
- Cell[3449, 107, 409, 7, 132, "Input",ExpressionUUID->"ce9f3e82-9335-42d3-bb9a-c470da973333"],
274
- Cell[3861, 116, 376, 10, 60, "Input",ExpressionUUID->"8fd7c7cf-8541-4688-9eee-770ae51fa545"],
275
- Cell[4240, 128, 256, 6, 35, "Input",ExpressionUUID->"64c250ea-9085-4823-8744-99ce4dc4c345"],
276
- Cell[4499, 136, 662, 12, 180, "Input",ExpressionUUID->"385be21a-bec2-4e90-bd1e-4f073f4fc8f8"]
277
- }, Open ]],
278
- Cell[CellGroupData[{
279
- Cell[5198, 153, 84, 0, 56, "Subsubsection",ExpressionUUID->"a96e88eb-3367-4ecd-982c-8585a2e28f50"],
280
- Cell[5285, 155, 340, 6, 108, "Input",ExpressionUUID->"b83f96fc-9491-4e94-b273-b53e9b5c332e"],
281
- Cell[5628, 163, 376, 10, 60, "Input",ExpressionUUID->"41da77ad-b373-4637-9d33-983738c56895"],
282
- Cell[6007, 175, 256, 6, 35, "Input",ExpressionUUID->"7d173871-0675-496f-b8c0-264b513b3ff2"],
283
- Cell[6266, 183, 662, 12, 180, "Input",ExpressionUUID->"d7dd982d-71bf-48d0-b05c-b17fb338d088"]
284
- }, Open ]],
285
- Cell[CellGroupData[{
286
- Cell[6965, 200, 87, 0, 56, "Subsubsection",ExpressionUUID->"105ed810-aaa6-4812-8974-47b492c6ab70"],
287
- Cell[7055, 202, 146, 2, 35, "Input",ExpressionUUID->"16201586-65a4-41fa-bcea-7bcb926e44c5"],
288
- Cell[7204, 206, 547, 11, 132, "Input",ExpressionUUID->"b9ecc46d-63bd-4845-8123-a6bfd0e9adba"],
289
- Cell[7754, 219, 962, 19, 252, "Input",ExpressionUUID->"5eb7c855-ecac-4b61-abd7-6baded7688a8"]
290
- }, Open ]]
291
- }, Open ]]
292
- }
293
- ]
294
- *)
295
-
0 commit comments