 So welcome to this 17 lecture, now we are actually ready to go into 2 dimensional analysis. Now we will start with you know a magnetostatic problem right in which you have a rectangular conductor with carrying some current I is enclosed in some boundary rectangular boundary obviously you know the current is going in here. So we will have field lines in clockwise direction right and here the dimensions are given. These node actually you know these boundary is considerably closer to this conductor. If you want to analyze field of this rectangular conductor in isolation then these boundary has to be really far away. So that the boundary condition does not affect the field distribution. But since we want to demonstrate you the corresponding FEM core we have taken boundary which is very close so that we can explain. But eventually when we write a code for this we can always you know take this boundary far off so that that boundary condition does not affect the field distribution right. So you know why I am saying it will affect because you will impose say some a say a equal to magnetic vector potential you will impose a equal to 0. Moment you impose a equal to 0 you are basically influencing the field distribution is it not because this boundary is closer to the conductor right. So more about it later. So now the governing equation for this magnetostatic problem is simply del square A z is equal to minus mu j z as we have discussed earlier in two dimensional problem as in this case we are taking cross section which is perpendicular to the current right. So the direction of current and therefore current density j is fixed it is in z direction right. So is the direction of A so direction of A also gets fixed right. So that is why it is both A and j they get replaced by vectors field vectors they get by replaced by A z and j z. So effectively this reduces to scalar Poisson's equation is it not otherwise it would have been a vector Poisson's equation with three components that also we have seen in basics of electromagnetic right. So it reduces to scalar Poisson's equation with only A z you know at various points in the domain to be determined right. So now the corresponding functional is this now you are very familiar with this kind of expression functional is given by this. So this you have like in case of electrostatic you have epsilon E square here you have 1 upon mu del A square in basics of electromagnetic sometime back I explained to you always when either mu or epsilon when they appear singly there you know if epsilon appears in numerator mu will appear in denominator half epsilon E square got replaced by one more mu del A square right. And then of course j A ds this is appearing on the right hand side. So this term gets multiplied by the corresponding potential in the functional expression this also I had explained right. So this functional expression is the it can be directly written based on the theory that we have seen earlier right. And then the boundary condition is A z equal to 0 that also I have explained to you earlier A z need not be 0 A z can be some other number like 50 or 100 all the values of A will then get shifted by corresponding values flux distribution flux flowing between 2 points is just a difference between the corresponding 2 points the A at corresponding 2 points A 1 and A 2. So reference potential even if you change from 0 to something else the field distribution corresponding B x B a values will not change is it clear. So that is why but for simplicity we always take in magnetostatic problems or magnetic field problems whenever we impose boundary condition in terms of A we take A as 0 and as reference potential clear. So now the FEM procedure we have already seen this is summarized here first we discretize here since it is 2D we will have either you know triangular or quadrilateral elements not just the segments then we approximate solution in 1D we approximated solution as A plus B x here it will be A plus B x plus C y right. Then assembly of global coefficient matrix now when we say assembly of global coefficient matrix what effectively we are doing we are actually adding energies of all elements that is effectively you know that global coefficient matrix is representing the energy of the entire you know domain. So because those global coefficient that global coefficient matrix gets formed by combination of all the you know appending of all the element level coefficient matrices and each of those element coefficient matrix is representing the corresponding energy of that element is it not. So the global coefficient matrix is representing the energy of the entire system and of course remember that the system of equation will also have now the corresponding this term right and that also will be deciding the overall energy of the system because this will give you one matrix this will also give you one matrix. So this will give you K matrix this will give you the matrix right the corresponding earlier you know we said K or whatever A matrix but here what we are doing is that global coefficient matrix will call it by C because already we have this variable A as magnetic vector potential. So the global coefficient matrix here will denote it as capital C. So our final system of equations will be C into A is equal to B where unknowns are magnetic vector potentials A z at various points in the domain right and then for getting the linear system of equations we need to minimize the total energy with respect to nodal magnetic vector potentials and then you apply the boundary condition right. Now the B matrix that you get which we have seen earlier also in case of 1D the contributions to that B matrix come from two you know accounts one is the boundary condition right other is this source condition. So here that is why that B matrix will have contribution from J which is the source as well as the boundary condition that we are imposing that A is equal to 0 on the outermost rectangular boundary. So always remember the right hand side B matrix that we will eventually get when we do the FEM procedure we will have contributions from source as well as boundary condition right. So this should be understood and of course then we will when we will get final matrix equation linear system of equations C A equal to B then you know you just have to take inverse to get the you know unknown vector A which is potentials at magnetic vector potentials at various nodes in the domain. Now let us go one by one these steps. So in first step we are discretizing. So in 1D we will always generally have segments as we have seen earlier. In 2D you can have either triangular element or quadrilateral element right. And in 3D you will have 2B tetrahedral or charismatic element right. Now how do we decide element size? We had some discussion earlier when we saw theory of eddy currents and all that or when we discussed non-uniform fields we discussed this that whenever there is a non-uniform field in some region you have to have find discretization right similarly when the frequency is high eddy currents are there and you know current is confined to a small surface depth then you need to have fine element size in that zone so that you can capture the rapid variation of the field as well as loss if the loss is occurring power loss is occurring. If you have to capture that then you need to have fine mesh in that region. So those considerations will be there while deciding the size of the element. The type of the element gets decided based on whether it is 1D, 2D or 3D and whether we should go for you know cubic tetrahedral or charismatic for 3D or triangular or quadrilateral for 2D is matter of convenience and coding. You know for example in this course we will always use triangular element because they are much simpler to code and you know process. Now let us go further. Second step is solution approximation. Now here you can have linear or quadratic element right. What is linear element? Linear element is for 1D for example it is A plus BX is a linear element right whereas same thing quadratic element for 1D will be A plus BX plus CX square will be the quadratic element right and then for 2D it will be A plus BX plus CY linear element whereas second order element or quadratic element will be this. Now here the number of constants in the approximation is equal to the number of nodes in that element. For example when it was 1D element, when it was just a segment there were 2 nodes so that is why you had A plus BX so 2 constants right. When now you have a triangular element right when you have triangular element you have 3 nodes. So you need to have 3 constants. Now why this is important? Eventually the linear system of equation that you saw the number of unknowns should be equal to the number of equations that you get. So this will ensure if you have number of nodes in the element in each element equal to the number of constants in the approximation then that will get automatically ensured right. Now for example a quadratic second quadratic 2D element there are 6 constants right so there are correspondingly there are 6 nodes. One at the 3 at the vertices and 3 at the middle of the corresponding 3 sides. Similarly you will have no quadrilateral element 2D quadrilateral element like this and then the corresponding approximation will be A plus BX plus CY plus DXY. So there are 4 constants here which are unknown for each element to be determined right and remember we directly do not determine this ABC because we eliminate those and we convert the problem in which constants need to be determined that problem we are converting into a problem wherein we directly determine the potential values is it not because we eliminate these constants right. Again we will see that procedure for this 2D case. And then you know 3D tetrahedral element it has got 4 nodes tetrahedron has got 4 nodes. So you will have corresponding this expression and for cubic element a cube has 8 nodes so there should be you know 8 constants so that is why you have this expression which has got now 8 constants. So these are cubic element approximation right. Now you know when to use which for example the question that would be asked when do I use linear when do I use quadratic. So if you are using linear element then you have to use higher number of element when you are using quadratic element you can use lower number of you know nodes and corresponding element. So but which one would be better one cannot say confidently because computational border border may be more or less same. So it is matter of convenience and so one may be comfortable in using higher number of first order elements as compared to a smaller number of second order elements because see second order elements although they are less in number the expression is becoming more complex is it not and the number of nodes are here they are actually increasing right. So the complexity of the formulation is higher in case of second order or quadratic element although the number of elements are less right. So the computational border may be more or less same right it depends on the convenience of the person who is doing coding right and you will see in that is why in commercial FE softwares also both the options are generally available the user has to basically choose whether he wants to use linear or quadratic you know element right. So going further now third step is assembly of global system of equation. So for that first we have to find global coefficient matrix. So for that first we have to find element coefficient matrix and then combine all the element coefficient matrices to form global matrix right. So that is what we will do now. Now here we will have this is a we will start with a one triangular element the node numbers are numbered in anticlockwise direction and why it is numbered in anticlockwise direction because then only eventually when we find out the area of triangle based on this simple you know later on we will see this triangle area is given by half of this determinant is it not is a very standard formula x1, y1, x2, y2, x3, y3 are the coordinates of vertices. So if you do not actually number these nodes in anticlockwise and if you number them in clockwise direction then the area calculated by this will become negative to avoid that we always number the nodes in anticlockwise direction right. Now using the approximation that we have for linear element that is a is equal to a plus bx plus cy like we did for one decase it is more or less same procedure now it is in two dimensions. So we write a1, a2 and a3 now here again it is tilde that means it is approximated solution right. So these tilde's 3 tilde's at 3 nodes will be simply a plus bx1 plus cy1 and likewise again as we did in 1D code and 1D formulation we eliminate a, b, c and express them in terms of nodal potential values right. Effectively what we are aiming for the total energy of the system instead of being function of all these individual a, b, c's of each element the total energy will be function of the potential values at all the nodes in the system because that makes it very simple right and in the variational procedure also we have been seeing in the variational calculus and the corresponding minimization procedure what we are varying is at every each of these nodes in the system we vary the potential and we see for which combination of potential we get minimum energy is it not. So it is very logical that we eliminate this a, b, c from the formulation and express energy of each element in terms of the potentials of the 3 vertices right and then you know we have this problem domain is split into these many elements. Now again you know these are very nicely made out elements triangular because you know I want to explain you the FEM procedure on paper but you know if you use some commercial software the elements will not be like this and not definitely so less in number because I have got only one layer of element between this conductor and the outermost boundary that means this solution is definitely going to be very, very approximate is it not being only one layer of element between the conductor and this is going to be very, very approximate why because you can imagine now a is this right the magnetic vector potential for any element is simply a plus b x plus c y. So actually b will be actually derivative of the magnetic vector potential we will see when we expand b is equal to curl of a the derivative of a will be there we will see in one of the further lectures. So moment that means what will happen if a is capital A magnetic vector potential is a plus b x plus c y right and derivative of if you take derivative with respect to x it will be b only b derivative with respect to y it will be only c so constant. So the components of b, b x and b y will be constant and hence the total magnitude of b will be constant in elements that means effectively what approximation we are doing here in all these elements b will be constant which is not the case. So later on when we do complete the code we will increase the number of elements here and then see how the solution improves right. Now going further now capital A which is magnetic vector potential is we are approximated as a plus b x plus c y so that we are actually writing it like 1 x y and a b c and then we basically in place of a b c we replace what we have got already so we replace it here and we expand the inverse of this you can express a as summation n i a a i e that is nothing but n 1 a 1 plus n 2 a 2 plus n 3 a 3 where in n 1 n 2 n 3 again other shape functions which are functions of x and y as expressed here same thing we did for 1 b is it not there also we had n 1 n 2 for each element is it not for the local coordinate 1 2 here we have 3 nodes for every element we will have 3 shape functions n 1 n 2 n 3 right if you expand this matrix you will get these expressions right and here 1 upon 2 delta this delta is the area of the triangle so here again the same property holds as in 1 d the shape function of node 1 n 1 at that node 1 will be equal to 1 and 0 at nodes 2 and 3 right similarly n 2 will be 1 at node number 2 0 at nodes 1 and 3 right and in fact that you can substitute for example n 1 you substitute here x x as x 1 and y as y 1 you will get this getting reduced to just 1 right and if you substitute here x as x 2 and y as y 2 n 1 you will get it as 0 you can verify similarly no n 2 and n 3 now we are ready to discuss why this is important this property now let us take 2 adjacent or contiguous elements suppose this is you know element number 1 and this is element number 2 with you know global node numbers as 1 2 3 4 right now by this property the potential at 2 and nodes 2 and 3 as well as any point on this segment 2 3 will be decided only by the potentials at 2 and 3 only because n 1 is 0 at nodes 2 and 3 and it is 0 at any point along 2 3 that you can verify you what can be done is you can take any arbitrary you know coordinates and form this you know 2 elements right and then get the expression of x and y on this segment and then that you can put it here you will find that n 1 on this segment 2 3 will also come 0 what I told previously n 1 at nodes 2 and 3 will be 0 by you know substituting here x 2 y 2 and x 3 y 3 you will get 0 to prove that at any other arbitrary point on segment 2 3 also n 1 will be 0 you can form a equation of this segment 2 3 right and then substitute x and y in terms of you know these potentials x 2 and x 2 y 2 and x 3 y 3 and then you will find that n 1 at any arbitrary x y on this segment 2 3 also is 0 right that you can verify yourself. So what then it means the potential at any point on this segment 2 3 will be decided by only the potentials of nodes 2 and 3 only is it not because over that this formula is a at any point is n 1 a 1 plus n 2 a 2 plus n 3 a 3. So if at any of these points if n 1 is 0 then potential at any point here will be decided by only n 2 and n 3. This should be the case because if it was not so suppose this node 1 and node 4 potentials if they were deciding potentials on segment 2 3 then what will happen when you calculate the potential at any x y on this segment 2 3 with reference to element 1 you will get one value and when you calculate the potential on this segment 2 3 with reference to this element number 2 then you will get another value and mathematically it will it will be absurd is it not. So it is very logical that the potential on this segment 2 3 is decided by only the potential values at nodes 2 and 3. In other words the continuity of potential across this element boundaries is ensured by this property of shape functions. So this is called as you know ensuring continuity of potential that means whether you come from here or here the potential has to be continuous at the interface is it not. Otherwise the formulation will be mathematically absurd right. So this is now I just explained why you know n 1 should be equal to 1 at node 1 and give at nodes 2 and 3 is very obvious a e at 1 will be n 1 a 1 plus n 2 a 2 plus n 3 a 3 but since n 2 and n 3 are 0 at node number 1 it will be a 1. So a at 1 is a 1 right ensures similarly for the other 2 right. And then here pictorially this shape function property is you know given. So for example this is our that triangular if suppose these are that one of the triangular element 1 2 3. So n 1 will be equal to 1 at node number 1 and that will go to 0 at nodes 2 and 3 right. So somewhere in the middle of triangle in anywhere in between all n 1 n 2 n 3 they will exist are you getting what I am saying. So suppose you take some triangle like this take any arbitrary point in the triangle n 1 n 2 n 3 all will be non-zero. If the point shifts towards node number 1 contribution of n 1 will increase contribution of n 2 and n 3 will reduce in deciding the potential of that point is very logical is it not. It is more intuitive of course it is by mass it will come but it is intuitive. And when the point coincides with node 1 the potential of that point is solely decided by node 1 which is is it not. Suppose the point is at centroid of this triangle then n 1 n 2 n 3 will all be equal to 1 by 3 is it not. That means all these potentials will have equal contribution in deciding the potential of that point. So it is like you know in other words it is like averaging is it not it is averaging right. So I think we will stop here and then we will continue in the next lecture.