Skip to content

Commit baad40f

Browse files
committed
Change title of example 8
1 parent 4eb20f8 commit baad40f

2 files changed

Lines changed: 2 additions & 46 deletions

File tree

examples/example2/example2.ipynb

Lines changed: 1 addition & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@
311311
"avg_X = [X.initial_condition]\n",
312312
"avg_B = [B.initial_condition]\n",
313313
"# Set loglevel to warning in order not to pollute notebook output\n",
314-
"logger.setLevel(logging.DEBUG)\n",
314+
"logger.setLevel(logging.WARNING)\n",
315315
"\n",
316316
"while True:\n",
317317
" # Solve the system\n",
@@ -333,50 +333,6 @@
333333
" break"
334334
]
335335
},
336-
{
337-
"cell_type": "code",
338-
"execution_count": null,
339-
"id": "72884c41",
340-
"metadata": {},
341-
"outputs": [],
342-
"source": [
343-
"import petsc4py.PETSc as PETSc\n",
344-
"Adof = model_cur.sc[\"A\"].dof_map\n",
345-
"Avec = model_cur.sc[\"A\"].sol.vector()[Adof]\n",
346-
"Bdof = model_cur.sc[\"B\"].dof_map\n",
347-
"Bvec = model_cur.sc[\"B\"].sol.vector()[Bdof]\n",
348-
"Xdof = model_cur.sc[\"X\"].dof_map\n",
349-
"Xvec = model_cur.sc[\"X\"].sol.vector()[Xdof]\n",
350-
"data_dict = dict()\n",
351-
"data_dict[\"A\"] = Avec\n",
352-
"data_dict[\"B\"] = Bvec\n",
353-
"data_dict[\"X\"] = Xvec\n",
354-
"\n",
355-
"def weak_residual(model_cur, data_dict):\n",
356-
" for s in model_cur.sc:\n",
357-
" if s.name not in data_dict.keys():\n",
358-
" raise ValueError(\"Must provide vector for all species\")\n",
359-
" else:\n",
360-
" cur_data = data_dict[s.name]\n",
361-
" cur_vec = s.u[\"u\"].vector()\n",
362-
" cur_dof = s.dof_map\n",
363-
" cur_vec[cur_dof] = cur_data\n",
364-
" s.u[\"u\"].vector().set_local(cur_vec)\n",
365-
" s.u[\"u\"].vector().apply(\"insert\")\n",
366-
" if len(model_cur.problem.global_sizes) == 1:\n",
367-
" model_cur._ubackend = model_cur.u[\"u\"]._functions[0].vector().vec().copy()\n",
368-
" else:\n",
369-
" model_cur._ubackend = PETSc.Vec().createNest(\n",
370-
" [usub.vector().vec().copy() for usub in model_cur.u[\"u\"]._functions],\n",
371-
" comm=model_cur.mpi_comm_world,\n",
372-
" )\n",
373-
" return model_cur.solver.getFunctionNorm()\n",
374-
"\n",
375-
"print(f\"Residual is {weak_residual(model_cur, data_dict)}\")\n",
376-
"data_dict[\"A\"] += 1.0\n",
377-
"print(f\"Perturbed residual is {weak_residual(model_cur, data_dict)}\")"
378-
]
379-
},
380336
{
381337
"attachments": {},
382338
"cell_type": "markdown",

examples/example8/example8.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"id": "f65f18d7",
77
"metadata": {},
88
"source": [
9-
"# Example 7: Advection-diffusion in a cylindrical geometry\n",
9+
"# Example 8: Advection-diffusion in a cylindrical geometry\n",
1010
"\n",
1111
"Here, we consider release of a molecule from a cylindrical wall with Pouiselle flow."
1212
]

0 commit comments

Comments
 (0)