Open-Source Software for Electromagnetic Scattering Simulation: The Case of Antenna Design

Electromagnetic scattering simulation is an extremely wide and interesting field, and its continuous evolution is associated with the development of computing resources. Undeniably, antenna design at all levels strongly relies on electromagnetic simulation software. However, despite the large number and the high quality of the available open-source simulation packages, most companies have no doubts about the choice of commercial program suites. At the same time, in the academic world, it is frequent to develop in-house simulation software, even from scratch and without proper knowledge of the existing possibilities. The rationale of the present paper is to review, from a practical viewpoint, the open-source software that can be useful in the antenna design process. To this end, an introductory overview of the usual design workflow is firstly presented. Subsequently, the strengths and weaknesses of open-source software compared to its commercial counterpart are analyzed. After that, the main open-source packages that are currently available online are briefly described. The last part of this paper is devoted to a preliminary numerical benchmark for the assessment of the capabilities and limitations of a subset of the presented open-source programs. The benchmark includes the calculation of some fundamental antenna parameters for four different typologies of radiating elements.


Introduction
Numerical simulation applied to electromagnetic scattering problems represents a very broad and multifaceted field. Historically, its bases derive from the initial attempts to find numerical solutions for describing electromagnetic propagation phenomena in complex and realistic scenarios, where analytical calculations were inapplicable. Throughout the years, the enormous increase in the available computer power, as well as the benefits of hardware task parallelization, have brought the electromagnetic simulation to a new era. Simultaneously, the worldwide availability of Internet connections, as well as the widespread diffusion of information and communication technologies, have removed all the barriers in opening science [1].
In this fast-growing background, the use and the development of numerical software for electromagnetic simulation follow two main directions.

•
In the industrial world, the standard approach is to employ commercial software suites, because of their easy integration in the design workflow, as well as their extended support and documentation.

•
In the academic world, it is very frequent to develop in-house simulation software from scratch, or alternatively to modify existing software packages in order to experiment new models and

Open-Source Programs and Free Software
To start with, a first distinction should be made between open-source codes (and free, according to the definition given by the GNU project [14]) and software whose access is free of charge, but still remains proprietary.
The programs belonging to the first family are also released with their source code, which can be freely studied, modified, and customized to the user's needs. However, it is worth noticing that some restrictions can apply to the redistribution of modified versions of the software.
The second family of software is characterized by only a binary distribution of the packages, and therefore no changes by the user (e.g., integration, porting, modification, etc.), as well as no access to their sources, are allowed.
This paper is focused on open-source software. Hence, other programs, which can be found on the Internet for free but are available only in binary closed-source form, are not discussed here.

Design Workflow
In general, the workflow of any device is a complex process, made of many different phases, that could be reiterated until a satisfactory result is obtained. A simplified sketch of the antenna design workflow, in which hardware prototyping and the subsequent steps are not included, is reported in Figure 1.
Without entering in all the details, from the point of view of the electromagnetic simulation, three subsequent phases in the design process of antennas and electromagnetic devices can always be identified. According to the common terminology, we have:

•
Pre-processing; • Solution of the electromagnetic problem, by means of a proper numerical "engine;" • Post-processing.

Pre-Processing Phase
The goal of the pre-processing phase is to translate the initial idea of the actual object into an approximate computer model, compatible with the numerical solver. This phase can be in turn decomposed in various steps. The most significant are:

•
Description of the geometric parameters of the design; • Approximation of the geometry by means of a proper modeling tool, through the generation of a (structured or unstructured) mesh. In this way, the device is decomposed into elementary building blocks; • Description of the physical parameters; definition of the sources and choice of the correct model; • Final definition of the simulation model; • Generation of the input data for the solver engine.
To carry out these steps, the user can interact with the software either with a graphical user interface (GUI) or by writing a text file in a specific scripting language. A mix of these two approaches is also possible. Furthermore, during this pre-processing phase, the documentation useful for the production of the device may be generated (e.g., drawings, layouts, part list, etc.).

Solution Phase
In this phase, the data generated during the pre-processing step are supplied to a solver engine, in order to obtain the numerical solution of the electromagnetic problem. The solver will generate one or more output files containing the results, to be used in the post-processing phase.

Post-Processing Phase
In the post-processing phase, the requested data are extracted from the output files provided by the numerical solver. In this case, too, the operations can be defined with a graphical interface, or by using a command script.
The collected data may be organized in files, tables, or graphs, and will be used for different purposes. Of course, the first purpose is the verification of the result. However, the output data may be also used to complete the documentation (both internal and public), to perform comparisons with other simulations and/or similar devices, or even to generate input data for other simulations.
An additional objective of the post-processing may be to generate the documentation needed for the production of the device, if not yet created during the pre-processing phase.

Calculation Methods
The most common calculation methods adopted for the electromagnetic simulation can be subdivided into several classes, based on the kind of numerical approximation of Maxwell's equations. Moreover, both methods operating directly in time domain and single-frequency approaches exist.
Not all the possible numerical methods are implemented in an open-source version. As regards antenna design, the choice is essentially limited to two methods: the Finite Difference Time Domain method (FDTD) and the Method of Moments (MoM, implemented in the frequency domain). A third approach, which is widespread in the open-source community for the solution of complex equations, i.e., the Finite Elements Method (FEM), is usually implemented in multi-physics packages not necessarily focused on electromagnetic applications, and at the present time, it does not appear sufficiently mature for an open application in electromagnetics. However, some promising FEM codes are briefly discussed in Section 7. A more deep discussion about the cited methods, as well as their open-source implementations, will be presented in the following sections.
It should be noted that it is quite difficult to describe methods' formulations with a correct level of detail in the framework of this review, especially for the most advanced techniques. In addition, there would be a risk of repetitions with respect to the existing scientific literature. For these reasons, we decided to provide some key references to theoretical works on modeling formulations instead of replicating part of their content and equations. For readers interested in the mathematical bases of the presented methods, several very good books exist where the most common formulations are presented, discussed and compared [15][16][17][18]. These books may be very useful for educational purposes, too.

