Skip to content

Commit

Permalink
#834 ferran comments
Browse files Browse the repository at this point in the history
  • Loading branch information
valentinsulzer committed May 5, 2020
1 parent 3d1c421 commit a95c982
Show file tree
Hide file tree
Showing 14 changed files with 62 additions and 102 deletions.
1 change: 1 addition & 0 deletions docs/source/models/submodels/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ Submodels
porosity/index
thermal/index
tortuosity/index
sei/index
6 changes: 6 additions & 0 deletions docs/source/models/submodels/sei/base_sei.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Base SEI
========

.. autoclass:: pybamm.sei.BaseSEI
:members:

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Electron Migration Limited
==========================

.. autoclass:: pybamm.sei.ElectronMigrationLimited
:members:

12 changes: 12 additions & 0 deletions docs/source/models/submodels/sei/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
SEI
===

.. toctree::
:maxdepth: 1

base_sei
electron_migration_limited
interstitial_diffusion_limited
no_sei
reaction_limited
solvent_diffusion_limited
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Interstitial Diffusion Limited
==============================

.. autoclass:: pybamm.sei.InterstitialDiffusionLimited
:members:

6 changes: 6 additions & 0 deletions docs/source/models/submodels/sei/no_sei.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
No SEI
======

.. autoclass:: pybamm.sei.NoSEI
:members:

6 changes: 6 additions & 0 deletions docs/source/models/submodels/sei/reaction_limited.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Reaction Limited
================

.. autoclass:: pybamm.sei.ReactionLimited
:members:

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Solvent Diffusion Limited
=========================

.. autoclass:: pybamm.sei.SolventDiffusionLimited
:members:

69 changes: 1 addition & 68 deletions examples/scripts/sei_growth.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,81 +2,15 @@
import numpy as np

pb.set_logging_level("INFO")
# pb.settings.debug_mode = True

options = {"sei": "reaction limited"}
options = {"sei": "solvent-diffusion limited"}
options = {"sei": "electron-migration limited"}
options = {"sei": "interstitial-diffusion limited"}
# options = {"sei": None}
model = pb.lithium_ion.DFN(options)

# experiment = pb.Experiment(
# [
# "Discharge at C/10 for 13 hours or until 3.3 V",
# "Rest for 1 hour",
# "Charge at 1 A until 4.1 V",
# "Hold at 4.1 V until 50 mA",
# "Rest for 1 hour",
# ]
# * 10
# )
# experiment = pb.Experiment(["Rest for 20000 hours"])

parameter_values = model.default_parameter_values

# parameter_values.update(
# {
# "Inner SEI reaction proportion": 0.5,
# "Inner SEI partial molar volume [m3.mol-1]": 95.86e-18,
# "Outer SEI partial molar volume [m3.mol-1]": 95.86e-18,
# "SEI reaction exchange current density [A.m-2]": 1.5e-6,
# "SEI resistance per unit thickness [Ohm.m-1]": 1,
# "Outer SEI solvent diffusivity [m2.s-1]": 2.5e-22,
# "Bulk solvent concentration [mol.m-3]": 2.636e3,
# "Ratio of inner and outer SEI exchange current densities": 1,
# "Inner SEI open-circuit potential [V]": 0.1,
# "Outer SEI open-circuit potential [V]": 0.8,
# "Inner SEI electron conducticity [S.m-1]": 8.95e-14,
# "Inner SEI lithium interstitial diffusivity [m2.s-1]": 1e-15,
# "Lithium interstitial reference concentration [mol.m-3]": 15,
# "Initial inner SEI thickness [m]": 7.5e-14,
# }
# )

# parameter_values.update(
# {
# "Inner SEI reaction proportion": 0.5,
# "Inner SEI partial molar volume [m3.mol-1]": 34.76e-7,
# "Outer SEI partial molar volume [m3.mol-1]": 34.76e-7,
# "SEI reaction exchange current density [A.m-2]": 1.5e-7,
# "SEI resistance per unit thickness [Ohm.m-1]": 1,
# "Outer SEI solvent diffusivity [m2.s-1]": 2.5e-22,
# "Bulk solvent concentration [mol.m-3]": 2.636e3,
# "Ratio of inner and outer SEI exchange current densities": 1,
# "Inner SEI open-circuit potential [V]": 0.1,
# "Outer SEI open-circuit potential [V]": 0.8,
# "Inner SEI electron conductivity [S.m-1]": 8.95e-13,
# "Inner SEI lithium interstitial diffusivity [m2.s-1]": 1e-20,
# "Lithium interstitial reference concentration [mol.m-3]": 15,
# "Initial inner SEI thickness [m]": 7.5e-9,
# "Initial outer SEI thickness [m]": 7.5e-9,
# }
# )

