In this lesson, I will introduce to you the physics-based models of an ideal lithium-ion battery cell without degradation at this point and then we will look at the degradation models later. The most commonly used model of physics-based model of lithium-ion battery cells is called a continuum porous-electrode model. The term continuum refers to the fact that the underlying physics have been averaged over certain homogeneity assumptions. This is beyond our scope, but it is the common practice. The porous-electrode term refers to the fact that the electrodes are made up of many microscopic particles as you have already learned. The openings or porous between these particles are filled with electrolyte. So, fundamental physics charge conservation and mass conservation and rate of reaction equations are applied to model and understand the internal behaviors of the lithium-ion battery cells. These equations are described by a five different time and space varying variables. First, we keep track of the concentration of lithium at different locations inside of the solid electrode materials. This concentration is a function of the spatial location in the x dimension of the cell, which is the cross sectional dimension between one current collector and the other. As well as also the radial dimension inside of each particle, which is assumed as spherical particle. As well as the point in time. It turns out that we are especially interested in the concentration of lithium at the surface of the electrode or at the solid electrolyte boundaries. So, we call this variable CSE, where the S is for solid and the E is for electrolyte. We also model the concentration of lithium at different points inside of the electrolyte itself. This concentration is a function of the spatial location and of time. We model the potential at different spatial locations in the solid electrode material at every point in time. We model the electrical potential at different points in the electrolyte at every point in time. Finally, we model the rate of reaction or the rate of lithium movement between the solid electrode material and the electrolyte in this cell. So, these five variables together define the state of a lithium-ion battery cell at any point in time. The model that describes the combined behaviors of these five electrochemical variables at every point in space and time uses coupled partial differential equations to do so. The first partial differential equation models diffusion of lithium in the solid electrode particles. The equation that I share here is a diffusion equation for the variable Cs, the solid concentration and a spherically symmetric reference frame as a function of time and as a function of the radial dimension are inside of that spherical particle. The second to partial differential equation models charge balance in the particles using the equation I share in this bullet point. This is also a diffusion equation, but this one is a linear diffusion equation and we're talking about electrons diffusing in this case. The diffusion equation also has a forcing term dependent on the rate of reaction, which is the rate of consumption of electrons at that point because of the chemical reaction or production of electrons instead. The third partial differential equation models diffusion of lithium cations, positive ions, and the electrolyte. The fourth partial differential equation models the ionic charge balance in the electrolyte. Also, basically, a modified diffusion equation. The final model equation is a non-linear algebraic closure term that models the rate of reaction and it couples all of the other four equations together. It's far outside of the scope of this lesson and the topics this week to understand these equations in detail. So, that's not my principal focus here. It is however possible to understand the basic concepts of how they operate. The first four equations are partial differential equations that are either purely diffusion equations or a slightly modified diffusion equations. The fifth equation is simply a non-linear function that couples the diffusion equations together and determines the rate of lithium transference between the solid and the electrolyte. So, lithium diffuses inside of an electrode particle from somewhere in the center or the core of the particle to the surface of the particle. At this surface, it crosses the surface due to a reaction which in the rate of reaction is defined by the j variable. Then, it diffuses from one electrode to the other through the electrolyte. Then, it crosses the surface into the opposite electrodes particle due to surface reaction and that electrode. Finally, it diffuses into the center of the electrodes particle. So, lithium is moving in that way and at the same time, electrons move essentially with the diffusion process also. The diffusion of electrons leads to a measurable potential or electric potential. The different concentrations and potentials control the rates of reaction at the surface of the particle. I've said the word diffusion a lot now. If you are beginning to see that diffusion is involved in almost all of these equations. This implies that if we understand at least qualitatively conceptually how diffusion works, that's a huge thing because it's going to help us really understand intuitively how a lithium-ion battery cell works. That's what we're going to focus on here. So, diffusion is so important to lithium-ion battery cell behaviors. We're going to spend some time exploring how diffusion works really for the remainder of this lesson and also in a future lesson this week. I really want you to get a good intuitive understanding for diffusion. I have reproduced here a very generic diffusion equation that applies in lots of different applications. It's modeling some concentrations C and it says that the rate of change of concentration on the left-hand side of the equation is equal on the right side of the equation two. We read this as the divergence of a diffusivity constant d multiplying the gradient of concentration, all of this plus a forcing function f. Now, this probably looks really awful. So, we're going to help visualize diffusion by spending some time considering the special case of linear diffusion in one dimension when the forcing function f is set equal to zero. We have an initial condition, and we see how that initial condition evolves over time because of the dynamics of the diffusion relationship itself. In one dimension, both the divergence operator and the gradient operator simplify to being partial derivatives with respect to the spatial dimension x. So, that simplifies how we write the equation quite a lot. So, we can see that the time rate of change of concentration is equal to the diffusivity constant multiplying the second spatial derivative of concentration. We would like to be able to simulate diffusion to get a better understanding of how it works. So, by running the simulation, we can look at the output and visualize it and get some intuition from that. In this simulation, we're going to approximate the time derivative using Euler's forward rule for derivatives. That is the time derivative of concentration is approximately equal to the concentration at a future point in time minus the present concentration, all divided by this change in time delta t. So, that takes care of the time derivative. How about the second derivative with regard to the spatial dimension x? Now, we can approximate this several ways. We can use Euler's forward rule as a first derivative approximation and then iterate that rule twice to get a second derivative approximation. Or we can use Euler's backward rule as a first derivative approximation and then iterate that rule twice to get a second derivative. Or we can average the result of Euler's forward rule and backward rule to get what is called the central difference rule. Here, I will use the central difference rule since it generally gives better approximations and more stable approximations. When we combine Euler's forward rule for the time derivative and the central difference rule for the second spatial derivative and we insert these approximations into the diffusion equation from the previous slide, we arrive at this particular discrete approximation of diffusion. It says that the future concentration at every point in space is equal to the present concentration. Plus a diffusivity times the time difference Delta t, times the central difference approximation of the second derivative. We're going to use this discrete approximation to create some Octave code to simulate linear diffusion. This code is available on the Coursera website, and you're going to have the opportunity to experiment with it and learn from it. If you change some of the parameter values in this simulation though I caution you that you will find it is quite easy to make this simulation unstable, to make it so that it will not converge to a reasonable answer, it will either probably go to plus infinity or minus infinity. This is because we're using the finite difference method for implementing the time derivative, and this method is stable only for a certain Delta t and Delta x combinations, and there are other ways to approximate the derivatives that are more stable, but this simple method will be sufficient for helping us to understand diffusion at this point in this lesson. Okay. So, the code that I share with you on this slide implements the linear diffusion example. The first line of code defines an initial concentration vector as a gradient of values with the left side has a concentration of one mole per meter cubed and the right side has a concentration of 32 moles per meter cubed. The diffusivity rate constant is defined to be two meters per second in this example, the timestamp is 0.1 seconds, and the spatial resolution is one meter per spatial point that I'm looking at, so overall 32 meters wide, and this diffusion example. The simulation operates over a span of 1,000 timestamps or equivalently 100 seconds. Inside of the loop, the first line of code implements the equation for updating the concentration vector. So, this one line of code right inside of the four loop does all of the math on the previous slide. It says that the new concentration is equal to the prior concentration plus the diffusivity constant times the Delta t constant and divided by the dx constant squared. All of this multiplies the numerator of the equation from the bottom of the previous slide. Now, remember that the numerator evaluates the concentration vector shifted left, and then it subtracts two times the concentration vector as it stands without shifting, and then it adds the concentration vector shifted right. Now, when we shift a concentration vector in our example here, we have a problem because we don't know what value to shift in to the spot that we open up. So, if we shift the whole vector to the left, then there's going to be an empty space on the right, and what should we use for that new rightmost value. Or if we shift everything to the right, there's going to be a new opening empty spot on the left, and what value should we use for the leftmost value. Here, we do something that's pretty common, and we choose to mirror if you will the concentration vector outside of the range. So, if I shift something one way, I'm shifting one of them mirrored points in or if I shift it the other way, I'm shifting the mirrored point in that way instead. So, that's why you see in the first that when I'm shifting it to the left, I'm taking the two through end, and I'm moving it over but then I'm repeating the end one which was mirrored. When I'm shifting it to the right, I take the one, two, and I keep those but I add in the C1 once again. So, this mirroring assumption is quite common when making discrete simulations, and overall that one line of code is really the only computational line in here. This one that's the one that does the diffusion, it's that simple. The remaining code looks a lot more complicated, but its only job is to make beautiful plots, and the code on this slide I believe is optimized for Matlab, and it might not work properly on Octave, but I do have a version on the Coursera website that is operating an Octave. So, you can see how to do the visualization code there too, and it will look exactly the same as what I'll share with you on the next slide. So, every 100 timestamps or every 10 seconds basically, we're plotting a color gradient to indicate the concentration at different points in the one-dimensional space. So, here's output from that simulation. At time zero, remember that the leftmost concentration has a value of one, and the rightmost concentration has a value of 32. In this graphic, low-concentrations are shown as a dark blue color and high-concentrations are shown as a dark red color. Medium concentrations are the light green color in the middle. As time progresses, lithium moves from high-concentration areas to low-concentration areas by this diffusion mechanism. The dark red areas become less red and the dark blue areas become less blue, and by the end of the simulation, the color across the entire space dimension is very close to uniform, and this means that the concentration at every location is nearly identical. You can see now hopefully visually that diffusion has the effect of moving lithium from high-concentration areas to low-concentration areas, and by doing so, it's evening out the concentrations over time. So, I hope that this simple example convinces you that diffusion even though the equation can look quite complicated and frightening, the actual physical process that's happening is quite simple. Now, I hope that you can even glance at an equation like the diffusion equation on this slide and say, "That's just a diffusion equation. I understand what that means," and really mean it. So, to summarize this lesson, a continuum porous-electrode physics-based model of a Lithium-ion battery cell dynamics has five main equations, and these equations describe: First, diffusion of lithium in the solid electrode particles, and that leads to a prediction of the solid surface concentration of lithium and the variable that we call CSE. We also have an equation that describes electronic charge balance and the particles, and that leads to a prediction of the potential in the solid, and we call that Phi S. It describes diffusion of lithium in the electrolyte and that leads to a prediction of electrolyte concentration that we call CE. It describes the ionic charge balance in the electrolyte, and that leads to a prediction of the potential in the electrolyte using a variable we call Phi E, and finally, the reaction rate that leads to a prediction of the flux or the rate of movement of lithium from the solid to the electrolyte, and we call that J. You've learned that the battery cell dynamics are really dominated by diffusion effects, and even while the diffusion equation appears quite complicated, I hope that you now believe and understand that the actual phenomenon is really simple to understand intuitively. We simply have lithium moving from high-concentration region to low-concentration region, and that's all diffusion is doing.