Advantages and Disadvantages of Commercial and Open-Source Products
It is to dispel the common opinion that open-source packages are in all cases worse than their commercial counterparts. In particular, when electromagnetic simulation is concerned, open-source software is usually very rigorous and formally correct from both the mathematical and the numerical points of view. Nevertheless, it is true that open-source packages for electromagnetics are less versatile and they lack most of the ancillary tools typical of commercial products. This is mainly due to the relatively young and niche field, even for the open-source community: the result is a slow development of complete packages for electromagnetic calculations. Despite these facts, several packages that can be fruitfully used-and in constant development-exist.
In general, high-level commercial products contain all the tools required for the whole design workflow. Conversely, they are characterized by high costs for buying and maintaining the license. It is worth noting that student versions of commercial simulators are often available, but they are significantly limited (with few exceptions) and do not allow professional usage. Academic versions may be also available (free of charge, in few cases, or with noticeable discounts) but their license is quite restrictive and their use outside non-commercial research purposes is prohibited. A rough and not-exhaustive list of pros and cons related to commercial packages is reported in Figure 2.  At present, the use of open-source software for electromagnetic simulation requires the integration of inhomogeneous products, which seldom offer the same level of functionality. If a complete system is needed (i.e., including pre-processing, solver engine, and post-processing) it is sure that several open-source packages should be integrated together with other "homemade" modules. However, the possibility of accessing source codes and the existence of good developers communities sometimes allow the user to solve problems quicker than with commercial products. A concise list of key points about open-source software in electromagnetics, describing some pros and cons, is reported in Figure 3. The generation of graphs, tables and text documentation is relatively simple (but external software is usually required) •

Open-source electromagnetic simulation software
The formats of files adopted in the program flow are known, and standard import/export formats are sometimes supported • The developers communities are often very available for discussions and suggestions Weaknesses: • GUI is often absent (or it is very rough) • Each phase of the design usually requires one or more different software packages, which should be integrated by the user • Powerful but difficult to use geometric modeling modules and mesh generators • FDTD mesh generation with graphical modeling tools is rather difficult • The capability to interface and manage some proprietary file formats (adopted in commercial packages) is absent even in high-quality products • There are very few reliable and user-friendly solver engines • Any software program implements only a single numerical solving method • Very sophisticated solvers exist, which can deal with different mathematical models, but their complexity results in a very steep learning curve • Parametric optimization is usually possible only by means of external tools (that should be integrated by the user) • An immediate graphical visualization of the processing progress is difficult (or not convenient) • Documentation is sometimes incomplete, obsolete, or completely absent

Method of Moments
Historically, Method of Moments [19,20] is the first kind of solvers for which the initial open-source applications were developed. The most famous code that implements the MoM is the NEC-2 [21]. Most of the MoM applications are developed in the frequency domain, and the open-source world is not an exception. In fact, all the programs described in the following sections have been elaborated starting from Maxwell's equations in the frequency domain.

NEC-2 and Derived Programs
The reference program for many open-source applications of the MoM is NEC-2 [21,22]. The NEC-2 code is based on the so-called thin-wire kernel [23], where only axial currents are considered and modeled according to a three-term expansion that was proposed by Yeh and Mei [24]. This approach implies that NEC-2 is limited to the modeling of structures composed of metallic wires or tubes. Furthermore, although wires could be also connected by means of lumped elements networks or transmission lines, the surrounding environment should be vacuum (free space) or, at most, a half-space. Therefore, antennas and devices containing dielectric parts cannot be simulated, even though in the past the code was employed for simulating the emissions radiated by printed circuit board tracks [25]. When metallic plates have to be modeled, they are approximated with a grid of wires [26][27][28]. There are also some limitations about the positioning of intersections and reciprocal positions of wires, that have been highlighted through the years.
Despite these limitations, this software program is successfully adopted for the analysis, the design, and the validation of various kinds of antennas. To cite some examples, Olver and Sterr used NEC-2 for validating the project of a corner reflector antenna developed with the FDTD method [29]. NEC-2 has also been used for the calibration of antennas for electromagnetic compatibility [30,31], as well as for the modeling of lightning [32] and transient over-voltages [33]. NEC-2 code has also found interesting applications in radio astronomy, in particular for projects related to low-frequency radio-telescopy [34,35]. The use of NEC-2 as a simulation engine in optimization processes has been proposed for the project of generic wire antennas [36], as well as for the optimization of the parameters of dipole arrays [37] and the design of logarithmic-periodic antennas [38]. In the field of arrays, around the NEC-2 program algorithms for the estimation of the direction of arrival (DOA) have been also developed [39].
The original NEC-2 source code, developed in Fortran, is currently available, as well as are the C and C++ porting of the code.
Presently, no modeling software or other programs for the generation of input data are available. In addition, there is a limited possibility of post-processing the output data by using open-source packages. On the other hand, a huge variety of ready-made antenna models can be found over the Internet. These models are useful as the starting point for antenna design.
Among the most interesting software packages that exploit the NEC-2 engine, we highlight:

