You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: examples/notebooks/change-input-current.ipynb
+20-36
Original file line number
Diff line number
Diff line change
@@ -22,7 +22,7 @@
22
22
"\n",
23
23
"In this notebook we will use the SPM as the example model, and change the input current from the default option. If you are not familiar with running a model in PyBaMM, please see [this](./models/SPM.ipynb) notebook for more details.\n",
24
24
"\n",
25
-
"In PyBaMM, the current function is set using the parameter \"Current function [A]\". Below we load the SPM with the default parameters, and then change the the current function to 16A."
25
+
"In PyBaMM, the current function is set using the parameter \"Current function [A]\". Below we load the SPM with the default parameters, and then change the the current function to be an input parameter, so that we can change it easily later."
26
26
]
27
27
},
28
28
{
@@ -45,15 +45,18 @@
45
45
"# set the default model parameters\n",
46
46
"param = model.default_parameter_values\n",
47
47
"\n",
48
-
"# change the current function\n",
49
-
"param[\"Current function [A]\"] = 16"
48
+
"# change the current function to be an input parameter\n",
49
+
"def current_function(t):\n",
50
+
" return pybamm.InputParameter(\"current\")\n",
51
+
"\n",
52
+
"param[\"Current function [A]\"] = current_function"
50
53
]
51
54
},
52
55
{
53
56
"cell_type": "markdown",
54
57
"metadata": {},
55
58
"source": [
56
-
"We can now solve the model in the ususal way"
59
+
"We can now solve the model in the ususal way, with a 16A current"
0 commit comments