Skip to content

Commit b786cbb

Browse files
committed
Add Binder badges to all tutorial notebooks
- Each tutorial now has a clickable Binder badge at the top - Badge links directly to that specific notebook on mybinder.org - Fixed "Notebook 8" reference in 1-Meshes.ipynb to be a proper link Underworld development team with AI support from Claude Code
1 parent e9726b9 commit b786cbb

16 files changed

+17
-349
lines changed

docs/beginner/tutorials/1-Meshes.ipynb

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,7 @@
1717
},
1818
"tags": []
1919
},
20-
"source": [
21-
"\n",
22-
"# Notebook 1: Meshes\n",
23-
"\n",
24-
"<div style=\"float: right; width: 40%\">\n",
25-
" \n",
26-
"![](media/SampleSphericalMesh.png)\n",
27-
"\n",
28-
"</div>\n",
29-
"\n",
30-
"\n",
31-
"\n",
32-
"This notebookIntroduces the mesh discretisation that we use in `Underworld3` and how you can build one of the pre-defined meshes. This notebook also show you how to use the `pyvista` visualisation tools for `Underworld3` objects. The mesh holds information on the mesh geometry, boundaries and coordinate systems and you can attach data to the mesh (see Notebook 2: [Variables](2-Variables.ipynb)). \n"
33-
]
20+
"source": "# Notebook 1: Meshes\n\n[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/underworldcode/uw3-binder-launcher/development?labpath=underworld3%2Fdocs%2Fbeginner%2Ftutorials%2F1-Meshes.ipynb)\n\n<div style=\"float: right; width: 40%\">\n \n![](media/SampleSphericalMesh.png)\n\n</div>\n\n\n\nThis notebook introduces the mesh discretisation that we use in `Underworld3` and how you can build one of the pre-defined meshes. This notebook also show you how to use the `pyvista` visualisation tools for `Underworld3` objects. The mesh holds information on the mesh geometry, boundaries and coordinate systems and you can attach data to the mesh (see Notebook 2: [Variables](2-Variables.ipynb)). "
3421
},
3522
{
3623
"cell_type": "code",
@@ -307,20 +294,7 @@
307294
"cell_type": "markdown",
308295
"id": "0c208112-a595-4d47-a5ad-acf3e16f699d",
309296
"metadata": {},
310-
"source": [
311-
"### Mesh deformation\n",
312-
"\n",
313-
"You can adjust the coordinates using:\n",
314-
"\n",
315-
"```python\n",
316-
" mesh.deform(local_coordinate_array)\n",
317-
"```\n",
318-
"This rebuilds all the finite element gadgets that live on the mesh but it\n",
319-
"will not do any remeshing of the points. It is useful for small deformation\n",
320-
"such as following a free surface but not large-deformation adaptive meshing.\n",
321-
"\n",
322-
"See Notebook 8 for a short mesh-deformation example.\n"
323-
]
297+
"source": "### Mesh deformation\n\nYou can adjust the coordinates using:\n\n```python\n mesh.deform(local_coordinate_array)\n```\nThis rebuilds all the finite element gadgets that live on the mesh but it\nwill not do any remeshing of the points. It is useful for small deformation\nsuch as following a free surface but not large-deformation adaptive meshing.\n\nSee [Notebook 8: Timestepping (coupled)](8-Timestepping-coupled.ipynb) for a short mesh-deformation example."
324298
}
325299
],
326300
"metadata": {

docs/beginner/tutorials/10-Particle_Swarms.ipynb

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,29 +4,7 @@
44
"cell_type": "markdown",
55
"id": "26d2a9ca-c094-40f2-b978-333c14142874",
66
"metadata": {},
7-
"source": [
8-
"# Notebook 8: Particle Swarms\n",
9-
"\n",
10-
"<!--\n",
11-
"<div style=\"float: right; width: 50%; padding-left:10px;\">\n",
12-
"<img src=\"media/CompositeImage.png\" width=100%>\n",
13-
"<caption>\n",
14-
"<i>\n",
15-
" Flow in a pipe with inflow at the left boundary\n",
16-
" after 50, 100, 150 timesteps (top to bottom) showing the\n",
17-
" progression of the impulsive initial condition. For details,\n",
18-
" see the notebook code.\n",
19-
"</i>\n",
20-
"</caption>\n",
21-
"</div>\n",
22-
"-->\n",
23-
"\n",
24-
"We used a particle swarm to track the flow in Example 7. We called this a \"passive\" swarm because the points did not influence the flow in any way but were simply carried along with the fluid. \n",
25-
"\n",
26-
"Particle swarms are unstructured data objects that live within the computational domain. Their points can be moved arbitrarily through the domain and points may migrate from one process to another when the coordinates are changed. By default they carry only the particle location, but we can add scalar, vector and tensor variables to the swarm and they will be transported with the particles.\n",
27-
"\n",
28-
"Particle transport is usually through a velocity or displacement field that incrementally changes the locations. This is a common use, but particles can be used to represent any unstructured field. For example, during mesh adaptation, the nodal points from the previous mesh are equivalent to a disconnected swarm from the point of view of the new mesh. The same is true when reading data save from one mesh to the `MeshVariables` on another.\n"
29-
]
7+
"source": "# Notebook 8: Particle Swarms\n\n[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/underworldcode/uw3-binder-launcher/development?labpath=underworld3%2Fdocs%2Fbeginner%2Ftutorials%2F10-Particle_Swarms.ipynb)\n\n\n<!--\n<div style=\"float: right; width: 50%; padding-left:10px;\">\n<img src=\"media/CompositeImage.png\" width=100%>\n<caption>\n<i>\n Flow in a pipe with inflow at the left boundary\n after 50, 100, 150 timesteps (top to bottom) showing the\n progression of the impulsive initial condition. For details,\n see the notebook code.\n</i>\n</caption>\n</div>\n-->\n\nWe used a particle swarm to track the flow in Example 7. We called this a \"passive\" swarm because the points did not influence the flow in any way but were simply carried along with the fluid. \n\nParticle swarms are unstructured data objects that live within the computational domain. Their points can be moved arbitrarily through the domain and points may migrate from one process to another when the coordinates are changed. By default they carry only the particle location, but we can add scalar, vector and tensor variables to the swarm and they will be transported with the particles.\n\nParticle transport is usually through a velocity or displacement field that incrementally changes the locations. This is a common use, but particles can be used to represent any unstructured field. For example, during mesh adaptation, the nodal points from the previous mesh are equivalent to a disconnected swarm from the point of view of the new mesh. The same is true when reading data save from one mesh to the `MeshVariables` on another.\n"
308
},
319
{
3210
"cell_type": "code",

docs/beginner/tutorials/11-Multi-Material_SolCx.ipynb

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -4,36 +4,7 @@
44
"cell_type": "markdown",
55
"id": "cell-intro",
66
"metadata": {},
7-
"source": [
8-
"# Notebook 9: Multi-Material Constitutive Models\n",
9-
"\n",
10-
"**PHYSICS:** fluid_mechanics \n",
11-
"**DIFFICULTY:** intermediate \n",
12-
"**PURPOSE:** demonstration\n",
13-
"\n",
14-
"## Description\n",
15-
"\n",
16-
"This notebook demonstrates the new multi-material constitutive model by recreating the classic SolCx benchmark using two different materials instead of a piecewise viscosity function.\n",
17-
"\n",
18-
"**Key Features:**\n",
19-
"- Multi-material constitutive model with level-set averaging\n",
20-
"- Index swarm variable for material tracking\n",
21-
"- Comparison with analytical SolCx solution\n",
22-
"- Simple setup suitable for quickstart examples\n",
23-
"\n",
24-
"**Physical Setup:**\n",
25-
"- Two materials: low viscosity ($\\eta=1$) and high viscosity ($\\eta=10^6$)\n",
26-
"- Material boundary at x = 0.5\n",
27-
"- SolCx harmonic forcing: $f_y = -\\cos(\\pi x) \\sin(2\\pi y)$\n",
28-
"- Free slip boundary conditions\n",
29-
"\n",
30-
"## Mathematical Foundation\n",
31-
"\n",
32-
"The multi-material model uses level-set weighted flux averaging:\n",
33-
"$$\\mathbf{f}_{\\text{composite}}(\\mathbf{x}) = \\sum_{i=0}^{N-1} \\phi_i(\\mathbf{x}) \\cdot \\mathbf{f}_i(\\mathbf{x})$$\n",
34-
"\n",
35-
"where $\\phi_i(\\mathbf{x})$ are level-set functions from IndexSwarmVariable."
36-
]
7+
"source": "# Notebook 9: Multi-Material Constitutive Models\n\n[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/underworldcode/uw3-binder-launcher/development?labpath=underworld3%2Fdocs%2Fbeginner%2Ftutorials%2F11-Multi-Material_SolCx.ipynb)\n\n\n**PHYSICS:** fluid_mechanics \n**DIFFICULTY:** intermediate \n**PURPOSE:** demonstration\n\n## Description\n\nThis notebook demonstrates the new multi-material constitutive model by recreating the classic SolCx benchmark using two different materials instead of a piecewise viscosity function.\n\n**Key Features:**\n- Multi-material constitutive model with level-set averaging\n- Index swarm variable for material tracking\n- Comparison with analytical SolCx solution\n- Simple setup suitable for quickstart examples\n\n**Physical Setup:**\n- Two materials: low viscosity ($\\eta=1$) and high viscosity ($\\eta=10^6$)\n- Material boundary at x = 0.5\n- SolCx harmonic forcing: $f_y = -\\cos(\\pi x) \\sin(2\\pi y)$\n- Free slip boundary conditions\n\n## Mathematical Foundation\n\nThe multi-material model uses level-set weighted flux averaging:\n$$\\mathbf{f}_{\\text{composite}}(\\mathbf{x}) = \\sum_{i=0}^{N-1} \\phi_i(\\mathbf{x}) \\cdot \\mathbf{f}_i(\\mathbf{x})$$\n\nwhere $\\phi_i(\\mathbf{x})$ are level-set functions from IndexSwarmVariable."
378
},
389
{
3910
"cell_type": "markdown",

docs/beginner/tutorials/12-Units_System.ipynb

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,7 @@
33
{
44
"cell_type": "markdown",
55
"metadata": {},
6-
"source": [
7-
"# Notebook 12: Working with Physical Units\n",
8-
"\n",
9-
"Underworld3 has built-in support for physical units throughout the modeling workflow. This makes your models easier to understand and helps catch dimensional errors early.\n",
10-
"\n",
11-
"In this notebook you'll learn:\n",
12-
"- Creating physical quantities (temperatures, velocities, viscosities)\n",
13-
"- Converting between units\n",
14-
"- Working with unit-aware arrays and coordinates\n",
15-
"- Automatic unit tracking through derivatives"
16-
]
6+
"source": "# Notebook 12: Working with Physical Units\n\n[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/underworldcode/uw3-binder-launcher/development?labpath=underworld3%2Fdocs%2Fbeginner%2Ftutorials%2F12-Units_System.ipynb)\n\n\nUnderworld3 has built-in support for physical units throughout the modeling workflow. This makes your models easier to understand and helps catch dimensional errors early.\n\nIn this notebook you'll learn:\n- Creating physical quantities (temperatures, velocities, viscosities)\n- Converting between units\n- Working with unit-aware arrays and coordinates\n- Automatic unit tracking through derivatives"
177
},
188
{
199
"cell_type": "code",

docs/beginner/tutorials/13-Scaling-problems-with-physical-units.ipynb

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,7 @@
44
"cell_type": "markdown",
55
"id": "cell-0",
66
"metadata": {},
7-
"source": [
8-
"# Notebook 13: Non-Dimensional Scaling\n",
9-
"\n",
10-
"When working with physical problems, the range of scales can cause numerical difficulties. For example, mantle convection involves:\n",
11-
"- Velocities of ~10\u207b\u2079 m/s (tiny)\n",
12-
"- Viscosities of ~10\u00b2\u00b9 Pa\u00b7s (huge)\n",
13-
"- Pressures of ~10\u2079 Pa (large)\n",
14-
"\n",
15-
"Non-dimensional (ND) scaling transforms the problem so all quantities are order-one, improving numerical conditioning and stability.\n",
16-
"\n",
17-
"In this notebook you'll learn:\n",
18-
"- Setting reference quantities for automatic scaling\n",
19-
"- Solving Poisson and Stokes equations with ND scaling\n",
20-
"- Understanding what happens under the hood\n",
21-
"- Validating that ND and dimensional solutions match"
22-
]
7+
"source": "# Notebook 13: Non-Dimensional Scaling\n\n[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/underworldcode/uw3-binder-launcher/development?labpath=underworld3%2Fdocs%2Fbeginner%2Ftutorials%2F13-Scaling-problems-with-physical-units.ipynb)\n\n\nWhen working with physical problems, the range of scales can cause numerical difficulties. For example, mantle convection involves:\n- Velocities of ~10\u207b\u2079 m/s (tiny)\n- Viscosities of ~10\u00b2\u00b9 Pa\u00b7s (huge)\n- Pressures of ~10\u2079 Pa (large)\n\nNon-dimensional (ND) scaling transforms the problem so all quantities are order-one, improving numerical conditioning and stability.\n\nIn this notebook you'll learn:\n- Setting reference quantities for automatic scaling\n- Solving Poisson and Stokes equations with ND scaling\n- Understanding what happens under the hood\n- Validating that ND and dimensional solutions match"
238
},
249
{
2510
"cell_type": "code",

docs/beginner/tutorials/14-Timestepping-with-physical-units.ipynb

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -10,28 +10,7 @@
1010
},
1111
"tags": []
1212
},
13-
"source": [
14-
"# Notebook 14: Time-Dependent Advection-Diffusion with units\n",
15-
"This notebook introduces time-dependent problems in Underworld3 through the advection-diffusion equation. We'll test the numerical solution against analytical solutions for the advection and diffusion of temperature steps.\n",
16-
"\n",
17-
"## Key Concepts\n",
18-
"\n",
19-
"Time-stepping - Explicit time integration for advection-diffusion\n",
20-
"CFL condition - Stability constraints on time step size\n",
21-
"Analytical validation - Comparing with known solutions\n",
22-
"Advection vs Diffusion - Understanding the balance between transport mechanisms\n",
23-
"\n",
24-
"\n",
25-
"## The Advection-Diffusion Equation\n",
26-
"\n",
27-
"We solve:\n",
28-
"$$\\frac{\\partial T}{\\partial t} + \\mathbf{u} \\cdot \\nabla T = \\kappa \\nabla^2 T$$\n",
29-
"\n",
30-
"where:\n",
31-
"- $T$ is temperature (or any scalar field)\n",
32-
"- $\\mathbf{u}$ is the velocity field\n",
33-
"- $\\kappa$ is the diffusivity"
34-
]
13+
"source": "# Notebook 14: Time-Dependent Advection-Diffusion with units\n\n[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/underworldcode/uw3-binder-launcher/development?labpath=underworld3%2Fdocs%2Fbeginner%2Ftutorials%2F14-Timestepping-with-physical-units.ipynb)\n\nThis notebook introduces time-dependent problems in Underworld3 through the advection-diffusion equation. We'll test the numerical solution against analytical solutions for the advection and diffusion of temperature steps.\n\n## Key Concepts\n\nTime-stepping - Explicit time integration for advection-diffusion\nCFL condition - Stability constraints on time step size\nAnalytical validation - Comparing with known solutions\nAdvection vs Diffusion - Understanding the balance between transport mechanisms\n\n\n## The Advection-Diffusion Equation\n\nWe solve:\n$$\\frac{\\partial T}{\\partial t} + \\mathbf{u} \\cdot \\nabla T = \\kappa \\nabla^2 T$$\n\nwhere:\n- $T$ is temperature (or any scalar field)\n- $\\mathbf{u}$ is the velocity field\n- $\\kappa$ is the diffusivity"
3514
},
3615
{
3716
"cell_type": "code",

docs/beginner/tutorials/15-Thermal-convection-with-units.ipynb

Lines changed: 1 addition & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -10,46 +10,7 @@
1010
},
1111
"tags": []
1212
},
13-
"source": [
14-
"# Notebook 15: Rayleigh-B\u00e9nard Convection (with physical units)\n",
15-
"\n",
16-
"<div style=\"float: right; width: 40%\">\n",
17-
" \n",
18-
"![](media/AnnulusConvectionModel.png)\n",
19-
"\n",
20-
"</div>\n",
21-
"\n",
22-
"\n",
23-
"We'll look at a convection problem which couples Stokes Flow with time-dependent advection/diffusion to give simple Rayleigh-B\u00e9nard convection model. \n",
24-
"\n",
25-
"$$\n",
26-
"-\\nabla \\cdot\n",
27-
" \\left[\n",
28-
" \\frac{\\eta}{2}\\left( \\nabla \\mathbf{u} + \\nabla \\mathbf{u}^T \\right) - p \\mathbf{I} \\right] =\n",
29-
" -\\rho_0 \\alpha T \\mathbf{g} \n",
30-
"$$\n",
31-
"$$\n",
32-
"\\nabla \\cdot \\mathbf{u} = 0\n",
33-
"$$\n",
34-
"\n",
35-
"$\\eta$ is viscosity, $p$ is pressure, $\\rho_0$ is a reference density, $\\alpha$ is thermal expansivity, and $T$ is the temperature. Here we explicitly express density variations in terms of temperature variations.\n",
36-
"\n",
37-
"Thermal evolution is given by\n",
38-
"$$\n",
39-
"\\frac{\\partial T}{\\partial t} - \\mathbf{u}\\cdot\\nabla T = \\kappa \\nabla^2 T \n",
40-
"$$\n",
41-
"where the velocity, $\\mathbf{u}$ is the result of the Stokes flow calculation. $\\kappa$ is the thermal diffusivity (compare this with Notebook 4). \n",
42-
"\n",
43-
"The starting point is our previous notebook where we solved for Stokes\n",
44-
"flow in a cylindrical annulus geometry. We then add an advection-diffusion \n",
45-
"solver to evolve temperature. The Stokes buoyancy force is proportional to the\n",
46-
"temperature anomaly, and the velocity solution is fed back into the \n",
47-
"temperature advection term. The timestepping loop is written by\n",
48-
"hand because usually you will want to do some analysis or output some checkpoints.\n",
49-
"\n",
50-
"To read more about the applications of simple mantle convection models like this one, see (for example) Schubert et al, 2001.\n",
51-
"\n"
52-
]
13+
"source": "# Notebook 15: Rayleigh-B\u00e9nard Convection (with physical units)\n\n[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/underworldcode/uw3-binder-launcher/development?labpath=underworld3%2Fdocs%2Fbeginner%2Ftutorials%2F15-Thermal-convection-with-units.ipynb)\n\n\n<div style=\"float: right; width: 40%\">\n \n![](media/AnnulusConvectionModel.png)\n\n</div>\n\n\nWe'll look at a convection problem which couples Stokes Flow with time-dependent advection/diffusion to give simple Rayleigh-B\u00e9nard convection model. \n\n$$\n-\\nabla \\cdot\n \\left[\n \\frac{\\eta}{2}\\left( \\nabla \\mathbf{u} + \\nabla \\mathbf{u}^T \\right) - p \\mathbf{I} \\right] =\n -\\rho_0 \\alpha T \\mathbf{g} \n$$\n$$\n\\nabla \\cdot \\mathbf{u} = 0\n$$\n\n$\\eta$ is viscosity, $p$ is pressure, $\\rho_0$ is a reference density, $\\alpha$ is thermal expansivity, and $T$ is the temperature. Here we explicitly express density variations in terms of temperature variations.\n\nThermal evolution is given by\n$$\n\\frac{\\partial T}{\\partial t} - \\mathbf{u}\\cdot\\nabla T = \\kappa \\nabla^2 T \n$$\nwhere the velocity, $\\mathbf{u}$ is the result of the Stokes flow calculation. $\\kappa$ is the thermal diffusivity (compare this with Notebook 4). \n\nThe starting point is our previous notebook where we solved for Stokes\nflow in a cylindrical annulus geometry. We then add an advection-diffusion \nsolver to evolve temperature. The Stokes buoyancy force is proportional to the\ntemperature anomaly, and the velocity solution is fed back into the \ntemperature advection term. The timestepping loop is written by\nhand because usually you will want to do some analysis or output some checkpoints.\n\nTo read more about the applications of simple mantle convection models like this one, see (for example) Schubert et al, 2001.\n\n"
5314
},
5415
{
5516
"cell_type": "code",

docs/beginner/tutorials/2-Variables.ipynb

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,7 @@
1717
},
1818
"tags": []
1919
},
20-
"source": [
21-
"# Notebook 2: Variables\n",
22-
"\n",
23-
"We can add discrete \"variables\" (unknowns associated with the mesh points) to a mesh, assign values to them and build expressions that `sympy` can understand, manipulate and simplify.\n",
24-
"\n",
25-
"This notebook introduces the concept of `MeshVariables` in `Underworld3`. These are both data containers and `sympy` symbolic objects. We show you how to inspect a `meshVariable`, set the data values in the `MeshVariable` and visualise them, and build expressions that `sympy` can understand, manipulate and simplify.\n",
26-
"\n"
27-
]
20+
"source": "# Notebook 2: Variables\n\n[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/underworldcode/uw3-binder-launcher/development?labpath=underworld3%2Fdocs%2Fbeginner%2Ftutorials%2F2-Variables.ipynb)\n\nWe can add discrete \"variables\" (unknowns associated with the mesh points) to a mesh, assign values to them and build expressions that `sympy` can understand, manipulate and simplify.\n\nThis notebook introduces the concept of `MeshVariables` in `Underworld3`. These are both data containers and `sympy` symbolic objects. We show you how to inspect a `meshVariable`, set the data values in the `MeshVariable` and visualise them, and build expressions that `sympy` can understand, manipulate and simplify."
2821
},
2922
{
3023
"cell_type": "code",

0 commit comments

Comments
 (0)