CHAPTER 08.06: FINITE DIFF METHOD FOR ODEs: Ex Part 2 of 2 

 

Equation for node 3, so node 3 is i=3, so if I write down the equation for node 3 I will get u_4 - 2(u_3) + u_2, so I am substituting the value of i=3 in my, in my equation, and divided by delta r squared plus (1/r_3) now, this is the value of r at the third node, (u_4 - u_3) divided by delta r, minus u_i which is u_3 divided by r_i which is (r_3)^2 equal to 0. Now I, now let me substitute the values which I know. I know delta r is 1.5, r_3 is the value of r at node 3 which is 5. So let's say u_4 - 2(u_3) + u_2 divided by delta r which is 1.5, squared, plus (1/r_3) which is 5, u_4 - u_3 divided by 1.5 because that's the value of delta r, minus u_3 divided by the value of r^2 at that particular point which is 5 and equal to 0. So I'm going to bring the terms of u_2 together, u_3 together, and u_4 together because those three are unknowns in this equation and this is what I am get. I get 0.4444 u_2 minus 1.0622 u_3 plus 0.57778 u_4 equal to 0. That's by combining all the terms which correspond to u_2, u_3, and u_4. So that gives me the third equation, so I am seeing here that I have four unknowns and I want to be able to develop this display, this u profile for the dependent variable u and I already have three equations and the fourth equation will be at node 4. So node 4, I'm not going to write down the differential equation at node 4 but I am going to just write down i=4 and I already know what u_4 is. u_4 is nothing but the value of u at 6.5 and that turns out to be equal to 0.003. So that's my fourth equation. So now we have, as you can see I have 4 equations, 4 unknowns so I should be able to write them up and if I write them in the matrix form this is what I am going to get. I am going to get: u_1, u_2, u_3, u_4. These are the 4 unknowns which I have which I set them up in the matrix form. Now the first equation will be 1, 0, 0, 0 because that's simply u_1=0.008. Now the next equation will be obtained from those finite difference approximations which I did, so I get 0.44444 here, -1.1610 here, and 0.63492 here and then 0 here. The next one is also coming from the finite difference approximations which I used and this is what I get here. And then the last one is simply that u_4=0.003, so this would be 0, 0, 0, 1 here. And this one is 0, and this one is 0, that's from the finite difference approximations of the approximation of the second order differential equation. And this one is coming from the boundary condition that is 0.003, so you have 4 equations, 4 unknowns. One of the things which you got to realize about these 4 equations, 4 unknowns is that this particular coefficient matrix, it is tridiagonal, so that's something which you can look at as homework that, what does it mean that this particular coefficient matrix is tridiagonal and also this is diagonally dominant. The coefficient matrix is diagonally dominant, what are the implications of that? What are the implications of it beign diagonally dominant is that if I use some kind of interative method such as Gauss Seidel Method to solve this, these equations, that convergence is guaranteed. What is the implication of the tridiagonal method is that hey, if you use Thomas's Algorithm, something called Thomas's Algorithm you will be able to quickly solve this set of equations by using, by using his algorithm. Now anyway, we solve these 4 equations, 4 unknowns and this is what we got. We got u_1= 0.008, we got u_2= 0.005128, u_3=0.003778, and we got u_4= 0.003. That's what we obtained from solving these 4 equations, 4 unknowns. So now we have a profile because we have a profile of how u is behaving as a function of r. So if I was going to plot it I have r here, I have u here, I know the value at 2 and 6.5 because those were the boundary values which were given to me. So at 2 it is 0.008, at this point it is 0.005128, at this point So that's the profile which you are getting for your and at this point 0.003. So that's the profile which you are getting for your dependent variable u. And now if you want to do interpolation and things like that you can calculate the value of u at any other point which is of interest to you. Now the exact value for this particular problem, the exact, the exact solution to this particular problem comes from the fact that u is of this particular form. You can show that if you take the orginal ordinary differential equation you can show that hey, this is the orginal form for the, is the exact solution for the orginal ordinary differential equation so the way you find out C1 and C2 is because you know that u at 2 is 0.008 and you know that u at 6.5 is 0.003. So those are the two boundary conditions which are given to you so you can set up two equations, two unknowns and for this particular case you are going to get u is equal to (9.1503*10^-5)r plus 0.015634/r. So that's how you'll be able to calculate what the exact values of r for the dependent variable u for this particular ordinary differential equation. So the reason why I picked up this ordinary differential equation is twofold; one is that an exact solution is available and the second one is that this particular ordinary differential equation actually is an applied ordinary differential equation for the case of thick pressure vessels so if you have a thick pressure vessel the displacement is given by that ordinary differential equation which I have wrote in the beginning of this segment. Now what we get is that, we get u at 3.5, I get 0.0047871 and u at 5 turns out to be 0.0035843. These are the exact values which I get from that particular equation. And the amount of difference which I see is, in this case here I see 6.65% absolute relative true error and I see a relative true error of for the value at 5 to be 5.11%. So those are the difference which I get for this particular problem and what I would like you to do is, there are some parts of the homework which I would like you to do for this particular case. One is I would like you to use this particular formula, du/dr is approximately equal to u_i+1 - u_i-1 divided by 2 delta r. So rather than using the forward divided difference approximation for du/dr, I would like you to use this approximation which is the central divided difference approximation and you'll find out that you'll get more accurate answers for this because both of the approximations for the second derivative and the first derivative both have the order of accuracy of (delta r)^2 so that's one and the second one I would like you to do is redo the problem, redo the problem with 7 nodes and see if it increases the accuracy which you get for your solution. And that's the end of this segment.