nec2c [40]
It is a C porting of the original source code; it has been widely tested and can replace the original code without problems. Differently from the original Fortran code, it allows command line input/output and dynamically allocates the resources (there is no need to recompile the application if the predefined memory is not sufficient). necpp [41] It is also known as nec2++, it is the C++ porting of the original source code; it may be interesting since the program has been restored and it is organized around a library that can be called from C, C++, Python and Ruby codes. xnecview [42] It is a program for visualizing input and output data. Regarding input data, it allows the user to visualize the analyzed structure; at the output, it provides the radiation pattern in two and three dimensions, the input impedance, the voltage standing wave ratio (VSWR) and the maximum gain with respect to frequency. This program can export graphs as image files, but it cannot create files and tables containing numerical values. The program code is rather difficult to understand. xnec2c [43] By partially using the xnecview code, the nec2c developer realized an application for visualizing and modifying the project in an interactive way. Unfortunately, the program has no textual output in the numerical format, but only a visual one. However, in the latest versions, it is possible to export some data not only as images but also as a file to be handled with the well known graphing utility gnuplot [44].
The NEC-2 has evolved in versions 3 and 4. These codes have been classified for a long time and presently are not available free of charge. Nevertheless, it seems that the classifications constraints have been removed almost completely and that now the NEC-4.2 source code can be obtained for a fee [45].

MiniNEC3
Despite the very similar name, the MiniNEC software package is structurally different from NEC-2 [46] as regards the numerical model, the implemented code, and the input/output. The original code, written in an old version of the BASIC programming language, is still available nowadays [47]. According to some users, the behavior of MiniNEC is better than NEC-2 for handling wires very close together and junctions between wires with different diameters.

Puma-EM
Puma-EM [48] is a software package developed in order to study the Radar Cross Section (RCS) of perfectly conducting structures. It is based on the Boundary Element Method (BEM) [49,50] together with a Multilevel Fast Multipole Method [51]. It is capable of computing the monostatic and bistatic RCS and to perform Synthetic Aperture Radar (SAR) calculations in the presence of perfectly electric conducting (PEC) targets. These targets can include junctions (e.g., plates intersected with volumes) and therefore the code can be applied to complicated geometries. Puma-EM does not have the necessary characteristics to model transmitting antennas and for retrieving their input parameters but is able to evaluate their radiation pattern. The software package has the attracting feature of accepting, as geometric input models, files generated by Gmsh [52], a mesh-generator program well known in the open-source world.

SCUFF-EM
SCUFF-EM [53,54] (or scuff-em) is a software suite based on the BEM [49,50]. The acronym stands for Surface-CUrrent-Field Formulation of ElectroMagnetism. The implementation is very accurate: in particular, the author and his collaborators paid attention to the development of an efficient method for calculating the integrals involved in the BEM formulation [55]. The program is well documented, although some parts of the documentation are incomplete.
SCUFF-EM was born with the original intention of studying highly specialized phenomena in photonics, such as the Casimir forces or the radiative transfer [56][57][58][59]. However, it evolved in a complete suite for the BEM analysis of electromagnetic scattering for nanophotonics, RF/microwave engineering, electrostatics, and so on [58]. It includes a main library with a low-level C++ application program interface (API) and many command-line applications, each one developed for dealing with particular electromagnetic problems.
The most interesting ones, as far as RF design is concerned, are scuff-scatter, a generic application for the study of electromagnetic scattering, scuff-static, specialized for electrostatics, and mostly important scuff-rf.
The open-source package SCUFF-EM also includes a general high-level application (scuff-solver) that exposes the functionalities developed in the single modules, with an interface that can be called from C++, Python, and MATLAB applications.
For the definition of geometric entities and the corresponding meshing operations, SCUFF-EM uses the Gmsh software [52]. Moreover, it can also perform complex operations on the generated meshes, such as translations, rotations, duplications, etc.

Buff-em
Buff-em is complementary to the SCUFF-EM software since it implements some cases that are not included in SCUFF-EM. In particular, these cases are characterized by the presence of inhomogeneous dielectric materials (SCUFF-EM can deal with piecewise homogeneous materials only) and anisotropic materials. Buff-em implements the solution of Maxwell's equations based on volumetric currents using SWG basis functions [60]. The implementation of Buff-em is also very accurate [61]. However, at present, Buff-em is not as rich of capabilities as SCUFF-EM. Although the Buff-em library offers analogous functionalities as SCUFF-EM, so far only the scattering module and a program for Casimir forces and radiative heat transfer [62] are already implemented as independent command line tools. Moreover, as the software author says, Buff-em is significantly slower than SCUFF-EM when both software packages can be used for the solution of the same problem. We also notice that, due to the adopted implementation choices, Buff-em cannot deal with surface currents, and therefore it cannot model PEC objects.

Finite Difference Time Domain Method
Most open-source software of recent development is based on the FDTD method. There are some variants of the method, but all the current implementations are based on the so-called "leap-frog" scheme proposed by Yee in 1966 [63,64]. FDTD has since become very popular and many high-level textbooks can be found about the method (see for example [17,65]). In addition, a comprehensive, high-quality book available in open source can be found [18]. The FDTD method seems to offer at least two great advantages compared to the MoM: it does not require the inversion of large data matrices (therefore, it is quite limited in memory requirements) and it is able to evaluate antennas in a wide frequency band with a single simulation in the time domain. Obviously, the method has also some disadvantages, such as the need of approximating the model geometry on regular grids. Despite this one and other well-known limitations [17], FDTD is widely used even in commercial products.

