The assembling of the matrix and the right hand side vector from (4.20) is demonstrated in the discretized domain from Fig. <4.4>. The entire domain is discretized and consists of the triangular elements to . The Dirichlet boundary is given by the curve elements , , , and . The Neumann boundary contains the curve elements , and . In the entire domain the nodes are numbered globally. In Fig. <4.4> the global node numbers are enclosed in circles. Since each element has three nodes, a local (element) number can be assigned to a node additionally to the global number. To map the local node number to the global one the so called connectivity array is used:
Considering (4.40) the global shape function is given by the union of all element (or local) shape functions, which are for the global node . From the local property (4.40) the global criterion follows
where is the position vector of the node . For example, the global trial function and (Fig. <4.4>) are given by
The plus operators must be treated as union operators, because the element form functions must not overlap. Taking into account the continuity of the solution across the element edges, it can be seen, that the coefficients comply with the values of the field approximation (in the global node ). The notation means the -th local (element) function in the -th triangular element . The subscript index of the element form function (superscript expression ) complies with the local node number in the -th element. The corresponding global node number is taken from the connectivity array and is equal to the global trial function number. The global trial function is non-zero only in the elements which are attached to the node with global number . As a consequence is non-zero in a very narrow area. With these considerations the matrix entry can be build piece wise in the elements sharing the global -th and -th nodes from the corresponding element form functions. For example the matrix element is given by
Analogously the remaining matrix entries are built. Most of the matrix entries correspond to global nodes, which do not belong to common elements and are zero for this reason. For instance, is such an entry. Thus is a sparse matrix.
Assembling like in (4.47) needs information of the neighbor nodes and the corresponding common elements. This information is contained in the connectivity array, unfortunately it cannot be obtained directly. Thus the assembling is performed in a different, reverse way. If the assembling of is performed as in (4.47), it can be seen that all possible variations of the element form functions
in all elements can be found as a summand in an expression for a matrix entry . The assembling proceeds element by element. For each element all possible variations (4.48) are calculated and added to the corresponding global matrix entry . Instead of now the superscript index is used, since by the element wise assembling the current element number is known implicitly. Thus the superscript index refers to the current element and notes that the indexes and are element (local) indexes. Otherwise, if no superscript index is written, and are global indexes. The local indexes are transformed to the corresponding global ones by the connectivity array. The global matrix is built from the element matrices on a very efficient way. Thus the finite element formulation for a given problem is mostly solved by giving the general expressions for the entries of the element matrices [48,49].
Let the permittivity be scalar ( ) and element wise constant for the further calculations. Thus using (4.41), the element matrix for the current problem is given by
The Dirichlet boundary is considered by the coefficients for , which are easily obtained from (4.23) taking (4.46) into account