 In the previous lectures, we saw two-dimensional formulation in terms of magnetic vector potential and you know we saw the procedure to calculate AZ basically, you guys have two-dimensional formulation. So, formulation is in terms of AZ and then but our main you know purpose is to get B and H fields. So, in this lecture 21 lecture number 21, we will find now way to get B and H from computed AZ values. So, now we know already that A in element is N1 A1 plus N2 plus N3 A3. So, now if you substitute the expressions for N1, N2 and N3, you will get this. So, this is N1, this is N2 and this is N3 and 1 upon 2 delta is common in all those expressions. So, then you can actually as we did last time we will denote these all these bracketed terms y2 minus y3, y3 minus y1, y1 minus y2 as P1, P2, P3 and similarly Q1, Q2, Q3. Then we come to B is equal to del cross A and now in we have only AZ component, AX and AY components are 0. So, this curl expression will reduce simply to this. So, AX component and AY component which is the case because current is in Z direction, A is in Z direction, B will be in X and Y direction. This we now know very well and notice BX component is daba AZ by daba Y and BY component is daba AZ by daba X. So, now if you actually substitute AZ from the previous slide is entire expression. Now, we know here there is a variation with respect to X, variation with respect to Y. So, variation with respect to X will have P1, P2, P3, variation with respect to Y will have only Q1, Q2, Q3 terms. So, that is what daba AZ by daba Y. So, it will be A1, Q1, A2, Q2, A3, Q3 and with respect to X it will be A1, P1, A2, P2, A3, P3. So, this constant, these terms will not, because they are constant. So, derivatives will be 0. So, only derivatives will remain corresponding to these two terms. So, now, so this you have got, this is a BX component and this is BY component. So, magnitude of B square in element is simply square of this plus square of this, right. So, this is a BX component. And then you can then calculate HX as BX upon mu and HY as BY upon mu. And as I discussed earlier, we can assume permeability over element area as constant. And then H will be given by this, straight forward. We know area of the element is given by this, of the element. Now, this, I think in basics of electromagnetic, we discussed this aspect, the energy. Why energy is integral HDB? Energy density is integral HDB. Again, just for the sake of completeness, I am giving it here, because we want to calculate now inductance, right. What we want to calculate, inductance of that bar that we have simulated, an isolated bar we have simulated in 2D. So, we will calculate the inductance and verify with analytical formula. So, energy is, we know it is integral VIDT power into time integrated, right. So, I U replaced by this expression, HL is equal to Ni, phi is V is equal to ND phi by DT and phi is B into S, S is the area. If you substitute all this here, you will simply get integral HDB S into L, right. And S into L is the incremental volume, small volume, right. And then, so you get, if you actually evaluate this, if you put H is equal to B by mu, then you will get this integral as B square upon twice mu into volume, right. So, now remember, some magnetic material will be there that is divided into small, small elements. Each element has volume V. In each of those elements, you have calculated B by this expression, because we calculate, we know A, we calculate B and B is constant, because it is, you know, first order approximation, A plus B x plus C y, is it not. And that is why you can imagine the corresponding A expression is also linear, we varying with x and y. So, these derivatives are just becoming constant. So, B in each element will be a constant number, right. So, then, over each element, you will get B square upon twice mu that you multiply by corresponding volume of the element, right. It is a 2D formulation, the area into 1, 1 meter depth in z direction. So, that is the energy associated with each element. And if you want to calculate the energy for the entire core, then you have to add energy of all these elements calculated in such a way, right. And then, we also understood when we were studying basics, the energy is represented by the shaded area and co-energy is represented by the remaining area. The physical interpretation of energy and co-energy and usefulness of co-energy we will see later when we calculate forces. So, till that time, I am just sort of differing the discussion on co-energy, right. Going further, now we have simulated and got the field solution for a rectangular bar, use that rectangular bar and we had enclosed this in a another rectangle, is it not, right. And then, we got the solution. Now, using that solution SEM solution, we can calculate the inductance of this bar. How we can calculate? From the, of course, this is the, first we will see the analytical formula. Analytical formula for an isolated bar is given by this, where Lb is the length of the bar in centimeter that is length means it is in z direction. Because this is xy, length in z direction we are assuming it is 1 meter, so per meter depth. We are calculating the inductance. So, inductance will be per meter and ds is nothing but this is a empirical formula 0.223 pi f into a plus b and a and b are the dimensions. So, if you substitute, this is in centimeters, this in centimeters when substituted here in this formula along with this Lb, you will get L as so many n rings, right. Now, we can verify the length of the bar. We can verify this by using finite element method. So, we already have got solution, right. We have got b values in each of the elements. We can calculate this square upon twice mu into the volume of each element that will be the elemental energy. We add energies of all elements and that we equate it to half L i square. Current, you can assume some current flowing here and then you know whatever we have not assumed, what current we have specified in our FEM simulation and corresponding J that we would have specified there, that current we have to take. And this expression of half L i square should be equated to the energy obtained by FEM simulation which is sum of all elemental energies throughout the domain. Each elemental energy is b square by twice mu naught multiplied by the elemental volume. So, now when you do that then FEM simulation gives you know 0.22 into 10 to the power minus 6. When we do with that original boundary which was this 40 by 40 bar was in 100 by 100 rectangle and that time I had mentioned that this boundary is rather too close that gets evident here. Now, you can see this formula is quite far off from this analytical formula. So, this is you know quite approximate solution because boundary is because this formula analytical formula is for an isolated bar. So, here you know this boundary where we had taken it too close and we had taken it too close because we wanted to understand FEM coding for a simple geometry with Q number of elements that is why we had taken the boundary close. But later on we developed a code also. Now, you know using that code if we take the boundary far enclosing it into 1 meter by 1 meter much bigger boundary around it far off. Then you will get L as this which is closer to the analytical and remember in fact this answer will be more accurate than this because this is analytical. There will be some because there are there are some empirical factors here is it not and those empirical factors depending upon the dimension the accuracy will vary. So, this value of 0.672 will be more accurate than this 0.747. So, now how do we calculate the same thing while we will see now in terms of coding. Now, again we we have got the solution already then you know for each element we run a form for loop and then for each element you you know using this command for 1, 2 number of elements nodes is equal to this now by now you are familiar with this by this command what will happen from the T matrix which is 4 by number of elements, second, third and fourth entries are the global node numbers. So, those will come into nodes for that element and then these these two commands will get x and y coordinates of those global node numbers and this will be x and y will be 3 by 1 matrix x x coordinates of those 3 global node numbers and y c will be 3 y coordinates of y coordinates of those 3 global node numbers corresponding to the element under consideration in this for loop and then you know we have already this is just a initial initialization and then p1, p2, p3 and q1, q2, q3 are this we have already seen that we basically calculate these values and then we just now saw by and bx are given by these two expressions d y is this d x is this area of the element is this this also we have seen in in the previous you know class and then you know you then calculate b y you know this minus sign this minus sign is here this minus sign is for this and then this is this expression coded here sorry not this expression this expression coded here and then similarly bx this expression for that corresponding this line is there then b net is square root of bx square plus by square and then hx and hy is corresponding division by mu right and then finally h element will be b net upon mu mu of that element right. So, then by this we have got b and h values now we calculate energy it is p square upon twice mu into so this will be the square upon twice mean mu will be the energy density into the area into 1. So, this will be the volume is the area of the element delta into per meter depth into 1. So, this is the so that is what you have got energy in the entire domain since the sum function adds energies of all elements in the domain and the total energy is equated to half L i square for which first you have to calculate i. So, i is you know this is 0.04 into 0.04 is the area and into the current density that we had taken that time. So, j into area so that gives you current and then simply half L i square is equal to En so L is given by this and then you get L in micro energy because here we have multiplied this by 10 to 6. Here there is one you know just a command here you see here dot is there if you put a dot here that means suppose there are two column vectors and you want corresponding entries of b net and delta column vectors to be multiplied. So, that is why we are putting a dot here. So, now we have seen a variational formulation and the corresponding procedure. In one of the first lectures probably I mentioned about there are two approaches distinct approaches one is variational and other is weighted residual. Variational approach is more related based on physics principle because we are minimizing energy whereas weighted residual approach is more like a mathematical error minimization approach. Now, we will see we will quickly see this method of weighted residual and also see the equivalence between the two approaches variational and this weighted residual approach and we will in fact prove that both the approaches lead to the same final system of equation. So, now and why weighted residual approach is sometimes preferred because it is more general method because in variational approach you have you know you need to find a functional for a given pd right. So, for standard pd is of course you know the functional and all that, but if you get a non-standard pd then you have to first find corresponding functional and then only process. Instead of that in weighted residual approach you need you do not have to find out the function. So, now again let us start with partial different equation which is say L phi equal to H where L in this case is say Laplacian operator minus del square. So, effectively this is a Poisson's equation right and phi is the unknown potential function and H is the forcing or source function which is known. Now, again we start with whole domain approximation right and there we will approximate phi tilde tilde stands for approximate as c0 plus c1 phi c2 phi 2 and so on right. So, now here residue is L phi minus H right. So, L this is phi is the here it is the approximate right. So, residue the agar is minimized in weighted integral sense that is integral wr area equal to 0. Now this omega d omega stands for area. So, we could call this as ds also earlier we have been using ds. So, you can say this as ds also. So, now in this case there are different residual approaches available. So, the first method is collocation method in which we use direct delta function as the weighting function. So, what is direct delta function? It is defined as like this delta of x minus x y is equal to 1 if x is equal to x x i and this you know in signal cell system this is very popularly used and it is 0 if x is not equal to x i. So, basically this function you can use to focus on a particular point in the domain and you know apply the equation only at that point and everywhere else you make it 0. So, now number of collocation or matching points in the domain should be equal to the number of unknowns is it not. So, like finally our objective is to find number of equations equal to the number of unknowns. How do you do that? Now let us again and of course, higher the number of points collocation points higher will be the accuracy again discretization. Now consider again our equation that we have been seeing for quite some time now phi double dash plus phi plus x is equal to 0 with boundary conditions that at the two end points potential is 0. So, let us have second order approximation. So, then phi tilde is equal to c 0 plus c 1 x plus c 2 x square and then if you apply this boundary condition this we have already seen earlier c 0 comes 0 c 1 comes minus c 2 that is why phi tilde becomes c into x into 1 minus x. Now residue is phi double dash plus phi plus x. Now you substitute the you know expression that we have got phi tilde this expression you substitute it in this equation you get this right. So, now this is the residue at each and every point depending upon the value of x the residue will vary is it not in this one dimensional domain. So, now you have here only one unknown which is capital C. So, then only choose one matching point that means that this direct delta function you operate only at that one matching point that you have chosen and that the chosen matching point is x is equal to half midpoint because it is logical is it not that we choose if we are choosing only one point let us choose in the middle. So, then when you actually execute this integral W r d s this omega is nothing but s is equal to 0 and W delta of x minus half if you substitute here as wetting function then you will get this will reduce to r half. So, we obtain a residue at one half at 0 and then this substitute x is equal to half you will get this you know this equation and then that will lead to c is equal to 2 by 7. So, you get this solution right. Now let us do third order approximation with you know 4 coefficients c 1 2 c 0 2 c 3 and then again apply boundary conditions you get phi tilde as this this also we had seen earlier is it not in case of 1 d with third order approximation we had in fact got the same solution earlier and then phi double dash will be using this will be this then the residue is phi double dash plus phi plus x is it not that is the residue and after simplification you will get residue as this I hope you are getting it see this is residue at every point is phi double dash plus phi double dash plus phi plus x is it not. So, in that we are just substituting this phi tilde what we have got here now. So, if you substitute it you will get residue as a function of x as this now we there are two unknowns here c 2 and c 3. So, we have to use two matching point so that we get two equations right. So, let us choose two matching points again equidistant one-third and two-third and then you get so r 1 by 3 equal to 0. So, when you get execute this statement with you know direct delta function operating at one-third and two-third right you will get these two equations r of r at residue at 1 by 3 is 0 residue at 2 by 3 is 0 and that you know you are substituting x is equal to 1 by 3 and x is equal to 2 by 3. So, we get two equations into unknowns and then we get c 2 and c 3 as this and but this method is not amenable for 2D and 3D problem right. So, because why the point collocation method is not suitable why because how many matching point that you should choose and where that will be a matter of measurement here it was 1D it was there. So, that is why you logically chose equidistant, but you can imagine for a two dimensional or even more complicated problem it will be difficult. So, before going further we will also see the corresponding errors and compare the errors in the two approaches that we have seen. So, this slide shows exact solution for that equation that we have been seeing. So, this black one is the variational method third order approximation and red one is the point matching that is collocation method that we have seen just now. So, the results are quite close in both cases and now we will see in this residual method residual method the residue can you see here at what were the two matching points x is equal to 0.33 and x is equal to 0.66. So, exactly at those two points residue is coming equal to 0, but at other points residue will not be 0 because we are not forcing residue to be 0. So, at those two points residue is 0, but that does not mean that we will get the minimum error in potential at those two points. So, here is the error in potential with respect to x. So, although you are getting lower values of you know errors in potential, but they are not 0. So, what we are ensuring is the residue at those points are 0 we are not ensuring by our formulation that error in potential is 0. So, we will stop at this and continue our discussion in the next lecture.