Skip to content

Commit

Permalink
#569 tino comments
Browse files Browse the repository at this point in the history
  • Loading branch information
rtimms committed Mar 10, 2020
1 parent 0682231 commit 178e7a4
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 50 deletions.
17 changes: 3 additions & 14 deletions examples/notebooks/Creating Models/1-an-ode-model.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Note that the keys of this dictionary are strings (i.e. the names of the variables). The model is now completely defined and is ready to be discretised and solved!"
"Note that the keys of this dictionary are strings (i.e. the names of the variables). The string names can be different from the variable symbol, and should in general be something informative. The model is now completely defined and is ready to be discretised and solved!"
]
},
{
Expand All @@ -164,21 +164,10 @@
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<pybamm.models.base_model.BaseModel at 0x7f31884a7b38>"
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"disc = pybamm.Discretisation() # use the default discretisation\n",
"disc.process_model(model)"
"disc.process_model(model);"
]
},
{
Expand Down
24 changes: 10 additions & 14 deletions examples/notebooks/Creating Models/2-a-pde-model.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"We then create a mesh using the `pybamm.MeshGenerator` class. As inputs this class takes the type of mesh and any parameters required by the mesh. In this case we choose a uniform one-dimensional mesh which doesn't require any parameters. Example of meshes that do require parameters include the `pybamm.Exponential1DSubMesh` which clusters points close to one or both boundaries using an exponential rule. It takes a parameter which sets how closely the points are clustered together. "
"We then create a mesh using the `pybamm.MeshGenerator` class. As inputs this class takes the type of mesh and any parameters required by the mesh. In this case we choose a uniform one-dimensional mesh which doesn't require any parameters. "
]
},
{
Expand All @@ -186,6 +186,13 @@
"mesh = pybamm.Mesh(geometry, submesh_types, var_pts)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Example of meshes that do require parameters include the `pybamm.Exponential1DSubMesh` which clusters points close to one or both boundaries using an exponential rule. It takes a parameter which sets how closely the points are clustered together, and also lets the users select the side on which more points should be clustered. For example, to create a mesh with more nodes clustered to the right (i.e. the surface in the particle problem), using a stretch factor of 2, we pass an instance of the exponential submesh class and a dictionary of parameters into the `MeshGenerator` class as follows: `pybamm.MeshGenerator(pybamm.Exponential1DSubMesh, submesh_params={\"side\": \"right\", \"stretch\": 2})`"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand All @@ -197,22 +204,11 @@
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<pybamm.models.base_model.BaseModel at 0x7f00c5334cc0>"
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"spatial_methods = {\"negative particle\": pybamm.FiniteVolume()}\n",
"disc = pybamm.Discretisation(mesh, spatial_methods)\n",
"disc.process_model(model)"
"disc.process_model(model);"
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Note that all battery models in PyBaMM are written in dimensionless form for better numerical conditioning This is discussed further in [the simple SEI model notebook](./5-a-simple-SEI-model.ipynb)."
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down Expand Up @@ -206,26 +213,15 @@
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<pybamm.models.base_model.BaseModel at 0x7f7ff13f0d68>"
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"submesh_types = {\"negative particle\": pybamm.MeshGenerator(pybamm.Uniform1DSubMesh)}\n",
"var_pts = {r: 20}\n",
"mesh = pybamm.Mesh(geometry, submesh_types, var_pts)\n",
"\n",
"spatial_methods = {\"negative particle\": pybamm.FiniteVolume()}\n",
"disc = pybamm.Discretisation(mesh, spatial_methods)\n",
"disc.process_model(model)"
"disc.process_model(model);"
]
},
{
Expand All @@ -251,7 +247,7 @@
},
{
"cell_type": "code",
"execution_count": 11,
"execution_count": 9,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -300,8 +296,15 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"In the [next notebook](/5-comparing-full-and-reduced-order-models.ipynb) we consider the limit of fast diffusion in the particle. This leads to a reduced-order model for the particle behaviour, which we compare with the full (Fickian diffusion) model. "
"In the [next notebook](./4-comparing-full-and-reduced-order-models.ipynb) we consider the limit of fast diffusion in the particle. This leads to a reduced-order model for the particle behaviour, which we compare with the full (Fickian diffusion) model. "
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@
"source": [
"We can now populate the variables dictionary of both models with any variables of interest. We can compute the average concentration in the full model using the operator `pybamm.r_average`. We may also wish to compare the concentration profile predicted by the full model with the uniform concentration profile predicted by the reduced model. We can use the operator `pybamm.PrimaryBroadcast` to broadcast the scalar valued uniform concentration across the particle domain so that it can be visualised as a function of $r$. \n",
"\n",
"Note: the \"Primary\" refers to the fact the we are broadcasting in only one dimension. For some models, such as the DFN, variables may depend on a \"pseudo-dimension\" (e.g. the position in $x$ across the cell), but spatial operators only act in the \"primary dimension\" (e.g. the position ion $r$ within the particle). If you are unfamiliar with battery models, do not worry, the details of this are not important for this example. "
"Note: the \"Primary\" refers to the fact the we are broadcasting in only one dimension. For some models, such as the DFN, variables may depend on a \"pseudo-dimension\" (e.g. the position in $x$ across the cell), but spatial operators only act in the \"primary dimension\" (e.g. the position ion $r$ within the particle). If you are unfamiliar with battery models, do not worry, the details of this are not important for this example. For more information see the [broadcasts notebook](../expression_tree/broadcasts.ipynb)."
]
},
{
Expand Down Expand Up @@ -250,7 +250,7 @@
"\n",
"# process models\n",
"for model in models:\n",
" disc.process_model(model)"
" disc.process_model(model);"
]
},
{
Expand All @@ -276,13 +276,13 @@
},
{
"cell_type": "code",
"execution_count": 23,
"execution_count": 10,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "b6a9b1125ea8432cacf0081560824fb4",
"model_id": "dbcd70fa09c6404dab80036156401985",
"version_major": 2,
"version_minor": 0
},
Expand Down Expand Up @@ -355,8 +355,15 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"In the [next notebook](/5-a-simple-SEI-model.ipynb) we consider a simple model for SEI growth, and show how to correctly pose the model in non-dimensional form and then create and solve it using pybamm."
"In the [next notebook](./5-a-simple-SEI-model.ipynb) we consider a simple model for SEI growth, and show how to correctly pose the model in non-dimensional form and then create and solve it using pybamm."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "193e59a0a0d84c99a1e8ac80fdc423dc",
"model_id": "4c1173e431cb4126a0067294587eb59d",
"version_major": 2,
"version_minor": 0
},
Expand Down
2 changes: 1 addition & 1 deletion examples/notebooks/expression_tree/broadcasts.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.3"
"version": "3.6.9"
}
},
"nbformat": 4,
Expand Down

0 comments on commit 178e7a4

Please sign in to comment.