OVERVIEW Numerical Electromagnetic Code for Antenna Analysis By the Method of Moments and similar problems R. P. Haviland, W4MB BACKGROUND ON MOMENT METHODS The basic equations of antennas were well worked out nearly 100 years ago, not too long after the invention of the dipole and the loop antennas by Hertz. However, the equations were complex and "mathematically intractable", and the early solutions were for limited conditions and special cases. The theories of very short dipoles and very small loops were the first developed. However, it took until the 1930s to get a good solution for dipoles with sinusoidal current distribution at resonance. The theory of arrays of antennas based on the assumption that they could be regarded as point sources came very early, and further advances were made in the 1930s. However, there was still a gap between calculations and measurements for most antenna types. In the 1960s, a new method of obtaining solutions to the equations was developed. Instead of demanding that results were correct at all points on the antenna, exactly correct values were demanded only at selected points, the ends of the antenna and some specific intermediate points. It was recognized that the values away from these points could be in error, but the amount of error could be controlled by selection of the number of points, and by making some assumptions as to the nature of variation between selected points. Following mathmetical nomenclature, the importance of the accumulated error is called its moment (as in the phrase, a momentous occasion). Consequently, the method of analysis came to be called the Method of Moments. It should be remembered that the "exact" used above is a mathmetical fiction. The starting equations are exact, but difficult to solve. Approximations must be used to get numerical results. The accuracy of these must be watched. This use of approximations is found in all of the antenna solution methods. A goal of the originators of the programs has been to make the programs "exact" in the practical sense© hopefully, they are as accurate as the measurement which can be made under conditions outside the laboratory. For many years these techniques were exclusively used by specialists, often under limits of military security. Two factors made the techniques available to Amateurs. One was the development of the small powerful computer, at a price within the Amateur pocketbook. The second was the development and release of a simplified version of the Method of Moments as applied to wire antennas, specifically intended for these computers. The pair made analysis relatively painless. It was possible to think of the antenna in terms of dimensions and connections, common Amateur practice. And the computer did all of the drudgery. Even the time needed became negligible, going from minutes and hours to seconds and even fractional seconds today. This first program to be generally available was called MININEC, standing for Miniature Numerical Electromagnetic Code. While the first version was used by a small number of amateurs, use did not become common until the third version became available, first as developed, then with modifications intended for simplest possible use. The extent of use can be judged from the number of articles based on MININEC results which have appeared in Amateur publications. Users of MININEC will recall will recall that it is: ©Limited to thin wires ©Limited to straight wire segments ©Uses constant current distribution on segments ©Allows near and/or far field calculations ©Allows reactance or resistance at segment junctions ©Provides for single or multiple voltage excitation. And calculates: ©Drive point resistance and reactance ©Current distribution on elements ©Power at specified voltage input ©Far field pattern and gain at specified angles ©Near field intensities along a line. These may be calculated for free space, or with a ground present. However the ground directly under the antenna is always a perfectly reflecting ideal earth. This means that drive impedance errors are appreciable for antennas lower than about 1/4 wavelength above ground. This also affects the far field pattern, in particular the depth of the nulls in the pattern. Errors are acceptably small for higher antennas. Since MININEC is a "minature" code, it follows that there was a full©featured code. This was the earlier NEC. SUMMARY OF NEC FEATURES NEC stands for Numerical Electromagnetic Code. The first version of the program (7) was constructed in the late 1970s, although it derives from an antenna analysis program developed a few years earlier. The program is now in its fourth revision, which is being validation tested. However, the last two revisions are restricted to military use, so only the first two revisions are available to Amateurs. (The third revision may be released for general use "any day now"). The following is based on NEC2, with a few indications of changes reported for later revisions. One difference between NEC and MININEC is the handling of assumed segment current variation. Instead of a single form, NEC uses a three term relation, of the form, constant + sine term + cosine term. This means that NEC will give good results with fewer segments than needed for MININEC. This also means that large problems can run faster. Additionally, because NEC provides automatic storage of data on tape when problems are too large for available memory. NEC can handle far more complex antennas. Another difference is that there is an alternate special routine to calculate current on the surface of a wire, rather than assuming that it is concentrated at the wire center. This means that NEC can be more accurate for fat wires. NEC has three methods of exciting an antenna by direct connection. One is a current source, and two are different methods of modelling voltage sources. Antennas may be excited by incoming fields, rather than only by direct connection. There are three possible modes for incident wave excitation, linear and the two senses of circular polarization. There are some restrictions on use of sources, for example, no mixing of the three basic types, voltage, current or incident wave. Other than these points, there is little difference between MININEC and NEC on a lot of Amateur antenna problems. Results are essentially identical for, say, a four element Yagi located well above earth. There is no reason to abandon MININEC for a lot of work. A few tries with NEC will show that the simpler program is best for simple problems. Where NEC really shows its value is in going beyond the limits of MININEC or other programs. For example, NEC will accept input describing wires bent in an arc, or even into helices. Internally, it handles these by simulation with straight segments, which can be done with MININEC. But the process is automatic in NEC. Also,because of its handling of memory, NEC can solve large elements or even arrays of this type. (The spiral antenna use in printed circuit antennas is a helix of zero height: NEC4 can handle logarithmic spirals.) Another NEC extension is ability to handle surfaces. These must be sections of a flat surface, joining other surfaces at the edge. Three or four sided surfaces are possible, singly or as divisions of a large plane surface. Wire©surface junctions can be made, for good analysis of, say, a 2 meter antenna mounted on an auto. This can be simulated with the other programs by wire grid models, but only crudely, due to problem size restrictions. Dish and horn antennas can be modeled as surfaces. NEC can handle very complex surfaces, either directly as solid sheets or as wire grids. Probably the most important feature of NEC for Amateur use is the possibilities for solutions involving the presence of the earth. Free space or ideal ground are two possibilities. Another is reflection coefficient approximation to ground, which, in essence, multiplies the radiation from the underground or image antenna by a factor to account for ground loss. The last possibility is a relatively exact solution based on the work of Sommerfield. This involves table look©up of data prepared separately (and slowly). Any one table applies only to the ground condition and frequency specified, so studies of antenna©ground interactions at different frequencies and ground types is time consuming. The calculation method selected applies to ground directly under the antenna as well as at the point of ground reflection. In addition, more ground conditions can be specified, but apply only to the far field. These may be in circular or linear zones, of different elevations, to simulate hills and valleys. The equations are valid for antennas close to the edge of a cliff. Ground screens can be specified. The near and far fields can be calculated. NEC includes a number of routines to simplify setting up antennas and structures. Symmetry can be used to specify these: for example a rhombic can be specified by one wire and double symmetry. Quasi©circular structures are specified by one face and the number of faces. Arrays are easy, since any antenna or structure can be duplicated at one or more other locations. There are a few other time savers, such as use of interaction range approximations for well separated elements. Loads can be introduced into elements as series or parallel RCL circuits, as impedances, and/or as wire resistance. Transmission lines may connect point pairs on elements or structures, and two©terminal networks any pair of points. True transmission line relations are used, much more accurate than can be obtained with parallel wires in other programs. NEC3 and NEC4 include routines for insulated wires. NEC4 can handle sagging wires directly, and includes detection of error producing overlapping and intersecting wires. The range of output data in NEC is large. The charge on a wire is available as well as the current. Coupling between elements can be output. Far field patterns can use an internally generated format, or one specified. Fixed frequency or stepped operation can be selected, with linear or constant percentage steps. Some intermediate results can be saved to shorten run time on other but similar problems. The paper output of NEC can only be called verbose. It is divided into sections, with the input instructions printed first, then the pertinent conditions, followed by the actual output. The run time of each section is shown, and usually is surprising small. THE PURPOSE OF NECCARDS NEC is written in Fortran, the first language developed which did not use machine language for programming. It is still a powerful tool, preferred for large complex scientific and engineering problems. However, is not as easy to use as BASIC. The NEC program is large: a printout of the source code of programs and subroutines by pages is well over an inch thick. Also, as required by techniques of the time, NEC is structured for input by punched cards, and temporary recording by tape. Some 36 card types are needed to cover all features, each have at least one input and some up to four integer and up to seven decimal values. Setting up a problem is not easy. While there is more freedom in card order than found in many Fortran programs, there are many complex order and format requirements. Rather than an extensive re©write to allow full direct input from the keyboard and use of disk for input and records, the approach here is to retain the card technique, and modify only direct input and output for disk operations. For initial input, the card program encompasses the full range of NEC analysis possibilities, simplifying these by calling for inputs in a logical order acceptable to the program. The program output is written to disk as a simulated tape, in the style that is generated by cards. These "card images" are then used for input to the NEC program itself. The public domain NEC program packagae includes a number of specialized programs, for input and output. A few of these are included here. One is CHECKER, which checks an input file for duplication. The second is GRAPS, a graphical plotting package. The final one is SOMNEC, which generates the special files called TAPE21 used for description of Sommerfield ground analysis. Additionally, input and ooutput files are compatable with many common programs. For example, a text or line editor can be used to read, check and modify the card images use for input. These plus a spreadsheet can be used to read most of the output files. Full feaured spreadsheets include analysis and plotting programs, useful for presenting data. OBTAINING PROGRAMS AND PROGRAM DATA The basic source for NEC (and for MININEC) is the Applied Computational Electromagnetic Society, ACES. This may be as NEEDS, a package of antenna programs, or as individual programs, all in source and compiled code form. It is necessary to become a member to obtain the programs from this source. This also brings a Newsletter, a Journal, makes many other programs available, and guarantees that the latest released version can be obtained. Although much of the Newsletter/ Journal material is based on complex mathematical techniques, there is a wealth of practical material. This includes such items as hints on accurate modelling, design of small antenna ranges, graphs of earth characteristics, and reports of bugs and corrections to programs. The material is almost a necessity for any serious worker on antennas. For information, write Dr. Richard Adler, Secretary, ACES, Naval Postgraduate School Code EC/AB, Monterey, CA 93943 The second source for NEC is the report, Numerical Electromagnetics Code (NEC) - Method of Moments, G. J. Burke and A. J. Poggio, available from the National Technical Information Service, Springfield, VA 22161 as AD-AO75 460. This three part report includes theory, code description and fortran code. It is available in microfiche at a very reasonable cost, or in paper at greater cost. This report is an enormous aid in full use of the capabilities of NEC, and is a necessity if program modifications are to be attempted. Versions of NEC are also available from other commercial sources. The announcing ads do not specify the source version. They also imply but do not state that some features of the original code have been eliminated, so check the detail capabilities if you have a difficult problem. Check also the InterNet files if you have access to that system. See the ads and announcements in QST, other amateur magazines and in the technical journals and newsletters for future changes in availability. This computational field is still developing.