Skip to content

Commit 0de2376

Browse files
authored
Merge pull request #2 from underworldcode/swarm-rework-dev-merged
Swarm rework dev merged - pull all development branch changes back into the swarm rework for synchronisation and testing.
2 parents 9a71dc6 + b8becc6 commit 0de2376

35 files changed

Lines changed: 4524 additions & 1285 deletions

docs/user/Notebooks/1-Meshes.ipynb

Lines changed: 87 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,13 @@
1414
},
1515
"source": [
1616
"<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+
"![](media/SampleSphericalMesh.png)\n",
19+
"\n",
2220
"</div>\n",
2321
"\n",
2422
"\n",
25-
"# Notebook 1: Meshes\n",
23+
"## Notebook 1: Meshes\n",
2624
"\n",
2725
"Introducing meshes: how to build them, interrogate them and visualise them.\n",
2826
"\n",
@@ -36,7 +34,6 @@
3634
"\n",
3735
"Mesh adaptivity is a work-in-progress.\n",
3836
"\n",
39-
"\n",
4037
"\n"
4138
]
4239
},
@@ -64,7 +61,7 @@
6461
},
6562
{
6663
"cell_type": "code",
67-
"execution_count": 9,
64+
"execution_count": 2,
6865
"id": "5a4437ff-63ae-4ffa-9f2b-8ec1b8b4baeb",
6966
"metadata": {
7067
"editable": true,
@@ -74,7 +71,15 @@
7471
},
7572
"tags": []
7673
},
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+
],
7883
"source": [
7984
"#| output: false # Suppress warnings in html version\n",
8085
"\n",
@@ -100,7 +105,7 @@
100105
},
101106
{
102107
"cell_type": "code",
103-
"execution_count": 3,
108+
"execution_count": 22,
104109
"id": "1c928d60-24a9-4415-ab22-41834695c70a",
105110
"metadata": {
106111
"editable": true,
@@ -109,15 +114,26 @@
109114
},
110115
"tags": []
111116
},
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+
],
113129
"source": [
114130
"mesh = uw.meshing.uw.meshing.CubedSphere(\n",
115131
" radiusOuter=1.0,\n",
116132
" radiusInner=0.547,\n",
117133
" numElements=8,\n",
118134
" refinement=0,\n",
119-
" simplex=False,\n",
120-
" verbose=False,\n",
135+
" simplex=True,\n",
136+
" verbose=True,\n",
121137
")"
122138
]
123139
},
@@ -141,7 +157,7 @@
141157
},
142158
{
143159
"cell_type": "code",
144-
"execution_count": 4,
160+
"execution_count": 23,
145161
"id": "b9cfac97-5c19-46b1-aebd-0fb77678b9ed",
146162
"metadata": {},
147163
"outputs": [
@@ -152,12 +168,12 @@
152168
" [-0.57735027, 0.57735027, -0.57735027],\n",
153169
" [-0.57735027, -0.57735027, -0.57735027],\n",
154170
" ...,\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]])"
158174
]
159175
},
160-
"execution_count": 4,
176+
"execution_count": 23,
161177
"metadata": {},
162178
"output_type": "execute_result"
163179
}
@@ -166,6 +182,14 @@
166182
"mesh.data"
167183
]
168184
},
185+
{
186+
"cell_type": "code",
187+
"execution_count": null,
188+
"id": "a7c5dd7e-58d2-45d0-bfc6-eaded6da20f0",
189+
"metadata": {},
190+
"outputs": [],
191+
"source": []
192+
},
169193
{
170194
"cell_type": "markdown",
171195
"id": "1ed56724-adc5-49c6-a33b-4552b619cb07",
@@ -208,7 +232,7 @@
208232
},
209233
{
210234
"cell_type": "code",
211-
"execution_count": 5,
235+
"execution_count": 26,
212236
"id": "1cb8378c-cdb8-4e75-bd12-e85f12169ef7",
213237
"metadata": {
214238
"editable": true,
@@ -226,13 +250,14 @@
226250
"\n",
227251
"pvmesh = vis.mesh_to_pv_mesh(mesh)\n",
228252
"pvmesh.point_data[\"z\"] = vis.scalar_fn_to_pv_points(pvmesh, mesh.CoordinateSystem.X[2])\n",
253+
"pvmesh1 = pvmesh.copy()\n",
229254
"\n",
230255
"if mesh.dim==3:\n",
231256
" pvmesh_c = pvmesh.clip( normal='z', crinkle=True, inplace=False, origin=(0.0,0.0,0.01))\n",
232257
"\n",
233258
"pl = pv.Plotter(window_size=(750, 750))\n",
234259
"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",
236261
"\n",
237262
"\n",
238263
"# Save and show the mesh\n",
@@ -241,7 +266,7 @@
241266
},
242267
{
243268
"cell_type": "code",
244-
"execution_count": 6,
269+
"execution_count": 27,
245270
"id": "fd6cbed0-3159-4c6c-a482-6a9636158854",
246271
"metadata": {
247272
"editable": true,
@@ -266,10 +291,10 @@
266291
" "
267292
],
268293
"text/plain": [
269-
"<IPython.lib.display.IFrame at 0x155c7fc90>"
294+
"<IPython.lib.display.IFrame at 0x35f726660>"
270295
]
271296
},
272-
"execution_count": 6,
297+
"execution_count": 27,
273298
"metadata": {},
274299
"output_type": "execute_result"
275300
}
@@ -320,10 +345,10 @@
320345
{
321346
"data": {
322347
"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]$"
324349
],
325350
"text/plain": [
326-
"Matrix([[{ r \\hspace{ 0.0pt } }, { \\theta \\hspace{ 0.01pt } }, { \\phi \\hspace{ 0.02pt } }]])"
351+
"Matrix([[r, \\theta, \\phi]])"
327352
]
328353
},
329354
"metadata": {},
@@ -382,33 +407,44 @@
382407
"\n",
383408
"\n",
384409
"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",
385432
"\n",
386433
"No variables are defined on the mesh\n",
387434
"\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",
395444
"\n",
396445
"\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"
412448
]
413449
}
414450
],
@@ -438,25 +474,17 @@
438474
{
439475
"cell_type": "code",
440476
"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",
450478
"metadata": {},
451479
"outputs": [],
452480
"source": []
453481
}
454482
],
455483
"metadata": {
456484
"kernelspec": {
457-
"display_name": "Python 3 (ipykernel)",
485+
"display_name": "Python (Pixi)",
458486
"language": "python",
459-
"name": "python3"
487+
"name": "pixi-kernel-python3"
460488
},
461489
"language_info": {
462490
"codemirror_mode": {
@@ -468,7 +496,7 @@
468496
"name": "python",
469497
"nbconvert_exporter": "python",
470498
"pygments_lexer": "ipython3",
471-
"version": "3.11.10"
499+
"version": "3.12.11"
472500
}
473501
},
474502
"nbformat": 4,

0 commit comments

Comments
 (0)