Transactions on Engineering Sciences vol 11, © 1996 WIT Press, www.witpress.com, ISSN 1743-3533 The FEMAX package for static and stationary electric and magnetic fields I.E. Lager, G. Mur Faculty ofElectrical Engineering, Laboratory of Electromagnetic Research, Delft University of Technology, P.O. Box 5031, NL-2600 GA Delft, The Netherlands ABSTRACT A finite element package is described for computing stationary and static electric and magneticfieldsin inhomogeneous media. A high efficiency and accuracy are obtained by formulating the problem directly in terms of the requiredfieldstrength. The medium parameters inside the domain of computation can be both linear and nonlinear and they may be anisotropic, also. A combination of edge and nodal elements is used for obtaining an accurate expansion of the field strength throughout the domain of computation. This is done such the conditions on internal surfaces of discontinuity in medium parameters, as well as along the outer boundary, can be modeled easily. Various post-processing facilities are available for examining the computed data. 1 INTRODUCTION Finite element methods for computing stationary and static electromagnetic fields are usually formulated in terms of (vector) potentials. Potentials have the advantage that they can be chosen to be continuous across internal surfaces of discontinuity in medium parameters with the consequence that the very convenient nodal expansion can be used throughout the entire domain of computation. However, there are the field strengths rather than the potentials that have a physical or practical meaning. Thesefieldstrengths can only be computed from the potentials by means of a numerical differentiation with an inherent loss of accuracy. The computation of the electromagnetic field can be carried out more efficiently if the field strength is computed directly. In case of a finite element formulation this requires a discretization technique that allows the modeling of continuity conditions for the field at interfaces between media with Transactions on Engineering Sciences vol 11, © 1996 WIT Press, www.witpress.com, ISSN 1743-3533 296 Software for Electrical Engineering different electric and/or magnetic properties. The well known decoupling of the electric and magnetic fields in case of the stationary and static states of the electromagnetic field [1, 2] requires that the stationary magnetic, stationary electric and electrostaticfieldsneed to be examined separately. We shall combine these three cases in one generic formalism. The above ideas were implemented in thefiniteelement code FEMAX. In this code use is made of a combination of consistently linear edge and nodal expansion functions [3] that together enable the correct and consistent modeling of the continuity conditions at interfaces inside the domain of computation. 2 THE GENERIC FORMALISM The position of an arbitrary point r is specified by its three coordinates {x,y,z} with respect to a background Cartesian reference frame with origin O and three mutually perpendicular base vectors {t\, 1*2,^3} of unit length each. The unit vector along the normal to an internal surface of discontinuity in medium parameters (J) is denoted as i/ and the unit vector along the outwardly oriented normal on the boundary (dT>) of the domain of computation (7)) is denoted as n (see Fig. 1). In order to simplify the computer code, the three respective cases of stationary and static electric and magneticfieldsare mapped on one generic formalism. All computations are carried out within the frame of this generic formalism, while preserving the original physical significance of the field quantities for the input and output data. The correspondence between the generic values and the electromagnetic field values is given in Table 1. The following notation is adopted: V = V(r) the (generic)fieldstrength, dVy n+ F = F(r) the (generic)fluxdensity, ( = £(V\r) a (generic) constitutive parameter; gimp _ Qimp(r) the (generic) volume source density of impressed (known) curdT> = dT>v U dT>p rent, Q™P = Q%*(r) the (generic) surface Figure 1. The domain of computation %). source density of impressed (known) current, pimp _ pimp^ the (generic) impressed (known) volume charge density, 0.imp _ 0.imp^ the (generic) impressed (known) surface charge density, ^ext _ <^ext^ a (generic) known vector function used for prescribing Dirichlet boundary conditions (the boundary conditions on the subsurface dVy C dU where tangential components of V are prescribed), 0.ext _ p-ext^ a (generic) known scalar function used for prescribing Neumann boundary conditions (the boundary conditions on the subsurface 3T>p — dV\dVy where normal components of thefluxF are prescribed). Transactions on Engineering Sciences vol 11, © 1996 WIT Press, www.witpress.com, ISSN 1743-3533 Software for Electrical Engineering 297 Table 1. Correspondence between generic quantities and stationary and static electromagnetic Held quantities. Generic formulation V F t Qimp or pimp ^amp #ext ^.ext Static Stationary electric field electric field E E J D a e 0 0 0 0 -V • J*™P ^r <yimp -i/ • J^P |? n x E^ n x E** n . J™P <" Stationary magnetic field H B M jimp Jf* (ft* <C> n x JET" _ext ^m For stationary and staticfields,the generic basic equation, the generic constitutive relation and the generic interface condition read V x V = Q™P, F = £V, v x V \l= Q^. (1) (2) (3) At the outer boundary dV of the domain D, the generic boundary conditions n x V = #**' on dT>v (4) need to be imposed. The generic formalism is made complete by adding a set of compatibility relations [4]. In case of the time-domain formulation the compatibility relations follow implicitly from the field equations. In case of the stationary and static fields they have to be explicitly made a part of the formulation in order to ensure the uniqueness of the solution (see also [5]). In the subdomains of the domain of computation where the electromagnetic field vectors are continuously differentiate functions of the spatial coordinates the electromagnetic compatibility (divergence) relation V • F = imp (5) applies. The field vectors are not differentiate with respect to all spatial coordinates at the interfaces between regions with different medium parameters. In that case Eq. (5) is replaced by i,.F\*=o*». (6) Transactions on Engineering Sciences vol 11, © 1996 WIT Press, www.witpress.com, ISSN 1743-3533 298 Software for Electrical Engineering A third type of compatibility relation is found when studying the behaviour of the field near the outer boundary of the domain of computation. The compatibility relation corresponding to Eq. (6) on dVp is obtained as n • F = -cr«*. 3 (7) DISCRETIZATION OF THE EQUATIONS IN THE LINEAR CASE For topological reasons, the domain of computation to which thefiniteelement method is applied is divided into tetrahedra. The field values are discretized using a combination of vectorial nodal and edge expansion functions. Nodal expansion functions are used inside homogeneous regions, edge expansion functions along interfaces between those regions. The minimum value of the contrast in the medium parameters in neighbouring tetrahedra for which use is made of edge expansion functions is user defined. The user can prescribe the use of edge expansion functions along (parts of) the outer boundary. This option is particularly useful in case reentrant corners are present in the outer boundary, since it reduces the local error at those locations. The resulting expansion can be written as V = J>Wp-">, (8) i where Wp^' denotes the edge (E) or nodal (N) expansion used. Note that, because of employing consistently linear elements, a local approximation error O(/i^), where h denotes the length of the longest edge of a tetrahedron used locally, is obtained in the representation of the field strength V. A weighted residuals method is applied for constructing the system of linear equations for computing the expansion coefficients [6], The weighted residuals equations are Z, v, [ &,, (V x Wf*>) • (V x W?*>) + (9) + Je,, (V - (f Wf '">)) p»P, Vj, where 2%j = D* D *Dj is the cross-section of the span *Dj of the weighting function wf^ and the span £>, of the expansion function W^ . The boundary condition (4), the interface compatibility (6) and the boundary compatibility (7) are implemented by imposing the implied relations between the expansion coefficients, explicitly. 4 COMPUTATION OF NONLINEAR FIELDS Nonlinear fields are computed by means of the parallel- chord method [7], At each global iteration the nonlinear medium parameters are updated on basis of the field strength' values computed at the previous iteration, a Transactions on Engineering Sciences vol 11, © 1996 WIT Press, www.witpress.com, ISSN 1743-3533 Software for Electrical Engineering 299 system of linear algebraic equations is built on basis of the set of equations for the linear case, the system of linear equations is solved and the updated field strength values' are computed. The iterative process stops when the relative error at two subsequent global iterations defined as NONLINEAR ERROR K = becomes smaller than a prescribed value or when the prescribed maximum number of iterations is exceeded. 5 THE FEMAX PACKAGE The FEMAX package consists of the FEMAXSfiniteelement code and the FEMAXP and FEMAXL codes that can be used for post-processing the results obtained by means of FEMAXS. The FEMAXS code uses the SEPRAN finite element package [8] for a number of elementaryfiniteelement tasks like generating the mesh, assembling the system of linear equations from the element matrices and solving the system. The FEMAXP and FEMAXL post-processors use the graphic routines included in the NAG library [9] and require the GKS interface [10]. The package was written in FORTRAN-77. FEMAXS inherits most of the options implemented in the earlier timedomain and frequency- domain versions of the FEMAX package [3]. Some new features that have been added are: • A set of integral values can be computed, i.e. surface or line integrals of the field strength and/or flux density along user-defined (closed) surfaces and/or lines. These integral values can serve for analysing the accuracy of the solution. • In the interior of the domain of computation the user can specify nonlinear medium parameters. For nonlinear media, the characteristic £ = £(V,r) or, more general, F = F(V,r) need to be prescribed. • An MS-DOS post-processor for generating 3D plots is available for sites where the NAG or GKS libraries cannot be used. • A set of "M-files" for post-processing the results inside the MATLAB computing environment [11] have been also written. 6 NUMERICAL RESULTS In the following, numerical results will be shown for three different problems. First, for demonstrating the accuracy of the FEMAX package, a test problem with a known analytical solution, the so called "Charged Brick" problem, is solved (see Figure 2 a). A "Brick" of electric charge with constant volume density p(x,y, z) = 4%eo [C/nf] is symmetrically placed in the origine of the reference frame. The medium is assumed to be homogeneous, linear and isotropic. The electrical permittivity is €Q. Transactions on Engineering Sciences vol 11, © 1996 WIT Press, www.witpress.com, ISSN 1743-3533 300 Software for Electrical Engineering E [V/m] Figure 2. The configuration for the " Charged Brick" problem, a) The configuration for the linear medium, b) The characteristic of the nonlinear medium. Because of the symetry of the problem it is sufficient to study the configuration in the octant {a,i/,z} > 0. On the planes x = 0, y = 0, z — 0 Neumann boundary conditions of the type n • D = 0 are imposed. Dirichlet boundary conditions are set elsewhere using the analytical solution. The domain of computation was discretized by means of a relatively coarse mesh of 10 x 10 x 10 parallelepipeds that are each divided into 6 tetrahedra. The mesh is increasingly coarser when moving away from the corner of the "Charged Brick" {aj,2/,z} = 1. Since no discontinuities in the material parameter are present, nodal elements can be used throughout the domain of computation. With these choices the total number of unknowns amounted to Nunk = 3993, Nbnd = 693 of them being explicitly specified. The system of equations was solved using a ICCG iterative solver with an incomplete LU decomposition preconditioner that allowed obtaining a relative error of 2.23 • 10"" after 24 iterations. The total charged CPU time for solving the problem on a DEC-AXP 3000 workstation was about 4.5 minutes. The overall value of the root mean square relative error in the result for the electric field was 1.34%. In Fig. 4 the plots for the local relative error in computing the electricfieldstrength along the plane z = 1 are presented. The integral of the flux density was computed on the surface of the cubes \x\ < 1.0001, \y\ < 1.0001, \z\ < 1.0001 and \x\ < 1.9999, \y\ < 1.9999, \z\ < 1.9999. The relative error in computing the surface integrals was -1.73% and 0.12%, respectively. Secondly, for demonstrating the accuracy of the FEMAX package in modeling interfaces between highly contrasting media, the so called "Test Slot" problem, is solved (see Fig. 3). A single, rectangular slot of an electric machine is studied. The slot being infinitely extended in the Oz direction yield the problem to be two-dimensional. Because the symmetry of the problem it is sufficient to study only one half of the slot. Transactions on Engineering Sciences vol 11, © 1996 WIT Press, www.witpress.com, ISSN 1743-3533 Software for Electrical Engineering 301 y HB Copper/IT = 1 [ ] Iron /XT = 1000 I I Air/XT = 1 Figure 3. The configuration for the "Test Slot" problem. The domain of computation was discretized by means of a relatively coarse mesh of 10 x 10 x 1 parallelepipeds that are divided in 6 tetrahedra. The mesh is increasingly coarser when moving away from the iron/air interfaces. Edge elements were used along the interfaces while nodal elements were used elsewhere. With these choices the total number of unknowns amounted to Nunk = 1668, Nbnd = 130 of them being explicitly specified. Because of the small number of unknowns, the system of equations was solved using a direct method, which proved to be faster. The total charged CPU time for solving the problem was about 45 seconds. The field distribution throughout the domain of computation is presented in Fig. 5 a. In Fig. 5 b the jump in the normal component of the field strength along the interfaces AC and CD (see Fig. 3) is depicted. Note that the value of the contrast in the medium parameters, i.e. 1000, is accurately reflected in the jump of the normal components. The value of the line integrals of the field strength was computed along the closed loops ABGHA and ABCDEFGHA. The relative error in computing the values of the line integrals was 0.5% and 1.3%, respectively. Finally, as an example for a nonlinear problem, we include the solution for the "Charged Brick" problem, in which the linear medium was replaced with a nonlinear medium that has a relative permittivity e^ — CT(V) shown in Fig. 2 b. The permittivity was chosen such that the medium is fully saturated at about 75% of the peak value of the modulus of the electric field computed in case of the linear "Charged Brick" problem with e^ = 2. The Dirichlet boundary conditions were set to 0. The same mesh as for the linear case was used. A number of 11 global iterations were necessary for obtaining a relative error of 0.0198% (see Eq. (10)). The total charged CPU time for solving the problem was about 1 hour. The integral of the flux density was computed on the same surfaces as in the case of the linear "Charged Brick" and the obtained relative error was -10.5% and -9.27%, respectively. In Fig. 6 the distribution of the modulus of the electric field strength and of the relative permeability along the plane z = 1 is presented. Transactions on Engineering Sciences vol 11, © 1996 WIT Press, www.witpress.com, ISSN 1743-3533 302 7 Software for Electrical Engineering CONCLUSIONS We have shown that the FEMAX package is an efficient and accurate code for computing stationary and static electric and magnetic fields. The freedom of choice between the edge and nodal elements allows an accurate modeling of the internal surfaces of discontinuity in medium parameters without excessively increasing the number of unknowns. The use of consistently linear elements yields a local approximation error 0(h?) in the representation of the field strength. Note that a method based on the use of vector potentials and linear expansion functions would yield a local approximation error 0(h) in the representation of the magnetic field strength for about the same computational effort. By mapping the three basic types of static and stationary electric and magnetic fields on one generic formalism the resulting code is very compact without inducing any restrictions on the range of problems to be solved. The package is capable of computing fields in arbitrarily inhomogeneous and (an)isotropic media that may be nonlinear. REFERENCES [1] Haus, H.A. and Melcher, J.R., Electromagnetic Fields and Energy, Prentice-Hall Inc., Englewood Cliffs, New Jersey, 1989. [2] Nayfeh, M.H., Brussel, M.K., Electricity and Magnetism, John Willey & Sons, New York, 1985. [3] Mur, G., "The FEMAX finite element package for computing threeedimensional time-domain electromagneticfieldsin inhomogeneous media", in Software Applications in Electrical Engineering. Computational Mechanics Publications, Southampton, 1993. [4] Lager, I.E., Mur, G., "Compatibility Relations for Time-Domain and Static Electromagnetic Field Problems" in Applied Computational Electromagnetics Society Journal, Vol. 9, No. 2, pp. 25-29, 1994. [5] Jiang, B., Wu, J., "The Origin of Spurious Solutions in Computational Electromagnetics", NASA Technical Memorandum 106921, ICOMP-958, 1995. [6] Lager, L, Mur, G., "The Finite Element Modeling of Static and Stationary Electric and Magnetic Fields", submitted for publication in IEEE Transactions on Magnetics. [7] Ortega, J.M., Rheinboldt, W.C., Iterative Solution of Nonlinear Equations in Several Variables, Academic Press, New York, 1970. [8] Segal, A., SEPRAN, Sepra Analysis, User's Manual, Sepra, Leidschendam, The Netherlands, 1984. Transactions on Engineering Sciences vol 11, © 1996 WIT Press, www.witpress.com, ISSN 1743-3533 Software for Electrical Engineering 303 [9] ***, NAGj Graphical Supplement Manual - Mark 2, Numerical Algorithms Group Ltd, Oxford, UK, 1985. [10] ***, VAX GKS Reference Manual, Volume I, Digital Equipment Corporation, Maynard, Massachusetts, USA, 1987. [11] * * *, MATLAB. High-Performance Numeric Computation and Visualization Software. Reference Guide, The Math Works, Inc., Natick, 1993. ERR(Ez) max = 3.98% Figure 4. Results for the "Charged Brick" problem. The local relative error in computing the electricfieldstrength for x E [0, 2], y € [0, 2] and z = 1. Figure 5. Results for the "Test Slot" problem, a) The values of the magnetic field strength components for x £ [0, 2] and y G [0, 4]. b) Detail representing the jump in the normal components along the interfaces. Transactions on Engineering Sciences vol 11, © 1996 WIT Press, www.witpress.com, ISSN 1743-3533 304 Software for Electrical Engineering Figure 6. Results for the nonlinear "Charged Brick" problem. The values of the electric field strength modulus and of the relative electric permittivity for x G [0,2], y G [0, 2] and z = 1.