[MUSIC] Hi, and welcome again to the fifth week of our class modeling and simulation of natural processes. This module will be about the transition from Lattice Gas Automata to Lattice Boltzmann method. First of all let me give you a short reminder of Lattice Gas Automata which you saw in the previous session. You saw in particular the Lattice Gas Model, HPP. Which is used to solve fluid flow. Lattice Gas Automata tried to mimic the actual physics of a gas by placing some idealized version of gas molecules onto a discrete grid. They are placed on cells on grid intersections, and there's a maximum number of four particles per cell. Every particle is stateless and can populate one of the four links which connects the cell to one of its neighbors. The model, the Lattice Gas model, consists of successive iterations. And the iteration starts with the collation step for followed by a propagation step. During the collision step, particles which are placed on the same cell interact and they collide. They collide, which means that their directions are reshuffled, and they are potentially replaced on different links on the same cell. We will now use a notation in which the particles, before collision, are plotted in green color and after collision they are red. So collision takes particles from the pre-collision stat which is green, to the post-collision state which is red. Collision converts green to red. And once they have collided they undergo a propagation which means they are copied from one cell to one of its neighbors according to the direction of the link on which they are situated. Streaming takes particles from post-collision, red state, to pre-collision state on the new cell, which are ready for the next collision during the next time iteration. Now, when you assimilate a fluid with Lattice Gas Automaton, how do you evaluate the quantities in the end? In the end, what you are interested in is to know the velocity at one space location, or the pressure, so how do you do when you have just discrete particles. Which moreover are just Boolean, they are zeroes or one if there's a particle, zero if there's no particle. To get physical quantities which are real value variables you need to do averages when you have alloyed when you post process your data. One way of doing this is to do space averages. So you take a portion of space like the red square which we have on top of the numerical grid here. Count the number of particles in each direction, and calculate averages. By calculating averages, we could do it. We get real value variables as we show on the right-hand side of this image. We have plotted again four arrows which now have a varying thickness, where the thickness is proportional to the amount of particles we counted which will propagating in this corresponding direction. After this, we have some macroscopic state from which we can extract pressure and velocity, the macroscopic variables we are interested in. Now the idea of Lattice Boltzmann method is to say well, if we can represent the state of the system with much fewer variables, once you have done the post processing, why not run the simulation on this review set of variables right from the beginning? This is what Lattice Boltzmann does. We take the average values, we call them the lattice populations, which are real values, and do some physics on them. The model which governs their motion is obtained from the Lattice Gas Automaton. We take, theoretically speaking, the Lattice Gas Automaton, take its dynamics, and do statistical physics on it to get an average model. The average model is the Lattice Boltzmann model, which works directly on averaged floating-point variables. Lets go in to more details. Today we will work with the two dimensional model which is called D2Q9. Which as opposed to the HPP model, which have four variables per cell has nine variables. Nine variables because it has one population which is a density of particles, associated to each link which connects the cell to its neighbors, along orthogonal directions for variables. And four variables along diagonal directions. And then there's a ninth variable, which corresponds to the so-called rest particles, which is a density of particles which stay on the cell, which do not move during the propagation step. When we run the Lattice Boltzmann simulation, we take the real physical space and discretize it. Which means we represent it by a certain number of cells. Every cell is a Lattice Boltzmann cell, it has nine variables. Nine floating point variables allocated on it, which we call the populations. I show you here an example of the portion of space which is disecretized by means of eight by eight cells, which means 64 cells. On every sort cell we have nine variables, which means that we have a total of eight times eight, times nine, which is 576 variables. To run such a simulation, we can, our case for example, these variables in the matrix. Let's see how this is written with the Python programming language and using the NumPy library which you have seen before. In the NumPy library, you can allocate a three dimensional matrix by using the command zeroes. It takes, in our case here, three variables, nine, eight, eight, to say a nine by eight by eight three-dimensional matrix. It will allocate the memory needed to run our simulation. Like a Lattice Gas Automaton, a Lattice Boltzmann starts iteration with a collision step. During collision, the populations are taken from their pre-collision state, which again, is green for us, to the post-collision state, which we plot in red. During collision the particles interact with each other and they reached a red post-collision state, which is different from the pre-collision state. Which means the thickness of the arrows has changed a little bit because of the recalculations during the collision. You could not see that the thickness changed because this change of thickness is really just a small perturbation of the value of the populations. And you don't see it here, visually, but they do change a little bit. Let's see this collision step a second time more precisely. This time, I colored one of the arrows black so you can follow its motion. The arrows move to each other, and they collide, and they change their value to go to the opposite location, where they are in the post-collision state. The model we are using when we describe collision in the Lattice Boltzmann method is a model which is instantaneous and localized on the coordinates of the cell. Nothing actually moves. We just do a motion here to represent the change of naming of the variables now in numerical model. But really the model we use, they physics we try to represent here does not involve any change in location or any change in time, it's instantaneous and localized to a cell. After collision we have a stringing step during which exactly the same thing happens as it did in the Lattice Gas Automaton. The population such as without any modification. From a cell to one of its eight neighbors or nine neighbors when you say that the rest particle corresponds to the particle that has not moved. That rates, that stays on the same cell. Let me show you the streaming step. Here particles are taken from their post-collision value, which is red, to a pre-collision value on the neighboring cell. They just move around one of their eight directions. Exactly the same thing happens as in Lattice Gas Automaton. And here we say that the time of the model has been increased. Our simulation moves from time t to time t plus delta t. We have two discrete variables in our model, which describe in which way we discretize the [INAUDIBLE] physics to go to a numerical model. Delta t is the discrete time state which represents the difference in time between one iteration and the next one. And delta x is the distance between one cell and one of its neighbors. This is the end of our module on the transition from Lattice Gas to Lattice Boltzmann models. Stay tuned for our next module. [MUSIC]