diff --git a/CHANGELOG.md b/CHANGELOG.md index ce83454dc1..b6c67c1174 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## Features +- Added `NewmanTobias` li-ion battery model ([#1423](https://github.com/pybamm-team/PyBaMM/pull/1423)) - Added `plot_voltage_components` to easily plot the component overpotentials that make up the voltage ([#1419](https://github.com/pybamm-team/PyBaMM/pull/1419)) - Made `QuickPlot` more customizable and added an example ([#1419](https://github.com/pybamm-team/PyBaMM/pull/1419)) - `Solution` objects can now be created by stepping *different* models ([#1408](https://github.com/pybamm-team/PyBaMM/pull/1408)) diff --git a/pybamm/models/submodels/electrolyte_diffusion/base_electrolyte_diffusion.py b/pybamm/models/submodels/electrolyte_diffusion/base_electrolyte_diffusion.py index 71712847c3..a2c9ce99d4 100644 --- a/pybamm/models/submodels/electrolyte_diffusion/base_electrolyte_diffusion.py +++ b/pybamm/models/submodels/electrolyte_diffusion/base_electrolyte_diffusion.py @@ -134,17 +134,6 @@ def _get_total_concentration_electrolyte(self, c_e, epsilon): return variables - def set_boundary_conditions(self, variables): - - c_e = variables["Electrolyte concentration"] - - self.boundary_conditions = { - c_e: { - "left": (pybamm.Scalar(0), "Neumann"), - "right": (pybamm.Scalar(0), "Neumann"), - } - } - def set_events(self, variables): c_e = variables["Electrolyte concentration"] self.events.append( diff --git a/pybamm/models/submodels/electrolyte_diffusion/composite_diffusion.py b/pybamm/models/submodels/electrolyte_diffusion/composite_diffusion.py index ad37e30b64..ebfa8232fb 100644 --- a/pybamm/models/submodels/electrolyte_diffusion/composite_diffusion.py +++ b/pybamm/models/submodels/electrolyte_diffusion/composite_diffusion.py @@ -95,3 +95,14 @@ def set_initial_conditions(self, variables): c_e = variables["Electrolyte concentration"] self.initial_conditions = {c_e: self.param.c_e_init} + + def set_boundary_conditions(self, variables): + + c_e = variables["Electrolyte concentration"] + + self.boundary_conditions = { + c_e: { + "left": (pybamm.Scalar(0), "Neumann"), + "right": (pybamm.Scalar(0), "Neumann"), + } + } diff --git a/pybamm/models/submodels/electrolyte_diffusion/constant_concentration.py b/pybamm/models/submodels/electrolyte_diffusion/constant_concentration.py index 570bce61b3..7001675d2f 100644 --- a/pybamm/models/submodels/electrolyte_diffusion/constant_concentration.py +++ b/pybamm/models/submodels/electrolyte_diffusion/constant_concentration.py @@ -45,3 +45,19 @@ def get_coupled_variables(self, variables): variables.update(self._get_total_concentration_electrolyte(c_e, eps)) return variables + + def set_boundary_conditions(self, variables): + """ + We provide boundary conditions even though the concentration is constant + so that the gradient of the concentration has the correct shape after + discretisation. + """ + + c_e = variables["Electrolyte concentration"] + + self.boundary_conditions = { + c_e: { + "left": (pybamm.Scalar(0), "Neumann"), + "right": (pybamm.Scalar(0), "Neumann"), + } + } diff --git a/pybamm/models/submodels/electrolyte_diffusion/full_diffusion.py b/pybamm/models/submodels/electrolyte_diffusion/full_diffusion.py index 14c09a501b..590f879612 100644 --- a/pybamm/models/submodels/electrolyte_diffusion/full_diffusion.py +++ b/pybamm/models/submodels/electrolyte_diffusion/full_diffusion.py @@ -81,3 +81,14 @@ def set_initial_conditions(self, variables): c_e = variables["Electrolyte concentration"] self.initial_conditions = {c_e: self.param.c_e_init} + + def set_boundary_conditions(self, variables): + + c_e = variables["Electrolyte concentration"] + + self.boundary_conditions = { + c_e: { + "left": (pybamm.Scalar(0), "Neumann"), + "right": (pybamm.Scalar(0), "Neumann"), + } + }