# parameter_values.update({"Current function [A]": 0})


def my_sin(t):
return pb.sin(0.01 * t)


parameter_values["Current function [A]"] = "[current data]US06"
parameter_values["Current function [A]"] = 0

sim = pb.Simulation(
model, parameter_values=parameter_values
) # , experiment=experiment)
sim = pb.Simulation(model, parameter_values=parameter_values)

solver = pb.CasadiSolver(mode="fast")

Expand All @@ -89,7 +23,6 @@ def my_sin(t):
t_eval = np.linspace(0, seconds, 100)

sim.solve(t_eval=t_eval, solver=solver)
# sim.solve(solver=solver, t_eval=t_eval)
sim.plot(
[
"Terminal voltage [V]",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,4 @@ def graphite_diffusivity_PeymanMPM(sto, T):
E_D_s = 42770
arrhenius = exp(E_D_s / constants.R * (1 / 298.15 - 1 / T))

# Removing the fudge factor 0 * sto requires different handling of either
# either simplifications or how sto is passed into this function.
# See #547
return D_ref * arrhenius + 0 * sto
return D_ref * arrhenius
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ def graphite_ocp_PeymanMPM(sto):
- 0.0800 * pybamm.tanh((sto - 1.030) / 0.055)
)

# u_eq = 1.0 + (0 * sto)

return u_eq


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,4 @@ def NMC_diffusivity_PeymanMPM(sto, T):
E_D_s = 18550
arrhenius = exp(E_D_s / constants.R * (1 / 298.15 - 1 / T))

# Removing the fudge factor 0 * sto requires different handling of either
# either simplifications or how sto is passed into this function.
# See #547
return D_ref * arrhenius + 0 * sto
return D_ref * arrhenius
15 changes: 10 additions & 5 deletions pybamm/models/full_battery_models/base_battery_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,16 @@ class BaseBatteryModel(pybamm.BaseModel):
are strings that correspond to the submodel names in the keys
of `self.submodels`.
* "sei" : str
Set the sei submodel to be used. If None, no SEI model is use. Options
are "reaction limited", "solvent diffusion limited",
"electron migration limited", or "lithium interstitial
diffusion limited".
Set the sei submodel to be used. Options are:
- None: :class:`pybamm.sei.NoSEI` (no SEI growth)
- "reaction limited": :class:`pybamm.sei.ReactionLimited`
- "solvent diffusion limited": \
:class:`pybamm.sei.SolventDiffusionLimited`
- "electron migration limited": \
:class:`pybamm.sei.ElectronMigrationLimited`
- "lithium interstitial diffusion limited": \
:class:`pybamm.sei.InterstitialDiffusionLimited`
**Extends:** :class:`pybamm.BaseModel`
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,25 +36,6 @@ def set_standard_output_variables(self):
}
)

# def set_reactions(self):

# # Should probably refactor as this is a bit clunky at the moment
# # Maybe each reaction as a Reaction class so we can just list names of classes
# icd = " interfacial current density"
# self.reactions = {
# "main": {
# "Negative": {"s": 1, "aj": "Negative electrode" + icd},
# "Positive": {"s": 1, "aj": "Positive electrode" + icd},
# }
# }

# # N.B if there is no sei reaction then reaction
# # is set to zero in the submodel.
# self.reactions["sei"] = {
# "Negative": {"s": 1, "aj": "Scaled negative electrode sei" + icd},
# "Positive": {"s": 1, "aj": "Scaled positive electrode sei" + icd},
# }

def set_sei_submodel(self):

# negative electrode SEI
Expand Down

0 comments on commit a95c982

Please sign in to comment.