Final exercises
To complete the course, here is a list of open-ended exercises to review the content of the course and go into detail into various features. By open-ended we mean that the exercises will often deliberately not specify every single aspect of the model. Some of this additional detail has nsot been covered in the course, so more information can be found in the PyBaMM documentation. The exercises are independent from each other so they can be tackled in any order.
Exercise 1: Coupled degradation mechanisms
We saw in Lesson 5 how to include additional physics to the models. The goal of this exercise is to further explore the degradation submodels, by coupling several of them together. O'Kane et al (2022) is a very good reference to read more about coupled degradation mechanisms.
Run an electrochemical model of your choice with the SEI growth submodel of your choice too.
Add a lithium plating model of your choice to the previous model. You may want to run multiple cycles to see noticeable differences, and you may want to use the SPM model for faster simulations.
Now add an
SEI on cracks
submodel. Hint: this notebook can be useful to understand better SEI on cracks models.Compare the previous three models together. What differences do you observe?
Use the
plot_summary_variables
function and compare the summary degradation variables for the various degradation models. What do you observe? Tip: check the docs for more information about this function.
Exercise 2: Long experiments
In lesson 2 we saw how to run experiments, that is how to change the cycling conditions between constant current, constant voltage, drive cycles... The goal of this exercise is to explore how to run very long experiments (i.e. experiments with hundreds or even thousands of cycles).
Run an experiment consisting of 10 cycles of 1C discharge, rest, a C/3 4.2 V CCCV charge and another rest.
Now try running the same experiment but for 500 cycles. Which issues are you encountering? Tip: you might want to use a simple model (e.g. SPM) to get faster simulations.
Use the
plot_summary_variables
function to plot the summary degradation variables. Tip: check the docs for more information about this function.Create two different models with different ageing mechanisms, run the long experiment for both and plot the results. Which one ages faster? What are the main contributions to the ageing?
In the previous tasks you might have encountered some memory issues. Use the
save_at_cycles
option in theSimulation.solve
method to not save all the cycles and speed up the computations.Plot both the standard and summary variables for this new solution. What do you observe?
Exercise 3: Half-cell models
A lithium counter-electrode can be used instead of a porous electrode, either to make a lithium-metal battery or to test the properties of an electrode in the laboratory. PyBaMM models can be defined for half-cells, by passing the option "working electrode": "positive"
.
Simulate the DFN model for a half-cell. What differences do you observe with the standard DFN model?
Compare the SPM, SPMe and DFN models for half-cell.
Now use the
Chen2020
parameter set to simulate the half-cell model. Why does it fail?Find the default parameter value used by half-cell models, you can access them by calling the
default_parameter_values
attribute of the model.Using the parameter values found in the previous question, modify the
Chen2020
parameter set to work with the half-cell models.
Exercise 4: Batch study and sensitivity analysis
One of the first examples we saw in lesson 1 was how to compare various PyBaMM models. The goal of this exercise is to explore how to compare various simulations and perform sensitivity analysis.
Compare the SPM, SPMe and DFN models as explained in lesson 1.
PyBaMM has the
BatchStudy
function that allows to streamline comparisons. Repeat the comparison above but usingBatchStudy
. Tip: check the docs for more information about this function.Compare the three models for two parameter sets of your choice. Tip: you may want to check what the
permutations
option does.Perform a parameter sweep for one parameter and one model of your choice.
The
solve
method has acalculate_sensitivities
method that allows you to calculate the sensitivity of the solution with respect to a parameter (see the docs). Perform a sensitivity analysis for a few different parameters and see which parameter has the most effect on the solution. (Hint: you can access the sensitivities of variablevar
with respect to parameterparam
by callingsol[var].sensitivities[param]
, which gives an array rather than apybamm.ProcessedVariable
).