 We were looking at one dimensional Euler equations in the last class and equation just to recall is dou q dou t plus dou e dou x equals 0. You just want to make an observation from a, this is a continuation of a comment I made earlier. So we will write it out in the delta form and so on. I think we will write the discretization out in the delta form, the semi-discrete version. I will make a few remarks and then we will look at applying boundary conditions. That is where we were. I think I ended by saying that I will show you how to apply boundary conditions in a proper fashion. Am I right? That is where I basically ended. Now what we have seen so far, as far as boundary conditions are concerned, we have seen I will just draw a line. We have seen that this is the x axis. T is of course the direction which we are marching. We have seen that x equals 0. We are prescribing total pressure and total temperature and we are doing this looking at it from the point of view of gas dynamics that we know. So I have a reservoir of some kind and from there I will typically know total pressure and total temperature. These are the classic problems that you see in gas dynamics. And on the right hand side you have P ambient. And if you recollect, we said if you use a scheme like FTCS or BTCS, you actually need, you need Q at this point and you need Q at this point. That is you need the total state at the boundary, okay, which you are not going to have, which the physics neither, the physics nor the mathematics require, the differential equations require. So it is our scheme that requires it. We need to generate. We have to somehow generate those boundary conditions. And in the last class, the point at which we had sort of left it is we were basically saying that if I look at this interface at that point and I look at the characteristics at that interface, the direction in which, see now I am only in space. I am not drawing time at all. The direction in which these characteristics are propagating some information. We know it is Q1 hat, Q2 hat, Q3 hat. But I use the word information because we said over, we are prescribing P0, T0, right. They are not actually Q1 hat, Q2 hat. Is that okay? So the Q1 hat and Q2 hat characteristics propagate inward, information propagates inward. They are in fact propagating Q1 hat and Q2 hat. I am just using information as a general expression. So these correspond to the characteristics U and U plus A, okay. And to the same interface, we have coming from the, within the domain, one characteristic which is propagating to the boundary, U-A characteristic, okay. This is for a subsonic inlet. In a similar fashion we saw, right. So I am just recapitulating what we have done earlier. In a similar fashion we saw that here towards the interface on the right hand side at the exit, we have U and U plus A, okay. So remember these are not characteristics. I am not drawing them in the xt plane, right. I am only indicating the direction in which propagation is taking place, okay. So that you do not fall into the trap of drawing these and saying they are characteristics, fine. They are not characteristics. And propagating in the opposite direction is the U-A, right. So Q3 hat is being propagated into the domain from the exit. And Q1 hat and Q2 hat are apparently being propagated out of the domain, okay. So at the interface, I have, I am going to see Q1 hat. You understand what I am saying? I am going to see Q3 hat coming one way and I am going to see Q1 hat and Q2 hat coming the other way at the exit. That is basically what I am standing at the interface and looking at. That is what I am going to see in the characteristics coordinates. Is that fine? Okay. We just use these directions, we use these directions to rationalize sort of a hand-waving way of applying boundary conditions. We use these directions to basically say, why do not you extrapolate? See, we get away, that is why I use the word some information is being propagated, right. I use that vague term because then it allows me to say extrapolate some quantity, right. So we extrapolate, we used our physical intuition and basically said we will extrapolate U. That is, I propagate U from within the computational domain to the boundary. So that I am able to get, I am able to determine all the conditions, right, at the boundary. I am able to determine Q. In a similar fashion at this point, we basically said, well, there are two quantities that should go from the interior to the boundary. We extrapolate. What did I suggest? T 0 and U is it? T 0 and U. So T 0 and U, okay. So you can extrapolate T 0 and U, all from the same point, T 0 and U from within the domain, okay. And we justified it. As I said in a hand-waving fashion, we justified it saying, well, there are two quantities that are going towards the boundary. Let me specify these and if I am able to determine Q, it is fine, okay. And we will, you can run this and see what basically happens. You can use FTCS, add that artificial dissipation that I was telling you about. I will tell you ways to get around it, but right now you can do that and everything is fine. Is that fine? So there are two questions that crop up. Clearly, the boundary conditions that we are not, we are generating are not, in this case, they are not Q1 hat and Q2 hat. Clearly. The second thing is we are extrapolating and we are using first-order extrapolation. This is a question that some student asked me after the class last time, right. We are extrapolating and if you think about it, think back when I said approximating things in the beginning of the semester, in the beginning of this course. I said that if you have f of x and if you approximate f of x plus delta x is equal to f of x, then that is a first-order approximation. The term that you dropped off is delta x times f prime, okay. So just to copy values, when I say extrapolate, just copy values from one point inward is the first-order. So does it make, is it a good thing? After all, we are using FTCS, it is second-order. Is it a good thing to be doing this first-order, okay, right? So we need to think about that a little because after all, what differentiates one problem from another problem? They are all Euler equations. They are all in a pipe in our case, in this particular case. The only thing that differentiates one problem from another problem, right, could be either the length of the pipe, one possibility. We have that degree of freedom or it is a boundary condition. You notice even the length of the pipe basically shifts the boundary condition. That is what it does. So primarily it boils down to, right, boundary conditions are at the edge of that length where and what, okay. So if you do, if you approximate your boundary conditions using a lower-order approximation, then it is likely that that will determine what is the order of your scheme. Is that fine? However, remember the sigma equals 1.1 demo that I did for wave equation. It started to diverge but then what happened? All of it just went out of the domain. So in this case, these are propagating to the right. So if you do a first-order extrapolation here, whatever error that you make is likely to just go out. It seems to be possible. So downstream boundary conditions, it may not matter. Upstream boundary conditions, it may matter. But the fact is if you look at this, you can translate this. When you say you extrapolate, it is f of x plus delta x equals f of x. This is like applying what is the mathematical boundary condition we are applying. What is the equivalent mathematical boundary condition we are applying? That is first-order accurate representation. Dof do x equals 0, right. We are basically saying dof do x at the boundary is 0. Is that fine? You can use 3 points. You can use 3 points and say dof do x equals 0, right. You can use, there is a 3-point representation for dof do x. You can use 3 points and say dof do x equals 0. And you will get a second-order extrapolation. Now you are making sense that we will use 2 interior grid points. We will use 2 interior grid points to determine the third point that is at the boundary. Is that clear? So that is one issue that I wanted to clarify. So remember whether we are talking about solution to Laplace's equation, whether we are talking about solution, the equation, right. Just giving the equation, which is what I did here. I started, gave you the equation, we did the analysis and I only really provided the boundary conditions when we started to solve the problem, right. In fact, we even talked about what was the problem, but in a sense that is the point. The boundary conditions are what are going to determine what is happening, okay. They determine the problem. Once you have picked the equation, the equation is known, right. What differentiates one flow problem, Euler equation, all those constraints. From the other is the fact that you change the boundary condition, okay. So the, all else being fixed, the application of the boundary condition, complete it should determine, completely should determine the solution. But then of course there are deal, there is issues of upstream, downstream and so on. But we will try out second order extrapolation, fine. Is that okay, right? If the exit were a supersonic exit, okay. If the exit were a supersonic exit, all three characteristics will be propagating outward. I would just use first order, okay. I would just use first order. These boundary conditions, they are called shift boundary conditions. Shift boundary conditions. I would just use first order. You understand what I am saying? It is supersonic. It is all flowing out. Nothing is coming back. I just use first order. I am not going to put in the effort to do second order. Is that fine? Okay, right. So there has been a little awareness. It can help you out. Okay. So that is as far as, that is as far as boundary conditions go, the approximate hand waving boundary conditions. Now we come to the point where I promised you that we will do it more precisely, right. And I would prefer to do it using BTCS. It because we know that BTCS, that matrix on the left hand side, if you replace it by the identity matrix, you will get FTCS. So we will do it with BTCS, general setting. And look at how to apply boundary conditions exactly, right. Exactly more precisely, more exactly, okay. Fine. So what was the, you remember the delta form? Delta form basically is I plus dou by dou x A. I always forget this delta T, delta T acting on delta Q is minus delta T into R, okay. We can use central differences to discretize this. And even here at this point, I want to make a remark because last time I sort of made a remark and let it go. I want to make a remark. If I use central differences and discretize this, a typical term will look like, will look like A P minus 1 Q delta, let me see, delta T minus 2 delta x and sort of doing it in my head. So it is going, right. And there is an I and there is a delta T by 2 delta x A P plus 1 Q. I do not remember last time where I used superscripts or subscripts. It does not matter. So this is a typical matrix. There are Is along the diagonal. There is the minus delta T whatever in the sub-diagonal. And this matrix acts on delta Q 1 or delta Q 0 depending on where you start counting delta Q 2, delta Q P minus 1, delta Q P, delta Q P plus 1, delta Q N. Am I making sense? Okay. And this is delta T times the right-hand side. So I will just say right-hand side because that is a little more, we will see that the right-hand side will become a little more involved because you have to incorporate the boundary conditions and so on, right. I sort of casually made a remark but I was hoping that you would see this but just in case I wanted to make sure that I pointed it out to you. If you use Gaussian elimination, right, these are all blocks. What I mentioned at that time is that you have to do LU decomposition and so on. But remember in this particular equation the diagonal elements, the pivot elements are all identity matrix. So Gaussian elimination for this is relatively easy. You can actually, if you actually try it out, we will see it is relatively easy. As is Gauss-Seidel, as is Gauss-Seidel because the identity matrix is on the diagonal. However, in those list of functions that I suggested that you implement right up front, I would suggest that you implement LU decomposition, LU decomposition for a 3 by 3 matrix. Am I making sense? Pre-implement LU decomposition for a 3 by 3 matrix. If you want matrix addition and multiplication, matrix multiplication, am I making sense? I would suggest that you implement these. I would suggest that you implement these beforehand because if you do change something here, they are useful functions to have. So in your base that I was telling you earlier saying that you know implement how to allocate Q, how to allocate E, A, all of that kind of stuff. You add a few of these functions, matrix operations functions, right. If you are going to do it for two dimensions, all those matrices would be 4 by 4. If you are doing it for three dimensions, all those matrices will be 5 by 5. And you would have corresponding vectors, these would become 5 by 5 blocks in three dimensions also. Is that fine? Is that okay? Right? So now let us look at how we do, we will use this equation. So I just wanted, this was the second item I wanted to point out and the need to implement these anyway despite the fact that you may not find the need for them right now. Now the second item that I have is, well that is done. What I want to do now is I want to use this equation to apply boundary condition. So if I look at the left boundary and I look at a subsonic inlet, so these are the subsonic inlets and subsonic exits are the interesting ones, inlet. I look at a subsonic inlet, so this is the interface at the inlet. So at this point, at this grid point, I have one, I have this equation I, A coming in from the left hand side plus delta T. Now what I am going to do is, over this small interval that I have between these few grid points, to keep life easy, I am going to assume A is a constant. A is not going to be within the operator. I am going to assume A is a constant. I am going to take the A out, dou by dou x. Why do I want to take the A out? Because I want to multiply by x inverse, right? If I am going to do it exactly then I have to make sure q1 hat and q2 hat are what are being propagated, right? Or q3 hat is being extrapolated. Am I making sense? So to that extent I want to take the A out. So this operator acting on delta q equals minus delta T into R. So remember that I have done this. I have taken that A out, okay. A is constant but only in that neighborhood, only in that neighborhood. So then I will pre-multiply by x inverse on both sides. I pre-multiply by x inverse on both sides. X remember is the inverse of the matrix of eigenvectors. What does this give me? This will give me an x inverse plus delta T, the matrix lambda dou by dou x acting on x inverse delta q. A is constant so x inverse is also going to be constant. That was a potent assumption. So I could take the x inverse into the derivative. You understand what I am saying? This is an operator. So by doing this I have taken it into the derivative. Equals minus x inverse delta T times R. I do not remember last time whether retain the delta T or not. It does not matter. Is that fine? x inverse times i is x inverse. Is that fine? Now I see a few physical questions. So here I have multiplied x inverse. Then in here I put a x x inverse. You understand what I am saying? So x inverse A x gives me the lambda matrix that leaves an x inverse which I have taken out. That is basically what I have done. Then there should be a i plus. If I am going to factor it out I should have an i plus. Great. Thank you very much. Yes, fine. Because I factored out x inverse from the right hand side. This is rather neat thing, right? Having multiplied it from the left. Okay. So what does this give me? Of course this gives me a familiar form lambda dou by dou x acting on delta q hat is minus x inverse delta T times R. And this lambda has, see now I have got it in characteristic form. And this lambda has, what is this lambda? So depending on how you have written the vectors, right? If you have written, depending on how you have written the vectors, it will turn out to be that. Okay. Of which from this equation, I want only one. I want only a third equation. I do not want the first two equations. The first two equations are coming from outside the boundary. I do not want the third equation. I mean I want the third equation. I do not want the first two equations. So in order to do that, I define a, what shall I call it? A matrix. I will define a matrix. Okay. I will call it L. I mean it is on the left hand side. You can imagine whatever. I will define a matrix L which is mostly 0s. Fine. Okay. And I will pre-multiply this by L. If I pre-multiply this by L and I pre-multiply this by L, now this has only a third equation. Am I making sense? Everyone, that is fine. Now we have to go to P0 and T0. Is that okay? Now we have to go to P0 and T0. We have P0 and T0 here coming in. We have to go to P0 and T0 and see what we can do. So these boundary conditions, right? I want to put it in the same delta form. Okay. My objective, I will tell you what I am trying to do now. What I am trying to do now is take these P0 and T0, right, and integrate it into that system of equation. So I have a matrix equation. I want my boundary condition to be one of the equations in that system. So I do not have to worry. You know, I do not have to deal with it as a, I mean of course I am dealing with it as a separate thing but there is a point at which they all essentially look the same. And I have incoming, outgoing, they are all in the form, delta form, in the form of a delta Q. Okay. So first we have to make up a vector, right, because it has to be a block, block, block, 3 by 3 block. Everything has to be a 3 by 3 block. So I will make up a vector here. I will call it B sub 0 because these are all something sub 0. Okay. T0, T0, 0. So now I have a state vector like thing for the boundary. And I will similarly call this B sub A. I can create a B sub A which is, you can think about whether it matters where I put this. I will consider at a later time whether it matters where I put this but I will stick it in the third one. Okay. Fine. See B could change with time. Actually you know that, you know the reservoir pressure, if instead of having a huge reservoir, if I have a bottle of air, right, and I start bleeding air, the P0 will drop. You know from gas dynamics because expansion is occurring even the T0 will drop. The temperature in the bottle temperature, if you hold the bottle, you will find that the temperature actually drops. P0 and T0 are a function of, right, are a function of time. Normally we assume the reservoir is very large. But it is possible that these drop. Okay. Bear in mind, I still want to look at, look for only the steady state solution. I am only looking for the steady state solution. But still there is scope open that they are varying in time. Let me look at what dou B dou T is. I have not given it a subscript. I just say dou B dou T boundary condition. Using chain rule, this is dou B dou Q dou Q dou T, right. Why did I do this now? Because I have a Jacobian. I have a dou B dou Q. You understand what I am saying? So I can actually write this as some D times dou Q dou T. Is that fine? Okay. And if this happens to be 0, there are lots of ways by which we can do it. I just decided to use it. If this happens to be 0, dou B dou T happens to be 0. So otherwise you would discretize this. Am I making sense? You would discretize this using forward time or backward time or whatever it is. But dou B dou T, we are looking for the steady state. We assume P0 and T0 are constant. If that is 0, then in delta form this will become D delta Q equals 0. Is that fine? Everyone? Is that fine? So on the left hand side, the equation that I have in the left hand side where I have this subscript 0, I would have D0 put a semicolon there, delta Q equals 0. And on the right hand side I will have DA delta Q equals 0. Is that fine? No, my boundary conditions are in delta form. Very similar to the rest of the equations. What do I need to do? Tell me. On the one hand I have, on the one hand I have L times I plus delta T lambda dou by dou x is minus L times x inverse delta T into R. I wish I had absorbed the delta T into R but anyway it does not matter. And then the other hand we have left hand side. This is at the left hand side. Remember, we did this for the left hand side. D0 delta Q equals 0 but this D0 delta Q, what was the mistake we were making earlier when we were prescribing P0 and T0? We do not know whether we were propagating, we were prescribing only Q1 hat and Q2 hat. We were most probably prescribing conditions in Q1 hat, Q2 hat and Q3 hat. Am I making sense? Okay. So this is equivalent. I will give you an equivalent example. If you think back to your engineering mechanics, you have a simply supported beam. There are boundary conditions. In fact, if this were on rollers, you definitely know that there are boundary conditions here that basically only normal. This does not generate a boundary condition that is tangential. Am I making sense? So if you prescribe a tangential boundary condition, there is an issue there. All that if you prescribe a force, this way of course it will be taken by the pin joint. But the boundary condition itself cannot have a tangential component. Am I making sense? So if you are solving this problem, if somebody, you know, then you throw away the tangential component. It is not there. It does not exist. It is not relevant to the problem. It is because you say, oh, consider. Why do not you consider a vector like this? No, that does not work. I am going to only take the vertical component. In a similar fashion, this has all 3. p0 and t0 have q1 hat, q2 hat, q3 hat. But we will take only the q1 hat and q2 hat component. We will throw away the q3 hat. You understand? It is basically analogous. So how do I get that? How do I get the first 2? I have l which picks the last one. So i-l will pick the first 2. I can make i-l times that. I have a mistake. What is the mistake? First, I have to get it into characteristic form. So I pre-multiply by x inverse. I have to project it onto the right coordinate system. That is, in this case, if I have a coordinate system that is like this, which is most probably why you have got. So I have to first project it onto the right coordinate system. I need to get a coordinate system that is aligned along the direction in which my forces are acting. Am I making sense? So I have some oddball coordinate system. I need to project it on the right coordinate system, which is what I am doing here. So you do this. This equation then becomes d0 hat delta q hat equals 0. Please, pardon me, delta q hat. I am really making a lot of mistakes. Thank you. And I pre-multiply this by i-l. And for the very first grid point, for the very first grid point, I combine this equation and that equation. And again now I have three equations. Everything works. Am I making sense? I combine this with that. Everybody fine with that? Combine this with that. Fine. Into one equation. I can just add them up. I can just add them up. So what will I get if I add them up? I will get, I do not know whether to factor out the i-l or not. I can just add them up. I can say this. Then you just add plus l times i plus delta t lambda dou by dou x delta q hat equals minus l x inverse delta t into r. So the right hand side, I have only added 0 in the boundary conditions. I have not added anything. Because this right hand side is 0. I have not touched my right hand side. So the right hand side will only have that, only have that third equation, the form of third equation. But now you have two possibilities. Sometimes I just solve it in the characteristic form. Sometimes I just, I will be very honest with you. I just solve it in the characteristic form. I mean I talk about integrating it. In CFD, we very rarely assemble, right? CFD, we very rarely assemble that matrix, that big matrix that I was talking about. If you talk to your friends who are doing finite element method and structures and so on, they will talk about assembling the global stiffness matrix. They actually assemble the matrix. They put it together. We very rarely assemble the matrix. We try to avoid assembling the matrix. We may compute the Jacobians as required, right? Depending on the circumstances. We may compute the Jacobians as required. Or if you feel, I mean if it turns out that it works, you may assemble, not assemble, but you may store all the Jacobians. But typically we will compute the Jacobians. We very rarely actually assemble that big matrix. And if you do, you will only store the diagonals and so on. So you keep track of what is happening. Is that fine? Okay. Now in this case, if you wanted to, if you, but if you wanted in your mind to have it in terms of q, which you may do, then you would pre-multiply this whole thing again by, how do I take it back to the original coordinate system? So you rotated it one way. Now you have to rotate it back. You pre-multiply the whole thing by an x. And you can actually, you can actually analytically work out this equation. You can actually analytically work out this equation, right? Okay. Maybe at the end of the semester if you have time, I will give it to you, but you should be able to do it. By now you should be able to do it, right? I will leave it as a exercise. First of all, try to make sure you are able to find d0 and so on. Fine? Is it clear? Is it obvious that it would be something similar on the right-hand side for p ambient? What would happen for p ambient? Can you guess? Can we just look at this and write out what happens for p ambient? So instead of, instead of, we have only one condition coming. So on the right-hand side, it would be an L times dA hat, delta q hat. And just doing, and just looking at the chalk dust and doing a pattern match, you should just check to make sure that there are new issues. Okay. Plus I-L times the equation because there are two of them propagating to the left. See, from the left to the right. You just have to look at the interface. What is coming from the left? Has an I-L on it. What is coming from the right? Right? Has a L on it. Is that fine? Okay. I plus delta t lambda dou by dou x delta q hat. Yes. I-L delta t times r. What was the big bracket? Is that fine? Okay. x inverse. Yes. Yeah. This is what happens. I am very proud of the fact that I remembered the I-L. I forgot the x inverse. Okay. That is fine. Right? You have to be careful. Algebraic manipulation calculus, you have to be a bit careful. It is very easy to get excited about something that you have done and make a mistake also. Okay. You are back. What now? So, remember this equation. This is the equation that you will use. So, I will erase the top one now and I will write. This is the equation that you will use at any arbitrary interior point. Right? At time level q. So, this is at point p. This is also at point p. At some interior point. This is the equation that you will use at the inlet and only at the grid point, only at the inlet grid point. Only at the inlet grid point. Am I making sense? Only at the inlet grid point. That is, this is the inlet at this grid point. This is the outside. This is where p0, p0 is coming from. This is the first interior grid point. This is applied only at that point. Okay. And this equation is applied only at the exit point. Fine? Okay. So, only at the exit point. So, we have p ambient here at this grid point and you use the interior grid point. So, obviously, when you discretize the derivative using the interior grid point, you are going to use backward differences here and you are going to use forward differences here. So, propagation will be in the right direction. Is that fine? Okay. So, this sort of feels a little better than that. Oh, let us extrapolate you all of that kind. But it is obviously a lot of work. Right? It feels intellectually a lot better. But it is a lot of work. Right? It is a lot of work. In one dimension, it seems relatively easy. These ideas, right? See, I am doing one-dimensional flow. The stability analysis that we have done. Okay? I just want to make an observation here. The stability analysis that we have done in this course extend to three dimensions and two dimensions in a sense that you can sort of squint at that equation and say that, yeah, this is the stability analysis. Am I making sense? You will come up with the, because we know now what do we know? Typically, it is going to be like, we need to know what is the CFL. Right? And that will be like propagation speed, some propagation speed. So, you have to figure out what is the propagation speed times delta t divided by delta x. Well, it is not delta x. There are three dimensions. Figure out some way to come up with a length scale. Right? Propagation speed delta t divided by length scale. That extends to multiple dimensions. I am rationalizing why I am restricting myself to 1D. I am justifying it. These boundary conditions, well, when you come to the boundary, when you actually come to a 3D manifold, come to the boundary, well, basically at that boundary, you either have characteristics that are propagating information out of the domain or into the domain. So, there you can sort of locally do a 1D. You understand what I am saying? 1D, local coordinates, 1D. And you can actually do something like that. Okay? Or you can cheat the way, I have told you earlier and extrapolate the appropriate U or extrapolate the appropriate t0. It depends. It is not that easy. But you write multiple dimensions here. There are other issues that are involved. Is that fine? This is okay. Okay? So, now you have seen sort of the full spectrum. Right? There is a full spectrum of possible ways by which you can apply boundary conditions. Okay? And of course, on top of all of this stuff, you can now decide how you are going to solve this. Fine? So, instead of solving this equation using Gaussian elimination, that is solving a system of equation, you can actually use, say, LU approximate factorization. Right? Which I do not think I have done for the block matrices. So, you can actually do LU approximate factorization. There is a reason why I want to write this out. You can actually do LU approximate factorization. Right? So, if you remember LU approximate factorization, we wrote it as dou by dou x minus 2 operators, split it as 2 operators acting on delta q is minus delta t into R. And this can be factored, this can be factored as, this can be factored approximately as delta t a dou by dou x acting on delta q equals minus delta t into R. Okay? So, this derivative would involve the grid points p and p minus 1. This derivative would involve the grid points p plus 1 and p. Okay? So, you get a lower triangular matrix and an upper triangular matrix. And you can just, again, just do forward substitution, back substitution. It is much faster than solving a system of equation. Okay? And the error is of the order of delta t squared. The error is of the order of delta t squared. It is a product of what is the error term that we get? The error we are making is delta t squared dou by dou x minus a acting on dou by dou x plus a, remember these are operators acting on delta q. That is the error that we are making on the left hand side. But if you are looking for the steady state, this is going to go to 0 anyway. Delta q is going to go to 0 anyway. How do you care? Is that fine? Okay? Everyone? Right? Now, here when you are doing this extra, so you have to be a bit, you can now decide at which sweep you are going to do. When you are doing the extrapolation, so in one case, in this case, this involves what grid points? p and p minus 1. Right? So, this will involve coming up, coming up. Right? It will involve this point and this point. But if you were to actually try to, if you were to try to actually work, figure out what the value at that point is, you do not have a p minus 1. You understand? There is no p minus 1. This involves a p and p plus 1. So, this boundary condition here, you are likely to apply it in the u sweep. Because it involves p and p plus 1 to determine the value at p. This is important. You understand what I am saying? This is important. Right? Because otherwise, LU de-compose, LU approximate factorization, that is the thing that people always come back saying, how do I apply a boundary condition? We come to the other end. So, that will be applied in the l sweep. Right? Because you are going to determine the value at p using the p minus 1 quantity. Am I making sense? Because you are using one-sided derivatives for the boundary condition. That is the critical part, using one-sided derivatives for the boundary condition. Right? Are there any questions? So, this is a relatively straightforward way to do it. Of course, as I said, when you get here, when you get there during the sweep, you will obviously be using the equations that correspond to the boundary condition and not corresponding to the equation itself. Okay? So, we have now a method. And of course, because we are saying that the r going to 0 tells us, determines when you have a solution. R is something like a, it is a predicate. You ask the question, do I have the solution? You understand? It is a discriminant. It tells us what is happening. Okay? So, you want to calculate, you want to treat R carefully. Right? R determines, just like the boundary conditions determine the solution. In that sense, R determines when you are at the solution. Okay? This determines the correction on the left-hand side. The left-hand side determines the correction. Right? So, the right-hand side, so in a sense, you can look at this and say, I can make the right-hand side as accurate as I want because that determines the accuracy of the steady state. When the r goes to 0, if you are able to say r goes to 0, second order accurate, then you have a second order accurate solution. Right? Third order, you have a third order accurate solution. The representation is of that order. On the left-hand side, you want acceleration, you want it to go fast. Right? So, you can do lots of stuff in order to get there quickly. Okay? However, I hope you have seen this in your controls. You have to be a bit careful. Right? I am now talking about observations and corrections. Think in controls lingo. Now, you have to be a bit careful. So, if you have fine changes, fine changes that you detect, which triggers your controller to make a correction, but the correction is always very large, then you will be hunting for the solution. If the delta Qs, this is really coarse, the difference between the order of this and that is so bad that small changes here create reasonably sizable delta Qs. So, this has to be well behaved. You have to be very careful with the choice of it. Right? So, as long as it is well behaved, it does not matter. You can make r as accurate as you want, but you have to make sure that a small perturbation here does not create a large delta Q there. And you can end up then hunting for the solution. Do you understand what I mean? The r basically triggers an idea, oh, it has to be delta Q is a large, is a positive quantity. You get a large, largest delta Q, which causes the correction to be too large, which causes r to say that your feedback is slightly negative. Then you get a largest delta because your delta Q size is coarseness, is so coarse that your correction is slightly coarse. And then students will come back saying that, oh, it converges to 10 power minus 10 and then it seems you are oscillating at 10 power minus 10. It converges to 10 power minus 6 and it seems you are oscillating at 10 power minus 10. The correction is that you are generating a too large. Okay? And you are not able to pin down the solution. You do not have that kind of resolution. So, it starts to hunt. Am I making sense? Is that okay? Right? So, sometimes you have to be careful. You do not get carried away with it. But typically, this is well behaved. See, I am being very vague now because I was equally vague when I said, oh, you can make it anything you want as long as it is well behaved. Because now I am just waving my hand. I am just saying r goes to 0. As long as this is not singular, delta Q will go to 0. Okay? So, r goes to 0, delta Q will go to 0. It does not matter with what we multiply delta Q. And as long as it is well behaved, you will get there. I will leave it in that vague sense. Fine? And something like this will approximate factorization works. One last thing. If you wanted to add, if you wanted to add for whatever reasons you are getting oscillations and you attempted to add artificial dissipation, right? This is supposed to work. This is supposed to be unconditionally stable. You attempted to add, there are some oscillations that are not dying out. You are in a hurry and you say, I will just add artificial dissipation. You can add it implicitly to the left-hand side. If you add it implicitly to the left-hand side, it still, the second derivative still gives you only a tridiagonal matrix. The second derivative still gives you only a tridiagonal matrix. Am I making sense? The second derivative still gives you only a tridiagonal matrix. Fine? So, you do not have to add it explicitly. You can add it implicitly. If you want to add fourth order, fourth derivative term, then that will change the bandwidth. That will change this. It will not be tridiagonal anymore. I would suggest that you can add that explicitly. It will contaminate your solution. But if you add the artificial dissipation on the left-hand side, especially the second derivative, it is not going to contaminate your solution because it multiplies the delta Q that is going to 0. Is that fine? So, it gives you the, it gives you a tridiagonal matrix. You should get a tremendous sense of freedom, feeling of freedom because there are lots of things that you can fiddle around with knowing that the delta Q, if as long as you do not mess up the fact that you are going to the solution, that the delta Q is going to 0. So, the amount of exploration that you can do is quite large. Okay. Okay, this is done. Now, what is the closing remarks I want to say, this will lead basically into our next class. What we are going to do is, you have a pipe that is of length L. You have a pipe of length L and we applied boundary conditions on the left-hand side. We applied boundary conditions on the left-hand side using characteristics, right? And we used applied boundary conditions on the right-hand side using characteristics. Instead of the pipe being of length L, what is the pipe was of length delta x? You imagine that you have a pipe that is only of length delta x. So, you have two boundaries. You have something going on inside. You want to find out what is going on inside. And it looks like we have a mechanism now. You understand, we have a mechanism now to determine what is happening in that little volume of size delta x just by applying compatible boundary conditions, the right boundary conditions. After all, the boundary conditions came from the equations. Okay. So, at some interior delta x, I would basically say, oh, there are characteristics coming from the left-hand side at the interface, right? There are characteristics coming from the left-hand side to this interface because it happens to be subsonic. There are characteristics coming from the, that are propagating in that direction. This is delta x. And you have two going this way and one going that way, right? So, from within this little volume delta x, the flux term here is determined by these two characteristics coming from within this volume and one characteristic coming from outside the volume, from the neighboring volume. See, right, now you see scope for a scheme. It is actually possible that we are talking about boundary conditions, but it is actually possible that we can cook up a scheme using this because remember when we talked about finite volume method earlier, what was it that I said? You have the state at this point and you do not have the flux. You do not have the state where you have the flux. Now we are saying, aha, wait a minute. I have the state in the interior. I have the state in the interior and I have some way by which I can figure out what is propagating to the boundary, right? So, it must be possible for us to come up with a scheme based on, based on all of this and see then you would be doing method of characteristics, right? The fact that we can do this kind of manipulation. You can go into the characteristic coordinates. You can come out of the characteristic coordinates, right? We have an easy way of getting into the characteristic coordinates and getting out of the characteristic coordinates and after all we are only talking about an interface. So, even in multiple dimensions, I will just, though we are not going to look at multiple dimensions in this course, even in multiple dimensions, you have the state in the interior. This is a volume. I pick a triangle because it is not a quadrilateral. You do not think you are not thinking Cartesian coordinates, right? And you have the same thing. So, you can figure out what is the, what is coming in, what is going out, right? What is coming in, what is going out? I do not know. Am I making sense, right? I cleverly put 2 going out there because otherwise Q1 hat and Q2 hat will be accumulating inside. It is a problem. Everything is coming in. Fine. Is that okay, right? But we are not going to be looking at this. This is just, now I am dreaming. This based on what we have done for boundary conditions. And the little realization that, oh, I can take a delta x and apply boundary conditions there. I am sort of in my mind jumping saying, oh, I can do stuff like this. Need stuff like this. Okay. Is that fine? So, in the next class, we will see whether we can use these ideas of applying boundary conditions to actually come up with a class of schemes. Fine. Okay. Thank you.