Tuesday, September 11, 2007


nec2c is a translation of the Numerical Electromagnetics Code (NEC2) from FORTRAN to C. Operationally nec2c differs from NEC2 by being a command line non-interactive program, taking as arguments the input file name and optionally the output file name. While translating NEC2 to C I also took the liberty of changing the output format somewhat, without realizing at the time that I was making it incompatible with visualizing software such as xnecview. Others, though, have taken nec2c and restored the output format while improving its functionality and speed, as well as building a C++ library based on nec2c.

Manual Read more details on-line or download nec2c's manual.

Since version 0.6, nec2c incorporates a fix for a bug that was inherited from the original NEC2 FORTRAN code. This has been kindly fixed by G. Burke and you can read more details about it here.

Package Download source package of nec2c.

xnec2c is a GTK+ graphical interactive version of nec2c. It incorporates the nec2c core which it uses for reading input files and calculating output data, but it does not need and indeed does not produce an output file by default. Since xnec2c incorporates the nec2c core, it has access to all internal buffers, including structure data, frequency-related data (structure currents, input impedance, gain etc) and radiation pattern data (for the far field and near field). It therefore has the ability to graphically display user-requested data directly, as the frequency loop progresses or after input from the user. Graphs of frequency-related data and the current or charge distribution evolve as the frequency loop progresses, and radiation patterns (far and near field) are sequentially drawn for each frequency step. A new frequency can be entered by the user from spin buttons in the main or radiation pattern windows or by clicking on the graphs of frequency-related data. New output data are then computed and displayed in text and graphical form.

Manual Read more details on-line or download xnec2c's manual.

Package Download source package of xnec2c.

ExamplesExample Input Files: This directory has some example NEC2 input files that I used for testing xnec2c. They include some antenna designs of interest to radio amateurs as well as possibly to professional radio engineers (short verticals for low frequencies).

These are screen shots of xnec2c displaying structure currents or charges, frequency-related data and radiation patterns.
Click on the thumbnails for the full-sized images.

currents charges freq-plots radiation
Current distribution
in the structure
Charge density
in the structure
data: Gain, VSWR, Zi
Radiation pattern:
transparent wire grid

No comments: