Skip to content

Commit 2cb6d30

Browse files
committed
Explicitly import triplot from firedrake
1 parent 260d64a commit 2cb6d30

6 files changed

Lines changed: 13 additions & 7 deletions

01-spd-helmholtz.ipynb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@
122122
"cell_type": "markdown",
123123
"metadata": {},
124124
"source": [
125-
"To start, we must make Firedrake available in the notebook. It is available as a normal Python package, named `firedrake`. To save on typing, we will import all of the public API into the current namespace"
125+
"To start, we must make Firedrake available in the notebook. We will import it through the `gadopt` package. To save on typing, we will import all of the public API into the current namespace. For plotting within this notebook, we also explicitly import the `triplot` function."
126126
]
127127
},
128128
{
@@ -131,7 +131,8 @@
131131
"metadata": {},
132132
"outputs": [],
133133
"source": [
134-
"from gadopt import *"
134+
"from gadopt import *\n",
135+
"from firedrake.pyplot import triplot, tripcolor"
135136
]
136137
},
137138
{

02-poisson.ipynb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
" !wget \"https://github.com/g-adopt/tutorials/releases/latest/download/firedrake-install-real.sh\" -O \"/tmp/firedrake-install.sh\" && bash \"/tmp/firedrake-install.sh\"\n",
6161
" import firedrake\n",
6262
"from gadopt import *\n",
63+
"from firedrake.pyplot import tripcolor\n",
6364
"mesh = UnitSquareMesh(10, 10)\n",
6465
"V = FunctionSpace(mesh, \"Lagrange\", 1)"
6566
]

03-elasticity.ipynb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
" !wget \"https://github.com/g-adopt/tutorials/releases/latest/download/firedrake-install-real.sh\" -O \"/tmp/firedrake-install.sh\" && bash \"/tmp/firedrake-install.sh\"\n",
5757
" import firedrake\n",
5858
"from gadopt import *\n",
59+
"from firedrake.pyplot import triplot\n",
5960
"length = 1\n",
6061
"width = 0.2\n",
6162
"mesh = RectangleMesh(40, 20, length, width)"

04-burgers.ipynb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
" !wget \"https://github.com/g-adopt/tutorials/releases/latest/download/firedrake-install-real.sh\" -O \"/tmp/firedrake-install.sh\" && bash \"/tmp/firedrake-install.sh\"\n",
5959
" import firedrake\n",
6060
"from gadopt import *\n",
61+
"from firedrake.pyplot import plot\n",
6162
"\n",
6263
"n = 100\n",
6364
"mesh = PeriodicIntervalMesh(n, length=2)\n",

05-pde-constrained-optimisation.ipynb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@
4949
"outputs": [],
5050
"source": [
5151
"from gadopt import *\n",
52-
"from gadopt.inverse import *"
52+
"from gadopt.inverse import *\n",
53+
"from firedrake.pyplot import quiver, streamplot, tricontourf, triplot"
5354
]
5455
},
5556
{

06-GD-2D-convection.ipynb

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,8 @@
141141
"metadata": {},
142142
"outputs": [],
143143
"source": [
144-
"from gadopt import *"
144+
"from gadopt import *\n",
145+
"from firedrake.pyplot import tripcolor"
145146
]
146147
},
147148
{
@@ -290,7 +291,7 @@
290291
"Ra, delta_t = Constant(1e4), Constant(1e-3)\n",
291292
"\n",
292293
"approximation = BoussinesqApproximation(Ra)\n",
293-
"t_adapt = TimestepAdaptor(delta_t, V, maximum_timestep=0.1, increase_tolerance=1.5)"
294+
"t_adapt = TimestepAdaptor(delta_t, u, V, maximum_timestep=0.1, increase_tolerance=1.5)"
294295
]
295296
},
296297
{
@@ -377,7 +378,7 @@
377378
"gd = GeodynamicalDiagnostics(u, p, T, bottom, top)\n",
378379
"\n",
379380
"for timestep in range(0, no_timesteps+1):\n",
380-
" dt = t_adapt.update_timestep(u)\n",
381+
" dt = t_adapt.update_timestep()\n",
381382
" time += dt\n",
382383
"\n",
383384
" stokes_solver.solve()\n",
@@ -521,7 +522,7 @@
521522
"gd = GeodynamicalDiagnostics(u, p, T, bottom, top)\n",
522523
"\n",
523524
"for timestep in range(0, no_timesteps+1):\n",
524-
" dt = t_adapt.update_timestep(u)\n",
525+
" dt = t_adapt.update_timestep()\n",
525526
" time += dt\n",
526527
"\n",
527528
" stokes_solver.solve()\n",

0 commit comments

Comments
 (0)