Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 923 reformat electrolyte #927

Merged
merged 15 commits into from
Apr 6, 2020
Merged
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
10 changes: 8 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
# [Unreleased](https://github.com/pybamm-team/PyBaMM)
# [Unreleased](https://github.com/pybamm-team/PyBaMM/)

## Features
## Optimizations

- Made `QuickPlot` compatible with Google Colab ([#935](https://github.com/pybamm-team/PyBaMM/pull/935))
- 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))

# [v0.2.1](https://github.com/pybamm-team/PyBaMM/tree/v0.2.1) - 2020-03-31

1 change: 1 addition & 0 deletions docs/source/expression_tree/operations/index.rst
Original file line number Diff line number Diff line change
@@ -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,7 @@
Surface Form
=============

.. toctree::

full_surface_form_conductivity
leading_surface_form_conductivity
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
@@ -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
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
@@ -18,14 +18,14 @@
# load models
models = [
pybamm.lead_acid.LOQS(),
# pybamm.lead_acid.FOQS(),
pybamm.lead_acid.Composite(),
pybamm.lead_acid.FOQS(),
pybamm.lead_acid.CompositeExtended(),
pybamm.lead_acid.Full(),
]

# load parameter values and process models and geometry
param = models[0].default_parameter_values
param.update({"Current function [A]": 10, "Initial State of Charge": 1})
param.update({"Current function [A]": 85, "Initial State of Charge": 1})
for model in models:
param.process_model(model)

13 changes: 6 additions & 7 deletions examples/scripts/custom_model.py
Original file line number Diff line number Diff line change
@@ -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()
4 changes: 3 additions & 1 deletion pybamm/__init__.py
Original file line number Diff line number Diff line change
@@ -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
@@ -123,7 +124,8 @@ def version(formatted=False):
from .models.submodels import (
convection,
current_collector,
electrolyte,
electrolyte_conductivity,
electrolyte_diffusion,
electrode,
external_circuit,
interface,
4 changes: 2 additions & 2 deletions pybamm/expression_tree/broadcasts.py
Original file line number Diff line number Diff line change
@@ -252,8 +252,8 @@ class FullBroadcast(Broadcast):
"A class for full broadcasts"

def __init__(self, child, broadcast_domain, auxiliary_domains, name=None):
if auxiliary_domains == "current collector":
auxiliary_domains = {"secondary": "current collector"}
if isinstance(auxiliary_domains, str):
auxiliary_domains = {"secondary": auxiliary_domains}
super().__init__(
child,
broadcast_domain,
2 changes: 1 addition & 1 deletion pybamm/expression_tree/functions.py
Original file line number Diff line number Diff line change
@@ -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(
Loading