OpenEMS
Actually, the openEMS program [66] is the solver of a suite of well-integrated applications [72] for the geometric modeling, the solution, the generation of output data in different formats, and the integration of the circuit simulation of electromagnetic systems and apparatuses. Basically, the suite is composed of four tools, integrated with each other.
CSXCAD is a library which allows the user to define various elementary geometric entities, and operate with them by means of the typical operations that can be found in computer graphics applications (rotations, translations, duplications, extrusions, masks, etc.). Both graphical and physical properties (e.g., dielectric permittivity) can be added to each object. Differently from other modeling tools, the CSXCAD library has been probably conceived from the beginning for the use with electromagnetic simulation. Therefore, it is possible to define particular properties inside the model, e.g., Drude, Debye, or Lorentz behaviors, as well as to insert lumped elements and test points. The CSXCAD library takes care of the mesh generation and the problem discretization. In this respect, it is worth noticing that the openEMS suite can handle non-uniform meshes, and CSXCAD includes some routines for the semi-automatic generation of meshes with non-uniform spacing and accurate smoothing. Furthermore, CSXCAD contains an interface package to be used with Octave/Matlab. QCSXCAD extends CSXCAD with a section devoted to the generation of GUIs, and AppCSXCAD is a graphical tool using the QCSXCAD library. Although AppCSXCAD should theoretically allow the complete graphical handling of the definition and generation of the simulation space, presently the interface is relatively poor and not very comfortable for the user. However, this interface turns out to be particularly interesting for the visualization of geometries (including feed ports, probes, and lumped elements) and for exporting the model in other graphical formats for the visualization with external software (e.g., Paraview [73] or Povray [74]).
The core program of the suite, openEMS, is based on the EC-FDTD method [75,76]. The method has been originally developed in the field of MRI (Magnetic Resonance Imaging) [77,78], but it is completely general. Examples of the use of the package in the field of antennas and arrays can be found in [79][80][81]. It is worth noting that openEMS has been also successfully employed in advanced biophysical research [82].

GprMax
The gprMax software [67], as the name suggests, was born for the electromagnetic simulation in the frame of ground penetrating radar (GPR) applications. However, nowadays it can be properly considered as a general-purpose simulator.
The last version of gprMax is written in Python language (version 3) and the most critical sections for the computing performance are implemented in Cython [83]. The program not only includes a parallel solver based on the OpenMP libraries, but it is also one of the few packages (among the ones discussed in this document) that can actually exploit the computing power of an Nvidia GPUs [84].
The development of gprMax is very accurate, and great attention is paid to the theoretical correctness of the employed algorithms. Among the possible feed ports, gprMax also includes a "virtual" transmission line [85] which, as the developers say, should avoid most of the perturbations introduced in simulation models by other kinds of ports (e.g., lumped element ports).
The history of the development of this software package can be summarized through some papers by the developers [86][87][88]. More references can be found on the gprMax website [83]. On the same site, there is also a summary of the many research papers whose development was based on gprMax. According to this list, gprMax is cited by more than 500 scientific papers.
Being written in Python, gprMax is intrinsically capable of interfacing with all the Python world, and itself is also written as a Python package. As regards the post-processing phase and visualization of results, some examples of using the open-source graphing package matplotlib [89] are included in the source code. Moreover, the output files (both geometries and results) can be easily read with Paraview [73], by using a macro that can be found on the gprMax website.

Meep
Meep [68] is a program that was born in the framework of advanced optics and is likely to be the most advanced among open-source FDTD programs. It is fully scriptable by using the Scheme language, in C++ and Python. The package contains advanced tools for both simulation and post-processing and has been used in photonics [90,91] but also for the optimization of patch antennas [92].
Nevertheless, due to the functional complexity, the learning curve of the Meep simulator is rather steep, especially when the user wants to move outside the photonic applications (for which several examples exist) to simulate antennas and other conventional devices at radio ad microwave frequencies.

Vulture
Vulture [69] implements a general-purpose FDTD algorithm, which has some interesting capabilities for electromagnetic engineering. At the moment the development seems to be stalled, although it continues on the front of research papers [93,94].

Angora
Angora [70] was born in the field of optical imaging, with the objective to simulate a whole microscopy system [95], and has been successively enhanced to deal also with biological and other samples showing complicated dispersion relations [96].

GS-Vit
GSvit [71] includes a set of numerical tools for the FDTD simulation, with the additional support for graphics cards compatible with the Nvidia CUDA (Compute Unified Device Architecture) environment [97,98]. The main scientific purposes include research in the field of nanotechnology and nanoscale optics, as well as near-field scanning microscopy, Raman scattering, scattering from rough surfaces, etc. However, as the FDTD method is universal, it can be used in principle for any other scope.

Finite Element Method
FEM codes and libraries are largely represented in the open-source world [99] and are of common use in many fields of engineering, especially in structural analysis, fluid dynamics, and heat transfer problems, but also in CEM. Moreover, FEM is the preferred kind of mathematical discretization in multi-physic problems. Nevertheless, finite element methods are, on the contrary, not so common in antenna design. One of the main reasons limiting the use of open source FEM packages is that most of these packages offer general-purpose solvers, requiring a further time-consuming and specialist programming, to implement the solution model. In general, the approach is slightly easier for the closed domain where PML or similar open-boundary conditions are not needed (for example for Surface Impedance Boundary Conditions [100,101]). Furthermore, using localized sources (ports) is another crucial point, because, in general, they are not available (except very simple cases, like elementary dipoles) in the codes and must be designed together with the model. However, there are some projects that deserve attention. We mention, in particular:  [113] and in microwave imaging [114].
It should be stressed again that none of the previous packages provide a "ready-to-use" user program, but a notable programming effort is still needed to define the problem and model of the solution.

