CHAPTER 08.02: FINITE DIFF METHOD FOR ODEs: Background Part 2 of 2
Now, so how do we solve this particular ordinary differential equation by using Finite Difference Method is to be able to rewrite these equations in terms of the finite difference approximations for the derivatives. So what I mean by that is that, let's suppose, if you are starting from, let's suppose, some point, let's suppose, 5 and you are ending at 9, so r is equal to 5 and r is equal to 9. So what I can do is I can say hey, let me divide this into equal nodes. So I am going to divide this into equal, equal to some nodes, let's suppose. So, let's say I call this node 1, node 2, node 3, node 4. So this is i=1,2, 3,4, those are the nodes. So since I am diving it into 3 nodes that becomes 9-5, so delta r, the distance between each node is (9-5)/3 which is 4/3. So what that means is that this particular distance between each node is 4/3 units. So if I am able to find out what the deflection, what the radial displacement at this point and this point is, and since I already know the displacement here and displacement here because those are the boundary values which are given to me, I will be able to develop a profile for the dependent variable or, basically what I am trying to say is I will be able to find out what the value of u is as a function of r. So if r was at an arbitrary node, so let's go and write down this equation if I was going to, if I had to break this interval into n segments, any number of segments which I have to break it up into, so if I had to break it up into n segments, let's suppose, r will be at some node i for example. And to the left of that node will be a node i-1 and to the right of that will be node i+1. So if the distance between the two nodes is delta r, how would I rewrite my differential equations to be able to solve them by using the Finite Difference Method? So one of the things which you can do is you can say hey, I got to approximate this second derivative of u with respect to r. I am going to a look at that node i and I am going to say, hey this is approximately equal to u sub i+1, minus 2 u sub i, plus u sub i-1, divided by delta r squared. What that means is that if I need to substitute for the second derivative of u with respect to r at this node i, I will need in order to approximate it, I am going to say hey, this is the displacement at this node, minus two times the displacement at this node, plus the displacement at this node, divided by delta r squared. And now what we are finding out is that you're replacing your derivatives by the values of u at specific points, that's what you are doing there. So same thing I can do with du/dr, for example, at node i I can say hey, it's approximately equal to the value of the node at i+1, minus the node at i, divided by delta r. So in this case what I am doing is I am using the forward divided difference approximation for the first derivative. This is a center divided difference approximation for the second derivative, but this is the forward divided difference approximation for the first derivative. Of course, this is not a good way of approximating the first derivative here because the order of the accuracy here is delta r and the order of the accuracy here is delta r squared so I am going to get delta r accuracy, but those are the kind of things which we are going to look at in some examples to see that hey, how does that make a difference. But for the arguments sake, let's say that we are doing this as our approximation. So what that means is that I am going to substitute these approximations now into my differential equations so I have, I am going to write down my differential equation again so that you understand what I am trying to do, accomplish here. So I got d2u/dr2 + (1/r)(du/dr) - u/r^2 = 0 d2u/dr2 + (1/r)(du/dr) - u/r^2 = 0 That is my differential equation, so I am going to approximate this by my finite difference approximation, (u_i+1 - 2ui + u_i-1)/(dr)^2 plus (1/r), r means that hey, whatever is the value of the value of r at that node i, du/dr will be approximated by (u_i+1 - u_i)/dr and then the last term which in this is the value of u at that particular node divided by the value of r at that particular node. So what you are finding out here is that we have approximated the differential equation now in terms of these radial displacements which we are seeking at these particular points. Now we have, if you look at this at node i we actually have three unknowns at node i because you don't know what u_i+1 is, you don't know what u_i is, you don't know what u_i-1 is, so there are three unknowns in that single equation. So what that means, that we have to find some kind of an implicit way to be able to solve these, solve for these unknowns. I am going to just go through the skeleton of how you would go about doing this. You would basically see that hey, going back to the example which I started with, is that I have r equal to 5 here and I have r equal to 9 here, right? And then I said hey, if I am going to number the nodes, I am breaking this up into three segments, that means I have 4 nodes; i=1, i=2, i=3, and i=4, which basically implies that you want to be able to find the value of the displacement, the radial displacement at node 1, node 2, node 3, and node 4. And if you are able to do that, then you are able to develop the profile for the displacement and hence, for solving this ordinary differential equation. So what we can do is, you can very well see that hey, what I am going to do is I'm going to say hey, u1 is equal to the value 0.008 because that's my boundary condition because u1 is the value of the diplacement at r equal to 5 at this particular point because that's the boundary. And I also know that u4 is equal to 0.007 because that is the displacement, radial displacement at the other part, other boundary which is at r equal to 9. Now what do I do about these two nodes at node 2 and node 3? I write down this equation, I write down that equation for node 2 and I write down that equation for node 3 and what's going to happen is that when I am going to write down this equation for node 2, so that means that I will replace my i by 2, I will get the unknowns of u3, u2, u1, like that, then I am going to write it for node 3, for example, I am going to get u4 minus 2u3 plus u2 and so on and so forth. And you are seeing that, hey, in this node 2 and node 3 equations all I'm seeing are the unknowns of u1, u2, u3, and u4 So when you see that, this is going to set up one equation, this is going to set up the second equation, this is the third equation, and this is the fourth equation so you have basically four equations, four unknowns. So by setting up the equation for each of the nodes, internal nodes by using this equation right here, you are able to set up two equations here, so you get four equations and four unknowns.So once you solve for the four equations, four unknowns you are done so far as finding out the values of the u's, the dependent variable u at various points. We are going to take an example, let's create this, so right now, I just want you to be sure that you understand that by using these finite difference approximations that we are able to set up four equations, four unknowns. Eventually you are reducing your ordinary differential equation into simultaneous linear equations to be solved. And that's the end of this segment. |