 So, the next topic is grid generation. I will start with an introduction followed by algebraic method, elliptic partial differential equation method towards the end I will discuss multi block grid and multi level adaptive Cartesian grid. Now, this is a topic which does not have any relation with fluid mechanics and heat transfer. This is a pure geometrical problem. What is the problem? What we want to do in grid generation? In grid generation we want to calculate coordinates of the vertices of the control volume. So, do you think calculation of coordinates or converting a region in space into some small region whether it involves fluid mechanics heat transfer or it is a pure geometrical problem. So, there will be no conservation laws mass conservation, momentum conservation they will not be involved in this topic. What will be involved is some mathematical equations like algebraic equations with which we will generate a grid which will called as algebraic grids which you can do for some simple domain, but for more complex domains you may have to use what is called as elliptic partial differential equations to generate structured grid. Note that here I am discussing only the structured grid. The methods I will discuss for a structured grid, however I will discuss what is unstructured grid. I will start with an introduction. As I had mentioned earlier there are two methods finite difference and finite volume method which are popular in computational fluid dynamics. In finite difference method grid points are defined at the intersection of the grid lines and in finite volume method they are defined at the centroids of the control volume generated by the intersection of the lines. Now, let me explain what is structured grid, what is simple domain, what is complex domain. I had mentioned that if in your problem which you want to solve if the boundary of the problem is either horizontal or vertical boundary may be not interconnected like they may be separate. You may have an inner boundary for a problem and you may have an outer boundary, but if the boundary continuous boundary let us say outer boundary is made up of horizontal and vertical lines and inner boundary is also made up of horizontal and vertical lines. Then you can solve the problem in Cartian coordinate system. If the inner boundary is circular and outer boundary is also circular on which problems you get this inner boundary, outer boundary like flow across a car. One inner boundary is the surface of the car and the outer boundary will be the far field boundary which you are taking or let us say a square plate with a circular hole. If it is a circular plate with a circular hole, hole is circular which is inner boundary. Your outer boundary of the plate is circular, both are circular then it is a cylindrical coordinate system problem. If it is a square plate with a square hole both the boundary is inner as well as outer are square which are made up of horizontal and vertical lines. It is a pure Cartian coordinate system problem, but if you have a square plate with a circular hole then it becomes a complex geometry problem because it is neither a Cartian or neither cylindrical. So, that is what is called as complex geometry problem and for those domains I am calling it as a complex domain. You can generate algebraic grid using algebraic equation for non uniform grid generation in simple domains, but for complex domain you may have to use partial differential equations to generate the grids. Now, let me discuss what is called as a curvilinear grid and note that here we try the when we generate grid we here there are two types of grid which is one which is called as body fitted grid where the grid lines are fitting the boundary. So, let me discuss this in a more detailed and simple way in the white board. So, like for Cartian coordinate system there are two family of lines, let me draw the simple domains. So, what are simple domains? Let us suppose if you have a square plate with a square hole or let us suppose if you have a circular plate with a circular hole. Now, what you do here you draw equispaced vertical lines let us say. So, this is your hole. So, you get grid points which are in the solid control volume. Here what you do? So, here you have drawn what are the lines which you have drawn? There are two families of lines. What are this lines? What are vertical lines? X is equals to constant. What are horizontal lines? Y is equals to constant. In this case you draw concentric circles and what are these lines? Radius is equals to constant. You also draw equispaced radial lines. What are these radial lines? Sorry. So, these are r is equals to constant. These are phi or theta is equals to constant. So, this is x y coordinate system. This is r phi coordinate system. So, there are two family of lines x equals to constant, phi is equals to constant for Cartian and r is equals to constant, phi is equals to constant. Now, when we want to go for complex geometry we want to draw grids using two family of lines only. Although in complex geometry it cannot be x y it cannot be r phi. So, in complex domain, so in simple domain right now I am showing you two family x y and second r phi. In a complex domain we cannot have r phi like let us take a square plate with a circular hole. In this case I cannot take x y because my hole is circular. I cannot take r phi because my outer domain is square. So, let me define some instead of x r let me define this as xi and instead of this y and phi let me define here as zeta. Actually there is a purpose because there is a reason why we want to restrict to two family of line because we want to create a Lebrick equation such that the value at a particular point is function of its four neighbor in case of 2D problem north, south, east, west. Like in this case if you take this control volume and you zoom it on you know which is north, south, east, west like if I take this node you know this is east neighbor this is west this is north and this is south. So, when you have two family of lines note that scrolling through the point or neighboring information is inbuilt because the data structure which you use is matrix. So, you can store the coordinates of the centroids of the control volume you can store the temperatures or velocities or pressure in a matrix where the neighboring information is inbuilt. So, and that is very important as far as when you want to develop a code like just to tell you if you use an unstructured grid the neighboring information is not built that is why this grid is called as it is having certain structure why where what when we say it is having certain structure what do we mean neighboring information is inbuilt what is east i plus 1 what is west i minus 1 what is north j plus 1 what is south j minus 1 this is what we mean by inbuilt information in an unstructured grid this is not the case. So, when we say unstructured what we mean by what is that where structure is breaking the neighboring information has to be stored separately then whenever you want to solve for a particular control volume you have to develop program and in that program it will go and search its neighbor. So, neighbor searching takes computational time. So, in unstructured grid note that it takes more computational time to solve for node, but what is the advantage in unstructured grid there are problems where if the geometry is too complex you cannot create the structured grid. So, for those cases unstructured grid is better otherwise another issue is that unstructured grid has a good characteristic as far as what we call as a local grid refinement is concerned which is not true for structured grid. So, if you look into this whiteboard in this case we want to create two family of lines. So, one family will be such that it will start with circle then it will slowly move towards square. So, there is one family of line which is starting with a square, but slowly moving towards square starting with a circle which is this is the whole and you can see that it is slowly approaching towards a square this is one family of line. What will be the second family of line which will be radial which will be radial here, but actually I cannot call as radial because inside it is circle, but outside it is square. If you look into one control volume in this case it is like this if you look into one control volume here may be near to the circle it will be like this, but here it may be straight. So, let us suppose here it is curve, but here it is straight. So, let us say the line which is initially circle and we which moves towards the square let me call it as xi and this radial outward lines let me call it zeta. So, this xi zeta is called as curvilinear coordinates. We are defining let us come back to this slide. So, we are defining for simple domain standard coordinate system for complex domain why we are calling it a body fitted I would like to mention that body fitted because the grid is fitting the hole it is not crossing the grid line is not crossing the hole. One value of xi is fitting on the circle another value of xi is equals to constant is fitting on the square ok. So, this is we call as body fitted curvilinear xi zeta coordinate. Each segment of the physical domain boundary is described by a constant value of one of the curvilinear grid. Now, when you want to generate a grid like this and if you want to propose a method which is simple not semi implicit pressure linked equation which is literally simple. So, when you want to propose a methodology for structured grid generation it is proposed that let us define a computational domain which is square in which is square where there are horizontal and vertical lines and there is a physical domain where there is one to one correspondence. Let me go back to this white board and then show you what I mean by physical domain and computational domain. So, this is a physical domain where we have let us say a square plate with a circular hole. Now, this circle slowly becomes square as you move out. So, let us suppose this is one family of line denoted by xi is equals to constant. By the way how many xi is equals to constant line you are having in this case this circle is also xi is equals to constant. Let us say this is xi 1, this is xi 2, this is xi 3 and this is xi 4 and let us suppose I have 4 lines for zeta also. This is zeta 1, this is zeta 2, this is zeta 3 and this is zeta 4. Now, this is physical domain where at the vertices of the control volume you have x and y coordinate. So, in this domain the coordinates are x and y because this is the real world situation this is the physical situation. So, the coordinate in this domain has to be x y coordinate although in this physical domain note that we are generating two family of lines which we are saying xi zeta. Now, for the simplicity in developing a method for grid generation what is proposed is that let me propose four vertical line, four horizontal line. This vertical line xi is this is xi 1, this is xi 2, this is xi 3, this is xi 4. This horizontal line zeta 1, zeta 2, zeta 3 and zeta 4 and this is my xi coordinate and this is my zeta coordinate. Note that here it was x and y and this I will call as computational domain. Why this is called as computational domain? Because we will use equations mathematical equation to solve in this domain why? Because the size of this domain note that it is always 1 by 1, it is always square and 1 by 1. What will be the xi and zeta coordinate for a particular point? What will be the delta xi here? 1 by 3. In this case the way I had discretized delta xi what is the length in the xi direction unity? How many divisions I am doing? 3. So, delta xi is 1 by 3, delta zeta is also 1 by 3. This is the origin 0 comma 0. So, can you calculate xi zeta coordinate on all the vertex? This will be delta xi, 2 delta xi, 3 delta xi and so on. Here you will have 0 delta zeta, 1 delta zeta, 2 delta zeta, 3 delta zeta. So, with this you can calculate xi and zeta coordinates on all the vertex. Is that clear? Now the mathematical equations which is used. So, there will be a equation which will be used to convert this xi zeta on this how many points you have? 16 points. So, this xi zeta we will have an equation. So, we will have an equation. The 16 values of xi zeta will be converted into 16 values of x and y. Where let us say there is 1 to 1 correspondence. What is meant by 1 to 1 correspondence? Let us say this point corresponds to this point. Note that this is just a geometric problem. You start from the computational domain just for ease in obtaining the x and y coordinate in this physical domain in which you want to solve here. Whatever I taught in my lectures all those are applicable after you have generated the grid, after you have obtained the coordinates of the vertices. I had told you about the simplest form of the grid generation. Here I am discussing more complicated form. This equations can be an algebraic equation for simpler problems, but for more complicated problem it has to be partial differential equation. Let us come back to the slide. This is an unstructured grid where the neighboring information is not built. In the unstructured grid the procedure is no mapping transformation is done and grid point cannot be associated with orderly defined family of grid lines. There is no definite structure between the neighbors. Due to the limitation of time I have 15 minutes left I will skip certain slides and I would like to discuss the important slides in this topic. As I mentioned in the whiteboard recently that we do a mapping. Start from a computational domain which is square. We divide into certain equal parts in the x and y direction. You calculate delta xi, delta zeta. Once you calculate delta xi, delta zeta you can calculate xi and zeta coordinates at 16 points which are taken in the figure. We use one mapping function or a mathematical equation with which we convert those 16 xi and zeta to 16 x and y. Those 16 x and y we take it to a plotting software. The software use those x and y and create a grid. It is as simple as this. The equations could be an algebraic equation and can be a partial differential equation. If this is the algebraic equation then from this computational domain you can get this type of algebraic grid. If this is the algebraic equation you can create grid for let us say flow over a flat plate where flat plate is the bottom. Note that in this algebraic equation you are still generating the quadrillion grid. However the grid is more fine near to the plate. You can use another algebraic equation. Note that if there are 16 xi and zeta you can create 16 x and y and you can create a grid like this. For this equation now the grid points are not only fine on the bottom wall but they are fine on the top wall also which is needed for flow in a pipe or a plane channel. If we use this type of equation algebraic equation you can create grid clustering in the interior of the domain which can be used for let us say flow not only over the top but if there is a flow at the below the flat plate also then your flat plate will be sitting in the middle of the domain. This is clustering at the interior of the domain. So that is obtained using algebraic equation. Now if you use partial differential equation actually this is the what we call as the equation then we do inverse transformation because why inverse transformation we do? Because we solve in computational domain where we want xi zeta to be independent variable and xi and y to be dependent. So this is the equation where x and y is a dependent and xi and zeta are independent variables. So using this equation we discretized by finite volume method. These are the details about the Taylor series expansion. I would just like to show when I was answering the question I had mentioned that when you do a Taylor series expansion you get an algebraic equation and then you get a truncated terms and the lowest power of delta x in the truncated term which is 1 here besides the order of accuracy. So this is the first order representation of del phi by del x using forward difference. This is for backward difference. This is for central difference. This is central difference for second order derivative. Here is the computational stencil. This is for cross derivative. So using that finite difference method if you discretize the different differential terms you end up with an algebraic equation where the stencil is such that it not only needs north south neighbors but it also needs corner neighbors. All these are discretization. What I will do is that I will show you the computational stencil. I will show you as an animation. Here I am showing you the computational stencil. So these are the nodes of the finite difference method. So n represents not here time level but it represents iterations because here there is no time. There is only xi and zeta. So n here represents iteration. n is the previous iteration or when you are doing first iteration it will be the initial guess. Now here the equation is such that it not only involves the east west north south but it involves corner neighbors also. So the computational stencil is such that you scroll through the 9 points to calculate x and y on those 9 points using xi and zeta to solve the algebraic equation 9 times. Let us come back to this slide and this is the solution algorithm. Maybe I will put this lecture slide in the model where you can go through it. This is just the procedure step by step how we solve that differential equation. I will be more interested in showing you that once you solve how the grids are generated. So I will discuss this through some animations. So let us take an example square plate with a circular hole. So now you can see that the grid the way grid is generated in this case that the slowly the circle becomes an let us say octagon and finally it reaches a square. Actually this is good for let us say square plate with a circular hole but if you have a flow across a car or a cylinder this grid is considered better. This is called as an h type of grid this is called as an o type of grid. If you have a 90 degree bend then this grid line is aligned along the stream lines then in that case this is the grid which is considered better called as c type. So this structure there are 3 types basically you get 3 types because what we do is we do mapping because we want that let us say if you have a square plate with a circular hole we want to map the boundary of the physical domain with that of the computational domain. So the inner boundary let us say in this case is this circle circular hole which is the left wall of the computational domain. The outer boundary of the plate BC is the right wall of the domain but the boundary here is connected. So what should be AB and BC? So the idea here is let us suppose if you take a paper and if you have a hole at the center and if you cut it from here and let us suppose this is made up of rubber then you can rotate it and you can unfold it like this. So when you unfold this let us say flexible material then there is 1 to 1 mapping of the inner boundary, outer boundary and this is what is called as branch cut. Physically this AB and CD are same and note that when you are solving in this computational domain where x and y is the dependent variable you need boundary condition for the dependent variable. So you need x and y coordinates in the circle you need x and y coordinate in the square. I will discuss this in the next slide. Let us let me discuss this in the through an animation called as O type structure grid I will show you an animation. So let us take a problem there is a square plate that is suppose the size of the plate is 10 by 10 units let us say. So what is the radius of the circle? 5 units sorry the plate is of dimension 10 by 10 the circle is of radius 2. So the radius of the hole is 2 units. So what is the radius of the hole if I this is the x y coordinate we have drawn a branch cut like this where what is AB? AB is the hole which represent the bottom boundary of the computational domain. CD is the complete outer square which represents the top domain top boundary of the computational domain AD and BC note that physically coordinate of A and B will be same. But in computational domain we are showing it as a 2 different point. So let us suppose I divide this circle into 8 equal parts where I know that the radius of the circle is 2 units. So can you calculate x and y coordinates of this blue circles? You know the radius you know how many equal divisions you are doing? So you can calculate x and y coordinates. Note that the blue circle in this animation is not only coming on the right figure but it is also coming on the computational domain. So those are the x and y coordinates which acts as the boundary condition at the bottom boundary of the computational domain. Now note that the radius is 2 unit diameter is sorry the plate dimension is 10. Let us say the origin is at the center of the plate. So what will be the top right corner coordinate? Origin is at the center of the circle hole and what will be the top right corner? Let us come back to this slide where I can show you in a better way. So if the hole is 2 unit and if the dimension of the plate is 10 origin is at the center 0 comma 0 is this. So what will be the coordinate of this coordinate? Plus 5 5 comma 5 this will be minus 5 comma 5 this will be minus 5 comma minus 5 this will be plus 5 comma minus 5 and let us suppose you are doing 4 how many equal divisions you are doing here? 3 equal divisions x equals to 0.2 which is the radius y is equals to 0. This point will be y is equals to 0 x will be 3 here it will be 4 here it will be 5. Let us come back to the animation. So I will show you points not only on the physical domain but there will be corresponding point on the computational domain on the right boundary BC of the computational domain where corresponding x and y coordinates x as a boundary condition. Similarly we divide the outer square and we can calculate we are doing equal divisions we know the origin we know the size of the plate we know the size of the hole we can calculate x and y coordinates on this blue circles and there is one to one correspondence and we can calculate we can use those x and y coordinates as the boundary conditions. So this way we set the boundary condition in the computational domain and we solve the partial differential equation which is discretized by finite difference method in the computational domain. Once we solve we get x and y coordinates and I will show you one to one correspondence one circle yellow circle will come in the left figure another one will come in the right figure this is in the left figure and this is in the right figure there is one to one correspondence. So this x and y coordinates in the physical domain if you take it to a software it generates this if you use a command machine you can see that the number of control volume in the computational domain and that in the physical domain is same the number of vertices are same this right now I had shown for O type you can get a different type of grid by having a different type of branch cut. Now note that here the branch cut is how was the branch cut in the previous slide it was a circle sorry it was a branch cut is shown by a line in this blinking line. So when the branch cut is like this you got get this type of grid called as O type grid because one of the family of line of xi and zeta is goes from circle to square. Now in this case the branch cut is not that only that horizontal line but it also includes the circle. Now in this case you get here again we do equal divisions and we apply boundary conditions the way I had discussed earlier. Now you are moving from on the circle note that you are still in the bottom boundary of the computational domain. Now you come back in the branch cut note that this completes the boundary condition only for the bottom boundary of the computational domain. Then you go on the right boundary of the computational domain there is a one to one correspondence there are two circles coming in this animation note that one on the left half another on the right half. Then you solve with this boundary conditions and domain computational domain you solve a partial differential equation. So it is solved iteratively and the converge solution of that gives you sorry this is the boundary condition last boundary condition then you solve the partial differential equation and this is the results which you obtain results are x and y coordinates and you join by certain lines this is called a c type grid. Similarly there is an h type grid I will not go into the detail maybe there will be one thing which I would like to show to you this is what is nowadays becoming popular using Cartian grid method. So after let us say unstructured grid nowadays again the grid which was the which is the easiest and which was the which is the oldest grid in CFD let us say the Cartian grid is gaining lot of popularity because when you use this unstructured in a grids in a moving boundary problem or an industrial problem the computational time in machine is very large where we want the grid to be static and moreover this Cartian grid have a very good accuracy when use unstructured grid in the formulation level there is lot of inaccuracies. So in a Cartian grid what I am discussing here is what we call as the adaptive mesh refinement. So the idea here is that there is one data structure which is used in computer science called as octree or quatery type of data structure. So here the data structure is not simple matrix data structure. Actually this method this adaptive multilevel refinement was used in Cartian grid and this is quite this was earlier used in compressible flow but nowadays it is also being used popular becoming popular in incompressible flows because in any CFD calculation the grid refinement adaptive multilevel adaptive grid refinement because you want that the action of the fluid mechanics shifts with respect to time. So you want that your fine grid should your grid should find in the region of action. This is what is called as multilevel grid refinement the idea is like this that if there is a parent which is called as root there are four children's and then there can be four grandchildren's. So this is what is there in the octree or quatery. Octree comes in a 3D code development and quatery comes in a 2D development because in 2D there can be four subdivisions in 3D there can be eight subdivisions. So four children's or eight children's. So using this technique one of our M. Tech student Rakesh has developed a code and I will show you an animation. What he has done is that he has right now it is a conduction problem. He has taken a circle where there is a volumetric heat generation and that circle itself it is like it rotates about the center of the domain. So you will see that the grid will be refined and it will move in a circle. So you can see that that volumetric heat generation is rotating and with that the grid refined grid is also automatically adapted. This is called as a multilevel Cartesian grid adoption. As we are close to lunch maybe I will stop here. Thank you for your attention.