 So, the next topic is on computational heat advection, we started with the pure diffusion phenomena, now we are moving to advection, then what we will do, in CFD any development we do module by module and each module will be tested, like if you want to develop a big product what you do, first you build different components correct, so this is the software development, here also what are the components, in the physical sense you may have the real material or real component, but here the components are the different modules and anyway if you develop a big product when you will component by component, each component you test for functionality, each component has certain function and the when all the functionality is combined you get a big product, so here also your product is software that is a new stroke solver and your components are that, let us say different modules or different subroutines for diffusion advection, then you combine these two components or two modules or two subroutines and then you get what you call as the combined advection diffusion, which you call as convection, here I am using a language where I am calling convection as a combination of diffusion phenomena and an advection phenomena. What is pure advection is a, I would say is a proposition, it is an assumption, pure advection is an assumption where we say that the heat by conduction is negligible as compared to the advection and this can only happen if the flow velocities are very very large, this I discussed earlier also, so after heat conduction which is a diffusion phenomena let us go to the next module which is advection, I will start with an introduction followed by the finite volume discretization. This advection scheme is basically the second level of approximation in our finite volume method, I have put it as a separate topic because this is one of the important thing in any CFD software application also, so I had taken it as a separate topic, thereafter I will be discussing the implementation details solution algorithm and finally some example problem, so pure advection I am just repeating what I have shown you earlier, what is pure advection if the flow velocities are very large, so that we can neglect conduction heat transfer as compared to advection heat transfer. So, if the flow is of very large velocity from the ice side, you feel a temperature of 0 degree centigrade, if the flow is very large from the fire side, you feel a temperature of 100 degree centigrade, it is a one dimensional assumption. Let us go to the two dimensional case, if you consider two dimensional advection, earlier case was one dimensional advection. Let us take flow inclined at an angle of 45 degree, let us say boundary condition are let us suppose left wall is 100, bottom wall is 0 degree centigrade, even this is the flow, flow is inclined at an angle of 45 degree, the plate is square note that, plate is square, flow is inclined at an angle of 45 degree. So, the fluid which is hitting the left boundary will carry the temperature of 100, the flow which is hitting the bottom boundary will carry the temperature of 0, flow is inclined at an angle of 45 degree and flow is uniform, it is of very large velocity. So, what will be the analytical solution, below diagonal it will be 0, above diagonal it will be 100, if the fluid particle carries the temperature as wherever it goes, because it is of very large velocity. We will use this problem as a test problem, because we know that this will be the exact solution for a pure advection. I would like to just point out that this pure, if you look into the multi-phase flow simulation, although I am not discussing the computational aspects of it, but we have been doing research in that code development of code for multi-phase flow for the last 6, 7 years. So, in the multi-phase flow, the interface motion, in multi-phase flow we have two sets of equations, one to solve the flow and which is like multi-solid, what I had thought there is a multi-fluid hole. So, basically the thermo physical property we have to take into consideration, but more than that as compared to multi-solid heat conduction where your interface was fixed, in multi-phase flow the interface will move. So, you need one more equation for capturing interfaces. To capture the interface let me tell you that the interface is such that it just get advected. So, the interfacial equation if you see, whether you follow up volume of fluid method or a level set method for multi-phase flow simulation, the interface motion is captured as a pure advection motion. So, right now we are talking about the topic of pure advection and I want to point out that in multi-phase flow simulation, the interface motion is modeled as pure advection motion. So, at the interface between the two fluid, whatever velocity is hitting the interface, the interface goes along with it. Right now this example which I had told, it is easy to digest or understand, assimilate using the example of temperature, but this advection is not only applicable for what is advection in heat transfer, it is enthalpy flux, I had discussed earlier, but the same advection you also get, similar advection you also get in fluid flow also, you also have advection in new stoke equation. What is advection flux in momentum equation? Momentum flux, x momentum flux, y momentum flux. Although I am taking the example and taking this topic for advection heat transfer, this is equally applicable for advection phenomena in the momentum transfer. So, if you simplify the energy equation, the general energy equation is rate of change of enthalpy of the fluid inside plus across the control volume, because you are following an Eulerian approach. So, in an Eulerian approach, there is change of enthalpy inside and what happens at the phases of the control volume, the enthalpy may be different. The fluid may be entering with some enthalpy, leaving with some other enthalpy. So, across the control volume also, there is some enthalpy exchange which is occurred, which in fact, we call as advection, is equals to heat gained by conduction plus volumetric heat generation. Here, what we are assuming is volumetric heat generation is 0, so that is it can be true for many physical situations, that is not an approximation I would say. Heat gained by conduction, we are saying that it is negligible as compared to advection, so this becomes 0. Then, what we do is that this rate of change of enthalpy across the control volume is basically total heat lost by advection. Just I would like to point out when you want to calculate rate of change across, so when you call it change across, then you will have out minus in. When you do out minus in, then what we call is the heat loss by advection, but you take it, if you take it from the left hand side to the right hand side, it will there will be a negative sign. So, it will be minus of loss, minus of loss becomes plus of gain. So, you can also interpret as rate of change of enthalpy of the fluid inside the control volume is equals to total heat gained by advection heat transfer. So, whether you have any confusion, any question on this, when you want to calculate rate of change across and the way we interpret is that rate of change across means you want to calculate a positive quantity and to do that you need to have out minus in enthalpy flux out and minus enthalpy flux in, out minus in gives you gain, sorry out minus in give you loss. So, if more is going out less is coming in means there is loss from the control volume. That is why I written on the left hand side as lost, but the same positive loss if you take it to the right hand side it becomes minus heat loss, minus heat loss you can interpret as gain. So, the way we are interpreting is the rate of change of enthalpy of the fluid is equals to total heat gained by advection. The unsteady state approximation I had mentioned. So, I will not go into detail, there are two levels of approximation. First level of approximation is volume averaging of rate of change of temperature in a control volume and representing it at the centroid of the control volume. The second level of approximation is basically the discrete representation of the temperature gradient by first order forward difference in time and this is the final expression for unsteady term. Rho Cp delta Vp Tp to the power n plus 1 minus Tp to the power n divided by delta T. Now, what are the advection flux I am just emphasizing it because do not think that this is only applicable for heat transfer it is also applicable for fluid flow. So, what is advection flux? Advection flux is product of mass flux and C which is one for fluid flow and specific heat for heat transfer and what is this phi? Phi is the advected variable. I had mentioned that there are two variables in advection. One is the advecting variable which is like acts like a driver and the advected variable which acts like a passenger. This phi is u for x momentum v for y momentum temperature for energy equation. So, this advection flux is x and x momentum flux for x momentum equation, y momentum flux for y momentum equation. This comes from here only, but C is 1 and phi is u here and phi is v here and this is enthalpy flux in case of energy equation. So, then the second level of averaging what we do is that this advection total advection we want to calculate. In conduction what we want to calculate? Total conduction heat transfer. Here we want to calculate total advection heat transfer. In conduction total heat transfer we represented by heat flux multiplied by surface area. Here we will represent it by enthalpy flux multiplied by surface area. What was the second level of approximation in conduction? Fourier law of heat conduction. This is the first level of approximation. What is the first level of approximation in conduction? The variation of heat flux on the surface area we expressed in terms of centroid value. The same approximation is used here. So, this advection flux on which varies at the surface area. There it was conduction flux was varying over the surface area. Here this advection flux in heat transfer it will be an enthalpy flux which will be varying over the surface area. So, we represented by one point. So, the average we are representing by the centroid value. So, this is the same thing, but in a different way. So, this way we approximate the total advection as the value of the fluxes at the centroid on the various faces. So, this gives you the first level of approximation. This is analogous to del by del x of A x plus del by del y of A y when I did the derivation in differential form in my first lecture. This is analogous to del by del x of q x plus del by del y of q y in case of conduction. Now, so this completes the first level. Note that the first level approximation is very much similar whether it was under conduction or advection. It is only that the first level in general is first level approximation in general is the presentation of flux at the surface in terms of centroid value. There it was conduction flux. Here it is enthalpy flux for heat transfer or in general advection flux. What is the second level of approximation in conduction? Discrete representation of Fourier Laffey conduction. So, there we use relationship between heat flux and temperature k d t by dx or k d t by dy minus k d t by dx or minus k d t by dy. Now, here we need expression to represent advection flux. For temperature it will be an enthalpy flux. How do you represent enthalpy flux? Product of mass flux, specific heat and u velocity for experimental equation. So, in conduction you got gradient of temperature. Here you will get value of temperature. Note that because when you calculate enthalpy, when you calculate enthalpy, you get expression of enthalpy as value of temperature. Expression for heat flux has gradient of temperature. Note that because here you need an approximation in the second level of approximation. You need an approximation to represent the value of advected variable, temperature in case of energy equation at the phase center. In conduction it was, here it was del t by del x at the phase center. Here is the value of temperature at the phase center. So, what is, that is what the second level approximation is what you call as advection scheme. So, if you use a software commonly it is called as convection scheme. But I feel that word advection is better here because as compared to convection. So, the advection scheme is what extrapolation or interpolation procedure to calculate the advected variable. Basically to calculate this phi e in terms of neighboring cell center value. You can use a linear interpolation because this is lying exactly between these two circles. So, this phi e you can write as phi capital E plus phi capital P divided by 2. This is called a central difference. So, this is something like this that if you are standing between ice and fire. So, let us suppose this point P is ice and this point E is fire. And if you are representing this as let us say 0 plus 100 divided by 2 then this is like a conduction which is not a good way of representing advection. So, you may feel that if the flow is from this side. So, your procedure what is what we are basically doing you are doing some interpolation. You are trying to calculate the value at phase center where you do not have yellow circle. Because your values what you calculate finally at are at yellow circle. So, at phase center you do not know temperature, but in your formulation you have to calculate in terms of neighboring yellow circle values. So, to do that you need to do some interpolation. Now the way I had shown you animation the purpose of showing you that animation of ice fire the purpose was to explain you that you need to develop procedures for you need to develop interpolation extrapolation procedure based on mass flux. Because that example of ice and fire if you add by that you could understand that the temperature which you feel is not 0 not 100 it is not 0 plus 100 divided by 2 it depends upon from which direction flow is occurring. So, that understanding should be used in your mathematical procedure. So, your interpolation or extra-polation should incorporate mass flux. So, like the animation which I showed in this slide if the flow is from this ice side then the temperature of this should be equal to temperature of this. So, if the flow is from this fire side the temperature of this phase center should be equal to this. This is what is called as first order of wind scheme. So, you may seen books this schemes, but I hope that through this animation and this discussion you might be getting a better insight into what is first order of wind scheme central. I will discuss more in derivations later on I will show you detailed mathematical derivation how those expressions come. So, the second level of approximation is to calculate the value of the advected variable at the phase centers in terms of neighboring cell centers and note that in case of this scheme we will use the mass flux direction because we knew the flow direction to do this interpolation. We should incorporate that because that is what in real world things happen. Just to show you that when you do a balance finally like the way you do balance in conduction here also you do the balance in of advection. So, once you do the balance what it represent is that net momentum lost by the fluid in the control volume for momentum equation. If we use u velocity at z then the x momentum flux lost is given in the y direction it is the y momentum flux lost and in case of heat transfer it represents net internal energy lost by the fluid in the control volume due to advection. Note that this is out minus in so that is why I am calling it as a loss. Analogously I had shown this as total heat gained by conduction. There I had used the symbol capital Q total or capital D to represent total heat gained by conduction. There it was in minus out so there it was west so the sign there was west south minus east north here it is opposite. So, that is why I am calling it as total enthalpy lost by the fluid in the control volume due to advection heat transfer. We are it is not complicated mathematics there are some approximation and there is some balance the what you have what you see in thermodynamics also it is just an addition, subtraction, balancing. So, in let us take two dimension on steady state advection and here I am talking of two different method explicit method and implicit method. So, here the idea is same what I showed in conduction. So, this is the unsteady state term which is same what I had shown you in conduction and on in conduction the difference is that this was total heat gained by conduction. Now, here the difference is this is total heat gained by advection note that here is west south minus on the left side it was east north minus west south when I took from the left side to the right side the sign has changed. Now, in conduction this was heat flux multiplied by surface area here it is enthalpy flux multiplied by surface area note that here you need the value of temperature at the phase center there it was gradient of temperature at phase center as it is an explicit method we are taking temperature to the power n because we are using previous time level temperature. So, in this equation there is only one unknown which is this there is only one term with superscript n plus 1 which is this all that temperature values are at time level n which is old time step. So, that way you have if there are 25 value circle you get 25 equations and in each equation there is only one unknown. In an earlier implicit method this temperature or calculate this total heat gained by advection are calculated using the new time level which anyway we do not know. So, that way this couple you get 25 equations if you have 25 yellow circles and each equation there is not more than 5 unknowns. So, it is a couple system the system of algebraic equations and here we solve that matrix by iterative method. So, that way you have an additional loop other than the steady state loop any question into this any question on the approximation. Sir why do we call it Euler explicit and Euler implicit? The word Euler is used because the earlier it was not used. Yeah you are right earlier I not used actually this type of discretization is called as Euler forward. This discretization in finite difference method it is called as Euler forward actually I should have not used because unnecessarily it create confusion, but the word Euler comes because this is called this discretization is called as Euler forward discretization for the time. Any other question? I want you to be very clear as far as this approximation is concerned because this is like bread and butter for your understanding. This approximation should be clear to you that is why today the beginning of the lecture I discussed this separately slowly by writing with pen and paper and showing you and I also convinced you that indeed you get the same final algebraic equation using finite difference and two different types of finite volume. So, I am taking finite volume is slightly different flavor, but the final answer remain same. So, if you use an explicit method I had mentioned earlier that there is a stability there is a mathematical procedure to do an stability analysis where basically how the numerical error grows with respect to time using that mathematical approach equation is obtained one equation is obtained that equation for conduction or a diffusion I had shown you in the for conduction what was that equation? Alpha delta t 1 by delta x square plus 1 by delta x square should be less than equal to half for pure conduction or pure diffusion in case of advection that expression comes out to be like this from the stability criteria the expression is delta t mod of u divided by delta x plus mod of v divided by delta y should be less than equal to 1. So, but you for so u varies from point to point v varies from grid point to grid point, but it is not that you will use different delta t for different grid point you want to use one delta t. So, which one will be the conservative or the safe one delta t is directly proportional to u or inversely proportional to u delta t from this expression is inversely proportional. And if you want to follow this expression you should use maximum value of u or my minimum value of u maximum value of u and then you may think that the maximum value of u will be at some other grid point maximum value of u will be at some other grid point, but you cannot have two different delta t. So, again a safe value or conservative value is that you take the maximum although there are two different grid point, but let us take them and then use this expression for pure advection for pure advection is that clear any question into this what is that ok, it is good that you ask this question this question is what is the meaning of this. The meaning of this is that u delta t represent what u into delta t if you take the product represents what distance travelled by the fluid particle and then you are dividing by delta x. So, let us take a one dimensional situation. So, in one dimensional this let us suppose this let us take this 0. So, u delta t represents the distance travelled by a fluid particle. So, that distance should be less than delta x that is the physical meaning of this. So, the distance travelled by the fluid particle in one time step should be less than one cell size. Cell width. Yeah, yeah, yeah, because we are doing this advection for a fluid only, not for a solid unit because this advection occurs when there is a flow. So, this u delta t is the distance travelled by the fluid particle and the distance travelled should not be greater than the cell width should be less than that that is the physical meaning. So, in the afternoon we will give you a code where this criteria is used for time step cap computation. I think we had generated two types of code in the initial part there will be you will be given an option there will be switch whether you want to put constant value of delta t for your explicit method, but in that case there is a risk. If you put a larger value of delta t your code will diverge, but you need to be sufficient and then to whatever delta t which you give you are not sure whether it will converge or not. Sir, you gave explanation for that term now. Yeah. You told that the distance travelled to be a fluid particle should be less than delta x value. Yeah. But you were adding another term also now sir. Correct, correct. Then that is easy to understand in a one dimensional situation, but in a two dimensional situation you have to distance travelled will be in not in the x direction or y direction it will be inclined direction, correct. So, that way in some sense it takes into consideration this distance travelled in the x direction distance travelled in the y direction the summation of this two should be less than one, okay. Now let us go to the next topic which is sorry next I would say subtopic advection scheme. What is advection scheme? This is an approximation to calculate the advected variable for energy it will be temperature. Let us talk about temperature so that you get a feel of what I am saying. Approximation to calculate temperature at phase center in terms of cell center. What is cell center? Yellow circle value. What is phase center? East, west, north, south, small fetus should incorporate the physical behavior of the convection. What is the physical behavior? That ice fire I will come back to that. This is done by a mathematical procedure I would say which is called as advection scheme and what is that advection procedure? What is that mathematical procedure? Interpolation or extrapolation. This should be based on the direction of mass flux. What this figure shows? This blue is let us say ice this red is fire in both the case. And this is the direction of flow at this phase center. So here the flow is from which direction? Ice and here is from which direction? Fire. If you want to have a general definition actually when the flow is in this direction then this is called as upstream. When the flow is in this direction this is called as upstream. What we call as upstream or downstream depends on the flow direction. And the general form of this if I want to incorporate pure advection the way I had said then this is done in what we call as the first order of flow. So what we are saying is temperature here is equals to upstream neighbor value. What is upstream? Ice. Temperature here is 0. What we are saying here is the temperature here is equal to upstream value which is fire. So in this case temperature here is equals to 100. But this can be expressed as a general expression like this. Temperature is equals to upstream value. Let me ask you what is the difference between extrapolation and interpolation. Please raise your hand to answer this question. What is the difference between extrapolation and interpolation? We have the correct data while interpolating. So the prediction is correct to a large extent. In extrapolation we are actually predicting beyond the range of data. To some sense you are correct but not precisely correct. I want some further answer also. The interpolation is for the intermediate value between the two known values whereas extrapolation goes beyond the extreme boundary. I mean we do not know the something which is beyond the range. We try to manipulate or make use of all known values and then. I think more or less it is the same answer what he has given but I need a different answer. We have got two points. Suppose we want to get another point value within these two points then it is called interpolation. Suppose if it is outside that is called extrapolation. More or less you are right but I will stop here. If you use yellow circle value only from one side it is extrapolation. If you use yellow circle values from both the side it is interpolation. So it is not that extrapolation means we do not have data. We have data. We indeed have data but we use only one sided neighbor that is called as extrapolation. Literally it means what you are saying that extrapolating many a times it means that we do not have information and we are trying to extrapolate. But here mathematically what I mean is that if we use only one sided neighbor like in case of ice fire whether we are using both side neighbor in first order of point. First order of point whether we are using both side neighbor in this case also and in this case also you use only one side. This is extrapolation. By the way this is best of extrapolation constant extrapolation. Why constant? Because whatever value you see here you are saying the same value should be here. Constant variation is also linear you may say but it is not a more specific answer is constant extrapolation. The constant value 100 we are saying is here. It is a constant extrapolation. One sided value we are extrapolating. By the way that I if you use that the refusion conduction thing then you do what you do 0 plus 100 divided by 2. The extrapolation means suppose we got a straight line I go to two points I know the slope. Suppose we want to extend this one I need to know the slope at least I need to have two points at the other side but this is not extrapolation in that sense. Why it is not an extrapolation? You take a straight line. I take a straight line I am saying that it is horizontal. I am saying horizontal. It is not extra you are getting having the same value there. No I am saying that the variation is horizontal. It is also a linear variation. Slope is 0. I will show you through figures also. I will show you later on mathematically figures expression. But if you use that pure diffusion phenomena 0 plus 100 divided by 2 that is what I call as interpolation. Any other confusion questions? So we will before we break for tea let me first show few of the extrapolation and interpolation advection schemes. We do extrapolation for what we call as first order upwind. Note that here we will take only one upstream neighbor. But why to take only one upstream? Because we can have one yellow circle upstream but there may be another yellow circle upstream of upstream. So I am standing between ice and fire but before ice there may be something else which at different temperature. After fire there may be something else at different temperature. So why to take only one upstream neighbor? If you take more upstream neighbor and the general rule of CFD or numerical method is that if you take more neighbors your equation becomes involves more neighbor. When your equation involves more neighbor your calculation takes more time. So the calculation competition time increases but on the other hand your accuracy increases. So if you use a higher order scheme you may need let us say 20 by 20 point to get an accurate solution which you get from 100 by 100 points in first order upwind scheme. So whenever you use higher order scheme the point is that per time step competition or your equations will become more complicated. Let us suppose 20 by 20 higher order schemes take same time as 100 by 100 sorry 20 by 20 let us suppose 20 by 20 and 100 by 100 first order up scheme and second order scheme take same competition time and have same accuracy. So the point of which I want to emphasize is lower order schemes need higher number of grid points to achieve the accuracy of the same level which is achieved by the lower order accurate sorry higher order accurate schemes on a lesser grid point. So when you use two upwind neighbors you get from first order second order scheme later on but just now I want to introduce that there are two upstream neighbors which we use. In interpolations what we will discuss here is central difference scheme which is like 0 plus 100 divided by 2 linear interpolation but there the slope will not be 0 it will be non-zero. Then I will also show you instead of linear variation if you take a quadratic variation and this quadratic when you want to have quadratic there are three constants Ax square plus Bx plus C you need ABC so you need three neighbors. So if you need three neighbors in advection it is better to take two upstream neighbor and one downstream neighbor. So that is what is called as quick scheme. Now I will show you the derivation derivations of the advection scheme derivation of the mathematical procedure used to calculate the value of the advected variable at face centers in terms of neighboring cell centers. Before we go into derivation let me first explain certain terms what we call as upstream what we mean by upstream of upstream and so on. So if the flow is in this direction positive x direction and we are interested at this face center then this will be my upstream neighbor this will be upstream of upstream neighbor and this will be downstream neighbor. What I mean is that let us suppose ice is here fire is here but there can be one more neighbor on upstream to upstream where maybe let us say temperature is 50 degree centigrade or some other temperature. The question which comes is that why to take only one upstream neighbor why not to take upstream of upstream neighbor you can take but the situation will be that you will get an equation which will involve more neighbors. More neighbor means more computation time that is the price you pay as far as computation time is known but the other end the advantage is that accuracy of the solution increases. So you can get the result of same level of accuracy with higher order schemes in lesser grid points but it is not necessary that it will take less computational time as compared to lower order scheme it depends upon the problem. If the flow is from the negative x direction then the upstream and downstream neighbor changes as shown here. Let us start with derivation. I had mentioned that in second order upstream, second order upwind scheme we will take two upstream neighbors. I am not showing you derivation for first order upwind scheme because it is very easy it is just a constant extrapolation. In second order upwind what we do is that we take a linear variation and we take two upstream neighbors. What is the equation for linear variation? A x plus b. The derivation is very easy simple mathematical. We define the coordinate system we take let us say this as origin this will be x equals to 0. If you have a uniform grid distribution this I can call it as delta x ok. So at x equals to 0 you have phi is equals to phi u u. At x equals to delta x sorry this x equals to 0 you have phi u u at x equals to delta x you have phi is equals to phi u so you have two constant you give these two values of x. Note that you are giving the value of x because you want expression in terms of phi u u and phi u this phi can be a temperature. So if you want to take the ice fire example let us suppose you are sitting here this is ice and there is one more neighbor upstream of ice which is a some other temperature. So just use these two x values and calculate A and B and substitute into this expression. Once you substitute into this expression finally you are interested into value of phi at this point. What is the value of x at this point? What is the value of x at this point? Note that origin is here 3 delta x by 2. Distance from here to here is delta x distance from here is delta x by 2. The total distance from this origin is 3 delta x by 2. So you substitute into that 3 delta x by 2 and this is the final expression which you have got after substituting A and B. B came out to be phi u u A came out to be this you substitute A and B you get an expression that in this expression substitute 3 delta x by 2 you get this expression. This is the derivation. Is it too difficult finally? Now let us try to understand what this expression says. What is the coefficient? Try to look into the coefficient and understand it. What is the coefficient? 3 by 2 and minus 1 by 2. 3 by 2 means what? 150 percent. Minus half means what? Minus 50 percent. 150 minus 50 is what? 100 percent. What it is basically doing? It is giving weights to neighbors. Always note that there is a way to check that whether your derivation is correct or not and the way is the sum of the coefficient should be unity. Now let us go to the next. Now let us go from linear variation to quadratic variation. Note that linear there are two constants we took two point values phi u phi u u. Now when you take quadratic you have three constants. So we will not only take x equals to 0 let us say x equals to delta x but we will also take x equals to 2 delta x. Three x locations we will take and we will fit a quadratic curve. What is how quadratic curve represented? A x square plus B x plus C substitute x equals to 0 x equals to delta x 2 delta x and you get an expression. In this expression substitute x equals to 3 delta x by 2 and you get this expression. Here again do the same exercise. Look into the coefficient. 3 by 8 is how much? 6 by 8 is 75 percent. Minus 1 by 8 is 12.5 percent. 3 by 8 is 87.5 percent. Sorry, 37.5 percent, 75 percent and minus 12.5 percent. So it will again come out to be 100 percent. So you can understand in this way that here in this case we give 75 percent weight to this, 37.5 percent weight to this and minus 12.5 percent weight to this. Yeah, there is some question. Reconvection. No, no, we are talking about pure advection process. Okay. Then what is the advantage of this quick scheme then? Okay, his question is we are talking of pure advection. So what is the use of this quick scheme? That is a good question. The usage of this is important when you go to a combination of advection with diffusion. If you talk of pure advection, maybe first order of point is should be good enough. But in actual case, we always have combination of the two. Then the importance of this comes here. The first order of point scheme I am not showing you the derivation because the idea is very simple. It is just a constant extrapolation. So depending upon the flow directions, but when you are implementing this in a code rather than writing if statement, if this mass flow rate is, mass flux is positive or negative, rather than using if statement, it is better that you use a single line statement which takes less computational time. So we can express this as a single expression as this. Okay, so maximum of Me, 0, pi P plus minimum of Me, 0, pi. This Me will either be positive or negative. If it is positive, then this will be non-zero term. If it is negative, then this will be the non-zero term. Most of the CFD book is written in a slightly different way. Maximum of minus of Me, 0, but I prefer to write it in this way. However you are free to use your own expression. This is a central difference scheme. This is like what we call as 0 plus 100 divided by 2 in the isofaric example. Basically you get an expression which is independent of flow direction. Okay? I am not shown with this derivation, but you can do this derivation very easily. For second order upwind scheme, depending upon the flow direction, this is the single line expression which is used. This corresponds to flow in the positive direction, so pi P and pi W are coming. This corresponds to the expression in the negative. In this the upstream neighbors are pi E and pi EE. So I started with first order upwind, second order upwind, central difference scheme and then this is the quick scheme. So this is the positive direction of the flow. Then the upstream neighbor is pi P, upstream of upstream is this and this is downstream and this is for the negative direction and this is the final expression for that. And this is all the four expressions. First order upwind, central difference second order upwind and quick in a single slide. For clarity I have shown this extrapolation considering that the mass flow rate is in positive direction, positive x direction. I am not showing you the negative x direction. Note that this only, this is done not only in the x direction, but for a 2D problem it also needs to be done in the 2D model. Because you do not have only east and west face center, you also have north and south face center. Please raise your hand if you have any question. Which type of scheme is preferable? Which type of problem? Please ask a question which type of scheme is preferable. I have a series of slide for answer that question. I have taken some example problem also little later. Let me see if the time permits before lunch. I will try to cover that. But anyway I will answer that question. Here I can at least mention that at higher Reynolds number, this higher order schemes are preferred, like quick. But the problem with this higher order scheme is that you have stiff equations because the way the coefficients of the algebraic equation comes, it makes the matrix little stiff. So it takes more time to convert or sometimes it may diverge also. Whereas if you use this first order of wind scheme it has a very good convergence criteria. But the problem with this is that it has certain numerical diffusion. Mathematically it can be shown if you go through book by JD Anderson using finite difference method he has talked about numerical diffusion. I am not showing you the derivation but it has some inherent numerical diffusion which makes this equation less stiff and you convergence is easy in this case. But the price is that it is less accurate. I would like to point out before I go to the next thing that here what I am the equations which I am showing you is specific. Why it is specific? Because I had assumed that the grid distribution is uniform. Delta x and delta y everywhere but if it is a non-uniform grid distribution then also this derivation which I had done you can do it it is not instead of x equals to 0 delta x 2 delta x it will be some different value but still you can do it ok. So the equation will be more complicated if you have a non-uniform grid point distribution. For simplicity I had I do not want to show you big expressions so I had done like this. But this can be extended indeed for the non-uniform grid distribution. First thing second thing this is also used in complex geometry formulation. So what I am trying to tell is that for the general expression for this is that it is a distance-based interpolation and that too it is a one-dimensional extrapolation or interpolations you are doing ok. So it is basically a distance-based interpolation or extrapolation procedure. For complex geometries when the control volume are not aligned along the standard coordinate system people use volume weighted interpolations. The code which will be given giving you which we had given you and in fact today afternoon we have a lab session it is it has been interpolated using volume weighted averaging but in this case you will see that the volume weighted averaging is all the more general but it boils down to the this expressions only. It degenerates into this expression maybe in the final workshop just to avoid confusion we will modify that code and hard code this number so that you are familiar what you see in the slide. Now let us go to the implementation details how to develop code from this formulation. So let me tell you we use two levels of approximation first level study state it is same but in case of advection first level is surface averaging to represent the advection flux. Second level is advection scheme I have discussed in detail the different advection schemes there are certain advantages and disadvantages of the different scheme. The second order quick are called as higher order schemes they give more accurate results but many time you have to struggle especially if you use first order upwind scheme at high Reynolds number the inaccuracies are more at low Reynolds number maybe first order upwind is good enough but as you keep increasing the Reynolds number the first order accurate scheme becomes more inaccurate although the convergence is fast use higher order schemes their accuracy is not only good in the low Reynolds number but it is it is consistently good at high Reynolds numbers also however especially at high Reynolds number you may find convergence issues stability issues. When I go to implementation there is one implementation issue. These arguments are true when we consider conduction diffusion as well as convection okay and this is misleading circuit you are talking about pure pure advection process yeah and this quick scheme all the things the argument you give you know it is I am unable to I am little bit uncomfortable. Yes you are right I agree I understand your uncomfortability and yeah it is slightly misleading I agree with that maybe I was also thinking on the back of my mind whether I should improve my slide to avoid this confusion and I got that message I will work on it and maybe in the final workshop thank you for coming. Okay so in the implementation I would like to talk specially if you use this higher order schemes how to apply this higher order schemes near to the boundary or for border control volumes is one of the issue and we need some special treatment for this I have taken that because the problem is so these are your points inside the fluid domain these are the points at the boundary now the issue is that whenever you use the second order upwind scheme or quick scheme you need two upstream neighbors correct now you have a problem if you want to use the expression which I had shown I had assumed that this is at a distance delta x this is also at a distance delta x all the neighbors are spaced delta x but there are certain phase centers where this is not true which are those phase centers I had shown by this red line at this red line the phase centers which are lying on this red line the mass flux if it is inward if it is outward then there is no problem because if it is outward I can get two neighbor two upstream neighbor and one downstream neighbor they are equi-space no problem but on this red lines if you have phase center and if the mass flux is inward inward means from this here to here if it is inward then this is my upstream of upstream neighbor this is my downstream upstream upstream upstream and downstream but the distance between two is delta x but the distance between these two is delta x by 2 so our expression should change for this phase center correct our expression should change for this phase center why because the distance this is fine delta x but this distance is delta x by 2 it is just that expression will change but the procedure will remain same using that procedure you can get expressions note that the mass flux is inward the expression is modifies as this second order open scheme 200 weight percent weight upstream minus 100% upstream of upstream plus 33 to downstream 100% upstream and minus 33% upstream of upstream so the expression changes okay now let me ask you a question how you will apply the advection scheme at the boundary do you need to apply any advection scheme at the boundary and if you need how you will use how you will obtain it what do you understand by negative weight here 1 by 3 it is a negative weight basically negative weight means let us suppose your upstream neighbor is is at 0 degree centigrade upstream of upstream is let us say 50 degree and downstream is fire at 100 degree so we are just giving when you are writing the expression maybe you are just give some weight to 50 degree centigrade 0 degree centigrade we are giving a negative weight any other question now I was asking a question what I was asking is whether we need to apply advection scheme at the boundary yes or no please raise your hand if you feel yes if your answer is no then you are partly correct that if it is a Dirichlet boundary condition Dirichlet boundary condition means the value is given from the boundary condition then there is no need something is given why to calculate okay and if it is a non Dirichlet boundary condition then your non Dirichlet boundary condition will be boundary value as a function of border value boundary you do not need to use any advection scheme so note that if you use this higher order scheme at the border control volume for some of the phases you may have to use a different expression if the mass flow rate is inward on those phases now let us go to I will repeat again that this implementation details is just to give you a visualization of how you develop a program and how the code runs in a computer but you can come up with a more efficient computational procedure or code development but this is just to give you a feel about the formulation because I wanted you to use the same formulation and extend it to the code level this is the simplest form of grid generation equispaced horizontal and vertical lines and these are the grid points inside the control volume so here again I am taking almost the same slide which I had shown you earlier in implementation in conduction where it was conduction flux here it will be an advection flux that is the only difference so here what I do is that these are the grid points where we will calculate let us say we are talking of heat transfer so these are the points where we will calculate temperatures 7 points in the x direction 7 points in the y direction although one at 7 and two are at the boundary these are the grid points for temperature this is the running indices in the x and y direction here again I say that a phase is common to control volume and at the phase centers we have heat fluxes in conduction it was conduction heat flux here it is an healthy flux but when the phase is common I do not want to use two running indices so what I am trying to say is that let us create matrix let us create matrix not only for temperature distribution but create solution for heat fluxes also but you know that heat flux grid point is not at the cell center it is at phase center so the heat flux grid point is I can call it staggered by delta x by 2 plus delta x by 2 for the enthalpy flux in the x direction plus delta y by 2 in the y direction so I am using a convention where the running indices for this will correspond to the running indices of the cell center at which it lies in the east phase center this is at east phase center of this and the running indices of this is j, i this will be j, i if you go to this phase center this is at the east phase of cell which is here you will have a x j, i minus 1 here it will be a by j minus 1, i and in fact finally when you do the balance the equation becomes easy that a x j, i minus here plus this minus this and so on what I am showing you here is just a visual picture information about the grid points for the x direction because strictly speaking this are the products of phase center on vertical lines vertical phase center what we do here these are the grid points that we will obtain enthalpy flux in the x direction which will be product of enthalpy flux in the x direction a product of density into normal velocity which is a u velocity into specific into temperature these are the grid points I will again repeat the number of squares they are how many 6 in the x direction and in y direction they are how many 5, 6 into 5 if you look it into ready inverted triangles they are 5 in the x direction you can see and 6 in the y direction including the boundary values also a x is 6 by 5 a y is 5 by 6 because this understanding helps us in putting proper loops while coding so this is the loop for calculating the heat flux in the x direction y direction note that this is from 1 to i max minus 1, i max is 7 so this is 1 to 6 i max is 7 because you have 7 circles this is 1 to 6 and this is 2 to 6 2 to 6 means 5 points this is 6 when you go here this is 1 to 6 and this is 2 to 5 sorry 2 to 6 this is 6 point here and 5 point here and this is the expression to calculate I will here what scheme is used can you tell me what scheme is used here which advection scheme is used here and what is the assumption about the direction of the flow and taking the temperature of the phase in the initial center but this I can do you can think it is a first order but I am also assuming that the flow is in the positive x direction and positive y direction if you consider flow inclined at an angle of 45 degree the way I had shown you in the example u is in the positive x direction if you take the component of that velocity okay so basically I am here showing you the first order opend scheme I am not showing you that big expression I am showing you final because I wanted to show this in one slide but in general those expressions are used we have given you a code where those expressions are indeed used so once in conduction instead of this enthalpy flux you had conduction heat flux there it was gradient of temperature here it is the value of the temperature note that once you get this enthalpy flux you multiply by surface area and do a balance so this way you get total heat gained by advection and once you know the total heat gained by advection you can basically apply rate of change of internal energy or enthalpy is equals to total heat gained by advection and finally obtain the temperature note that this is very much analogous and similar to what I had shown in conduction so I started this formulation now I had shown you pseudo code I will also show you the solution algorithm and with this we hope that you will be able to develop your code or at least understand the code which we had given to you and start teaching in your class the solution algorithm is as I said that there is, I mentioned that in the introductory lecture that we start with some user inputs you have to call also called as pre-processing the actual process is basically the solution of those situations but before solution there are some other process which we can call as pre-processing solution is the main process you can call and so any other thing before that we call it as pre-processing and after that we call that as post-processing so all the step number you can call one to maybe six you can call it as a pre-processing what is the step number one to six there are certain user inputs because what is the material software does not know what material you want to simulate you have to mention properly software does not know what or your code does not know what dimensions you are, what domain size you have maximum number of grid and points code cannot just specify certain number of points let us suppose it specify thousand by thousand it takes one day to convert but you do not have that much time you want some quick result, you want to show something to the students so these are some of the things which are left to the user to enter there are some boundary conditions input which user only knows because there can be millions of CFD problem software cannot have millions which is although CFD software try to customize depending upon certain sector like for aerospace sector or electronic cooling they come up with a customized product to make the life of the user easy but if you look into general purpose software these are some of the inputs which are left to the user then this electron is something which we define whenever we are solving numerically what we call as practically zero because computer does not understand exactly zero there is some always precision what precision you call zero ten to power minus three or ten to power minus five that is the convergence criteria we use for any iterative method finally it has to difference has to approach to zero between two consecutive iterations then there is a grid generation in the grid generation basically you calculate the all the geometrical parameters width of the control volume of the control volume distance of a cell center from its neighbor then you calculate time step from stability criteria you calculate mass flux I have the example problem which you are taking you want to talk of pure advection actually when you take advection there is a velocity and from where you get velocity from continuity and momentum but I had not discussed till now how to solve the coupled equation so if you want a pure advection module separately then what we say is that let us assume the flow field so this is a hypothetical problem so with a prescribed velocity field let us try to solve it like if you look into the energy equation convective heat transfer problem what happens force convection let us say to make your life simple in force convection how is the energy equation there is an advection term where you need velocity for force convection temperature field depends upon the flow but whether flow depends upon temperature ok so let us suppose yes natural and mixed convection flow depends upon temperature so let us suppose you have force convection you have written an energy equation ok and now you want to test this energy equation independently if you want to test this independently but the energy equation depend on flow unless I know flow however can proceed so the numerical people say that ok let us take a hypothetical problem let us have certain propose certain flow field, continuity satisfying flow field let us say u is equals to 1 v is equals to 1 everywhere in the flow domain so for a prescribed velocity field you can use to test your advection as well as combination of advection diffusion equation I will show you little later also so in this class of problem advection velocity field is prescribed to you and based on the velocity field you calculate mass flux at various phase center ok is that clear let me repeat again as a big product is made up of component by component testing each component so we are also planning to develop a product but this is like a software which is basically made up of different modules here the modules are advection diffusion we write different subroutine but each of this subroutine should be tested independently not to test independently many times they have coupling not to break this coupling we design hypothetical problem let me tell you when you are developing code for new type of problems you may not get test problem like in this class you have certain test problem in the literature but you should cleverly design test problem because whatever code you develop you have to test it whether it is a physical product or a soft product software it needs to be tested and this is one of the test problem pure advection set the initial condition for let us say temperature here this is the advected variable then before you go for the here I am solving the unsteady state equation before you go for the next time you take that as a old value then calculate AX and AY at those green squares and the red inverted triangle points using a advection scheme to calculate the value of the temperature at phase center once you know the advection fluxes you can calculate total heat gained by advection once you know the total heat gained by advection you can calculate the temperature at each yellow circle values and check for converges as I mentioned that this is one of the good way of checking for the converges instead of taking the absolute difference we calculate the RMS value if this is not converged you go back to step 4 and continue let us take an example problem as I said in a pure advection we have there is no pure advection case in real world but it is always coupled coupled in the sense that the flow is required for advection and we want to avoid we if you want to solve this module independently then you have to prescribe flow if you take from the Navier-Stokes equations then it is coupled you are not testing it independently and actually this problem is hypothetical but the good thing is that it has an analytical solution what is analytical solution as I already mentioned I am showing you here in non-dimensional form non-dimensional temperature on the left wall is 1 bottom wall it is 0 here I would like to point out although the advection equations are what is the derivative in it how many boundary conditions you need to solve the advection equations if you look into the advection term although I had not shown you the equation because I am following a control volume approach but if you look into the differential equation the advection term has first derivative or second derivative first derivative how many boundary conditions you need boundary conditions you need one in the x direction and one in the y direction you can use this one boundary conditions only left wall and bottom wall in this case and use first order of point scheme and get the solution but if you are using central difference or quick scheme then you have to take this boundary condition as well just for numerical reason not for mathematical reason because if you use the central difference or quick you need one downstream neighbor so the border point which will lie here which will demand the boundary value so this two boundary conditions are needed if you are using an advection scheme which demands downstream neighbor but if you think mathematically this is not rigorously correct these two boundary conditions should be good enough to solve it, mathematically so this is the flow inclined at a 45 degree we have taken a hypothetical problem rho we are taking s1, cp s1 u and v we are taking s1 divided by root 2 at prescribed the boundary conditions so with the prescribed flow we saw to obtain the temperature distribution non-dimensional temperature distribution expressed as this this is the exact solution here you have 0 degree centigrade or non-dimensional temperature 0 non-dimensional temperature unity and this is the temperature variation on the vertical center line what do you expect in the vertical center line let us go to the solution what is the temperature distribution in the vertical center line the bottom half 0, on the top half 1, bottom half 0, top half 1. What is happening in the middle? Step change. Just see the result of FOU, first order of print scheme, second order of print scheme and quick scheme. We are looking into this three lines, green line, red line and blue line. If you compare red line and blue line, at least you can make one statement. Just by looking, red line is varying smoothly, blue line is oscillating, blue line is what? Quick. Quick has oscillatory solution. First order of print is smooth. What is the second statement? What is your boundary condition? 0 and 1. Solution should limit to 0 and 1. Which solutions are going out of bounds? Second order of print scheme, quick scheme. They are called an unbounded. But this we did on 22 by 22. If I call this as coarse grade, if you refine it, this unboundedness reduces. If you keep refining it at large, the good thing what you see is, although it is unbounded, although it is unbounded, but the good thing is that it is more accurate. You agree with this? So the second order and quick scheme, although they have unbounded and that you can eliminate at finer grade size. So higher order schemes are unbounded, but that can be limited on a finer grade size. First order of print has a smooth profile, but it is inaccurate. Just see difference. When you increase the grid size from 22 to 52, the change in the accuracy of the solution. Although first order of print is smooth, but the change in the accuracy is much more in case of higher order scheme. Can anybody answer that out of the different scheme which I am doing around this grid size? It could take least computational time. As far as the solution approximation like schemes, we decide, we apply the different schemes. We get the solution and then only we will go for the grid independence and domain independence. For a particular scheme, I should go for the domain independence and grid independence. But based on our knowledge, we at least know because we cannot keep doing the exercise that for first order of print, I will do grid independence. Then I will take second order of print. Maybe as an academic exercise, it is a good exercise. I appreciate that. But when you are solving some research problem in an industry or you have some funded project, you have to deliver something. You do not have that much of time. But academically, if you want to do, you can do. So what you will find most probably is that first order of print will reach to a grid independent solution on much finer grid side. Let us suppose F O U reaches to grid independent solution on 1000 by 1000. And for the same problem, quick may get reaching to grid independent solution on 100 by 100.