||The field of 21-cm cosmology ? in which the hyperfine spectral line of neutral hydrogen (ap- pearing at the rest-frame wavelength of 21 cm) is mapped over large swathes of the Universe’s history ? has developed radically over the last decade. The promise of the field is to revo- lutionize our knowledge of the first stars, galaxies, and black holes through the timing and patterns they imprint on the cosmic 21-cm signal. In order to interpret the eventual observa- tional data, a range of physical models have been developed ? from simple analytic models of the global history of hydrogen reionization, through to fully hydrodynamical simulations of the 3D evolution of the brightness temperature of the spectral line. Between these extremes lies an especially versatile middle-ground: fast semi-numerical models that approximate the full 3D evolution of the relevant fields: density, velocity, temperature, ionization, and radiation (Lyman-alpha, neutral hydrogen 21-cm, etc.). These have the advantage of being compara- ble to the full first-principles hydrodynamic simulations, but significantly quicker to run; so much so that they can be used to produce thousands of realizations on scales comparable to those observable by upcoming low-frequency radio telescopes, in order to explore the very wide parameter space that still remains consistent with the data.
Amongst practitioners in the field of 21-cm cosmology, the 21cmFAST program has become the de facto standard for such semi-numerical simulators. 21cmFAST (Mesinger & Furlanetto, 2007; Mesinger, Furlanetto, & Cen, 2011) is a high-performance C code that uses the excursion set formalism (Furlanetto, Zaldarriaga, & Hernquist, 2004) to identify regions of ionized hydrogen atop a cosmological density field evolved using first- or second-order Lagrangian perturbation theory (Scoccimarro & Sheth, 2002; Zel’Dovich, 1970), tracking the thermal and ionization state of the intergalactic medium, and computing X-ray, soft UV and ionizing UV cosmic radiation fields based on parametrized galaxy models. For example, the following figure contains slices of lightcones (3D fields in which one axis corresponds to both spatial and temporal evolution) for the various component fields produced by 21cmFAST.
However, 21cmFAST is a highly specialized code, and its implementation has been quite specific and relatively inflexible. This inflexibility makes it difficult to modify the behaviour of the code without detailed knowledge of the full system, or disrupting its workings. This lack of modularity within the code has led to widespread code “branching” as researchers hack new physical features of interest into the C code; the lack of a streamlined API has led derivative codes which run multiple realizations of 21cmFAST simulations (such as the Monte Carlo simulator, 21CMMC, Greig & Mesinger, 2015) to re-write large portions of the code in order to serve their purpose. It is thus of critical importance, as the field moves forward in its understanding ? and the range and scale of physical models of interest continues to increase ? to reformulate the 21cmFAST code in order to provide a fast, modular, well-documented, well-tested, stable simulator for the community.