 So we're looking at applying the finite difference method to the heat diffusion equation and in the last segment what we did we looked at grid generation and we looked at conversion of the heat diffusion equation using the finite difference method. So we recast the mathematical physics equation in finite difference form. The third step, the third thing that we're going to start looking at now is how to handle the boundary conditions. So remember boundary conditions pertain to what is happening on the external surface of the object that we're interested in and what we're after here we want to be able to determine the temperature distribution within an object. We said we were looking at an object with internal heat generation. It was steady state and it was two-dimensional so those were the restrictions. So what we're going to do we're going to begin with the simplest boundary condition that there is and that's where you prescribe the external temperature on the surface. So let's take a look at that one and what I'll do I'll begin by drawing the surface of the object and we'll put some nodes on it that we'll work with and so I'll use the same convention that we had before m and n for nodes and this is a surface that we know the temperature and that's why we say it's a prescribed temperature boundary condition and writing out the finite difference form of this is actually quite easy. What we say is temperature at node location capital M n plus 1 is just equal to the surface temperature and tm little n is again equal to the surface temperature and finally t capital M kind of n minus 1 again is equal to the surface temperature. So you can see that's pretty straightforward pretty easy. You could even have a temperature a surface temperature that is changing and then all you have to do is just change the temperature at each of those node locations. So that's the simplest boundary condition that that will deal with. What I'm going to do now is I'm going to start increasing the complexity and so the next one that we'll look at is a boundary condition where you have a prescribed heat flux on the external surface and again what I'll do is I will draw out the surface with nodes and I'm going to draw another node point inside of the surface and that will be node location m minus 1 n and what I'm now going to do is I'm going to draw a control surface that goes like this and the size of that control surface the vertical extent of it is delta y that's our grid spacing in the y direction and the horizontal extent of that is going to be delta x over 2 and so we're going to use that in formulating the boundary condition for this surface and the last thing that I'll do is I will draw the heat flux coming in and so we said that this was a constant heat flux surface and we will prescribe the heat flux at this node location as being q m comma n denoting that it's coming in through that nodal location. So what we're now going to do that we've drawn this picture we're going to do or perform this is our control surface we're going to perform an energy balance on the control surface and that will enable us to come up with a formulation for the boundary condition for prescribed heat flux so let's go ahead and do that on the next slide. So remember we said that we're looking at the heat diffusion equation where we can have internal generation and it is steady state so consequently when we look at the energy balance of this surface coming back here what we have is we have the heat flux coming in this direction so that is what the first term is representing in our energy balance looking here that is heat in through boundary surface. The second term we have represents conduction. Conduction going across this control surface and that could be coming in or it could be going out depending upon the conditions and so that's conduction across our control surface and that is what the second term is and the final one is rate of energy generation if it turns out that we have internal energy generation we need to be able to take that into account as well so what I'm now going to do is I'm going to write out the energy balance in finite difference form and that is what we're going to use in order to determine this boundary condition. So beginning with the heat flux in through the boundary surface looking here that's just qmn multiplied by delta y we'll assume that it's a unit depth into the plane of the page and then we have the conduction terms and for conduction we're going to have conduction on this surface conduction on this surface and conduction on this surface noting that for these surfaces the upper and the lower here they're only delta x over 2y so we'll have to account for that in our equation and for that we just use Fourier's law and remember Fourier's law was KADT by DX so the delta y here represents a and it technically should be multiplied by 1 per unit depth and the final term we have is the internal generation term and I'll multiply that by the volume and that would be multiplied by 1 for the unit depth as well and all of this has to equal 0 so that becomes the equation that we work with in terms of determining the boundary condition for prescribed heat flux and we can simplify this if we have uniform grid spacing that's where we said delta x was equal to delta y and so doing that and rearranging what we're going to do we're going to rearrange for TM comma n on the left because remember that's what we're looking for through our finite difference method okay so that is the equation that results for prescribed heat flux on the surface of a solid that we're examining and the prescribed heat flux is there and that is the internal generation there now there is one special case of heat flux on the boundary and that is the special case of an insulated boundary so let's take a look at that and for an insulated boundary we know that the heat flux on the surface is equal to 0 so all we need to do is we set 0 in the equation above and we can rewrite it and that becomes the equation for an insulated boundary and that would be how we would handle the boundary condition of an insulated boundary so that is the case of constant heat flux on the surface for the boundary conditions what we're going to do in the next segment we're going to increase the complexity a little bit we're going to take a look at the case where we have convection on the surface