CHAPTER 10: Elliptic PDEs Gauss-Seidel Method
In this segment we are going to talk about elliptic partial differential equations and how to solve them by using the Gauss-Seidel method. If you want more details on this topic including the textbook chapter, you can go to the numerical methods open course web page and click on keyword and click on elliptic partial differential equations. So again what we are going to do is we are going to take the example we've been taking for the other ways of solving elliptic partial differential equations numerically. So we are looking at a rectangular plate, and the temperatures on the edges of these rectangular plates are given to be these and what we want to do is we want to find out the temperature will be inside this plate as a function of x and y. The temperature of the plate, the steady state temperature of the plate is given by this particular second order linear elliptic partial differential equation and that's what we want to use to be able to find out what the temperature inside this plate will be. So recapping what we have done basically is that we have taken this rectangular plate and broken it up into square grids here. So we have m+1 nodes in the x-axis and n+1 nodes in the y-axis. And what we are doing is that we are writing down the equation for the temperature at a particular node, so we take the same node, we look at it here based on node numbering. The x node is given as the number i. The y coordinate is given the node j. And we have already found out that when we take this Laplacian equation, the second order linear elliptic partial differential equation which we had, it can be discretized in this particular form here, so where we have the temperature at the node which we are interested in is given in terms of the temperature at the node here, the temperature of the node here, the temperature of the node here, and the temperature of the node here. So the temperature at the node in the middle, which is right here, is given by the temperatures of the four surrounding nodes and that's what a discretized equation gives us. So what Gauss-Seidel method is going to do is it is going to help us find out how to solve this particular equation, this discretized equation. So we haev a discretized equation as given by this here. What we do is we rewrite it in terms of the other four, so we write down the Tij which is the temperature at the current node or at a particular node in terms of the four surrounding nodes. That doesn't mean that we can find out what the temperature here is, it's just that if we assume certain temperatures at these certain nodes here, or they are given by the boundary conditions, we can find an estimate of the temperature at the current node. So this becomes an iterative process, so basically what Gauss-Seidel method does here in this case is is it solves the equations iteratively until you meet a certain prespecified tolerance. If you want more information on Gauss-Seidel methos all you have to do is click on the annotation on the bottom of the screen and you'll be taken to the videos which show you how the Gauss-Seidel method works. So we are going to take the same example as we are taking for the direct method, so in the Gauss-Seidel method what we are doing for the example, we are taking a plate which is 3 meters wide, 2.4 meters long. The temperatures on the 4 sides are given by these and whet we want to be able to do is we want to be able to find out what the temperature in the plate is at different points. We are going to take a grid length of 0.6 meters which basically means that we will have 4 grids along the x-axis and we will have 5 grids along the y-axis. And we are going to assume that the initial temperature guess at all interior nodes is 0 degrees C. Please note that this is only the initial temperature guess, not the initial temperature of the plate but what we want to guess at the different nodes which we are going to choose the temperature would be 0 degrees C. You can choose, a better guess would have been to choose the average of the boundary condition temperatures but just to keep things simple we are going to choose 0 degrees C. So here we are, we are discretizing the plate into as I said, 4 different grids along the x-axis, so we have 1, 2, 3, 4, 5 nodes along the x-axis. And then we are discretizing it into 5 grids along the y-axis. We have 1, 2, 3, 4, 5, 6. We have 6 nodes on the y-axis. So we have 6 nodes along the y-axis, 5 nodes along the x-axis. Which makes it so we have a total number of 30 nodes in this problem. However, you can very well see that the temperatures at all the external nodes, which are here, they are all given to us based on the boundary conditions. So we have to only find out what the temperature is the interior nodes which are 9 in number. So as I was talking to you about that we have not 9, but 12. We have 12 nodes at which we don't know what the temperature is and those are these particular nodes right here. And if we look at the numbering of the nodes we call this to be 0,0 then 1,0 2,0 and similarly the nodes here are 0,1 0,2 and so on and so forth. And since we have 12 nodes at which we don't know the temperature, so somehow what we are going to do is we are going to set up 12 equations and 12 unknowns. But what we are doing here, since we are using the Gauss-Seidel method we are going to write down each equation for each of these nodes in terms of the other nodes which show up in the equation, whcih means that for example, if I am writing the equation for T1,1 it will be given in terms of, so T1,1 will be given in terms of the temperature here, temperature here, temperature here, and temperature here. So that's how it's going to work out for all the nodes. So let's take an illustration here that we begin to solve for the temperature at each node. This is the Gauss-Seidel method equation of the discretized equation for the second order linear elliptic partial differential equation. We are assuming all internal nodes temperature guess is 0 to begin with because this is an iterative method. So if I want to find the temperature at node 1,1 like for example, this. Now, node 1,1 will be now written in terms of temperature here, temperature here, temperature here, and temperature here and that's what we are doing here. This is T at 2,1 T at 0,1, T at 1,2, and T at 1,0. How would the temperature at T0,1 is the boundary temperature of 75 degrees C. The temperature at T1,0 is the boundary tmeperature of 50 degrees C at that particular point so that's why we are substituting 50 here and 75 here. For the other temperatures we substitute 0 and 0 because that is the initial guess which we are assuming for those internal node temperatures. We are dividing by 4 and we get the temperature at that particular node to be 31.25 degrees C. Now, let's take another node for an example. As I said, for this iteration, iteration number 1, we will have to take 12 such equations to find the 12 different temperatures after our first iteration, but let's take another example. So T1,2: so let's me just erase what I have done here. So we have T1,2 so we are right here, we are at this particular node. Now, this particular node you will find out that the temperatures at that particular node will be given in terms of this node, this node, this node, and this node and what you are seeing here is that the temperatures are given in terms of the three internal nodes and one external node which is at 75 degrees C. So let's take care of that, so this is the external node T0,2 and the temperature there is 75. The temperature at T2,2 is 0. The temperature at T1,3 is 0 but the temperature at T1,1 is not 0, although it is an internal node, it is 31.25. So basically what you have to understand is that as you are going from node to node, use the most recent temperature to be able to find what the temperature at the next node is. so, based on that we get 26.5625 as our answer for the temperature at node 1,2. You will continue doing the same things for the other nodes and that's how you will be able to find out what the temperature's will be at each and every node for the first iteration. So I have summarized the temperatures which we get up to, well the integer part of the temperature, for at all these internal nodes. This is the temperature which we get at the internal nodes by following the same proceedure for each and every node and we have to figure out, that hey, what is the, or should we go for another iteration. As you can see in this case the absolute relative approximate error at this stage will be 100% for all these different nodes because we assume the initial guess to be 0 as the temperature at these nodes, so we know that we have to conduct more iterations. So let's go see how we conduct another iteration, so if we wanted to go for a second iteration and let's suppose now we are talking again about node 1,1. Again we will write it in terms of the nodes which are around that particular node. We substitute, this is the temperature which we got at, from the first iteration, this temperature is from the boundary condition, this temperature is from the first iteration and this temperature is from the boundary condition and we get a temperature of 42.9688 degrees C at node 1,1. Now again, what we can do is, what we are supposed to do is to calculate what the absolute relative approximation error at that particular node is, which is the present temperature minus the previous temperature divided by the present temperature right here. So 42.9688 is the present temperature which was calculated at the end of iteration 2. Our 31.25 was what we calculated in our previous iteration and it gives us absolute relative error of 27.27 percent. So we conducted again this iteration number 2 and these are the results which we obtained for the temperatures at the end of the iteration number 2. We also calculated the absolute relative approximate errors at the end of the second iteration and we find out that these are different numbers at different nodes but the maximum absolute relative approximate error that we are getting is at this particular node and that's going to determine whether we should keep on going further. So if somebody told us hey, I can accept 80% error we still have to go further, conduct one more iteration, more iterations because we have not reached the prespecified tolerance of 80% at each and every node. So it's not what is the minimum absolute relative approximate error, but the maximum absolute relative approximate error at any node which is going to determine whether you have gone through enough iterations or not. So you understand how the process works, so what we have done here is we have summarized some of the temperature which we got from the, these are the temperatures which we got from the first iteration, this is the temperature we got from the second iteration, and then we conducted more iterations as we go along and these are the results at the end of the 10th iteration. In fact, these results which you are seeing at the end of the 10th iteration are within 1% of the pre-specified tolerance. So when we compared all of these numbers, this number to the 9th iteration, this number to the 9th iteration and all of these numbers were compared with the cooresponding value in the 9th iteration, the absolute relative approximate error which we got for all of these 12 nodes was less than 1%. So if somebody would have said that hey, you can have as much as 1% pre-specified tolerance then we know that we can accept the results at the end of the 10th iteration to be our temperature distribution in the plate at steady state. So that's how the Gauss-Seidel method works. And that's the end of this segment. |