Skip to content

Commit

Permalink
Merge pull request #903 from pybamm-team/issue-901-fix-notebook-2
Browse files Browse the repository at this point in the history
#901 corrected notebook
  • Loading branch information
Scottmar93 authored Mar 22, 2020
2 parents d43060b + d7c4c9f commit 1b0e0c5
Show file tree
Hide file tree
Showing 3 changed files with 111 additions and 105 deletions.
9 changes: 5 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

## Features

- Add new symbols `VariableDot`, representing the derivative of a variable wrt time,
and `StateVectorDot`, representing the derivative of a state vector wrt time
- Add new symbols `VariableDot`, representing the derivative of a variable wrt time,
and `StateVectorDot`, representing the derivative of a state vector wrt time
([#858](https://github.com/pybamm-team/PyBaMM/issues/858))
- Added functionality to broadcast to edges
- Added functionality to broadcast to edges
([#891](https://github.com/pybamm-team/PyBaMM/pull/891))
- Added additional notebooks showing how to create and compare models ([#877](https://github.com/pybamm-team/PyBaMM/pull/877))
- Added `Minimum`, `Maximum` and `Sign` operators
- Added `Minimum`, `Maximum` and `Sign` operators
([#876](https://github.com/pybamm-team/PyBaMM/pull/876))
- Added a search feature to `FuzzyDict` ([#875](https://github.com/pybamm-team/PyBaMM/pull/875))
- Add ambient temperature as a function of time ([#872](https://github.com/pybamm-team/PyBaMM/pull/872))
Expand All @@ -17,6 +17,7 @@

## Bug fixes

- Updated Getting started notebook 2 ([#903](https://github.com/pybamm-team/PyBaMM/pull/903))
- Reformatted external circuit submodels ([#879](https://github.com/pybamm-team/PyBaMM/pull/879))
- Some bug fixes to generalize specifying models that aren't battery models, see [#846](https://github.com/pybamm-team/PyBaMM/issues/846)
- Reformatted interface submodels to be more readable ([#866](https://github.com/pybamm-team/PyBaMM/pull/866))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "4e12f3f5188c4c47b9055d2a0cbd66ea",
"model_id": "051690c8629b4ab3992cfb364c4aa8e1",
"version_major": 2,
"version_minor": 0
},
Expand Down Expand Up @@ -166,7 +166,7 @@
"metadata": {},
"outputs": [],
"source": [
"parameter_values2.update({\"Typical current [A]\": 1.36})"
"parameter_values2.update({\"Current function [A]\": 1.36})"
]
},
{
Expand All @@ -182,7 +182,7 @@
"metadata": {},
"outputs": [],
"source": [
"sim.specs(parameter_values=parameter_values2)"
"sim2.specs(parameter_values=parameter_values2)"
]
},
{
Expand All @@ -200,21 +200,21 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "e89691f9bbf84d6180b793ab2b22bd14",
"model_id": "260a89fad4db4fadbf409bc123a18285",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"interactive(children=(FloatSlider(value=0.0, description='t', max=0.4898989898989899, step=0.05), Output()), _…"
"interactive(children=(FloatSlider(value=0.0, description='t', max=0.4852877005347593, step=0.05), Output()), _…"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"sim.solve()\n",
"sim.plot()"
"sim2.solve()\n",
"sim2.plot()"
]
},
{
Expand Down Expand Up @@ -259,99 +259,100 @@
{
"data": {
"text/plain": [
"{'Negative current collector thickness [m]': 2.5e-05,\n",
" 'Negative electrode thickness [m]': 0.0001,\n",
" 'Separator thickness [m]': 2.5e-05,\n",
" 'Positive electrode thickness [m]': 0.0001,\n",
" 'Positive current collector thickness [m]': 2.5e-05,\n",
" 'Electrode height [m]': 0.13699999999999998,\n",
" 'Electrode width [m]': 0.207,\n",
" 'Negative tab width [m]': 0.04,\n",
" 'Negative tab centre y-coordinate [m]': 0.06,\n",
" 'Negative tab centre z-coordinate [m]': 0.13699999999999998,\n",
" 'Positive tab width [m]': 0.04,\n",
" 'Positive tab centre y-coordinate [m]': 0.147,\n",
" 'Positive tab centre z-coordinate [m]': 0.13699999999999998,\n",
" 'Negative current collector conductivity [S.m-1]': 59600000.0,\n",
" 'Positive current collector conductivity [S.m-1]': 35500000.0,\n",
" 'Negative current collector density [kg.m-3]': 8954.0,\n",
" 'Positive current collector density [kg.m-3]': 2707.0,\n",
" 'Negative current collector specific heat capacity [J.kg-1.K-1]': 385.0,\n",
" 'Positive current collector specific heat capacity [J.kg-1.K-1]': 897.0,\n",
" 'Negative current collector thermal conductivity [W.m-1.K-1]': 401.0,\n",
" 'Positive current collector thermal conductivity [W.m-1.K-1]': 237.0,\n",
" 'Cell capacity [A.h]': 0.68,\n",
" 'Negative electrode conductivity [S.m-1]': 100.0,\n",
" 'Maximum concentration in negative electrode [mol.m-3]': 24983.2619938437,\n",
" 'Negative electrode diffusivity [m2.s-1]': <function graphite_mcmb2528_diffusivity_Dualfoil1998.graphite_mcmb2528_diffusivity_Dualfoil1998(sto, T, T_inf, E_D_s, R_g)>,\n",
" 'Negative electrode OCP [V]': <function graphite_mcmb2528_ocp_Dualfoil1998.graphite_mcmb2528_ocp_Dualfoil1998(sto)>,\n",
" 'Negative electrode porosity': 0.3,\n",
" 'Negative electrode active material volume fraction': 0.7,\n",
" 'Negative particle radius [m]': 1e-05,\n",
" 'Negative electrode surface area density [m-1]': 180000.0,\n",
" 'Negative electrode Bruggeman coefficient (electrolyte)': 1.5,\n",
" 'Negative electrode Bruggeman coefficient (electrode)': 1.5,\n",
" 'Negative electrode cation signed stoichiometry': -1.0,\n",
" 'Negative electrode electrons in reaction': 1.0,\n",
" 'Negative electrode reference exchange-current density [A.m-2(m3.mol)1.5]': 2e-05,\n",
" 'Reference OCP vs SHE in the negative electrode [V]': nan,\n",
" 'Negative electrode charge transfer coefficient': 0.5,\n",
" 'Negative electrode double-layer capacity [F.m-2]': 0.2,\n",
" 'Negative electrode density [kg.m-3]': 1657.0,\n",
" 'Negative electrode specific heat capacity [J.kg-1.K-1]': 700.0,\n",
" 'Negative electrode thermal conductivity [W.m-1.K-1]': 1.7,\n",
" 'Negative electrode OCP entropic change [V.K-1]': <function graphite_entropic_change_Moura2016.graphite_entropic_change_Moura2016(sto, c_n_max)>,\n",
" 'Reference temperature [K]': 298.15,\n",
" 'Negative electrode reaction rate': <function graphite_electrolyte_reaction_rate_Dualfoil1998.graphite_electrolyte_reaction_rate_Dualfoil1998(T, T_inf, E_r, R_g)>,\n",
" 'Negative reaction rate activation energy [J.mol-1]': 37480.0,\n",
" 'Negative solid diffusion activation energy [J.mol-1]': 42770.0,\n",
" 'Positive electrode conductivity [S.m-1]': 10.0,\n",
" 'Maximum concentration in positive electrode [mol.m-3]': 51217.9257309275,\n",
" 'Positive electrode diffusivity [m2.s-1]': <function lico2_diffusivity_Dualfoil1998.lico2_diffusivity_Dualfoil1998(sto, T, T_inf, E_D_s, R_g)>,\n",
" 'Positive electrode OCP [V]': <function lico2_ocp_Dualfoil1998.lico2_ocp_Dualfoil1998(sto)>,\n",
" 'Positive electrode porosity': 0.3,\n",
" 'Positive electrode active material volume fraction': 0.7,\n",
" 'Positive particle radius [m]': 1e-05,\n",
" 'Positive electrode surface area density [m-1]': 150000.0,\n",
" 'Positive electrode Bruggeman coefficient (electrolyte)': 1.5,\n",
" 'Positive electrode Bruggeman coefficient (electrode)': 1.5,\n",
" 'Positive electrode cation signed stoichiometry': -1.0,\n",
" 'Positive electrode electrons in reaction': 1.0,\n",
" 'Positive electrode reference exchange-current density [A.m-2(m3.mol)1.5]': 6e-07,\n",
" 'Reference OCP vs SHE in the positive electrode [V]': nan,\n",
" 'Positive electrode charge transfer coefficient': 0.5,\n",
" 'Positive electrode double-layer capacity [F.m-2]': 0.2,\n",
" 'Positive electrode density [kg.m-3]': 3262.0,\n",
" 'Positive electrode specific heat capacity [J.kg-1.K-1]': 700.0,\n",
" 'Positive electrode thermal conductivity [W.m-1.K-1]': 2.1,\n",
" 'Positive electrode OCP entropic change [V.K-1]': <function lico2_entropic_change_Moura2016.lico2_entropic_change_Moura2016(sto, c_p_max)>,\n",
" 'Positive electrode reaction rate': <function lico2_electrolyte_reaction_rate_Dualfoil1998.lico2_electrolyte_reaction_rate_Dualfoil1998(T, T_inf, E_r, R_g)>,\n",
" 'Positive reaction rate activation energy [J.mol-1]': 39570.0,\n",
" 'Positive solid diffusion activation energy [J.mol-1]': 18550.0,\n",
" 'Separator porosity': 1.0,\n",
" 'Separator Bruggeman coefficient (electrolyte)': 1.5,\n",
" 'Separator Bruggeman coefficient (electrode)': 1.5,\n",
" 'Separator density [kg.m-3]': 397.0,\n",
" 'Separator specific heat capacity [J.kg-1.K-1]': 700.0,\n",
" 'Separator thermal conductivity [W.m-1.K-1]': 0.16,\n",
" 'Typical electrolyte concentration [mol.m-3]': 1000.0,\n",
" 'Cation transference number': 0.4,\n",
" 'Electrolyte diffusivity [m2.s-1]': <function electrolyte_diffusivity_Capiglia1999.electrolyte_diffusivity_Capiglia1999(c_e, T, T_inf, E_D_e, R_g)>,\n",
" 'Electrolyte conductivity [S.m-1]': <function electrolyte_conductivity_Capiglia1999.electrolyte_conductivity_Capiglia1999(c_e, T, T_inf, E_k_e, R_g)>,\n",
" 'Electrolyte diffusion activation energy [J.mol-1]': 37040.0,\n",
" 'Electrolyte conductivity activation energy [J.mol-1]': 34700.0,\n",
" 'Heat transfer coefficient [W.m-2.K-1]': 10.0,\n",
" 'Number of electrodes connected in parallel to make a cell': 1.0,\n",
" 'Number of cells connected in series to make a battery': 1.0,\n",
" 'Lower voltage cut-off [V]': 3.105,\n",
" 'Upper voltage cut-off [V]': 4.7,\n",
" 'C-rate': 2.0,\n",
" 'Current function': 1.36,\n",
" 'Initial concentration in negative electrode [mol.m-3]': 19986.609595075,\n",
" 'Initial concentration in positive electrode [mol.m-3]': 30730.7554385565,\n",
" 'Initial concentration in electrolyte [mol.m-3]': 1000.0,\n",
" 'Initial temperature [K]': 298.15,\n",
" 'Typical current [A]': 1.36}"
"{ 'Ambient temperature [K]': 298.15,\n",
" 'C-rate': 1.9981898750543627,\n",
" 'Cation transference number': 0.4,\n",
" 'Cell capacity [A.h]': 0.680616,\n",
" 'Current function [A]': 1.36,\n",
" 'Electrode height [m]': 0.13699999999999998,\n",
" 'Electrode width [m]': 0.207,\n",
" 'Electrolyte conductivity [S.m-1]': <function electrolyte_conductivity_Capiglia1999 at 0x7f42be7f4320>,\n",
" 'Electrolyte conductivity activation energy [J.mol-1]': 34700.0,\n",
" 'Electrolyte diffusion activation energy [J.mol-1]': 37040.0,\n",
" 'Electrolyte diffusivity [m2.s-1]': <function electrolyte_diffusivity_Capiglia1999 at 0x7f42be7f44d0>,\n",
" 'Heat transfer coefficient [W.m-2.K-1]': 10.0,\n",
" 'Initial concentration in electrolyte [mol.m-3]': 1000.0,\n",
" 'Initial concentration in negative electrode [mol.m-3]': 19986.609595075,\n",
" 'Initial concentration in positive electrode [mol.m-3]': 30730.755438556498,\n",
" 'Initial temperature [K]': 298.15,\n",
" 'Lower voltage cut-off [V]': 3.105,\n",
" 'Maximum concentration in negative electrode [mol.m-3]': 24983.2619938437,\n",
" 'Maximum concentration in positive electrode [mol.m-3]': 51217.9257309275,\n",
" 'Negative current collector conductivity [S.m-1]': 59600000.0,\n",
" 'Negative current collector density [kg.m-3]': 8954.0,\n",
" 'Negative current collector specific heat capacity [J.kg-1.K-1]': 385.0,\n",
" 'Negative current collector thermal conductivity [W.m-1.K-1]': 401.0,\n",
" 'Negative current collector thickness [m]': 2.5e-05,\n",
" 'Negative electrode Bruggeman coefficient (electrode)': 1.5,\n",
" 'Negative electrode Bruggeman coefficient (electrolyte)': 1.5,\n",
" 'Negative electrode OCP [V]': <function graphite_mcmb2528_ocp_Dualfoil1998 at 0x7f42bfb4a8c0>,\n",
" 'Negative electrode OCP entropic change [V.K-1]': <function graphite_entropic_change_Moura2016 at 0x7f42bfb4ab90>,\n",
" 'Negative electrode active material volume fraction': 0.7,\n",
" 'Negative electrode cation signed stoichiometry': -1.0,\n",
" 'Negative electrode charge transfer coefficient': 0.5,\n",
" 'Negative electrode conductivity [S.m-1]': 100.0,\n",
" 'Negative electrode density [kg.m-3]': 1657.0,\n",
" 'Negative electrode diffusivity [m2.s-1]': <function graphite_mcmb2528_diffusivity_Dualfoil1998 at 0x7f42ebf467a0>,\n",
" 'Negative electrode double-layer capacity [F.m-2]': 0.2,\n",
" 'Negative electrode electrons in reaction': 1.0,\n",
" 'Negative electrode porosity': 0.3,\n",
" 'Negative electrode reaction rate': <function graphite_electrolyte_reaction_rate_Dualfoil1998 at 0x7f42bfb4a7a0>,\n",
" 'Negative electrode specific heat capacity [J.kg-1.K-1]': 700.0,\n",
" 'Negative electrode surface area density [m-1]': 180000.0,\n",
" 'Negative electrode thermal conductivity [W.m-1.K-1]': 1.7,\n",
" 'Negative electrode thickness [m]': 0.0001,\n",
" 'Negative particle distribution in x': 1.0,\n",
" 'Negative particle radius [m]': 1e-05,\n",
" 'Negative reaction rate activation energy [J.mol-1]': 37480.0,\n",
" 'Negative solid diffusion activation energy [J.mol-1]': 42770.0,\n",
" 'Negative tab centre y-coordinate [m]': 0.06,\n",
" 'Negative tab centre z-coordinate [m]': 0.13699999999999998,\n",
" 'Negative tab width [m]': 0.04,\n",
" 'Number of cells connected in series to make a battery': 1.0,\n",
" 'Number of electrodes connected in parallel to make a cell': 1.0,\n",
" 'Positive current collector conductivity [S.m-1]': 35500000.0,\n",
" 'Positive current collector density [kg.m-3]': 2707.0,\n",
" 'Positive current collector specific heat capacity [J.kg-1.K-1]': 897.0,\n",
" 'Positive current collector thermal conductivity [W.m-1.K-1]': 237.0,\n",
" 'Positive current collector thickness [m]': 2.5e-05,\n",
" 'Positive electrode Bruggeman coefficient (electrode)': 1.5,\n",
" 'Positive electrode Bruggeman coefficient (electrolyte)': 1.5,\n",
" 'Positive electrode OCP [V]': <function lico2_ocp_Dualfoil1998 at 0x7f42bfb4ad40>,\n",
" 'Positive electrode OCP entropic change [V.K-1]': <function lico2_entropic_change_Moura2016 at 0x7f42be7f40e0>,\n",
" 'Positive electrode active material volume fraction': 0.7,\n",
" 'Positive electrode cation signed stoichiometry': -1.0,\n",
" 'Positive electrode charge transfer coefficient': 0.5,\n",
" 'Positive electrode conductivity [S.m-1]': 10.0,\n",
" 'Positive electrode density [kg.m-3]': 3262.0,\n",
" 'Positive electrode diffusivity [m2.s-1]': <function lico2_diffusivity_Dualfoil1998 at 0x7f42bfb4ac20>,\n",
" 'Positive electrode double-layer capacity [F.m-2]': 0.2,\n",
" 'Positive electrode electrons in reaction': 1.0,\n",
" 'Positive electrode porosity': 0.3,\n",
" 'Positive electrode reaction rate': <function lico2_electrolyte_reaction_rate_Dualfoil1998 at 0x7f42bfb36710>,\n",
" 'Positive electrode specific heat capacity [J.kg-1.K-1]': 700.0,\n",
" 'Positive electrode surface area density [m-1]': 150000.0,\n",
" 'Positive electrode thermal conductivity [W.m-1.K-1]': 2.1,\n",
" 'Positive electrode thickness [m]': 0.0001,\n",
" 'Positive particle distribution in x': 1.0,\n",
" 'Positive particle radius [m]': 1e-05,\n",
" 'Positive reaction rate activation energy [J.mol-1]': 39570.0,\n",
" 'Positive solid diffusion activation energy [J.mol-1]': 18550.0,\n",
" 'Positive tab centre y-coordinate [m]': 0.147,\n",
" 'Positive tab centre z-coordinate [m]': 0.13699999999999998,\n",
" 'Positive tab width [m]': 0.04,\n",
" 'Reference OCP vs SHE in the negative electrode [V]': nan,\n",
" 'Reference OCP vs SHE in the positive electrode [V]': nan,\n",
" 'Reference temperature [K]': 298.15,\n",
" 'Separator Bruggeman coefficient (electrode)': 1.5,\n",
" 'Separator Bruggeman coefficient (electrolyte)': 1.5,\n",
" 'Separator density [kg.m-3]': 397.0,\n",
" 'Separator porosity': 1.0,\n",
" 'Separator specific heat capacity [J.kg-1.K-1]': 700.0,\n",
" 'Separator thermal conductivity [W.m-1.K-1]': 0.16,\n",
" 'Separator thickness [m]': 2.5e-05,\n",
" 'Typical current [A]': 0.680616,\n",
" 'Typical electrolyte concentration [mol.m-3]': 1000.0,\n",
" 'Upper voltage cut-off [V]': 4.7}"
]
},
"execution_count": 10,
Expand Down Expand Up @@ -380,7 +381,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.3"
"version": "3.7.5"
}
},
"nbformat": 4,
Expand Down
4 changes: 4 additions & 0 deletions pybamm/parameters/parameter_values.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import os
import numbers
import numpy as np
from pprint import pformat


class ParameterValues:
Expand Down Expand Up @@ -92,6 +93,9 @@ def __setitem__(self, key, value):
def __delitem__(self, key):
del self._dict_items[key]

def __repr__(self):
return pformat(self._dict_items, width=1)

def keys(self):
"Get the keys of the dictionary"
return self._dict_items.keys()
Expand Down

0 comments on commit 1b0e0c5

Please sign in to comment.