 So, now what we saw in the previous lecture we saw wetted residual approach and then one example of that approach is collocation method. Second popular approach is what is known as Galerkin method and so it is one of the wetted residual approaches. So, in this case the weight is chosen as the shape function. Now we are into the finite element procedure when we saw point collocation that time we were in whole domain approximation. So, that I explained from the point of a whole domain. But here when I am explaining Galerkin method we are into finite element proper finite element discretization procedure. So, that is why we have divided the whole domain into number of elements and there are number of nodes for each node there will be corresponding shape function ni, is it not. And for each we will write wetted residual statement for each node we will see how to do that and then there are this shape function ni will come. Now what is the advantage of using weight function as shape function because it leads to the same linear system of equations as in variation formula. That will prove now. That is the reason that you know this became very popular and you know that is why Galerkin method and this variational approach, Rayleigh's method they can be proved to be equivalent. Now how that is done and how it is achieved we will see. So, again let us take two dimensional Poisson's equation and the residue is this is it not. So, this is nothing but del square phi is equal to minus h and then this when moment I say residue that means this is actually phi tilde that means you are substituted in this some approximate solution assume and that is why you will get residue at every point. So, for simplicity I have dropped this tilde notation on phi. So, now what we will do we will write wetted residual statement or expression for each element. So, what is the you know wetted residual expression integral wr d omega or ds. So, now we are in this approach weight is substituted by corresponding shape function at that node because see now I goes from 1 to 3. So, that is why this statement will be there for each node of considered element. So, there will be three wetted residual expressions and corresponding three wetted residual statements integral w into residue is equal to 0 integral. So, we are minimizing residue in wetted integral sense now this is the residue this is the residue is it not. We are minimizing the residue in integral sense where in this weight is shape function wetted residual statement for ith node of element is. So, there will be three statements for every node every element in case of triangular element. If we are using a quadrilateral element with four nodes there will be four you know wetted residual statements like this and the corresponding this shape function would be different for the rectangular or quadrilateral element right ok. Now, going further now we will like I think we did previously this these two terms we will you know express is that express as minus this minus the derivative of this product minus it is basically we are doing this d by dz of pq is pdq by dz plus qdq by dz it is simply that ok. So, this term is whole you know group of these two term is basically return as this minus by using this simple 10 rule of differentiation ok. So, now so you have now three terms here this is Roman 1 Roman 2 and this is the source term. So, the wetted residual statement earlier there were only so there was a source term and this term was there this got split into two and is one. So, there are total now three terms 1 2 and 3. Now, let us take this first integral which I have rewritten here as we did earlier we apply first you know we use divergence definition at exactly same procedure we followed in one of the earlier cases. We substitute this by using divergence definition this bracketed term is nothing but divergence of this is it not right divergence of this is this and then now we invoke divergence theorem and then this surface integral becomes contour integral ok. So, this T is a tau is a is a closed contour and closing the element formed by the edges of the element. Now, this integral 1 this we will see little later first we will concentrate now on this second integral integral 1 which we simplified we will see it later. So, now let us see the second integral the second integral is this ok and then we substitute phi as summation nj e phi j e n 1 phi 1 plus n 2 phi 2 plus n 3 phi 3 as phi is it not. So, that when you substitute in place of phi you will get this expression where now this only daba by daba x and daba by daba y they operate only on n nj because phi j is not function of x y in this very in this when we minimize it is not function is it not we are just varying the potential at a point same thing that we have seen earlier ok. So, that is why this phi j is coming out and then you get this and now this can be written as del ni dot del nj now compare this with the corresponding variational formulation expression that we had got at the element level. So, when we actually had found in element level energy we had got this right if you refer the previous slides you will easily recollect we had got this right and then we actually but here what is the difference you see here we have phi i and phi j. So, two potential variables are there here there is only one potential variable why it is so because remember this in variational formulation finally this was basically part of energy elemental energy you will combine energies of all elements and then with respect to each phi i you will differentiate the total energy expression and equate it to 0. So, one of this phi i or phi j whatever phi i say phi i will get eliminated because when you differentiate that total energy say capital F by phi 1 this phi i will go is it not. So, then this and then half here there is another difference there is no half here because the same thing that you know you when you have phi when you differentiate with respect to the diagonal terms will be phi i square is it not. So, when you actually differentiate that 2 and this 2 will get cancelled when it is half diagonal term half diagonal term because of symmetry they will come twice phi 1, phi 2, phi 2, phi 1 is it not. So, again that 2 will get cancelled with this half. So, that is why this and this they are equivalent after energy minimization this both will become equivalent and what is this you know this term this is going to give you the global coefficient matrix finally your equation is your equation is Ca is equal to b is it not. So, this both this will give you capital C matrix this also after minimization will lead to capital C matrix. So, you can just refer this earlier that our formulation you will understand that is finally led to the global coefficient matrix C in the system of equation Ca is equal to b right here A is nothing but phi, C is the global coefficient matrix n by l is it clear. So, now we have already seen the equivalence between Galerkin method and this variation variation method which is Galerkin's. So, now the residual function can be converted into a matrix form like this. So, this is what I was saying this C capital C E will directly come from this is it not. Now, here there if you see there were 2 summations you remember that element coefficient matrix there were 2 summations here i goes from 1 to 3 j goes from 1 to 3 and then we said that you know that is 3 by 3 matrix, but here there are only 3 terms there are only 3 terms here other 6 terms will come when you write corresponding residual statement for the other 2 nodes. So, this C E capital C E will again be 3 by 3 at the element level I will again repeat suppose you know we are suppose there is some element E and nodes 1 to 3. So, this will be for node 1 this statement you will get 3 terms when you execute the same procedure for second node and third node of that element you will get another 3 and 3 terms. So, totally you will again get 9 terms right. So, again it will lead to a 3 by 3 matrix at the element level in this weighted residual procedure is it clear. So, now we understood this now there are 2 more this matrices here this B j will directly come from this and this we have seen earlier this will directly give you that B j. Now, here this is the additional term here B capital B small b this B stands for boundary right. Now, this B capital B small b E is basically is coming from this integral 1. So, now see here going back in the weighted residual statement we started with this for node I only node I of one element we started with this weighted residual statement then we got this 3 terms this we understood this will lead to B j the source term source matrix at the element level corresponding to the whatever source you have that we have already seen. This second this term we have seen that leads to the global coefficient matrix capital C right. Now, what remains is this right. So, this first integral Roman I we already converted it to this ok. Now, this is corresponding to is Roman I now we will see what happens to that. So, we are now considering the integral I. So, now this you know we are discussing elements of this capital B small b matrix at the element level. Now, consider a phi node example these are phi global node numbers and there are three elements right. So, now if we write for node 2 remember here in weighted residual we are operating at nodal level for every node we are writing right. So, for node 2 that integral I this expression for node 2 then here it will be N2 is it not. So, in element 1 now this node 2 is you know common and we are considering this H24 we are considering what happens here because finally what we are doing we have gone from you know from the surface integration to contour integration. We are going from area integration to contour integration. So, now we are actually seeing what will be the contribution of this integral I along all this segment because any element you take this will be the counter for element 1 this is the counter 1 4 2 is it not. So, I am considering now on H24 what is happening H24 which is common to these elements 1 and 2. So, now in element 1 the corresponding integral rho 11 for node 2 will be this is that expression right. So, it will be N2 for that element d phi by dx, daba phi by daba x and similarly this right. So, it will be for element number 1 it will be N2 of 1 remember shape functions for a node will have different expressions in the adjacent element is it not. So, N2 of 1 N2 in element number 1 will be different than N2 of element number 2 N2 in element number 2 is it not, but N2 of 1 at node 2 will be same as N2 of element 2 at node 2, but in general at other points it will be different except on H24. Are we getting N2 of shape function of node 2 in element 1 at a found at node 2 itself will be same as corresponding N2 2 in element 2 evaluated at node 2 it has to be mathematically it should be consistent right. So, now in element 1 you get that this expression into AN hat d tau in element 2 it will be N2 2 and AN AN hat 2. Now, we have now something interesting happens now you take this segment N2 4 right. Now N2 of 1 and N2 of 2 on this segment is same because to get the same potential is it not and how you can do that you know the expression of N2 the standard expression that we have been seeing right that expression you have x and y there is it not that x and y you know the equation of this segment any line you can represent it as y equal to mx plus c right. So, you know the N coordinates of this 2 and 4 you know. So, you can express this segment equation as y equal to mx plus c if you that you substitute in N2 of element 1 expression N2 of element 2 expression then you will find that you can prove this yeah. So, here this N1 is there is it not N1 is this now for example, you see this is N1 for element number 1 and N1 for element number 2 will be different is it not because this x3 y3 all those coordinates will be different because there are different corresponding node numbers is it not and these coordinates will be different I hope you are getting it yeah. So, N2 for example, this N2 is there. So, N2 here will be different for one element and second element because this coordinates themselves are different in different elements is it not but actually in the same expression of N2 here for the two different elements if you put the equation of line that is y if you put y equal to mx plus c and substitute y in terms of x for example, you will find that N2 expressions for both the elements will reduce the same on that common segment 2, 4 you can verify this okay in very simple matter of you take any two you know one common segment with some coordinates and you can quickly verify this then if that being the case then this whole square bracketed term become equal on segment 2, 4 on segment 2, 4 is bracketed term square bracketed term become equal because this is equal to this, this is equal to this and what happens to this AN, AN hat they are exactly opposite see this is AN, AN2 because this is the outward normal we have seen earlier is it not this is the outward normal for element 2 for this edge this blue one AN hat this is the outward normal for element 1 and for the corresponding segment 2, 4 this will be the outward normal is it not so this outward normals on this segment for the two elements are exactly opposite so this will be exactly they will cancel each other. So effectively what we have you know sort of seen that this contribution of all these inside segments to this integral 1 Roman integral 1 will be 0 all these you know inside segments which are common to any two elements the contribution to the Roman 1 integral is 0 so the contribution to the Roman 1 integral will be only for the from the sides of elements on the outermost boundary. And that means when you have this you know Roman 1 integral evaluated for the entire geometry when you combine all the elements together only the contributions of the outermost boundary segment will remain is it not is this clear and now so same thing is summarized here in this two statement read it carefully integral that Roman integral 1 while combining those you know individual level matrices the contribution from the two contiguous element will become 0 over the corresponding common edge we saw just now right. So over the outer boundary of the domain this will result into a Neumann boundary condition why Neumann because this is d daba 5 by daba x and daba 5 by daba y the Neumann condition right and depending upon you know suppose if we take that parallel plate capacitor ks then you know we have seen earlier that this a and hat will be either in x direction or a y direction is it not if you take a parallel plate capacitor vertical boundaries for example the unit normal will be in the x direction. So then one of these two terms will be 0 because the dot product with for you know if it is vertical boundary then a n will be a x hat and a x hat dot a y hat will be 0. So there will be only one contribution and then only whatever is the if there is a Neumann boundary condition daba 5 by daba x that will get imposed right. If it is homogenous Neumann condition then it will go to 0 depends on what is the boundary condition on that right. So if it is homogenous Neumann condition as in case of that parallel plate capacitor problem with fringing effect neglected then these there will not be any contribution from this is it not because it is all homogenous Neumann condition these all these derivatives will become 0 anyway where that is applicable. One term will go down to 0 because a n is in particular direction the other term will go down to 0 if it is homogenous Neumann condition is it not okay and if suppose you have on the outermost boundary you have a diraculate boundary condition that means stop and bottom plates of that capacitor if it is a diraculate boundary condition that will get imposed when you actually in the final set of equation when you impose the boundary condition there will have to impose that boundary condition as we have done earlier is it not the diraculate boundary condition will get imposed at that at that you know stage right. In case of non homogenous boundary condition these terms will be non 0 and then this matrix will be there if it is homogenous Neumann condition this will go down to 0. So, if homogenous it is equal to 0 that is the meaning of this and then it is called as natural or implicit boundary condition in FEM why implicit that time we discussed even if you do not impose it it will get if you do not impose it will be automatically be taken as homogenous Neumann because those terms will not be there in your final set of equations is it not. So, that is why it is called as implicit you do not have to if is homogenous Neumann you do not have to impose moment you do not consider those matrix term automatically you know they are they are made to 0 clear and if diraculate condition it has to be imposed when you get final that matrix CA equal to B right. So, your final matrix equation is say CA is equal to B right here A is what phi in our case because we are taking phi as the variable. Now this B has two contribution from B j if it is a magneto static right. So, current density say and then there is a B boundary. So, this B j will come and you know that will come from that from this term capital B small b e is controlled by this integral. So, this B e finally, this B capital B small b this matrix will come from the segments which are on the outermost boundary right when you evaluate that integral Roman 1 right and C anyway is the global coefficient matrix which is same in both variational and so finally, this CA equal to B will be same this matrix equation will be same in both cases variational as well as wetted residual right. So, with this you know we have understood both variational and wetted residual methods right wetted residual approach is more of a mathematical because here you can see we have not talked of energy. We only talked of minimizing the residue or the error in wetted integral sense we did not talk about the energy. So, it is purely a mathematical technique of minimizing the error or the residue at each point. So, we will stop at this and then we will see now mostly the applications and the corresponding changes in the PDEs and you know formulation. Now, every time we see new formulation like axisymmetric diffusion equation transient we will see only the governing equation and the corresponding changes that will happen in our formulation, but we will not get into coding because that coding part is more or less now over we have explained 2, 3 codes to you. So, using that you can develop code for any two dimensional formulation. As I said 3D formulation is difficult from the point of your coding unless it is absolutely necessary you should not go for 3D coding to start with first you should do 2D coding, verify 2D results then only you can go for 3 dimensional coding ok. Thank you.