Skip to content

Commit

Permalink
#247 merge master
Browse files Browse the repository at this point in the history
  • Loading branch information
valentinsulzer committed Feb 19, 2020
2 parents 96e4130 + 53fa5f5 commit fe7995a
Show file tree
Hide file tree
Showing 68 changed files with 843 additions and 773 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@

## Bug fixes

- Moved evaluation of initial conditions to solver ([#839](https://github.com/pybamm-team/PyBaMM/pull/839))
- Fixed a bug where the first line of the data wasn't loaded when parameters are loaded from data ([#819](https://github.com/pybamm-team/PyBaMM/pull/819))
- Made `graphviz` an optional dependency ([#810](https://github.com/pybamm-team/PyBaMM/pull/810))
- Fixed examples to run with basic pip installation ([#800](https://github.com/pybamm-team/PyBaMM/pull/800))
Expand All @@ -74,6 +75,7 @@

## Breaking changes

- Time for solver should now be given in seconds ([#832](https://github.com/pybamm-team/PyBaMM/pull/832))
- Model events are now represented as a list of `pybamm.Event` ([#759](https://github.com/pybamm-team/PyBaMM/issues/759)
- Removed `ParameterValues.update_model`, whose functionality is now replaced by `InputParameter` ([#801](https://github.com/pybamm-team/PyBaMM/pull/801))
- Removed `Outer` and `Kron` nodes as no longer used ([#777](https://github.com/pybamm-team/PyBaMM/pull/777))
Expand Down
28 changes: 12 additions & 16 deletions examples/notebooks/change-input-current.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"os.chdir(pybamm.__path__[0]+'/..')\n",
"\n",
"# create the model\n",
"model = pybamm.lithium_ion.SPM()\n",
"model = pybamm.lithium_ion.DFN()\n",
"\n",
"# set the default model geometry\n",
"geometry = model.default_geometry\n",
Expand Down Expand Up @@ -66,12 +66,12 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "770ba7f159054c5bad11038ac7be3f72",
"model_id": "528740d94922483b86f14724fcfa32b8",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"interactive(children=(FloatSlider(value=0.0, description='t', max=0.003612040133779264, step=0.005), Output())…"
"interactive(children=(FloatSlider(value=0.0, description='t', max=0.0006659775771737802, step=0.005), Output()…"
]
},
"metadata": {},
Expand All @@ -91,9 +91,9 @@
"disc.process_model(model)\n",
"\n",
"# Solve the model at the given time points\n",
"solver = model.default_solver\n",
"solver = pybamm.CasadiSolver()\n",
"n = 300\n",
"t_eval = np.linspace(0, 0.02, n)\n",
"t_eval = np.linspace(0, 500, n)\n",
"solution = solver.solve(model, t_eval, inputs={\"Current function [A]\": 16})\n",
"\n",
"# plot\n",
Expand All @@ -118,12 +118,12 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "4625a91d401b456d8e43aae201f4a380",
"model_id": "2811c58f82064ae6b2e558d33c5551fd",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"interactive(children=(FloatSlider(value=0.0, description='t', max=0.02, step=0.005), Output()), _dom_classes=("
"interactive(children=(FloatSlider(value=0.0, description='t', max=0.022125255063884477, step=0.005), Output())…"
]
},
"metadata": {},
Expand Down Expand Up @@ -158,7 +158,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "88c9c957b666420e9cf6f615ff43817c",
"model_id": "8bad57c00aec41bd85c17bec2981a8da",
"version_major": 2,
"version_minor": 0
},
Expand All @@ -171,7 +171,7 @@
}
],
"source": [
"model = pybamm.lithium_ion.SPM()\n",
"model = pybamm.lithium_ion.DFN()\n",
"\n",
"# create geometry\n",
"geometry = model.default_geometry\n",
Expand All @@ -190,10 +190,7 @@
"disc.process_model(model)\n",
"\n",
"# simulate US06 drive cycle (duration 600 seconds)\n",
"tau = param.process_symbol(\n",
" pybamm.standard_parameters_lithium_ion.tau_discharge\n",
").evaluate(0)\n",
"t_eval = np.linspace(0, 600 / tau, 600)\n",
"t_eval = np.linspace(0, 600, 600)\n",
"solution = solver.solve(model, t_eval)\n",
"\n",
"# plot\n",
Expand Down Expand Up @@ -282,7 +279,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "a8b90dfe860644c68af15c7c07e3adeb",
"model_id": "47c47acd733b46428148e9dc7cdf373e",
"version_major": 2,
"version_minor": 0
},
Expand All @@ -304,9 +301,8 @@
"\n",
"# Example: simulate for 30 seconds\n",
"simulation_time = 30 # end time in seconds\n",
"tau = param.process_symbol(pybamm.standard_parameters_lithium_ion.tau_discharge).evaluate(0)\n",
"npts = int(50 * simulation_time * omega) # need enough timesteps to resolve output\n",
"t_eval = np.linspace(0, simulation_time / tau, npts)\n",
"t_eval = np.linspace(0, simulation_time, npts)\n",
"solution = model.default_solver.solve(model, t_eval)\n",
"label = [\"Frequency: {} Hz\".format(omega)]\n",
"\n",
Expand Down
47 changes: 17 additions & 30 deletions examples/notebooks/change-settings.ipynb

Large diffs are not rendered by default.

8 changes: 1 addition & 7 deletions examples/notebooks/compare-comsol-discharge-curve.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -140,15 +140,9 @@
" # update current density\n",
" current = 24 * C_rate\n",
"\n",
" # discharge timescale\n",
" tau = param.process_symbol(\n",
" pybamm.standard_parameters_lithium_ion.tau_discharge\n",
" ).evaluate(0, 0)\n",
"\n",
" # solve model at comsol times\n",
" solver = pybamm.CasadiSolver(mode=\"fast\")\n",
" t = comsol_time / tau\n",
" solution = solver.solve(model, t, inputs={\"Current function [A]\": current})\n",
" solution = solver.solve(model, comsol_time, inputs={\"Current function [A]\": current})\n",
"\n",
" # discharge capacity\n",
" discharge_capacity = solution[\"Discharge capacity [A.h]\"]\n",
Expand Down
10 changes: 5 additions & 5 deletions examples/notebooks/models/DFN.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@
{
"data": {
"text/plain": [
"<pybamm.models.full_battery_models.lithium_ion.dfn.DFN at 0x7f5fe5a04f60>"
"<pybamm.models.full_battery_models.lithium_ion.dfn.DFN at 0x112728780>"
]
},
"execution_count": 3,
Expand Down Expand Up @@ -187,7 +187,7 @@
"source": [
"# solve model\n",
"solver = model.default_solver\n",
"t_eval = np.linspace(0, 1, 300)\n",
"t_eval = np.linspace(0, 3600, 300) # time in seconds\n",
"solution = solver.solve(model, t_eval)\n"
]
},
Expand All @@ -206,12 +206,12 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "7f5052f5e0654d749080b4360008678b",
"model_id": "564a7d77b9894de29f0e926ee1e0e2d6",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"interactive(children=(FloatSlider(value=0.0, description='t', max=0.15719063545150502, step=0.05), Output()), …"
"interactive(children=(FloatSlider(value=0.0, description='t', max=0.15930183645996823, step=0.05), Output()), …"
]
},
"metadata": {},
Expand Down Expand Up @@ -284,7 +284,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.8"
"version": "3.7.3"
}
},
"nbformat": 4,
Expand Down
48 changes: 16 additions & 32 deletions examples/notebooks/models/SPM.ipynb

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions examples/notebooks/models/SPMe.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@
{
"data": {
"text/plain": [
"<pybamm.models.lithium_ion.spme.SPMe at 0x7fb4b587b5f8>"
"<pybamm.models.full_battery_models.lithium_ion.spme.SPMe at 0x11165d5f8>"
]
},
"execution_count": 3,
Expand Down Expand Up @@ -185,7 +185,7 @@
"source": [
"# solve model\n",
"solver = model.default_solver\n",
"t_eval = np.linspace(0, 1, 250)\n",
"t_eval = np.linspace(0, 3600, 250) # time in seconds\n",
"solution = solver.solve(model, t_eval)\n"
]
},
Expand All @@ -204,12 +204,12 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "5181f9cd45ca4c7fb8122c20a058e634",
"model_id": "4b296e4b16c9438083c80708c52f8f1b",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"interactive(children=(FloatSlider(value=0.0, description='t', max=0.15662650602409636, step=0.05), Output()), …"
"interactive(children=(FloatSlider(value=0.0, description='t', max=0.15930183645996823, step=0.05), Output()), …"
]
},
"metadata": {},
Expand Down
22 changes: 12 additions & 10 deletions examples/notebooks/models/compare-lithium-ion.ipynb

Large diffs are not rendered by default.

19 changes: 10 additions & 9 deletions examples/notebooks/models/lead-acid.ipynb

Large diffs are not rendered by default.

Binary file modified examples/notebooks/models/spm1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified examples/notebooks/models/spm2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit fe7995a

Please sign in to comment.