Numerical Assessment
A fair comparison of the existing open-source electromagnetic simulation software that can be used for antenna design is quite difficult for three main reasons. First, suitable testing benchmarks should be defined. Second, the post-processing phase of open-source software is often non-homogeneous, and therefore not all the relevant parameters may be directly provided in output by all packages. Third, because of the free nature of open-source programs, all-inclusive and cross-platform installation utilities are almost never provided. As a result, installation and compatibility issues frequently arise, and it is sometimes difficult to run programs that-in principle-are very powerful.
As a preliminary assessment, we chose to present the results obtained by three open-source packages: nec2c, gprMax, and openEMS versus some commercial and academic software alternatives based on MoM formulations. An extended comparison including the other presented open-source programs is under development.
To start with, simple canonical structures are considered. Four different antennas have been simulated here: a standard half-wavelength dipole, a circular loop antenna, a radiator composed by a metallic box and a plate, and finally a patch element on a dielectric substrate. The first examples have been inspired by a set of numerical benchmarks proposed in the IEEE recommended practice for the validation of CEM computer modeling and simulations [115] and in [116]. All the antenna geometries have been visualized here by processing with Paraview 5.6.0 [73] the meshes obtained with gprMax, but analogous results may be achieved by using other packages. Results in the frequency domain are retrieved from the time-domain simulators (gprMax and openEMS) by performing a Fast-Fourier Transform (FFT) on the simulated data.

Half-Wavelength Dipole
A simple half-wavelength dipole made to resonate around 500 MHz has been considered first. Its geometry, shown in Figure 4, is composed of a z-directed thin cylindrical shape with an overall length l = 300 mm, subdivided into two arms by a gap of g = 2 mm width. The antenna material is assumed as PEC. It is worth noting that the nec2c code, which is based on an MoM formulation, does not require the discretization of the surrounding space, but only of the antenna element. Conversely, the two FDTD codes gprMax and openEMS need to build a simulation region around the antenna in which even the free space is discretized, and surrounded by proper absorbing boundary conditions. The gprMax simulation involved a region of space of dimension 0.3 × 0.3 × 0.6 m, discretized with 2 mm voxel size (150 × 150 × 300 6.75 × 10 6 cells). The antenna is located at the center of this region, and it is fed by a 50 Ω z-directed transmission line port excited with a Gaussian waveform with the central frequency equal to 1 GHz. A perfectly matched layer (PML) of 10-cells width encloses the simulation domain. The simulated time window has a width of T = 100 ns, with a time step equal to ∆t = 3.85 ps (25,964 iterations).
In the openEMS simulation, a domain of the same size as in the gprMax simulation has been considered, with also the same depth of the PML layer. Using the capability of openEMS to deal with non-uniform meshes, the domain was discretized into 153 × 153 × 302 7.06 × 10 6 FDTD cells, and the simulation resulted in a time step of ∆t = 2.31 ps. The simulated time window has a width of T = 60 ns (26,000 iterations).
The considered antenna structure can be simulated by employing different kinds of numerical models. For instance, thin wire or cylindrical models can be adopted. The wire model is the simplest one and represents the antenna as a wire (or an edge) in the simulation mesh. As previously mentioned, the open-source nec2c software can only deal with wire models. With nec2c, the simulation was carried out by considering a wire of radius 0.3 mm, divided into 151 uniform segments. This is about the same wire model used in the original benchmark [116], where the segments are 150 and a small gap is left for feeding the structure. The magnitude of the reflection coefficient S 11 measured at the antenna port has been reported in Figure 5a, where the open-source software is compared with a wire-model simulation obtained by two commercial software packages. Moreover, the analytic solution in the case of a sinusoidal current distribution has been reported in this graph [117].
A good agreement is observed between the computed reflection coefficients. The real and imaginary parts of the complex impedance measured at the antenna port versus frequency are also shown in Figure 5c,e, respectively, where the same comments as before still hold. In all cases, there are relevant differences between the analytic solution and the numerical ones around 1 GHz and 2 GHz, where the theoretical impedance computed with the sinusoidal current approximation tends to infinity [117] since the length of the dipole l is a multiple of the wavelength in free space.
The compared simulation results achieved with a cylindrical model of the same dipole, where the arms are represented with a cylinder of diameter d = 2 mm, can be found in the same figure.
In particular, Figure 5b reports the reflection coefficient magnitude, whereas the complex impedance is shown in Figure 5d,f.
In general, results are quite similar; the only significant differences are noticed for the impedance calculation by means of the second commercial code. A small underestimation of the impedance values is also observed in the gprMax simulation. These differences in results may be ascribed to the different modelling capabilities of the adopted simulators, and in particular to the staircase effect in the uniform FDTD mesh.
Moreover, the gain of the antenna obtained with nec2c compared with a commercial program and the analytic solution [117] is reported in Figure 6, in case of a thin wire dipole. It is evident that these results match exactly. Unfortunately, not all the software packages implement near-field to far-field (NFFF) transformations (e.g., gprMax) and therefore the radiation pattern is not always available. This may be a limitation of some open-source programs for the design and characterization of antennas in far-field conditions.    [117]. Vertical cut on the xz plane.

