 So, welcome to the 13th lecture of this course. In the previous case, previous lecture which was little mathematical, but if you understood that, then FEM theory is more or less understood by you. Now, it is more of applications to various PDs and all that. Now, for example, if it is non-homogeneous, first thing is, if we take a non-homogeneous case, let me see in the previous lecture, last slide, we actually had associated mu with J, mu was on the right hand side, but mu, but that will be for single material case. There had written also in backlight, it is single material, but mu generally will vary, can vary from point to point. There could be more than one material in the problem domain. So, mu can vary and in case of non-linear problem, in case of non-linear problem, in given magnetic material, mu can vary from point to point. That means, when we convert the whole geometry into number of elements, in each element generally we will assume mu as constant. So, from element to element mu will change. So, that is why we cannot associate mu with J in any case. So, mu should be associated with this. So, it should be inside this integral. Then only you can change the value of integral. Now, for example, when we eventually will see the finite element formulation, this dx dy will correspond to the element level area. Is it not? When we discretize this dx dy, till now we have been assuming it is like a whole domain approximation. So, this is the entire problem domain area. But when we go to finite element formulation, this dx dy will correspond to every element. So, depending upon the value of mu for that element, you will take the corresponding value of permeability here. So, you cannot anyway associate it to J because J is current density, some winding. So, that is why then this will be recast that expression has to be recast with 1 upon mu taken here. Rest thing is same. Other thing you know to notice, we understood when we solve finite element problem, there are sort of 3 or 4 things involved. One is of course, the source. Source is this, source is represented here is the source. Then there is a material here. And then there are boundary conditions, which we have already been discussing. In fact, one of the those integrals in the last lecture, we in fact saw how homogeneous Neumann condition get implicitly imposed and all that. So, what actually then remains is this, what does this represent? So, this bracketed term represents the geometry and the vertical property. So, this basically gives the finally, when we form element level coefficient matrix and global coefficient matrix using finite element procedure. That time we will see that this basically leads to this bracketed term, the entire term leads to what is known as global coefficient matrix, which has information of material properties and geometry. So, now, so that explains the various terms typically that are there. In case of diffusion equation, these also we have seen in basics, these are diffusion equations. And you know for that, now you can see that this del square a that becomes this only, that there is no change. Like here also it is this del square a 1 over this, this is this. Whatever is on the right hand side, now here you see here minus, here minus sign was taken here, that is why it was plus here, here it is plus del square a, that is why it is minus. So, whatever is on the right hand side, that the sign repeats here in the functional expression and that gets multiplied, the source term gets multiplied by the corresponding source term. So, it was here, j was there a into j, here also a into j. So, secondly, this whatever, this wind term is brought on this side j omega sigma and there is a here. So, that a gets multiplied by another a, you get a square. And then for that there is no 2 term, the multiplication is not there. So, then we go to the wave equation. Wave equation also is del square a plus k square a is equal to minus h. Now, here this h will be again you will be some source in wave equation. And then this again del square a becomes same, this expression is same. Now, this k square a you bring it on the other side, it becomes minus k square a. So, that minus k square a and a is only in z direction. So, this becomes a z and I mentioned previously, k square a will get multiplied by a. So, that is why this becomes k square a square. Now, these, so by inspection I am telling, but you can obtain these functional expression using the theory that we have covered. Starting with PDE you can derive the functional, but by inspection how do you know the expression that I am telling. And whatever was on the left hand side, when it is brought on the right hand side, then that does not get multiplied by 2, because that actually here there is a square term. So, that you know when you actually do the procedure, you will understand why there is no 2 here and there is a 2 get multiplied to the source term. So, here also see here everywhere the source term is multiplied by twice into the potential. So, this you know these are the standard functional expression that we will be using in this course. Now, you know more or less the complicated theory is over related to FEM theory this part. There will be some again some complexity in formulations later on. For the time being you know this is the complexity in formulation is over. Now, we will see some simple example. So, that you know our theory learning will get consolidated. Now, consider an ODE of the form phi double dash plus phi plus x is equal to 0. So, that with the boundary condition that phi is equal to 0 at x is equal to 0 and x is equal to 1. That means our one dimensional problem domain is from x is equal to 0 to x is equal to 1. So, and then you know you just recast this you know like equation like this phi double dash plus phi is equal to minus x. And then now the same logic that I explained you just now you apply. So, by inspection you can write that phi double dash will become phi dash square. Phi you being on this side it will become minus phi and that minus phi gets multiplied by the potential. So, it becomes minus phi square and that does not get multiplied by 2 I explained earlier. And then this is the actually this x is the source term do not consider this x as just you know geometry variable. What it means is the source at any x is equal to numerically equal to the x. So, this is the in effect it is representing the source and that is why it becomes again 2 it gets multiplied by phi anyway and it gets multiplied by 2 because it is source. So, by inspection you can and then half of course comes as usual half of this. If it was simply Laplace equation this both this terms would be 0. You will get only half phi dash square is it not if it is Poisson's equation then only this phi dash phi square will go to 0. So, it will be only phi dash square minus 2 x phi this will be for the Poisson's equation. So, what will be Poisson's equation here phi double dash is equal to minus x phi will be 0. So, phi double dash is equal to minus x will be the Poisson's equation and for that the corresponding functional would be half 0 to 1 phi dash square minus 2 x phi dx. Now, you know one can easily find out the simple ordinary differential equation the exact solution is this the ordinary differential equation. So, phi is equal to sin x by sin 1 minus x is the exact solution actually you can verify this by applying boundary condition. You will see that when you put x is equal to 0 and x is equal to 1 in this expression you will get phi is equal to 0. So, that is the simple verification that indeed yes this is the exact solution. So, now we will assume now we are slowly getting into finite element method actual procedure. So, in finite element method what we have to do this is still you know analytical solution does exist, but you can imagine if it is more complicated you know ODE or PDE then you do not have this exact solution then you have to assume something. So, let us assume phi tilde now henceforth whenever you see phi tilde that means this is approximate solution approximated solution. So, phi tilde I am assuming as some c 0 plus c 1 x plus c 2 x square. So, I am assuming that it is of this form I may be correct I may be wrong, but even if I am wrong this is a numerical technique there will be some error that error can be minimized only when I am exactly correct when it this is exact solution, but which is generally not possible for practical problem. So, generally numerical methods we are not exactly right, but we are not either that too wrong also there will be some errors because we are approximating solution and those errors can be minimized by standard you know procedures in any numerical technique. So, this is the approximated solution and now first we apply boundary condition we already know these two boundary conditions at x is equal to 0 and x is equal to 1 phi is equal to 0. So, phi equal to 0 is equal to 0 you substitute it here you will get immediately c 0 is equal to 0 is it not and now you substitute c 0 equal to 0 and then use the other boundary condition phi of 1 is equal to 0 then you will get c 1 equal to minus c 2 straight forward is it not and just to make it simple I am calling this as c 1 is equal to minus c 2 is equal to c. So, now my this approximated solution expression becomes this I am just x substituting the values of c 0 is 0 and c 1 is equal to c 2 is equal to minus c is equal to plus c. So, you will get phi tilde as c into x 1 minus x. So, then phi dash will be c into 1 minus 2 x this is the derivative of phi with respect to x. So, then we will substitute these two things phi dash and phi in the functional expression the functional expression is this is it not. So, here there is a phi dash there is a phi I will. So, we will substitute these two here and anyway 2 x phi is there. So, that so, phi dash square minus phi square minus 2 x into phi integral half phi x into phi of 0 to 1 dx. So, this is the total functional and so, this is representing the energy. Now this energy has to be minimized with respect to what is the variable here. Now after you integrate this will be function of only c. So, here that is why you have to. So, after you evaluate this integral you will get this integral as 3 by 10 c square minus c by 6. So, then you have to differentiate with respect to c and then you get the c value as this and then you substitute c in the expression of phi tilde you will get this. So, we have obtained a solution. So, again now you see the whatever we saw in theory we are implementing that first we are finding out the functional that functional we are differentiating with the variable unknown variable c and that is how you get that c and then that. So, this leads to energy minimization is it not earlier what we were doing we are taking we are making del f equal to 0. So, del f equal to 0 amounts to differentiating here f by c is it not and equating it to 0. So, you get this now remember this is whole domain approximation and that is why here c is coming we are differentiating with respect to c then we will actually see the finite element procedure and we will discretize a given problem domain into number of element there the variables will be the potentials at various nodes in the finite element formulation. So, there actually it will not be d daba f by daba c but it will be daba f by corresponding you know potential variables at various nodes that we will see at that time. Now, this was you know second order approximation now if we do that third order approximation. Now, I will say I will add one more term here c 3 x cube I will say that this second order approximation is not good enough I will make it third order approximation. So, that I will get more accurate result and indeed we will see later that we get accurate result. So, now again you follow the same procedure using this first we apply boundary condition and then c 0 will be equal to 0 and then now it will be more complicated because after applying the first boundary condition we will be left with three variables. So, that is why it becomes little more complicated and then you get more complicated expression for f as compared to as compared to what you have got here is it not. So, you have got f here of only one variable c but here you will get in two variables c 2 and c 3 because second boundary condition when you will impose you will replace c 1 in terms of c 2 and c 3. So, c 1 will get eliminated. So, that is why only there will be two variables here c 2 and c 3 and then you will you know differentiate that f which is now function of c 2 and c 3 with respect to c 2 and c 3 and then you will get dava f by dava c 2 equal to 0 and dava f by dava c 3 equal to 0 and that will give you these two equations. Yes c 0 was made 0 by the first boundary condition like earlier c 0 will become 0 second boundary condition that at x is equal to 1 also phi is equal to 0 that will actually you know lead to a condition that you can replace c 1 in terms of c 2 and c 3. So, eventually then f expression will have only c 2 and c 3 term right and then when you evaluate the integral you will get f expression in terms of only c 2 and c 3 and then you will get two equation because you have two unknown. So, you know you differentiate f by c 2 and then c 3 and equate it to 0 that will make the minimization okay and then you get you know you solve these two equations into unknowns you get c 2 and c 3 as this and then you get phi tilde as this okay. So, now let us go further and see error distribution actually if you see here and the corresponding solutions and we did in fact second and third order approximation is it not in the previous slide if you remember we had initially done second second order approximation and then we did third order approximation this was third order approximation and here what we had got earlier was second order approximation right. Now here we will we have plotted exact solution is in blue second order approximation is green and you know black is third order approximation. So, as you can see third order approximation is better than second order and if you go on increasing the order of approximation right then the numerical solution will match more and more exactly with the actual solution right. But then the computational burden will go up. So, then we have to always do compromise between the order of approximation and whatever accuracy or the and the corresponding computational burden that you are willing to you know take right. So, now here if you what is plotted in the second figure is the residual now residual is basically error is also we decided we discussed earlier. So, here you can see the error is not 0 everywhere except here at one point. So, error is somewhere it is positive, somewhere it is negative and the summation of error is also not equal to 0 right. But summation integral so that means integral error dx because it is one one dimensional problem. So, integral error dx is not equal to 0 actually if you take the integral of this curve with respect to x you will find that the integral is not 0 which is in fact done here you can see because since we have the exact expression for the solution that we obtained. So, this was the solution that we obtained is it not? Phi tilde is the approximate solution it is phi by 18 x into 1 minus x is what we you know obtained by using boundary conditions and then minimization procedure right. Now, if you do integral error dx right. So, it is integral 0 to 1 r dx and what is r residue is phi tilde double dash plus phi tilde plus x because this was our original equation is it not? So, we are substituting phi tilde into that and then we are checking. So, this will result into not necessarily 0 everywhere. So, last time last slide we saw only at one point you know it is it is error with 0 right. So, this is in general this will not be 0 because it is some approximate solution somewhere the error is positive somewhere the error is negative right and now if you integrate the error with respect to dx. So, now it is phi tilde double dash now what is the error? Error is this at every point. So, we are just substituting phi double dash tilde will be if you just take a double derivative of this you will get simply minus phi by 9. Then phi tilde is simply phi by 18 x into 1 minus x plus this x right. So, you just if we do this integration simple integration 0 to 1 and if you evaluate you will get this number which is not equal to 0 right. Now, we will see what happens with the integral phi tilde error dx right and then we will also understand why error in phi is not only positive or not only negative here can you see here somewhere the error is positive somewhere the error is negative is it not. Now, we will calculate this integral phi error dx right. Now, actually if you do this actually we had seen this equation when we derived the functional and all that is it not this equation was earlier seen and then based on that we are saying that this should be equal to 0 when this is minimized. Now, let us see whether these get satisfied. So, second order again we have this solution with second order approximation and now if you substitute in del f and you know again it is now phi, phi tilde is this right and error in the previous slide this was the error is it not. We have already evaluated that error was this this expression same error is put here. So, what we are doing is now we are integrating phi tilde into error and if you actually evaluate this you will find that it comes identically equal to 0 right. So, it means that this indeed get satisfied okay. So, here you can see here this is R residue into phi tilde and then this if you actually integrate this over x the positive and negative areas will exactly be equal and then we will get cancelled right. So, here and why we are actually getting this you know this because we are forcing this equal to 0 in one of the earlier slide this slide do you remember right. So, here if it is exact solution you know del square will be equal to minus del square phi equal to minus h at every point and this will be identically equal to 0. But since it is approximate solution this minus del square phi minus h will be equal to some residual or error right. So, in this slide for example you see when we derived this finding functional form of given pd we had got this expression now here since it is approximate solution here what will come R residue into phi that. So, that actually we are making it equal to 0. So, we are forcing if this is not exact if it is exact this anyway is equal to 0 and this becomes 0. If it is not exact then there will be some residue and that integral of residue into phi over the domain is forced to 0 is it not. So, exact solution anyway this gets exactly satisfied if it is approximate solution there will be error. But that integral error into phi in this our case phi tilde is it not integral error here R will come del will anyway come outside here del error into phi dx dy equal to 0. So, in our case it is only dx is it is one dimension. So, it exactly sort of confirms that since we are minimizing the functional or energy and equating del f equal to 0 if it is approximate solution it will amount to making integral of residue into phi dx dy equal to 0. In our case it will be only dx for one degree. So, we will stop here and we will go to the further theory in the next lecture.