Skip to content

Commit

Permalink
#546 merge #923
Browse files Browse the repository at this point in the history
  • Loading branch information
valentinsulzer committed Mar 28, 2020
2 parents d71cd6b + aae9402 commit 6500ac9
Show file tree
Hide file tree
Showing 115 changed files with 841 additions and 834 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,14 @@
- Added `CasadiAlgebraicSolver` for solving algebraic systems with CasADi ([#868](https://github.com/pybamm-team/PyBaMM/pull/868))
- Added electrolyte functions from Landesfeind ([#860](https://github.com/pybamm-team/PyBaMM/pull/860))

## Optimizations

- Sped up model building ([#927](https://github.com/pybamm-team/PyBaMM/pull/927))
- Changed default solver for lead-acid to `CasadiSolver` ([#927](https://github.com/pybamm-team/PyBaMM/pull/927))

## Bug fixes

- Reformatted electrolyte submodels ([#927](https://github.com/pybamm-team/PyBaMM/pull/927))
- Fixed bug raised if function returns a scalar ([#919](https://github.com/pybamm-team/PyBaMM/pull/919))
- Fixed event handling in `ScipySolver` ([#905](https://github.com/pybamm-team/PyBaMM/pull/905))
- Made input handling clearer in solvers ([#905](https://github.com/pybamm-team/PyBaMM/pull/905))
Expand Down
1 change: 1 addition & 0 deletions docs/source/expression_tree/operations/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ Classes and functions that operate on the expression tree
evaluate
jacobian
convert_to_casadi
unpack_symbol
5 changes: 5 additions & 0 deletions docs/source/expression_tree/operations/unpack_symbol.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Symbol Unpacker
===============

.. autoclass:: pybamm.SymbolUnpacker
:members:
9 changes: 0 additions & 9 deletions docs/source/models/submodels/electrolyte/index.rst

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Base Electrolyte Conductivity Submodel
======================================

.. autoclass:: pybamm.electrolyte.BaseElectrolyteConductivity
.. autoclass:: pybamm.electrolyte_conductivity.BaseElectrolyteConductivity
:members:

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Composite Model
===============

.. autoclass:: pybamm.electrolyte_conductivity.Composite
:members:
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Full Model
==========

.. autoclass:: pybamm.electrolyte_conductivity.Full
:members:
:inherited-members:

11 changes: 11 additions & 0 deletions docs/source/models/submodels/electrolyte_conductivity/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Electrolyte Conductivity
========================

.. toctree::
:maxdepth: 1

base_electrolyte_conductivity
leading_order_conductivity
composite_conductivity
full_conductivity
surface_form/index
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Leading Order Model
===================

.. autoclass:: pybamm.electrolyte_conductivity.LeadingOrder
:members:

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Full Model
===========

.. autoclass:: pybamm.electrolyte_conductivity.surface_potential_form.FullDifferential
:members:

.. autoclass:: pybamm.electrolyte_conductivity.surface_potential_form.FullAlgebraic
:members:
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Leading Order Model
====================

.. autoclass:: pybamm.electrolyte_conductivity.surface_potential_form.LeadingOrderDifferential
:members:

.. autoclass:: pybamm.electrolyte_conductivity.surface_potential_form.LeadingOrderAlgebraic
:members:
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Base Electrolyte Diffusion Submodel
====================================

.. autoclass:: pybamm.electrolyte.BaseElectrolyteDiffusion
.. autoclass:: pybamm.electrolyte_diffusion.BaseElectrolyteDiffusion
:members:
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Composite Model
===============

.. autoclass:: pybamm.electrolyte_diffusion.Composite
:members:
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Constant Concentration
=======================

.. autoclass:: pybamm.electrolyte_diffusion.ConstantConcentration
:members:

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Full Model
==========

.. autoclass:: pybamm.electrolyte_diffusion.Full
:members:

10 changes: 10 additions & 0 deletions docs/source/models/submodels/electrolyte_diffusion/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Electrolyte Diffusion
=====================

.. toctree::

base_electrolyte_diffusion
constant_concentration
leading_order_diffusion
composite_diffusion
full_diffusion
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Leading Order Model
===================

.. autoclass:: pybamm.electrolyte_diffusion.LeadingOrder
:members:


3 changes: 2 additions & 1 deletion docs/source/models/submodels/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ Submodels
current_collector/index
convection/index
electrode/index
electrolyte/index
electrolyte_conductivity/index
electrolyte_diffusion/index
external_circuit/index
interface/index
oxygen_diffusion/index
Expand Down
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.
12 changes: 6 additions & 6 deletions examples/notebooks/spatial_methods/finite-volumes.ipynb

Large diffs are not rendered by default.

77 changes: 38 additions & 39 deletions examples/notebooks/using-submodels.ipynb

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions examples/scripts/compare_lead_acid.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@

# load models
models = [
pybamm.lead_acid.LOQS(),
# pybamm.lead_acid.FOQS(),
pybamm.lead_acid.Composite(),
# pybamm.lead_acid.LOQS(),
# # pybamm.lead_acid.FOQS(),
# pybamm.lead_acid.Composite(),
pybamm.lead_acid.Full(),
]

Expand Down
13 changes: 6 additions & 7 deletions examples/scripts/custom_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,12 @@
model.submodels["positive interface"] = pybamm.interface.InverseButlerVolmer(
model.param, "Positive", "lithium-ion main"
)
electrolyte = pybamm.electrolyte.stefan_maxwell
model.submodels["electrolyte diffusion"] = electrolyte.diffusion.ConstantConcentration(
model.param
)
model.submodels["electrolyte conductivity"] = electrolyte.conductivity.LeadingOrder(
model.param
)
model.submodels[
"electrolyte diffusion"
] = pybamm.electrolyte_diffusion.ConstantConcentration(model.param)
model.submodels[
"electrolyte conductivity"
] = pybamm.electrolyte_conductivity.LeadingOrder(model.param)

# build model
model.build_model()
Expand Down
4 changes: 3 additions & 1 deletion pybamm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ def version(formatted=False):
)
from .expression_tree.operations.jacobian import Jacobian
from .expression_tree.operations.convert_to_casadi import CasadiConverter
from .expression_tree.operations.unpack_symbols import SymbolUnpacker

#
# Model classes
Expand All @@ -123,7 +124,8 @@ def version(formatted=False):
from .models.submodels import (
convection,
current_collector,
electrolyte,
electrolyte_conductivity,
electrolyte_diffusion,
electrode,
external_circuit,
interface,
Expand Down
2 changes: 1 addition & 1 deletion pybamm/expression_tree/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def diff(self, variable):
children = self.orphans
partial_derivatives = [None] * len(children)
for i, child in enumerate(self.children):
# if variable appears in the function,use autograd to differentiate
# if variable appears in the function, differentiate
# function, and apply chain rule
if variable.id in [symbol.id for symbol in child.pre_order()]:
partial_derivatives[i] = self._function_diff(
Expand Down
Loading

0 comments on commit 6500ac9

Please sign in to comment.