Loop Antenna
As a second example, a circular loop antenna has been considered, which is represented in Figure 7a. The loop has a diameter D l = 300 mm and the cylindrical PEC wire has a thickness d = 4 mm. The radiating structure is fed through a gap of width g = 2 mm.
The nec2c simulation of the loop antenna was based on the discretized wire loop provided with the results of [116]. Once again the wire was divided into three segments to position the feeding port.
The gprMax software has been run with a domain of side lengths 0.5 × 0.5 × 0.3 m, enclosed by a 10-cells PML boundary. A uniform mesh with 2 mm voxel size has been chosen, with a resulting total number of cells equal to 9.375 × 10 6 . Like in the previous case, the antenna is centered within the simulation domain, and it is fed by a 50 Ω z-directed transmission line port. The structure is excited with a Gaussian waveform characterized by a central frequency of 300 MHz. A time window of width T = 100 ns has been considered, with a time step equal to ∆t = 3.85 ps (25,964 iterations).
The magnitude of the reflection coefficient at the port of this antenna versus frequency can be seen in Figure 7b. In can be seen that the superposition of the three results is almost perfect. The corresponding real and imaginary parts of the complex input impedance are reported in Figure 7c,d. In these graphs, some differences can be appreciated among the results. There could be many possible causes for these behaviors, but the more obvious and probable is that the initial dissimilarities in the geometrical and electromagnetic models can give rise to these small differences in the results. Figure 8 shows an xy-plane cut of the antenna gain, where the nec2c simulation is compared with a commercial package. The trend is similar, but a maximum difference of 1 dB is evident in the left lobe of the pattern, which corresponds to the location of the feed point. This must be investigated; however, it can be guessed that the different model of the feeding port could be the reason for this difference. The problem of accurately modeling the ports is still a challenging task for any simulator, both open-source and commercial.

Box-Plate Antenna
A more complex antenna configuration has been taken into account, as shown in Figure 9. In particular, the structure is composed of a square PEC plate at the bottom (whose side length is W p = L p = 300 mm) and a metallic box on the top (again, for more details, the reader is referred to [116]). The box has dimensions W b = 54 mm, L b = 72 mm, H b = 56 mm, and it is separated from the bottom plate by a distance D f = 10 mm. Particular attention should be paid in this case to the feed point, whose details are visible in Figure 9b. A small metallic box is attached to the upper part of the antenna, in the central position, and its dimensions are W f = 1 mm, L f = 4 mm, H f = 8 mm. The resulting gap between the box and the PEC plate is g = 2 mm.
In the gprMax simulation, the simulation domain and the time window have the same size as in Section 8.2. However, due to the increased complexity of the structure, a spatial discretization with 1 mm voxel size has been adopted. As a result, the simulation domain contains 75 × 10 6 cells, and the time step is reduced to ∆t = 1.93 ps (51,927 iterations). As shown in Figure 9b, since the spatial discretization is smaller than the gap between the plate and the box, a PEC edge has been placed to fill the space between the gprMax transmission line (which is in contact with the bottom plate) and the box. The openEMS simulation has been carried out by using the same domain size as in gprMax simulation, the same depth of PML and fixing the minimum acceptable resolution to λ/40 at 6 GHz. This resulted in a domain discretized into 407 × 409 × 244 40.6 × 10 6 FDTD cells, with a time-step ∆t = 1.35 ps and a total excitation length of 873 × ∆t, corresponding to a Gaussian modulated pulse with a −20 dB band [0.1 − 6.0] GHz.
A comparison between the simulated magnitude of the reflection coefficient versus frequency is presented in Figure 10. A very good agreement between the various electromagnetic solvers is observed, despite the complexity of the structure. Moreover, these results match very well with the experimental measurements reported in [116].

