 I am starting from introduction a topic grid generation, which has nothing to do with let me tell you fluid mechanics and heat transfer, so purely a mathematical or a geometrical problem. The problem is that you have a region in space and let us suppose you want to click a picture or a movie of fluid mechanics and you have to divide that region into certain discrete points. Do you need fluid mechanics and heat transfer to do that? It is a geometrical problem. So in this topic there will be no conservation laws which will be coming, but this is a topic, this is the thing which is needed whenever you start CFD. The first thing which you need to do is that you need to generate grid. So grid generation is in fact a full course in aerospace department at IIT Bombay. So there are a lot of topics into this, but I have tried to talk about few of the topics which I can cover, let us say in the next one and half hours. So the basic problem of grid generation is how to convert infinite number of points in a flow domain to certain fixed number of points. And there are various mathematical approaches to do that. You have to write programs, many of them are iterative in nature. I will talk about algebraic methods, elliptic partial differential equation method, multi-broad grid and there is a recent method which is becoming quite popular which is called as multi-level adaptive Cartian grid method. Let us start the lecture by taking you to the history of development of computational fluid dynamics. When people started solving problems using computer, they were solving initially the method was proposed for Cartian grid. So that was applicable only to those problems where the boundaries are either horizontal or vertical in standard coordinate system. So at that time people were using finite difference method which works very well in the Cartian coordinate system and so but like you can solve heat transfer in a plate, square plate or a rectangular plate or they can maybe solve heat transfer in a circular plate. But let us suppose there is a square plate with a circular hole. Now what are the boundaries in this case? Boundaries of the solid, what are the boundaries? Inner boundary which is a hole which is circular and outer boundary which is square. Outer boundary is aligned along the Cartian coordinate system. Inner boundary is aligned along the cylindrical coordinate system. So this type of class of problems are called as complex geometry problems. In CFD we call those problems as simple geometry problems where all the boundaries are aligned along one of the standard coordinate system. But at that time also people solve this class of problems. What they used to do is that that circular hole, if you have a very fine grid near to the circle it will be like a stepped circular cylinder. You can convert the smooth curvature of the circle into stepped cylinder made up of like a step horizontal vertical lines. With that people started but slowly CFD moved from, in that case people were not getting very accurate solution especially for a very complex. If it is a circle maybe you get an accurate solution. But instead of circle that will suppose an aerofoil shape then the, to create a good step profile of an aerofoil shape or you need a very fine grid. So to capture the curvature accurately of the complex shapes people found that finite difference method gives lot of trouble as far as stability is concerned. So they came up with a method which is more robust as far as the conservation law, obey of the conservation law is concerned. So finite volume method came up. In the finite volume method although initially it was proposed for a standard coordinate system but slowly people proposed methods for a, because that has a potential to solve the complex geometry problem. So it was proposed for complex geometry problem. Then there were structured grid, unstructured grid. Initially people were solving in curviliness structured grid where then they went into unstructured grid because they felt that complex geometry is better handled by the unstructured grid. But recently when industry starts using this unstructured grids what they are realizing is that lot of time especially for complex industrial problem. This grid generation takes lot of time, lot of computational time. And the second issue is that even if you generate a grid especially for a complex shape it is not guaranteed that you will get a solution. That is what I discussed in the solution methodology when I talk of CFB software applications. Because many times in complex geometry it is difficult to maintain the quality of the grid and if the grid is of bad quality if you run the code your code does not convert. You need to go back to the machine, improve it. So slowly this grid generation is becoming a big issue as far as industry is concerned. So there is a recently there is a new trend which is coming up which is where what is said is that instead of having a body fitted curvilinear grid or body fitted unstructured grid. Let us have a non body fitted Cartesian grids where Cartesian grids means you will have only horizontal and vertical lines. And you can do a multi-level adaptive multi-level adaption which is so this is the most recent method which is called as multi-level adaptive Cartesian grid. There are some software companies recently came up with this and even some of the well established companies or CFB companies are now working on this. There is a separate method which is called as a Cartesian grid methods or immerse boundary method which has developed because this is a potential because the grid generation time is very small especially this becomes an issue when you we can big industrial problem. So I will start with the simplest one algebraic method and then move on to the latest method which is the multi-level adaptive Cartesian grid. Although I will introduce structured as well as unstructured grid but most of my lecture will be focused on how to generate structured grid. As I said that in any CFB software first thing which you need to is that you need to generate the grid. First you need to domain, domain is the first thing which you draw then you go for the grid generation. Actually when you do the grid generation geometrical parameters are computed. I would again like to point out one more thing why grid generation has become quite important and challenging. Nowadays there are a lot of problems which are like in CFB we have what challenging problem called as moving boundary problem. Earlier mostly CFB problems were solved taking the body as stationary but now there are a lot of problems where let us suppose fish is moving in water. Not only flow occurs but the body also moves. It is a fluid structure interaction problem. So the flow exerts some force to the fish, fish exerts some force to the fluid. So for those kinds of problem what happens is that after each time step when the body has moved the grid needs to be regenerated and especially if you have a body fitted grid after each time step you have to generate the grid. So instead of that nowadays what is being proposed is let us have a Cartian multilevel adaptive grid. So whenever let us say the fish is moving I will have a fine grid but that will be non-body adaptive grid. So there will be certain grids only which will be changing due to adoption but at other regions the grids will be same and there is a in fact as I say that this field is contributed by computer science people also because in computer science as far as code development is concerned they use certain data structure like octary type of data structure, octary or quadtary. So this type of data structure is good as far as the multilevel Cartian grid adoption is concerned. So that idea is taken from the computer science and that is being applied now for multilevel Cartian adaptive grid generation. In our CFD lab also recently we are developing codes using this method. So we start with the domain and then do the grid generation and when we do the grid generation we convert the domain which is infinite number of points to certain fixed number of points. After grid generation we calculate certain geometrical parameters. So here I will focus mainly into this part. So this is the definition which I had already mentioned and so after grid generation as I said that you need to discretize, this is the discretization of domain, this is the discretization of the equation of the conservation law and then finally you have a solution methodology to solve that. There are three types of discretization method finite element, finite difference, finite volume. Finite difference is one of the oldest in CFD. Finite volume is the more recent and more commonly used in CFD. Finite element method is comparatively more popular in solid mechanics. One of the questions commonly asked is that why finite volume method is common in fluid mechanics because in fluid mechanics you have certain conservation law and the way this method has been developed finite volume method it obeys the conservation law in a very good way. So a rear slide was governing equation discretization. This slide is on domain discretization. There are two levels of discretization. So this domain discretization you can also call as grid generation. There are two types of commonly used grid generation called as structured grid generation and unstructured. This is just a proposition right now but this will be more clear in the later slides. I will start with what is the simplest grid generation. Let us suppose you have a plate. So if you draw equally spaced vertical lines, equi-spaced horizontal lines and if you are using a finite difference method then the grid points commonly is defined at the vertices of the at the intersection of this line. So how many lines I had drawn? Four vertical, four horizontal and I got four into four sixteen intersection points. At this intersection points I have shown yellow circles. In finite difference method this called as the interior grid points. Actually let me tell you that the equations you apply to this yellow point. Whenever you are solving a fluid mechanics problem you have equations and you have boundary conditions. So this at this yellow point equation is used and at this point at this blue points left wall boundary condition will be used. At this point bottom wall boundary condition will be used. At this point right wall boundary condition will be used. At this point top wall boundary condition will be used. So there are different types of points. If you look into this yellow circle carefully you will see that there are two types of yellow circle. Yellow circle will thick boundary and the yellow circle with thin boundary. What is the difference between this yellow circle and this yellow circle? This is having one neighbor at boundary. So as it is close to the boundary, domain boundary, we will call this as border. Border grid points and we will call this as interior grid points. Bordering internal or interior. Now when you in CFD whether you are generating grid or whether you are solving, simulating. You have to store this data. You get some number, discrete number distribution. You have to store as a data. So you need a data structure. So to store the data you need a data structure. Now how many points you have in the x direction and y direction here in this case? Six in the x direction, six in the y direction. What is the best data structure to store this value? 2D matrix. So fine. So data structure is matrix. Now the second thing is that when you are solving you need to tag different points. Like when you want to solve this point, it needs, it should have certain tag to identify that this is the point I am calculating. So to tag as in the matrix, how do you tag a element in a matrix? Rows and columns. This is what is called as running indices. So we have running indices like in this case i varying from 1 to 7, j varying from 1 to 7. But note that i is equals to 1 and i is equals to i max. i is equals to 1 corresponds to left wall, i max corresponds to the right wall, j is equals to 1 corresponds to the bottom wall, j is equals to j max corresponds to the top wall. I made difference method especially if you are solving a conduction problem or a diffusion which Mr. Puranic has introduced last lecture. When you discretize you get the value at a particular point as a function of only this four points. This is called as computational stencil. So when you are solving for this point north, south, east, west, this four points will come. This stencil moves on as you proceed. I will show you later on an animation to give you an idea how the numbers are calculated one by one. So the issue is that the Gavan equation we will discretize and the discretized form of the Gavan equation will for that this same stencil will be used and we will apply that equation sixteen times at all this yellow circle and at this blue points we will apply the boundary condition. So this blue point is the boundary grid point. The yellow circle with thick boundary is the border grid point and the yellow circle with thin boundary is the interior grid point. There is a mistake here. In the finite volume method what happens? We draw this is the simplest form of the grid generation. To a beginner this is a simple idea of telling how about grid generation. In finite volume method the grid points are not at the vertices but they are located at the centroid and these are the boundary grid points. This is the running indices in the x direction and this is the running indices in the y direction. Here how many points you have in the x and y direction? Seven not six. And this is the computational stencil. Normally in finite difference method we use symbols like i like i plus 1, i minus 1, j plus 1, j minus 1 but in finite volume method we represent in term this way as a neighbor. But finally when you are writing a code it needs to be expressed in terms of i's and j's. So this is the boundary control volume, this is the border control volume and this is the interior control volume. So this way I showed you the simplest form of the grid generation and the grid points in finite difference method explained here in finite volume method. Located at vertices and centroid respectively. Now the simplest grid generation which we had shown you just now. If you look into that carefully there are two types of two family of lines. What are those two families? Vertical horizontal. What is the equation for vertical lines? x equals to constant. What is the equation for horizontal line? y is equals to constant. And second good thing about that was let me go back. Here we have x equals to constant lines y is equals to constant line. And the second good thing about this is that the neighboring information is inbuilt. For a particular point if I want west neighbor, if this is i comma j this will be i minus 1. This is the running indices in the x direction. So this is i, this is i minus 1, this is i minus 2, this is i minus 3, this is i plus 1, i plus 2, i plus 3. This is j, j plus 1, j plus 2. Neighboring information is inbuilt in between. Later on I will show you in finite volume method you will get a Leibrich equations where the value at a particular point is a function of its neighbor. So you need neighbor information. And neighboring information here is inbuilt. That is why it is called a structured grid. It has certain structure by which neighboring information is inbuilt. So this is the simplest form of the structured grid. But let us suppose instead of this straight boundary plate if the walls are curved then instead of this vertical line 1 comma 1 there is a grid or not. There is no grid. That is not used in the computation also. But when we are having a matrix data structure we have to take that 1 comma 1 j max comma j max. There is no point. But they are not used also. They are idle point. Instead of let us suppose I have, instead of horizontal and vertical lines let us say I have a boundary like this. So instead of vertical I what I will draw is I will draw some this type of line. Let us say. I have drawn 4 vertical. Let me draw 4 only. And here I will draw. Here again I can have yellow circles. And here again neighboring information is inbuilt. Here again I can use same data structure. Here also it is 7 by 7. But this was vertical lines. But here it is some different line. Let me call this lines. What were they earlier? X is equals to constant. Now it is I will call xi is equals to constant. And this lines I will call zeta is equals to constant. Any question on this? Here you have horizontal and vertical lines. Here you have instead of vertical lines xi is equals to constant instead of horizontal line zeta is equals to constant. Do you see the analogy? Here you have the neighboring information inbuilt. Here you have a matrix as a data structure. Here also you have a matrix as a data structure. Here neighboring information is inbuilt. Here also neighboring information is inbuilt. In grid generation let me tell you although in finite volume method we solve at this point. But in grid generation we obtain the coordinates at the vertices only using finite difference. What we will do in grid generation is we will start with a square domain xi zeta. Let me ask you a question. I said your plate is like this. So this is which type of domain? This is physical. So this is a physical domain. So this is your xy direction. You want xy coordinates of vertices of this or let us say xy coordinates of intersection of this line. Now the mathematical procedure is I take up computational domain whose length is 1, height is 1 and I do the same thing what I did here. So in this case my computational domain is four horizontal lines, four vertical lines and there is one to one correspondence. I have to do a mapping from computational domain to physical domain. What is the dependent variable here? What do you want here? xy. What is your independent variable? xi and zeta. So and as the neighboring information is inbuilt this is called as structured grid. If you use an algebraic equation for this mapping it is called as algebraic method. If you use a partial differential equation it is called as partial differential equation method. Both form the structured grid which I will discuss in detail later on. What is structured grid? So with this you get an idea of the picture what I mean by structured grid. So this structured grid are identified easily with reference to the grid lines. There are certain grid lines. What are those grid lines? As I have mentioned earlier there is a simple geometry and then a complex geometry. In a Cartesian coordinate system what are those grid lines? Horizontal and vertical. If it is a polar cylindrical then they are concentric circle and the radial lines. Similarly in spherical coordinate system. In simple domain. But the domain which I am showing you here the boundaries are curved. It is a complex domain. You can have a structured grid for complex domains also. These are called as body fitted curvilinear grid for the complex domain. Each segment of the physical domain is described by a constant value of the one of the curvilinear coordinate. Like all the vertical lines we have mapped here as xi is equals to constant. And all horizontal are mapped as zeta is equals to constant. So there is one to one correspond not only about the grid point but also the family of lines. So how we do the structured grid generation? We have a square computational domain. Note that computational domain always we take one by one. Zero to one is the variation in the xi and zeta direction. The grid in the computational domain is transformed into complex physical domain by using body fitted coordinates which may be curvilinear and non nothing. Let me explain you what is win by body fitted and what is win by non body fitted. What body fitted means is let us suppose you are studying flow across a circular cylinder. If you have grid like this there is one grid line which is fitting the boundary. But if you have a grid like this where the grid lines are cutting then these are called as non body fitted grid. So among the family of lines if there are some lines which are fitting the boundary which are not crossing through the boundary then this is called as body fitted grid. So computational domain you always have vertical horizontal line but in the physical domain you have a curved line. That is why it is called as curvilinear coordinates. This xi and zeta are curved lines, curvilinear coordinates. As I said that the neighboring information is ordered. So that is why there is a structure and a typical node we can know why this is happening. For a typical, why there is structure is there because the total number of intersection of xi and zeta line remains constant. The xi and zeta line the number of the number of times xi is intersecting the zeta line or zeta is intersecting the remains constant they do not vary and then every information is inbuilt. Let me show you through an animation and an example. What is grid generation? This is a computational domain of size 1 by 1 and there are 7 vertical lines equi-space horizontal lines. Now if I do that I will have certain delta xi and delta zeta. What is delta xi? How many divisions I am having in x direction? 1, 2, 3, 4, 5, 6, 7, 8. So 1 divided by 8 is this delta xi. What is delta zeta? 1 divided by 3. Now this is let us say the same example which I said square plate with a circular hole. Let us suppose the size of this plate is 1 meter by 1 meter. The diameter of the hole is 0.4 meter. Now I have to map the boundary. What is the boundary in computational domain? Left wall, right wall, bottom and top. What is the boundary in this case? 2 boundaries. Inner boundary, hole, outer boundary, square and the problem is that these 2 boundaries are not connected and I have to map this. This boundary is continuous but this boundary in this case they are disconnected. So if I have to map it, I have to do a cut section. Otherwise I cannot map it. So that is the reason we have to, so let us suppose what is linking here right is the cut section and I am saying that this boundary AB is what in this case? It is this AB is a circle. So the bottom boundary is mapped to the circular hole and the outer square boundary C to D is the top wall. So the bottom wall of the computational domain is mapped to the circular hole. The top wall of the computational domain is mapped to the square, outer square and the left wall and the right wall of the computational domain. In fact the coordinates will be same because they are actually one point. This line is a common between the top part as well as bottom part. There will be a repetition. So let us suppose as I said this plate is let us say the origin is here x equals to 0, y equals to 0 is here. The plate length is 1 meter, diameter is 0.4 meter. So what is the coordinate of this? 0.4 diameter here it is a radius. So 0.2 meter. 0.2 okay. This circle if you know the diameter you can know the x and y coordinate. Is it correct? Because here I am dividing into how many equal parts? 8 equal parts. So note that we want to solve in this computational domain but our dependent variable is x and y. So I need x coordinate and y coordinate here. As I know that radius of the circle origin is at the center. If I am doing equal division I can map 1 to 1. So this is, so the first point is what this a is x is equals to 0.2, y is equals to 0. The second point you can map there is 1 to 1 correspondence. So with this I prescribe the boundary condition in terms of dependent variable which is x and y. B to C what you see is blinking which this will be what? 0.2, 0.3, 0.4 and 0.5. I am doing an equal division 0.2, 0.3, 0.4, 0.5. Plate length is 1, origin is at the center. So that way I know x and y coordinate which is dependent variable in this computational domain. If I am again dividing into certain points this will be 1, 1, this will be 0, 1, this will be minus 1, minus 1, sorry 0.5 because this length is 1, origin is here. So it will be plus 0.5, 0.5, this will be minus 0.5 and sorry plus minus 0.5 and y plus 0.5. So this way there is 1 to 1 correspondence depending upon the way we are dividing the boundaries. Note that now the circle is overlapping. Actually this point is same as this in the physical domain. This point is same as this. So the xy coordinate here will be same as the xy coordinate because the cd boundary, bc boundary and ad is just a 2 half of the cut plane but physically they are same. Let me point out again that this b has x is equals to 0.2, y is equals to 0. This point also has the same coordinate. What is the coordinate of this? x equals to, this point is this point. x is 0.3 here, y is equals to 0. x equals to 0.3 here, y is equals to 0 for both this point. Here x equals to 0.4, y is equals to 0. x equals to 0.5 is 0. Is that clear? Now we solve a differential equation or an algebraic equation in this domain with boundary conditions for x and y and then we obtain x and y. So this points, there will be one to one correspondence. This points corresponds to this point. This points corresponds to this point and finally we join them in some fashion. So you need to create a data structure of this x and y coordinate in this physical domain after solving this equation and you take it to a protein software and then use a command like mesh command which generates this type of mesh. This is what is called a structured O type grid generation. Actually depending upon this branch cut we call, red line which is blinking here, you can have different type of structured grid. This is called as O type of structured grid. More detail, mathematical details I will show in the coming slide but this is just an introduction. That will be discussed in the later slide. Just hold on. This is just an introduction of what it is. Details are coming later on. What happens in a structured grid? It is something like this. There is no structure, what in the no structure? Neighboring information is for each of this control volume we have to store data but actually can you store this in a matrix form, two dimensional matrix? You have to store the each of the control volume. Not that in structured grid, mapping information you do not have to store. Like in this case if I am storing this cell data I have to store that these are their neighbors. So in a structured grid no transformation mapping is carried out and grid points cannot be associated with, in this case whether there is a two family of lines, no. So there is no grid points are not associated with the defined grid lines and there is no definite structure between any node and its neighbor. Neighboring information is not inbuilt. Now what is desirable in a grid system is that the mapping should guarantee one to as far as structured grid system. This desirable feature is for a structured grid system. The mapping should be such that there is one to one correspondence of the grid lines between the computational and physical domain and there should be certain smoothness in the grid point distribution. This is a very important thing because many times as I said that when I was teaching fluid mechanics I mentioned many a time that you need normal gradient, normal gradient of temperature, normal gradient of velocity, normal gradient of u velocity, v velocity. So at the boundary many a times you have to apply a boundary condition where you have to take normal gradient. So to use that boundary condition accurately your grid lines should hit the boundary in the normal direction. So orthogonality of the grid lines at the boundary is one of the desirable condition. And let us suppose if you are simulating flow across an aeroplane and fluid mechanics you know that most of the action occurs near to the solid surface. So you need much finer grid or much larger resolution, special resolution near to the solid surface. So you should have a point, you should have an option of clustering means putting more number of points near to the solid surface. The general idea in structured grid method is that you do a transformation. Actually later on I will show you that the way that the equations was proposed. I will not go into the details how this equation was proposed. But once in structured grid method first the equation is proposed for psi as a function of x and y, zeta as a function of x and y. Then there is an inverse transformation which is done where we get x and y as a function of psi and zeta. And we have methods depending on different types of equations which we have, algebraic equation and partial differential equation. I will start with the simplest method which is algebraic methods. So in the algebraic method let us suppose this is your computational domain of size 1 by 1. And as far as the correlation between this physical space and the computational space is let us suppose here the length is 1 but here the length is l. So what will be the value here? Xi is equal to 0 here. This will be 0.2, 0.4, 0.6, 0.81. But let us suppose if l is 3 then this should be 0, this should be 0.6, this should be 1.2. So basically what we are doing this is the linear mapping 1 to 1 corresponding. And if you want to map y, this is the physical space. The difference between this space is that the top wall is inclined. So when the top wall is inclined what happens is that y coordinate varies along the x direction. If you want to map the top grid points into this grid point this y coordinate varies. And what is the non-dimensional correlation between the two? It is y t is equals to you can write h1 plus h2 minus h1 x y l because this is straight line. So y varies along with x as a disformed. So if you substitute so what I suggest is that if you want to generate this grid what you do is that you go to this domain you know what is Xi and zeta at all these points. You know what is the value of x and y. So using this expression once you know Xi and zeta you just use this expression and obtain x and y. This is the simplest one because here anyway at least the boundaries are straight. But this does not have any option of grid point clustering. So let us now next go to the case where you want clustering. So in the previous grid generation you see a control volume which is almost of equal size. You do not have option of clustering. But in many of the problems like for flow over a flat plate where you want grid points to the maximum near to the flat plate. Flow in a plane channel where you want grid points to the maximum. What is plane channel? Bottom wall top wall fluid is flowing between the two walls near to the walls. So let us suppose you want like if you consider flow over a flat plate. So what happens is that in that flat plate if the flow is above the flat plate you have a solid boundary in the bottom wall of the domain and you have top domain which is open. So for that the relationship is if you want for flow over a flat plate Xi is equals to x pi L zeta is this expression was proposed with some functional relationship which was using the log function and when we do inverse transformation we get an equation like this. So the idea is that in the computational domain you need to first decide how many horizontal and vertical lines you want to have. Based on that in the computational domain you can obtain Xi and zeta. Substitute those Xi and zeta into this Xi sitting here. Zeta is sitting here. Substitute Xi and zeta. Like in the previous slide how many Xi and zeta you had? How many Xi and zeta you have here? 6 into 6 36 Xi 36 zeta. Anyway once you have decided that you will have this many division you know Xi and zeta. You can calculate it very easily. Once you know those 36 Xi and zeta you substitute into this expression and get X and Y. Once you get X and Y plot it. Note that in the previous expression there is a parameter to vary the clustering. There is a tuning parameter which is beta. I will show you here for two values of beta. Beta should be greater than 1. This is 1.2 and this is 1.05. Just see the grid for flow over a horizontal flat plate. So what happens as beta comes close to 1 the clustering is increases or decreases. The refinement here to the wall increases. Note that the number of horizontal lines here and here are same. Here I have taken the length of the plate as 2. Height of the domain as wall. The bottom boundary of the domain is the flat plate. Top is an open boundary. Here I have taken I max. Vertical lines is 21. Vertical lines probably here is 41 and horizontal lines is 21. That was for flow over a flat plate but if you have a flow over a let us say flow in a plane channel. That was an external flow. Now I am talking of an internal. Here also that some expression was proposed for algebraic grid generation and we do inverse transformation. Again those 36 psi and zeta is substituted into this equation. You get 36 psi x and y and if you plot them here again there is a clustering parameter. Same beta is equals to 1.2 and beta is equals to 1.05. Now here what you see is that on both the wall. So there is a separate equation for the two cases as I said. Now let us suppose take a case where you want clustering at the interior of the domain. Let us suppose in the previous case I said that flow above the flat plate. Now let us suppose you have a case where you have flow above as well as below the flat plate. So flat plate let us say we take a domain where it is sitting in the middle. So we need clustering at the interior. For that these are the equations which we have proposed and these are the grids which you get. Here clustering is at 25 percent of the height. Here the clustering is at the center. Here there again there is a parameter beta. Beta increases from 5 to 10. Here the magnitude of beta in the earlier case and this case are quite different. Here you can see as you increase beta there in the previous case when beta as you were taking it close to 1 it was getting more refined. Here in this case the nature of the equation is such that when beta increases you get more refined. The number of horizontal and vertical lines in all these three figures are same.