Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions docs/models/packed_bed.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,31 @@ The model also gives the device totals per unit cross-sectional area of the bed,
`"Power per unit area [W.m-2]"`. The averaged bed is the reduced model of the
[encapsulated-LTES](https://github.com/mmsg-warwick/encapsulated-LTES) repository.

## Mesh and solver tolerance

By default, the mesh has 40 points along the capsule radius and 40 along the bed, and the
solver is IDAKLU with `rtol=1e-5` and `atol=1e-8`: a charge of the default bed solves in
about 2 s. While the capsules melt, the fluid temperature can wiggle by a few hundredths of
a kelvin (0.04 K at a quarter of the height in the default charge), as the cells next to the
capsule surface melt one after another. The wiggles shrink as the mesh along the radius is
refined, and are gone with 80 points, which solve about 5 times slower:

```python
model = pytes.PackedBedModel()
sim = pybamm.Simulation(
model,
var_pts={model.r: 80, model.z: 40},
solver=pybamm.IDAKLUSolver(rtol=1e-6, atol=1e-8),
)
```

Energy is conserved exactly by the discretised equations, so the error in the energy balance
is that of the solver. With the default mesh it is about $10^{-8}$ J; with a finer mesh in the
averaged bed it reaches a few joules (about one part in a million of the energy stored), and
a tighter `rtol` reduces it. The dips of the averaged bed (see the
[packed-bed example](../examples/packed_bed_models.ipynb)) do not change with the mesh: they
come from the averaged formulation.

## Parameter sets

The default parameter values are the experiments of
Expand Down
34 changes: 17 additions & 17 deletions examples/advection_scheme.ipynb

Large diffs are not rendered by default.

32 changes: 16 additions & 16 deletions examples/composing_models.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
"id": "ed85d650",
"metadata": {
"execution": {
"iopub.execute_input": "2026-10-23T22:00:53.642264Z",
"iopub.status.busy": "2026-10-23T22:00:53.642141Z",
"iopub.status.idle": "2026-10-23T22:00:54.546262Z",
"shell.execute_reply": "2026-10-23T22:00:54.545215Z"
"iopub.execute_input": "2026-11-01T10:06:39.115151Z",
"iopub.status.busy": "2026-11-01T10:06:39.114847Z",
"iopub.status.idle": "2026-11-01T10:06:41.207572Z",
"shell.execute_reply": "2026-11-01T10:06:41.205624Z"
}
},
"outputs": [
Expand Down Expand Up @@ -180,10 +180,10 @@
"id": "ca1eae53",
"metadata": {
"execution": {
"iopub.execute_input": "2026-10-23T22:00:54.547913Z",
"iopub.status.busy": "2026-10-23T22:00:54.547625Z",
"iopub.status.idle": "2026-10-23T22:00:54.557150Z",
"shell.execute_reply": "2026-10-23T22:00:54.556020Z"
"iopub.execute_input": "2026-11-01T10:06:41.216727Z",
"iopub.status.busy": "2026-11-01T10:06:41.216084Z",
"iopub.status.idle": "2026-11-01T10:06:41.257820Z",
"shell.execute_reply": "2026-11-01T10:06:41.255914Z"
}
},
"outputs": [],
Expand Down Expand Up @@ -231,25 +231,25 @@
"id": "e50dd849",
"metadata": {
"execution": {
"iopub.execute_input": "2026-10-23T22:00:54.559077Z",
"iopub.status.busy": "2026-10-23T22:00:54.558856Z",
"iopub.status.idle": "2026-10-23T22:00:56.296607Z",
"shell.execute_reply": "2026-10-23T22:00:56.295872Z"
"iopub.execute_input": "2026-11-01T10:06:41.260675Z",
"iopub.status.busy": "2026-11-01T10:06:41.260333Z",
"iopub.status.idle": "2026-11-01T10:06:51.766079Z",
"shell.execute_reply": "2026-11-01T10:06:51.762757Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Sharp front model - max conservation error [J]: 1.4901161193847656e-08\n",
"Cubic flux - max conservation error [J]: 3.91155481338501e-08\n"
"Sharp front model - max conservation error [J]: 2.2351741790771484e-08\n",
"Cubic flux - max conservation error [J]: 3.5390257835388184e-08\n"
]
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "7c54f839abc5412ab1965632f6b1dae1",
"model_id": "aee65a570646499185f6586ef95b0e8a",
"version_major": 2,
"version_minor": 0
},
Expand All @@ -263,7 +263,7 @@
{
"data": {
"text/plain": [
"<pybamm.plotting.quick_plot.QuickPlot at 0x7133212e2510>"
"<pybamm.plotting.quick_plot.QuickPlot at 0x73fbd7f1e510>"
]
},
"execution_count": 3,
Expand Down
36 changes: 18 additions & 18 deletions examples/design_study.ipynb

Large diffs are not rendered by default.

46 changes: 23 additions & 23 deletions examples/experiments.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@
"id": "e5ebbd94",
"metadata": {
"execution": {
"iopub.execute_input": "2026-10-23T18:21:45.018162Z",
"iopub.status.busy": "2026-10-23T18:21:45.018005Z",
"iopub.status.idle": "2026-10-23T18:21:46.311439Z",
"shell.execute_reply": "2026-10-23T18:21:46.310296Z"
"iopub.execute_input": "2026-11-01T11:16:00.042081Z",
"iopub.status.busy": "2026-11-01T11:16:00.041948Z",
"iopub.status.idle": "2026-11-01T11:16:01.022441Z",
"shell.execute_reply": "2026-11-01T11:16:01.021088Z"
}
},
"outputs": [],
Expand Down Expand Up @@ -63,10 +63,10 @@
"id": "cc1ea913",
"metadata": {
"execution": {
"iopub.execute_input": "2026-10-23T18:21:46.314277Z",
"iopub.status.busy": "2026-10-23T18:21:46.313972Z",
"iopub.status.idle": "2026-10-23T18:21:49.313443Z",
"shell.execute_reply": "2026-10-23T18:21:49.312473Z"
"iopub.execute_input": "2026-11-01T11:16:01.024040Z",
"iopub.status.busy": "2026-11-01T11:16:01.023793Z",
"iopub.status.idle": "2026-11-01T11:16:03.726662Z",
"shell.execute_reply": "2026-11-01T11:16:03.724463Z"
}
},
"outputs": [
Expand Down Expand Up @@ -127,22 +127,22 @@
"id": "fd8b7d0f",
"metadata": {
"execution": {
"iopub.execute_input": "2026-10-23T18:21:49.315166Z",
"iopub.status.busy": "2026-10-23T18:21:49.314991Z",
"iopub.status.idle": "2026-10-23T18:21:50.053037Z",
"shell.execute_reply": "2026-10-23T18:21:50.052166Z"
"iopub.execute_input": "2026-11-01T11:16:03.728625Z",
"iopub.status.busy": "2026-11-01T11:16:03.728454Z",
"iopub.status.idle": "2026-11-01T11:16:05.996064Z",
"shell.execute_reply": "2026-11-01T11:16:05.994917Z"
}
},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "81c898efeaf242ce8922233263200fa3",
"model_id": "d7fb6003cb47449fa2c670ce1ad30678",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"interactive(children=(FloatSlider(value=0.0, description='t', max=8.263858761068837, step=0.08263858761068837)…"
"interactive(children=(FloatSlider(value=0.0, description='t', max=8.263893215828132, step=0.08263893215828132)…"
]
},
"metadata": {},
Expand All @@ -151,7 +151,7 @@
{
"data": {
"text/plain": [
"<pybamm.plotting.quick_plot.QuickPlot at 0x7cdfb3a6af90>"
"<pybamm.plotting.quick_plot.QuickPlot at 0x7d2adb0d6cf0>"
]
},
"execution_count": 3,
Expand Down Expand Up @@ -191,10 +191,10 @@
"id": "c7c58c44",
"metadata": {
"execution": {
"iopub.execute_input": "2026-10-23T18:21:50.056142Z",
"iopub.status.busy": "2026-10-23T18:21:50.055999Z",
"iopub.status.idle": "2026-10-23T18:21:50.068414Z",
"shell.execute_reply": "2026-10-23T18:21:50.067381Z"
"iopub.execute_input": "2026-11-01T11:16:06.000055Z",
"iopub.status.busy": "2026-11-01T11:16:05.999887Z",
"iopub.status.idle": "2026-11-01T11:16:06.012357Z",
"shell.execute_reply": "2026-11-01T11:16:06.011178Z"
}
},
"outputs": [
Expand Down Expand Up @@ -235,10 +235,10 @@
"id": "30de7eff",
"metadata": {
"execution": {
"iopub.execute_input": "2026-10-23T18:21:50.070003Z",
"iopub.status.busy": "2026-10-23T18:21:50.069866Z",
"iopub.status.idle": "2026-10-23T18:21:51.058784Z",
"shell.execute_reply": "2026-10-23T18:21:51.057473Z"
"iopub.execute_input": "2026-11-01T11:16:06.014239Z",
"iopub.status.busy": "2026-11-01T11:16:06.014044Z",
"iopub.status.idle": "2026-11-01T11:16:06.714876Z",
"shell.execute_reply": "2026-11-01T11:16:06.713808Z"
}
},
"outputs": [
Expand Down
66 changes: 33 additions & 33 deletions examples/finned_tube_models.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
"id": "e4deee08",
"metadata": {
"execution": {
"iopub.execute_input": "2026-10-23T22:01:03.160572Z",
"iopub.status.busy": "2026-10-23T22:01:03.160260Z",
"iopub.status.idle": "2026-10-23T22:01:03.984625Z",
"shell.execute_reply": "2026-10-23T22:01:03.983516Z"
"iopub.execute_input": "2026-11-01T11:16:08.215232Z",
"iopub.status.busy": "2026-11-01T11:16:08.214976Z",
"iopub.status.idle": "2026-11-01T11:16:09.137164Z",
"shell.execute_reply": "2026-11-01T11:16:09.136343Z"
}
},
"outputs": [
Expand Down Expand Up @@ -77,17 +77,17 @@
"id": "35990921",
"metadata": {
"execution": {
"iopub.execute_input": "2026-10-23T22:01:03.986545Z",
"iopub.status.busy": "2026-10-23T22:01:03.986208Z",
"iopub.status.idle": "2026-10-23T22:01:05.145253Z",
"shell.execute_reply": "2026-10-23T22:01:05.143752Z"
"iopub.execute_input": "2026-11-01T11:16:09.138908Z",
"iopub.status.busy": "2026-11-01T11:16:09.138645Z",
"iopub.status.idle": "2026-11-01T11:16:11.044265Z",
"shell.execute_reply": "2026-11-01T11:16:11.043117Z"
}
},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "94d777affad1493b94b6ab4892f84b39",
"model_id": "e45b232b7e5c4b499dd01d8f9cdbf388",
"version_major": 2,
"version_minor": 0
},
Expand All @@ -101,7 +101,7 @@
{
"data": {
"text/plain": [
"<pybamm.plotting.quick_plot.QuickPlot at 0x72accd818ad0>"
"<pybamm.plotting.quick_plot.QuickPlot at 0x7ac151e1cad0>"
]
},
"execution_count": 2,
Expand Down Expand Up @@ -134,19 +134,19 @@
"id": "001f2df5",
"metadata": {
"execution": {
"iopub.execute_input": "2026-10-23T22:01:05.148462Z",
"iopub.status.busy": "2026-10-23T22:01:05.148334Z",
"iopub.status.idle": "2026-10-23T22:01:05.172190Z",
"shell.execute_reply": "2026-10-23T22:01:05.171271Z"
"iopub.execute_input": "2026-11-01T11:16:11.048482Z",
"iopub.status.busy": "2026-11-01T11:16:11.048320Z",
"iopub.status.idle": "2026-11-01T11:16:11.075398Z",
"shell.execute_reply": "2026-11-01T11:16:11.074231Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"max conservation error [J]: 1.4901161193847656e-08\n",
"discharged energy [kWh]: 2.417954249270433\n",
"max conservation error [J]: 2.2351741790771484e-08\n",
"discharged energy [kWh]: 2.4179608181995835\n",
"energy between 10 and 70 degC [kWh]: 2.4523701748815085\n"
]
}
Expand Down Expand Up @@ -176,10 +176,10 @@
"id": "8f18a7c9",
"metadata": {
"execution": {
"iopub.execute_input": "2026-10-23T22:01:05.174491Z",
"iopub.status.busy": "2026-10-23T22:01:05.174306Z",
"iopub.status.idle": "2026-10-23T22:01:05.828492Z",
"shell.execute_reply": "2026-10-23T22:01:05.827686Z"
"iopub.execute_input": "2026-11-01T11:16:11.077010Z",
"iopub.status.busy": "2026-11-01T11:16:11.076828Z",
"iopub.status.idle": "2026-11-01T11:16:11.769973Z",
"shell.execute_reply": "2026-11-01T11:16:11.768888Z"
}
},
"outputs": [
Expand All @@ -194,7 +194,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"outlet temperature at the end of the first run and at the restart [degC]: 51.71779784644089 51.71779784644089\n"
"outlet temperature at the end of the first run and at the restart [degC]: 51.71737041672396 51.71737041672396\n"
]
}
],
Expand Down Expand Up @@ -234,17 +234,17 @@
"id": "87b57886",
"metadata": {
"execution": {
"iopub.execute_input": "2026-10-23T22:01:05.830036Z",
"iopub.status.busy": "2026-10-23T22:01:05.829899Z",
"iopub.status.idle": "2026-10-23T22:01:06.758213Z",
"shell.execute_reply": "2026-10-23T22:01:06.757243Z"
"iopub.execute_input": "2026-11-01T11:16:11.771375Z",
"iopub.status.busy": "2026-11-01T11:16:11.771237Z",
"iopub.status.idle": "2026-11-01T11:16:12.911982Z",
"shell.execute_reply": "2026-11-01T11:16:12.910691Z"
}
},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "953407a8ba1e45068bc74f331cec9bcb",
"model_id": "4a2b2562192a4168a0472044c58683da",
"version_major": 2,
"version_minor": 0
},
Expand All @@ -258,7 +258,7 @@
{
"data": {
"text/plain": [
"<pybamm.plotting.quick_plot.QuickPlot at 0x72acc57ebe00>"
"<pybamm.plotting.quick_plot.QuickPlot at 0x7ac149a05940>"
]
},
"execution_count": 5,
Expand Down Expand Up @@ -294,17 +294,17 @@
"id": "35da1f03",
"metadata": {
"execution": {
"iopub.execute_input": "2026-10-23T22:01:06.760517Z",
"iopub.status.busy": "2026-10-23T22:01:06.760401Z",
"iopub.status.idle": "2026-10-23T22:01:24.488558Z",
"shell.execute_reply": "2026-10-23T22:01:24.487344Z"
"iopub.execute_input": "2026-11-01T11:16:12.914352Z",
"iopub.status.busy": "2026-11-01T11:16:12.914200Z",
"iopub.status.idle": "2026-11-01T11:16:31.746523Z",
"shell.execute_reply": "2026-11-01T11:16:31.745488Z"
}
},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "e64d34fccfbe4ee19847365bb9f69ed0",
"model_id": "752d4e4a24644d99b4048ccfaafe0a47",
"version_major": 2,
"version_minor": 0
},
Expand All @@ -318,7 +318,7 @@
{
"data": {
"text/plain": [
"<pybamm.plotting.quick_plot.QuickPlot at 0x72acc41b82f0>"
"<pybamm.plotting.quick_plot.QuickPlot at 0x7ac148521d30>"
]
},
"execution_count": 6,
Expand Down
Loading
Loading