Patch Antenna
At the end of this preliminary assessment, a rectangular patch antenna has been simulated. The structure, presented in Figure 11, is supported by a dielectric substrate Rogers RT/Duroid 5880 (characterized by a relative dielectric permittivity r = 2.2) with length L s = 30 mm, width W s = 30 mm and thickness H s = 1 mm. A PEC plate, with the same length and width of the substrate, is assumed at the bottom. The patch element has a rectangular shape of length L p = 12 mm and width W p = 10 mm. The antenna is fed by a vertical edge placed inside the substrate between the bottom conducting plane and the upper patch. The feed point is centered on the y-axis, whereas on the x-axis is off-centered by an offset x f = 2 mm.
The gprMax simulation of this antenna has been made by considering a box of size 90 × 90 × 50 mm. A PML absorbing layer is placed on the external boundary of the simulation domain, as usual. A Gaussian pulse whose spectrum is centered at 10 GHz has been used as the excitation waveform, and the simulated time window is T = 100 ns wide. A transmission line is placed inside the substrate dielectric material.
In this case, a comparison has been done between gprMax and openEMS results obtained with two different spatial discretizations. In the first simulations, a coarse spatial discretization with 1 mm voxel size has been employed (4.05 × 10 5 cells) with a time step ∆t = 1.92 ps (51,927 iterations). In the second case, a finer spatial discretization of 0.5 mm (3.24 × 10 6 cells) has been used, adopting a time step equal to ∆t = 0.96 ps (103,853 iterations). Like in Section 8.3, in this case, the transmission line is in contact with the bottom plate, and a vertical conducting edge lies between the transmission line and the upper patch element.
As for openEMS, again the capability of using non-uniform meshes has been used to refine some details of the simulation, however, in order to compare results, the simulation domain was taken as much as possible similar to the one used for gprMax. In particular, the dimensions of the simulation volume and the number of PML layers were exactly the same, while minor differences were in the total number of cells (4.22 × 10 5 cells in the coarse mesh and 3.33 × 10 6 cells in the fines mesh). A Gaussian modulated pulse with a −20 dB band between 4.0 and 11.0 GHz has been used and imposed by means of a lumped port placed between the patch and the ground plane. When the coarser-resolution is considered, the time step is ∆t = 1.925 ps, while with the finer mesh we have ∆t = 0.96 ps.  The three-dimensional radiation pattern obtained with openEMS is shown in Figure 12a, whereas the resulting values of the reflection coefficient magnitude and of the input impedance versus frequency (in the band between 5 and 10 GHz) are reported in Figure 12b-d. The resonance peak is observed between 7 and 8 GHz.
Analyzing the graphs in Figure 12, it can be noticed that the coarse gprMax and openEMS simulations have a resonance peak significantly lower than the prediction by the commercial software. Instead, in the results with the finer meshes, the position of the peak shows a quite good match, although the minimum value of the reflection coefficient is different. These results let us comment on two important points. First, the models with a coarse mesh clearly suffer from the effects of a too low spatial discretization (the substrate thickness is modeled with the height of only one cell). This produces a noticeable shift in the resonance toward low frequencies. Second, the differences in the minimum value of the reflection coefficient magnitude are mainly due to the frequency axis discretization adopted in the postprocessing, which is coarser than in commercial software results (where an adaptive frequency sampling is used). The frequency resolution-which is due to the FFT operation-may be enhanced if needed by enlarging the simulated time window, by adding padding zeroes to the time-domain data, or by employing other more advanced strategies.

Discussion and Comparisons
Some comments about the simulations and the use of the involved open-source packages are now in order. Therefore, a discussion about the presented results is given in this Section. Two different aspects are considered here, comparing a subset of the simulated cases. A first comparison is made by using the analytical solution available for the dipole antenna. Then, the use of computational resources is discussed.

Comparison with Analytic Solutions
Having confidence in simulation results is a key point. In CEM software validation, a crucial role is played by comparisons with the available analytic results. This fact is highlighted by the IEEE standard for validation of CEM computer modeling and simulations [118] and the related recommended practice [115]. In this standard, however, it is also stressed that closed-form equation references may not represent-in general-the real-world problem of interest. As a result, analytic comparisons should be selected with care, knowing their limitations. When analytic results are not available or they are not suitable for the problem of interest, external validation references derived from measurements or obtained with alternate modeling techniques may be used.
In the specific case of this preliminary review, our goal is to explore some possibilities given by the open-source CEM world, rather than establishing a detailed compared validation of the various software implementations. Therefore, alternate modeling technique-derived references [118] have been mostly presented in Section 8. In addition, for the dipole antenna example, we provide here a brief comparison and error analysis with respect to the corresponding analytic solution [117]. Although the standard analytic results are computed with sinusoidal current distribution along the dipole (and therefore present some infinite impedance values, as mentioned in Section 8.1), this solution has been taken as a reference in [115]. Of course, more advanced analytic comparisons can be made, as well as involving other kinds of antennas (e.g., loop). However, this case only will be considered here, with the goal of extending this point in future works.
For establishing the comparison, the following features have been taken into account.

•
The impedance measured at the input terminals of the dipole antenna when its length l is exactly a half of the free space wavelength, i.e., l = λ/2. This complex number is denoted as Z λ/2 in . • The first two frequencies related to series resonance (i.e, the first and the third frequency point where {Z in } = 0). These values are indicated with f sr 1 and f sr 2 , respectively.
The distance between simulated and analytic results has been evaluated by means of relative error quantities, computed as where p denotes the considered parameter (i.e., Z λ/2 in , f sr 1 or f sr 2 ). Wire and cylindrical models of the dipole antenna were taken into account, and the obtained results are reported in Tables 1 and 2. As regards the complex impedance Z λ/2 in , we note that the simulated values are always higher than the analytic ones, and this reflects on the computed errors (which are between 13% and 28%). The error appears always lower in the codes implementing a MoM formulation (both commercial and open-source) and this is reasonable, the MoM being particularly suitable for simulating wire antennas. By considering the series resonance frequencies f sr 1 and f sr 2 , deviations from the analytic values are less evident (errors between 0.3% and 2%). In this case, too, open-source FDTD codes have relatively higher errors compared to the MoM counterparts.

