|
14 | 14 | }, |
15 | 15 | "source": [ |
16 | 16 | "<div style=\"float: right; width: 40%\">\n", |
17 | | - "<img src=\"media/SampleSphericalMesh.png\" width=100%>\n", |
18 | | - "<caption>\n", |
19 | | - "<i>\n", |
20 | | - "</i>\n", |
21 | | - "</caption>\n", |
| 17 | + " \n", |
| 18 | + "\n", |
| 19 | + "\n", |
22 | 20 | "</div>\n", |
23 | 21 | "\n", |
24 | 22 | "\n", |
25 | | - "# Notebook 1: Meshes\n", |
| 23 | + "## Notebook 1: Meshes\n", |
26 | 24 | "\n", |
27 | 25 | "Introducing meshes: how to build them, interrogate them and visualise them.\n", |
28 | 26 | "\n", |
|
36 | 34 | "\n", |
37 | 35 | "Mesh adaptivity is a work-in-progress.\n", |
38 | 36 | "\n", |
39 | | - "\n", |
40 | 37 | "\n" |
41 | 38 | ] |
42 | 39 | }, |
|
64 | 61 | }, |
65 | 62 | { |
66 | 63 | "cell_type": "code", |
67 | | - "execution_count": 9, |
| 64 | + "execution_count": 2, |
68 | 65 | "id": "5a4437ff-63ae-4ffa-9f2b-8ec1b8b4baeb", |
69 | 66 | "metadata": { |
70 | 67 | "editable": true, |
|
74 | 71 | }, |
75 | 72 | "tags": [] |
76 | 73 | }, |
77 | | - "outputs": [], |
| 74 | + "outputs": [ |
| 75 | + { |
| 76 | + "name": "stdout", |
| 77 | + "output_type": "stream", |
| 78 | + "text": [ |
| 79 | + "PostHog telemetry failed: HTTPSConnectionPool(host='eu.i.posthog.com', port=443): Max retries exceeded with url: /capture/ (Caused by NameResolutionError(\"<urllib3.connection.HTTPSConnection object at 0x3049912b0>: Failed to resolve 'eu.i.posthog.com' ([Errno 8] nodename nor servname provided, or not known)\"))\n" |
| 80 | + ] |
| 81 | + } |
| 82 | + ], |
78 | 83 | "source": [ |
79 | 84 | "#| output: false # Suppress warnings in html version\n", |
80 | 85 | "\n", |
|
100 | 105 | }, |
101 | 106 | { |
102 | 107 | "cell_type": "code", |
103 | | - "execution_count": 3, |
| 108 | + "execution_count": 22, |
104 | 109 | "id": "1c928d60-24a9-4415-ab22-41834695c70a", |
105 | 110 | "metadata": { |
106 | 111 | "editable": true, |
|
109 | 114 | }, |
110 | 115 | "tags": [] |
111 | 116 | }, |
112 | | - "outputs": [], |
| 117 | + "outputs": [ |
| 118 | + { |
| 119 | + "name": "stdout", |
| 120 | + "output_type": "stream", |
| 121 | + "text": [ |
| 122 | + "Constructing UW mesh from gmsh .meshes/uw_cubed_spherical_shell_ro1.0_ri0.547_elts8_plexTrue.msh\n", |
| 123 | + "Mesh refinement levels: 0\n", |
| 124 | + "Mesh coarsening levels: None\n", |
| 125 | + "Populating mesh coordinates CoordinateSystemType.SPHERICAL\n" |
| 126 | + ] |
| 127 | + } |
| 128 | + ], |
113 | 129 | "source": [ |
114 | 130 | "mesh = uw.meshing.uw.meshing.CubedSphere(\n", |
115 | 131 | " radiusOuter=1.0,\n", |
116 | 132 | " radiusInner=0.547,\n", |
117 | 133 | " numElements=8,\n", |
118 | 134 | " refinement=0,\n", |
119 | | - " simplex=False,\n", |
120 | | - " verbose=False,\n", |
| 135 | + " simplex=True,\n", |
| 136 | + " verbose=True,\n", |
121 | 137 | ")" |
122 | 138 | ] |
123 | 139 | }, |
|
141 | 157 | }, |
142 | 158 | { |
143 | 159 | "cell_type": "code", |
144 | | - "execution_count": 4, |
| 160 | + "execution_count": 23, |
145 | 161 | "id": "b9cfac97-5c19-46b1-aebd-0fb77678b9ed", |
146 | 162 | "metadata": {}, |
147 | 163 | "outputs": [ |
|
152 | 168 | " [-0.57735027, 0.57735027, -0.57735027],\n", |
153 | 169 | " [-0.57735027, -0.57735027, -0.57735027],\n", |
154 | 170 | " ...,\n", |
155 | | - " [ 0.58691901, -0.41511058, -0.41511058],\n", |
156 | | - " [ 0.6269543 , -0.44342636, -0.44342636],\n", |
157 | | - " [ 0.66698958, -0.47174214, -0.47174214]])" |
| 171 | + " [ 0.61340251, 0.4866531 , 0.41538064],\n", |
| 172 | + " [ 0.56556024, 0.42209717, 0.44274422],\n", |
| 173 | + " [ 0.51755571, 0.41031492, 0.44421012]])" |
158 | 174 | ] |
159 | 175 | }, |
160 | | - "execution_count": 4, |
| 176 | + "execution_count": 23, |
161 | 177 | "metadata": {}, |
162 | 178 | "output_type": "execute_result" |
163 | 179 | } |
|
166 | 182 | "mesh.data" |
167 | 183 | ] |
168 | 184 | }, |
| 185 | + { |
| 186 | + "cell_type": "code", |
| 187 | + "execution_count": null, |
| 188 | + "id": "a7c5dd7e-58d2-45d0-bfc6-eaded6da20f0", |
| 189 | + "metadata": {}, |
| 190 | + "outputs": [], |
| 191 | + "source": [] |
| 192 | + }, |
169 | 193 | { |
170 | 194 | "cell_type": "markdown", |
171 | 195 | "id": "1ed56724-adc5-49c6-a33b-4552b619cb07", |
|
208 | 232 | }, |
209 | 233 | { |
210 | 234 | "cell_type": "code", |
211 | | - "execution_count": 5, |
| 235 | + "execution_count": 26, |
212 | 236 | "id": "1cb8378c-cdb8-4e75-bd12-e85f12169ef7", |
213 | 237 | "metadata": { |
214 | 238 | "editable": true, |
|
226 | 250 | "\n", |
227 | 251 | "pvmesh = vis.mesh_to_pv_mesh(mesh)\n", |
228 | 252 | "pvmesh.point_data[\"z\"] = vis.scalar_fn_to_pv_points(pvmesh, mesh.CoordinateSystem.X[2])\n", |
| 253 | + "pvmesh1 = pvmesh.copy()\n", |
229 | 254 | "\n", |
230 | 255 | "if mesh.dim==3:\n", |
231 | 256 | " pvmesh_c = pvmesh.clip( normal='z', crinkle=True, inplace=False, origin=(0.0,0.0,0.01))\n", |
232 | 257 | "\n", |
233 | 258 | "pl = pv.Plotter(window_size=(750, 750))\n", |
234 | 259 | "pl.add_mesh(pvmesh_c, show_edges=True, show_scalar_bar=False, opacity=1.0)\n", |
235 | | - "pl.add_mesh(pvmesh, show_edges=True, show_scalar_bar=False, opacity=0.3)\n", |
| 260 | + "pl.add_mesh(pvmesh1, show_edges=True, show_scalar_bar=False, opacity=0.3)\n", |
236 | 261 | "\n", |
237 | 262 | "\n", |
238 | 263 | "# Save and show the mesh\n", |
|
241 | 266 | }, |
242 | 267 | { |
243 | 268 | "cell_type": "code", |
244 | | - "execution_count": 6, |
| 269 | + "execution_count": 27, |
245 | 270 | "id": "fd6cbed0-3159-4c6c-a482-6a9636158854", |
246 | 271 | "metadata": { |
247 | 272 | "editable": true, |
|
266 | 291 | " " |
267 | 292 | ], |
268 | 293 | "text/plain": [ |
269 | | - "<IPython.lib.display.IFrame at 0x155c7fc90>" |
| 294 | + "<IPython.lib.display.IFrame at 0x35f726660>" |
270 | 295 | ] |
271 | 296 | }, |
272 | | - "execution_count": 6, |
| 297 | + "execution_count": 27, |
273 | 298 | "metadata": {}, |
274 | 299 | "output_type": "execute_result" |
275 | 300 | } |
|
320 | 345 | { |
321 | 346 | "data": { |
322 | 347 | "text/latex": [ |
323 | | - "$\\displaystyle \\left[\\begin{matrix}{ r \\hspace{ 0.0pt } } & { \\theta \\hspace{ 0.01pt } } & { \\phi \\hspace{ 0.02pt } }\\end{matrix}\\right]$" |
| 348 | + "$\\displaystyle \\left[\\begin{matrix}r & \\theta & \\phi\\end{matrix}\\right]$" |
324 | 349 | ], |
325 | 350 | "text/plain": [ |
326 | | - "Matrix([[{ r \\hspace{ 0.0pt } }, { \\theta \\hspace{ 0.01pt } }, { \\phi \\hspace{ 0.02pt } }]])" |
| 351 | + "Matrix([[r, \\theta, \\phi]])" |
327 | 352 | ] |
328 | 353 | }, |
329 | 354 | "metadata": {}, |
|
382 | 407 | "\n", |
383 | 408 | "\n", |
384 | 409 | "Mesh # 0: .meshes/uw_cubed_spherical_shell_ro1.0_ri0.547_elts8_plexFalse.msh\n", |
| 410 | + "\n" |
| 411 | + ] |
| 412 | + }, |
| 413 | + { |
| 414 | + "data": { |
| 415 | + "application/vnd.jupyter.widget-view+json": { |
| 416 | + "model_id": "f18b77ba1d8d44ae96a3832ea3ffa5a3", |
| 417 | + "version_major": 2, |
| 418 | + "version_minor": 0 |
| 419 | + }, |
| 420 | + "text/plain": [ |
| 421 | + "Widget(value='<iframe src=\"http://localhost:50188/index.html?ui=P_0x307b3b5f0_1&reconnect=auto\" class=\"pyvista…" |
| 422 | + ] |
| 423 | + }, |
| 424 | + "metadata": {}, |
| 425 | + "output_type": "display_data" |
| 426 | + }, |
| 427 | + { |
| 428 | + "name": "stdout", |
| 429 | + "output_type": "stream", |
| 430 | + "text": [ |
| 431 | + "Number of cells: 3072\n", |
385 | 432 | "\n", |
386 | 433 | "No variables are defined on the mesh\n", |
387 | 434 | "\n", |
388 | | - "| Boundary Name | ID | Min Size | Max Size |\n", |
389 | | - "| ------------------------------------------------------ |\n", |
390 | | - "| Lower | 1 | 678 | 678 |\n", |
391 | | - "| Upper | 2 | 678 | 678 |\n", |
392 | | - "| All_Boundaries | 1001 | 768 | 768 |\n", |
393 | | - "| UW_Boundaries | -- | 1356 | 1356 |\n", |
394 | | - "| ------------------------------------------------------ |\n", |
| 435 | + "| Boundary Name | ID |\n", |
| 436 | + "| -------------------------------- |\n", |
| 437 | + "| Lower | 1 |\n", |
| 438 | + "| Upper | 2 |\n", |
| 439 | + "| Null_Boundary | 666 |\n", |
| 440 | + "| All_Boundaries | 1001 |\n", |
| 441 | + "| All_Boundaries | 1001 |\n", |
| 442 | + "| UW_Boundaries | -- |\n", |
| 443 | + "| -------------------------------- |\n", |
395 | 444 | "\n", |
396 | 445 | "\n", |
397 | | - "DM Object: uw_.meshes/uw_cubed_spherical_shell_ro1.0_ri0.547_elts8_plexFalse.msh 1 MPI process\n", |
398 | | - " type: plex\n", |
399 | | - "uw_.meshes/uw_cubed_spherical_shell_ro1.0_ri0.547_elts8_plexFalse.msh in 3 dimensions:\n", |
400 | | - " Number of 0-cells per rank: 3474\n", |
401 | | - " Number of 1-cells per rank: 10000\n", |
402 | | - " Number of 2-cells per rank: 9600\n", |
403 | | - " Number of 3-cells per rank: 3072\n", |
404 | | - "Labels:\n", |
405 | | - " depth: 4 strata with value/size (0 (3474), 1 (10000), 2 (9600), 3 (3072))\n", |
406 | | - " All_Boundaries: 1 strata with value/size (1001 (768))\n", |
407 | | - " Elements: 1 strata with value/size (99999 (5130))\n", |
408 | | - " Lower: 1 strata with value/size (1 (678))\n", |
409 | | - " Upper: 1 strata with value/size (2 (678))\n", |
410 | | - " celltype: 4 strata with value/size (0 (3474), 1 (10000), 4 (9600), 7 (3072))\n", |
411 | | - " UW_Boundaries: 2 strata with value/size (1 (678), 2 (678))\n" |
| 446 | + "Use view(1) to view detailed mesh information.\n", |
| 447 | + "\n" |
412 | 448 | ] |
413 | 449 | } |
414 | 450 | ], |
|
438 | 474 | { |
439 | 475 | "cell_type": "code", |
440 | 476 | "execution_count": null, |
441 | | - "id": "4c23a076-d47a-4d27-80b7-b28b0ad38523", |
442 | | - "metadata": {}, |
443 | | - "outputs": [], |
444 | | - "source": [] |
445 | | - }, |
446 | | - { |
447 | | - "cell_type": "code", |
448 | | - "execution_count": null, |
449 | | - "id": "85dd4cc4-ae92-4dba-a917-298590533ca0", |
| 477 | + "id": "2374ad95-c893-49a8-9915-de68374135ba", |
450 | 478 | "metadata": {}, |
451 | 479 | "outputs": [], |
452 | 480 | "source": [] |
453 | 481 | } |
454 | 482 | ], |
455 | 483 | "metadata": { |
456 | 484 | "kernelspec": { |
457 | | - "display_name": "Python 3 (ipykernel)", |
| 485 | + "display_name": "Python (Pixi)", |
458 | 486 | "language": "python", |
459 | | - "name": "python3" |
| 487 | + "name": "pixi-kernel-python3" |
460 | 488 | }, |
461 | 489 | "language_info": { |
462 | 490 | "codemirror_mode": { |
|
468 | 496 | "name": "python", |
469 | 497 | "nbconvert_exporter": "python", |
470 | 498 | "pygments_lexer": "ipython3", |
471 | | - "version": "3.11.10" |
| 499 | + "version": "3.12.11" |
472 | 500 | } |
473 | 501 | }, |
474 | 502 | "nbformat": 4, |
|
0 commit comments