Single Particle Model
The Single Particle Model
Now we will extend our PDE model to the full single particle model. The single particle model is a system of PDEs that describes the behaviour of a lithium-ion battery electrode particle.
The Single Particle Model state equations
The SPM model only needs to solve for the concentration of lithium ions in the positive and negative electrodes, and . The diffusion of lithium ions in each electrode particle is given by:
subject to the following boundary and initial conditions:
where is the concentration of lithium ions in the positive () or negative () electrode, is the diffusion coefficient, is the interfacial current density, and is the concentration at the particle surface.
The primary addition here in comparison with our previous PDE model is the fluxes of lithium ions in the positive and negative electrodes . These are dependent on the applied current :
where is the specific surface area of the electrode, is the volume fraction of active material, is the thickness of the electrode, is the Faraday constant, and is the electrode surface area.
Function Parameters in PyBaMM
The applied current is a parameter to the model, but unlike the
other parameters we have seen so far, it is a function of time. We can define
this using pybamm.FunctionParameter
:
import pybamm I = pybamm.FunctionParameter("Current function [A]", {"Time [s]": pybamm.t})
This will allow us to define the applied current as a function of time when we
create our pybamm.ParameterValues
object.
def current(t): return 1 param = pybamm.ParameterValues( { "Current function [A]": current } )
Domains in PyBaMM
In the SPM model we have two different spatial domains, one for the positive
electrode and one for the negative electrode. Remember that when we define a variable in
PyBaMM, we can specify the domain using the domain
keyword argument:
c_n = pybamm.Variable("Negative particle concentration [mol.m-3]", domain="negative particle")
SPM governing equations
Copy your PDE model from the previous challenge to a new file, and modify it to
include the state equations for the concentration of lithium ions in both the
positive and negative electrodes. Note that now you will have two variables,
and , that must be defined on separate spatial domains, and a number
of new parameters. Define the applied current as a input parameter that is a
function of time using pybamm.FunctionParameter
.
Output variables for the Single Particle Model
Now that we have defined the equations to solve, we turn to the output variables that we need to calculate from the state variables and . The terminal voltage of the battery is given by:
where is the open circuit potential (OCP) of the electrode, is the surface stoichiometry, and is the overpotential.
Assuming Butler-Volmer kinetics and , the overpotential is given by:
where the exchange current density is given by:
where is the concentration of lithium ions in the electrolyte, and is the reaction rate constant.
Surface stoichiometry
Lets revisit the definition of the surface stoichiometry , which is
is the maximum concentration of lithium ions in the electrode, and is a parameter of the model. However, is the concentration of lithium ions at the surface of the electrode particle. How can we express this in PyBaMM, given that we only have the concentration defined on the whole domain?
To get the surface concentration, we can use the pybamm.boundary_value
or
pybamm.surf
functions. The pybamm.boundary_value
function returns the value
of a variable at the boundary of a domain (either "left" or "right"), and the
pybamm.surf
function returns the value of a variable at the right boundary of
a domain. For example, to get the surface concentration of we can use:
c_n_surf = pybamm.surf(c_n)
or
c_n_surf = pybamm.boundary_value(c_n, "right")
Open Circuit Potentials (OCPs)
The OCPs are functions of the surface stoichiometries , and we can
define them using pybamm.FunctionParameter
in a similar way to the applied
current . For example, to define the OCP of the positive electrode as a
function of the surface stoichiometry :
U_p = pybamm.FunctionParameter("Positive electrode OCP [V]", {"stoichiometry": "x_p_s"})
PyBaMM's built-in functions
PyBaMM has a number of built-in functions that can be used in expressions. For
the SPM model, you will need to use the
pybamm.sqrt
and
pybamm.arcsinh
functions:
four = pybamm.Scalar(4) two = pybamm.sqrt(four) arcsinh_four = pybamm.arcsinh(four)
You can see a list of all the functions available in PyBaMM in the documentation.
SPM output variables
Define the output variables for the SPM model. You will need to define the
overpotentials and , the exchange current densities
and , and the terminal voltage . You will also need to define the
OCPs and as functions of the surface stoichiometries and
. You can use pybamm.FunctionParameter
to define the OCPs as functions
of the surface stoichiometries.
Define the following output variables for the model
Terminal voltage
Surface concentration in negative particle
Discretising and solving the Single Particle Model
Now that we have defined the SPM model, we can discretise and solve it using PyBaMM. We can use the same meshing and discretisation methods as in the previous section, but we now need to discretise the model on two different spatial domains.
Discretise and solve the SPM model
Discretise and solve the SPM model using the same methods as in the previous section. The following parameter values object copies the parameters from the PyBaMM Chen2020 model, feel free to use this to define the parameters for the SPM model.
param = pybamm.ParameterValues("Chen2020") # PyBaMM parameters provide the exchange current density directly, rather than the reaction rate, so define here param.update({ "Positive electrode reaction rate [m.s-1]": 1e-3, "Negative electrode reaction rate [m.s-1]": 1e-3, }, check_already_exists=False)