Usage of Computational Resources
In order to test the capabilities of the examined packages in terms of speed and CPU usage, some of the examples presented in Section 8 were also "measured" by using the Linux/Unix utility time. In particular, we collected the values of the user time t U , of the system time t S , and of the elapsed time t E as provided by the command time, as well as the percent utilization of the CPU for the considered job P CPU . Note that the value of P CPU can raise well over 100, since, in modern computers, it is a cumulative value that considers all the logical cores. Hence, to facilitate comparisons, we defined a new value, called normalized time t norm , which was defined as: and can provide a more significant figure than just the sum of t U and t S , when multicore, multithread computers are involved To carry out these performance measurements, we used two workstations (in the following W1 and W2), both equipped with a Debian/Linux system and with the packages openEMS, nec2c, and xnec2c. As gprMax is not yet packaged by Debian, release 3.5 was downloaded and compiled according to the instructions provided by the software maintainer. Note that, since xnec2c works only with user interaction, in these tests the non-graphic version nec2c was used, which unfortunately is not multi-thread.
Both computers were equipped with Intel R Core TM processors: the main information about the two workstations (according to the Level 2 Performance Reporting Requirements [115]) are reported in Table 3.
The first comparison is about the half-wavelength dipole. A comparison of the times needed by each package and of the capabilities to make the most of the CPU potentialities is summarized in Table 4. Despite the reduced attitude of nec2c to exploit all the CPU capabilities, it is just a little bit less than two orders of magnitude faster than gprMax, that is, in turn, much faster than openEMS. The fact that nec2c is the fastest to execute is not surprising as the method implemented by nec2c does not need to account for the surrounding of the antenna, as it is instead by the FDTD used by gprMax and openEMS. As for these last two codes, it is worth noting that, while openEMS is the slowest code in any case, in W1 gprMax and openEMS differ by a factor of about 5, while this difference reduces to less than 3.4 in W2. This is a general behavior, which will be observed also in the cases that follow, and can be related to the capability of openEMS to exploit not only the multicore configuration of the CPUs, but also the separation in logical threads of each core.
The second case is about the patch and the third one is that of the box-plate antenna. In these cases, obviously, only gprMax and openEMS are considered. In Table 5 the results about the patch antenna are shown. It can be seen that gprMax is about 4 times faster than openEMS, while this factor reduces to less than 3 when W2 is considered. Table 6 is about the box-plate antenna. In this case, gprMax is also faster than openEMS, however the increments are about 3.61 with W1 and about 2.21 with W2.
In general, one can deduce that the more complex the job and the more performing the hardware, the more openEMS is able to exploit the performances of the computer.
The last case is about the loop antenna (Table 7). At first glance, it could look that the terrific difference in speed between nec2c and gprMax that was observed in the first case be now disappeared. Actually, nec2c is still faster, but only by a factor that is less than 2. It must be observed, however, that nec2c computed also the radiation patterns, at 1601 different frequencies. When the command to evaluate the radiation patterns is removed from the input file, the improvement in speed raises to more than 100 again. Both gprMax and openEMS could exploit the full power of computational parallelization, based on message passing interfaces (MPI) and/or openMP. Furthermore, it is worth noting that gprMax contains a GPU-based solver written by using the CUDA programming paradigm proposed by Nvidia [84], although it does not support the transmission-line port, and openEMS has an SSE capable engine. Table 8 summarizes the computational capabilities of the examined software. Unfortunately, at the time of writing, nor a GPU equipped machine nor a true cluster of parallel computers were available, hence it was not possible to test the peak performances of each software. On the other hand, we remark again that the main aim of the paper was introducing and promoting the use of open-source software in general and not to compare the performances of the packages, that is here reported for the sake of completeness, but it is far for being the core of the work.

General Remarks
According to the simulation performed, all the software packages have capabilities that compare with those of commercial ones, when this comparison is made on results. Obviously, any package has also limitations and constraints.
The weaknesses of the NEC-2 family are already well known, however, the package remains a reference tool for wire antenna simulations. Furthermore, the versions tested here have also some enhancements with respect to the original code; in particular, xnec2c has graphic capabilities and can be very fast thanks to its multi-threaded engine.
At the moment, gprMax has constraints on the mesh, which can only be uniform. Moreover, different materials on the same cell are not allowed. However, the package already accurately implements many important features needed in an FDTD code and is very efficient from a computational point of view. We note, in particular, the careful implementation of the virtual transmission line port, which avoids spurious radiation from the feeding region.
The package openEMS still has some rough edges, which deserve careful consideration. Nevertheless, it is a complete simulation tool, which provides a geometrical modeling program, a solver, and good post-processing capabilities. Furthermore, the possibility of using nonuniform meshes is a point of strength for the package.

Conclusions
In the research and scientific community, there is nowadays an increasing demand for open data, results, algorithms, and codes. Open-source software in CEM is a very powerful tool, and at the same time is an extremely interesting research field. However, the knowledge of open-source alternatives is often insufficient, and updated reviews cannot be easily found in the scientific literature. In this paper, we focused our attention on open-source simulation software applied to the design of antennas, presenting the main kinds of open-source simulation codes, with reference to the existing software implementations. The aim of the paper was not to prove the superiority of open-source software with respect to other products nor to find the best open-source software available. Instead, the paper was written with the belief that a proper knowledge of the existing open-source alternatives is very useful for researchers working in this field. From the point of view of graduate and undergraduate students and their teachers, open-source software can assume an important role in their educational path. Furthermore, it has been underlined that an up-to-date view of the available open-source packages can be beneficial even for the developers of commercial software.
While CEM software should be primarily compared based on computational or result quality merits, on the other hand, user experience can influence software diffusion and should not be neglected. For this reason, one of the targets of the present work was also that of finding simple and easy to use codes, not requiring particular skills in programming. Hence a subset of the presented programs has been selected and tested in a preliminary numerical benchmark, in which four different antenna typologies have been considered. However, as the numerical tests were performed, it appeared more and more clear that a comprehensive review and comparison between all the existing packages in a unified framework represents a heavy task, and cannot be resolved from a unique perspective. Therefore, a large part of this ambitious project is still under development and will be treated in more detail in future works. Moreover, the study of open-source software for other typologies of electromagnetic scattering simulations will be considered as a next step.

Conflicts of Interest:
The authors declare no conflict of interest.

Abbreviations
The following abbreviations are used in this manuscript: