Evaluation of impurity densities from charge exchange recombination spectroscopy measurements at ASDEX Upgrade

At ASDEX upgrade (AUG) a new framework for the evaluation of impurity densities based on measurements from charge exchange recombination spectroscopy (CXRS) diagnostics has been developed. The charge exchange impurity concentration analysis code, or CHICA, can perform these calculations for all of the beam-based CXRS diagnostics at AUG and is equipped with the atomic data for all of the regularly measured charge exchange spectral lines (He, Li, B, C, N, O, and Ne). CHICA includes four different methods for the evaluation of the neutral density populations, which feature different implementations and contain varying levels of sophistication. These methods have been thoroughly benchmarked against one another, enabling the important processes for the evaluation of neutral densities to be identified as well as the neutral populations that are most critical to the accurate interpretation of the measured CXRS intensities. For the AUG neutral beams, charge exchange with the ground state of the first energy component is typically the dominant contribution to the measured CXRS intensities, but emission from reactions with the n = 2 beam halo population can contribute up to 35% to the total signal and must be included in the analysis. Neglect of this population leads to incorrect magnitudes and incorrect profile shapes of the calculated impurity density profiles. The edge lines of sight (LOS) of the core CXRS diagnostics at AUG intersect the edge pedestal inside of the neutral beam volume. Therefore, the impurity density is not constant along the LOS, complicating the interpretation of the measured intensities. Within CHICA a forward model for the edge impurity densities has been implemented, enabling the reconstruction of accurate edge profiles.

where H is, typically, a neutral hydrogen or deuterium atom and A is an ion of elementary charge Z. After the transfer of the electron, the impurity is left in an excited state and subsequently decays to a lower energy level and emits characteristic radiation: the measured CXRS spectrum. In fusion plasmas, the natural population of neutral particles is very low due to the high temperatures and densities. Thus, to make active CXRS measurements, neutral atoms are introduced into the plasma. This is typically done either by means of neutral beam injection (NBI) or neutral gas puffs. The injection of neutrals provides the added benefit of localizing the CXRS measurements to the intersection of the diagnostic line of sight (LOS) and the volume enclosing the injected neutral population. While the impurity ion temperature and rotation along the LOS can be derived directly from the measured spectra via the Doppler broadening and shift of the active spectral line, the impurity density evaluation is more complicated as the measured intensity is not only proportional to the impurity density, but also to the densities of the various energy components of the neutral beam and their excited state populations [3,4]. For neutral beam based charge exchange, there are typically at least three energy populations in the beam: the full, half, and third energy components. These correspond to H + , H 2 + and H 3 + ions in the beam source that are all accelerated to the same energy by high voltage grids. During the neutralization process the H 2 + and H 3 + ions break up, resulting in H neutrals with one half and one third of the full acceleration energy. Since the charge exchange cross-sections are dependent on the collision velocity, all three of these populations contribute differently to the total CXRS emission and must be accounted for separately. In addition, there is a fourth population that must be taken into account, namely the beam halo [2,[5][6][7][8]. The halo is a cloud of thermal neutral particles that forms in and around the beam volume due to charge exchange reactions between beam neutrals and main ions in the plasma. These new thermal neutrals can then undergo charge exchange reactions with impurity ions leading to additional emission. The importance of the halo to CXRS measurements has been known since the 1980s [2,9] and is discussed in several publications including [2,5,7]. Regardless, it is not routinely included in present day CXRS impurity density calculations. This is possibly due to the additional complexity of modeling these components and possibly due to the high beam energies used in present day fusion devices. As will be shown in section 2.3, the production of halo neutrals decreases strongly with increasing beam energy. Together with the very small charge exchange crosssections at thermal energies, this justifies the neglect of the ground-state halo population and perhaps contributed to the general neglect of halo neutrals in CXRS calculations. However, the charge exchange cross-sections for different excited state populations differ significantly and must be considered separately to correctly determine the total charge exchange emission. In the case of the halo, the n=2 [4] population can not a priori be neglected. This was also pointed out by Isler et al [2] and first assessed quantitatively for AUG data in [7].
The measured CXRS intensity is given by equation (2) where hν is the energy of the photon, n Z is the impurity density, n 0,n,j are the neutral density populations, the sums on n and j are over the principle quantum number and the neutral energy components, respectively. v n j Z j , , , eff is the effective CX emission rate with σ the charge exchange crosssection and v j the collision velocity. Here, the angle brackets, < K > , indicate integration over the appropriate velocity distributions: thermal distributions in the case of the halo and thermal and beam velocity in the case of beamimpact charge exchange. λ refers to the specific emission line and s to the position along the diagnostic LOS. Note that the effective emission rates and the neutral densities in the plasma are also dependent on local plasma parameters such as the electron density, electron and ion temperatures, and the effective charge, all of which can vary along a LOS. Hence, these quantities have been kept inside the LOS integral, as has the impurity density itself. It is often assumed that these quantities do not vary along the intersection of the LOS and the neutral population as was done, for example, in [8]. With these assumptions, the impurity density can be removed from the LOS integral and it is straightforward to solve directly for n Z ) contains all of the 3D geometric information of the sightline and neutral beam geometry. This is the conventional way of solving for the impurity density. However, it can be necessary to maintain the LOS dependences of the impurity density and the charge exchange cross-sections, particularly if the LOS samples many flux surfaces inside the neutral volume or if it intersects the neutral volume in a region with steep gradients, for example, the edge pedestal. This will be discussed further in section 5.
At ASDEX Upgrade (AUG) a new framework for the evaluation of impurity densities from CXRS measurements has been developed. The charge exchange impurity concentration analysis code, or CHICA, is capable of calculating impurity densities using measurements from all of the CXRS diagnostics in the AUG CXRS suite [10,11] and is equipped with the atomic data for all of the regularly measured CX spectral lines including He, Li, B, C, N, O, and Ne. The atomic data used for the calculations will be discussed further in section 3. Presently, CHICA only evaluates beam based CXRS measurements. CHICA supports four different methods for calculating the neutral beam densities in the plasma: FIDASIM [12], two versions of a 'pencil' code dubbed 'FAST' and 'COLRAD,' and indirect measurements of the neutral populations from beam emission spectroscopy (BES) [7,13,14]. The details of these methods and their comparative pros and cons are presented in section 2. In section 3 the effective emission rates used for the CXRS impurity density evaluation are presented and discussed. In addition, the contributions from the different energy components and excited states to the total measured CXRS intensity are examined. In section 4 these codes are applied to AUG experimental data and the resultant impurity density profiles obtained via the different methods are compared. Section 5 discusses the evaluation of CXRS impurity densities when they vary along the LOS of the diagnostic and, therefore, can not be removed from the LOS integral. Finally, this work is summarized in section 6.

Neutral beam geometries
A top-down view and poloidal cross-section of the AUG tokamak are shown in figure 1. Here one can see the trajectories of the AUG neutral beam sources as well as the LOS of the BES and CXRS diagnostics. The LOS of the core toroidal CXRS and BES systems are embedded in the same optical heads, providing measurements along nearly parallel paths through the neutral beams, and are marked simply as 'Core tor.' in figure 1. There are two separate core toroidal CXRS/ BES systems, one on each of the neutral beam boxes. For clarity, only a subset of the LOS from each system are shown. On NBI box I, there are 91 LOS imaging the plasma from the magnetic axis to the pedestal top on the low field side (LFS), separated into three vertically stacked rows of 30, 31, and 30 fibers. The vertical separation is roughly 1.5 cm. These LOS are divided between three charge exchange diagnostics, typically measuring He, B, and N, a fast ion D-alpha (FIDA) system, and a BES diagnostic. On NBI box II, there are 70 LOS imaging the plasma from the pedestal top on the LFS to the pedestal top on the high field side (HFS). These LOS are divided between two CXRS diagnostics, typically measuring either B or N, and a second BES system.
As can be seen from figure 1 the AUG NBI boxes [15] are separated toroidally by 180°. Each box is comprised of four neutral beam sources capable of injecting 2.5 MW of power in D operation for a total of 20 MW. NBI Box 1 uses arc plasmas sources and has a maximum injection energy of 60 keV. NBI Box 2 uses radio frequency sources and has a maximum injection energy of 93 keV in D. The extraction voltages of these beams are not fixed. On a discharge-todischarge basis, the energy of NBI Box 1 can vary between 30 and 60 keV (0.5-2.5 MW) and the energy of box 2 from 50 to 93 keV (0.72-2.5 MW). When reducing the voltage of the beams, also the beam current is reduced to keep the beams operating at the optimum points of their respective perveance curves. As such, at reduced voltage the CXRS signal suffers from both a reduction in the CX cross-sections and a reduction in the overall number of neutral particles injected, resulting very quickly in a significant reduction in the CXRS signal. As a result, standard CXRS analysis at AUG focuses on discharges with full-voltage beams, although CHICA is capable of handing reduced voltage beams, provided sufficient CXRS signal is present. CHICA is also capable of handling the impurity density analysis when the beams are operated in hydrogen.
The extracted beam power is very well known, as are the losses in the acceleration grids and in the neutralization chamber. In addition, the fraction of particles in the different energy components is well diagnosed. The biggest uncertainty on the power reaching the plasma comes from the losses in the duct, which are not measured and are assumed to result in a 15% loss. While this assumption results in injected powers that agree very well with BES measurements of the beam energy components in the plasma, the error bars on the BES data are also of order 10% and the BES data is not analyzed routinely. There are pressure gauges in the duct itself, which show a relatively large variation in pressure (factor of two), which indicates that the flat 15% assumption might not be appropriate for all plasma discharges. As such, NBI losses due to variable duct pressure could well contribute to the 10%-20% variations observed between the measured CXRS intensities on NBI box 1 and NBI box 2. This could be clarified through the analysis of the BES data for a large number of discharges. Such an analysis task, however, is beyond the scope of this work.
Not only are the injection energies and particle distributions of the two boxes different, but the beam geometries are as well. In addition, the geometries of sources 6 and 7 (NBI box 2) are variable and, for a given plasma discharge, can be in any position between the extrema of the range. The CXRS and BES diagnostics on NBI Box 1, while focused on source 3, also collect significant emission from reactions with sources 1, 2, and 4, see figure 1. The diagnostics on NBI Box 2 [11] are focused on source 8, but also see emission from sources 5 and 7 at the LFS plasma edge. Thus, all of these beam sources need to be sufficiently well characterized to reliably produce impurity densities from the full suite of CXRS diagnostics. NBI source 6 is situated significantly below the LOS of the diagnostics, see figure 1, and does not contribute to the CXRS signal. It too, however, has been characterized and included in the codes.
The geometries of the NBI sources (trajectories and divergences) have been determined by a combination of BES measurements using both toroidal and poloidal LOS, thermal images of the beam impact positions on the inner wall, and direct measurements of the source locations. The impact positions of the beams on the inner wall of the machine are known to an accuracy of ∼1 cm, which translates into an uncertainty on the horizontal and vertical angles of the beam of ∼0.05°. The full width half maximum (FWHM) of the beams are on the order of 20 cm and the radial and vertical dimensions of the LOS integration volumes are approximately 1 cm, making a 1 cm uncertainty in the overall positions of the beam centers acceptable. The uncertainties on the beam widths are more difficult to characterize. Perhaps the best measure we have of how well the widths are characterized are from CXRS impurity density profiles on different beam boxes and using different beam configurations, particularly using beams that are centered well below the diagnostic LOS, such that only the wings of the neutral distributions contribute to the signal. Comparisons of impurity density profiles from NBI 2 and 3 (box 1) or NBI 5 and 8 (box 2), for example, produce the same impurity density profiles within the error bars of the measurements.
As previously mentioned, CHICA supports four different methods for calculating the neutral beam densities in the plasma, three different beam attenuation codes as well as indirect measurements via BES. All three beam attenuation codes (FIDASIM, FAST, and COLRAD) use identical neutral beam geometries, although the implementation between FIDASIM and the pencil codes is different. FIDASIM uses set beam divergences and foci of the particle distributions accelerated by the grids to describe the downstream beam geometry. FAST and COLRAD use the product of two Gaussians to describe the fall-off of the neutral densities perpendicular to the beam direction. These Gaussians are characterized by vertical and horizontal widths, a u,n,j and a v,n,j , that increase as a function of distance along the beam path to account for the beam divergence. These widths were obtained via fits to the same beam model that is included in FIDASIM. The beam widths and divergences are very similar for the different energy components and excited states in the beam, but not identical. Therefore, the differences as a function of beam energy, j, and excited state, n, are explicitly maintained. The fit function is given in equations  Here, u and v are orthogonal directions, perpendicular to the direction of the neutral beam injection, l. This function is with respect to a fixed starting point at the edge of the plasma outside of which the geometry is not valid. For all three codes, the neutral densities are calculated on the same three dimensional spatial grid. Care has been taken to ensure that the grid for each beam box encompasses the entire beam-LOS intersection volume and is dense enough to describe the beam geometry well. For the analysis of the core impurity densities the grids extend typically 80 cm in the direction perpendicular to the beams and have a 1.5 cm resolution. A smaller, finer spatial grid is used for the edge diagnostics. Figure 2 provides a comparison of the beam geometries implemented within the pencil codes (left) and FIDASIM (right) for NBI 3 (top) and NBI 8 (bottom). Here, the neutral densities in the ground state, first energy component have been used for the comparison. The beams are shown in a topdown view and the densities were summed in the vertical direction. Note that the scale differs between the NBI 3 and the NBI 8 plots. There is almost a factor of two difference between the densities of this population (n=1, first energy) at the plasma edge. The x-and y-axes correspond to the outer boundaries of the grids used for these calculations and the directions of x and y are the same as in figure 1. The LOS of the core toroidal systems are also shown as red lines terminating in filled circles at the center of the beams. The grids are sufficient to encompass the entire intersection volume of the LOS with the neutral distribution, also in the z direction (not shown). One can see that the geometries agree very well between the two methods. This is also the case for the other six neutral beams at AUG. The slight differences between the two methods (left and right columns) are attributed to the fact that FIDASIM takes into account plasma rotation as well as the shape of the magnetic flux surfaces. This leads to slightly asymmetric attenuation between the top and bottom and leftand right-hand sides of the beam. In addition, one can see larger discrepancies between the two codes in the plasma scrape off layer, i.e. outside of the solid red line. This is because the geometry used in the pencil models (FAST/ COLRAD) is not applicable in this region. The valid comparison region starts just outside of the last closed flux surface (LCFS) (solid red line) on the low-field side of the machine.
It is important to remember that the integral along the LOS as written in equation (2) gives the effective measurement position of the diagnostic. This is often approximated as the intersection of the LOS with the center of the beam. This is appropriate for LOS that cross only a single NBI source, are perpendicular to the beam injection, and do not cross-regions with steep gradients, such as the edge pedestal. In practice at AUG, these conditions are only very rarely fulfilled. Therefore, the default measurement positions are calculated as the center of mass of the distribution given by the integrand in equation (2) [11]. This is done using the equilibrium and plasma profiles from a standard H-mode discharge and for all possible combinations of the NBI sources. Even so, when running CHICA the calculation is re-done with the actual plasma equilibrium and kinetic profiles. This can result in shifts of the effective measurement positions by up to 1 cm in the core and even more at the edge, depending on the position of the LCFS compared to the value used in the default evaluation.

Neutral beam attenuation methods
The beam attenuation codes implemented within CHICA vary significantly in terms of their capabilities, the physics included, the beam model used, and the atomic data. To provide a reference for the discussions that follow, an overview of the main features of each code is provided in table 1.
FIDASIM [12,16] is a Monte Carlo (MC) code capable of simulating the entire D α spectrum. As part of these calculations, FIDASIM calculates the neutral densities of all beam energy components including the halo in the first four excited states. Within CHICA, this information can be extracted and used for the determination of the CXRS impurity density profiles. The results of the FIDASIM simulations have been compared to the measured beam emission spectra, including halo, and reproduce the experimental spectra well [17]. Due to the MC approach, the analysis of the neutral density via this method requires relatively long computation times; the simulation of an entire discharge can take several days. Using FIDASIM for the neutral density calculation also has the disadvantage that the noise level on the resultant neutral densities is inversely proportional to the number of Monte Carlo particles used. This means that to get a smooth neutral density profiles on the HFS requires larger number of particles and longer computation times. However, FIDASIM is the only method within CHICA that correctly handles the plasma edge, taking regularly into account the plasma curvature and also neutral particle losses out of the plasma. In addition, FIDASIM is the only model that fully treats the movement of halo neutrals.
The FAST code originated as a very simple, hands-on, attenuation model for the assessment of the CXRS impurity densities. Through comparisons of FAST with COLRAD and FIDASIM, it was possible to identify errors in all three codes as well as the physics that was important for the evaluation of the impurity densities. During this process, the physics included in FAST was evolved until it became possible to run COLRAD on similarly fast time scales within the CHICA framework and all of the remaining differences between the codes could be attributed to specific pieces of physics missing in FAST. At this point, COLRAD became the standard analysis tool and there was no need for further evolution of the FAST code. However, it remains as a reduced model within CHICA that is still useful as a benchmark and for the understanding of the behavior of its more complicated counter-parts.
The FAST method calculates the neutral densities of the jth energy component in the ground state (equation (8)) and first excited state (equation (9)) along the center of each neutral beam according to equations (7) through (9).
Here, A l j ( ) is the beam attenuation factor with A 0 1 j = ( ) and l being the position along the beam path. S B,j are the total beam stopping rate coefficients in m s 3 1 -, n e is the electron density and Δt j =v j /dl, where v j is the beam velocity per energy component and dl is the distance of one iteration step along the beam path. The beam stopping cross-sections are taken from ADAS [18] using an implementation [19] that takes into account the temperature, density, beam energy, and individual impurity density profiles. In equations (8) and (9) E j is the fraction of particles in the first excited state from a simplified model considering only ion impact excitation. The normalization factor, n 0,n=1,j , is the starting neutral density in the ground state at the center of the beam outside of the plasma, i.e. before attenuation. The FAST code also includes a simplified halo estimate in which the source of the halo, CX reactions between beam neutrals and plasma main ions (righthand side of equation (10) Here, n 0,n=1,Halo is the halo density in the ground state, S e is the ionization loss term, σ DD is the cross-section for deuterium charge exchange with beam neutrals, j v is the velocity of the neutral atoms, n 0,n=1 is the neutral density in the ground state, the subscript l refers to the position along the NBI trajectory, j to the neutral beam energy component, and n e and  (4)) Gaussian (equation (4)) Fixed foci and divergences for 'launched' MC particles Halo Geom.: Gaussian (equation (4) Yes (not standard) Yes (not standard) Yes Rotation: No No Yes n-states n=1, 2 n=1-10 n=1-10 Beam excit. : Ion-impact equations (7)- (9) full col. rad. full col. rad. Halo source: Halo excit.: elec. impact full col. rad. full col. rad. Z eff profile: Array of impurities Single impurity Single impurity n D are the electron and main ion densities, respectively. For the ionization, only electron impact ionization as a function of electron temperature and density along the beam is taken into account. The atomic data used is taken from the ADAS ADF11 scd96_h.dat file. For the main ion charge exchange cross-sections only the energy dependence has been taken into account as the variations with density and temperature in the parameter space of interest are comparatively small. A proper analysis would integrate the product of these crosssections and beam velocities over a Maxwellian velocity distribution. Within the FAST code this has not been done. However, this is properly treated in both FIDASIM and COLRAD.
As will be shown in section 3, the emission from charge exchange reactions between impurity ions and ground state halo atoms to the total CXRS signal is negligible. However, the contribution from the n=2 halo atoms is important. Within the FAST model, the fraction of halo atoms in the first excited state is estimated as where n 0,n=1,Halo is the ground state halo population, n 0,n=2,Halo is the population in the n=2, PEC is the photon emissivity coefficient as a function of electron temperature and density along the beam taken from the ADAS ADF15 pec96#h_pju#h0.dat file, and A 21 is the hydrogen Einstein 21 rate coefficient. Despite its simplicity, the neutral densities from this model compare well against those from the more complete physics models included in FIDASIM and COL-RAD and deviations from this model highlight where additional physics effects become important. All of the calculations described above are performed for the parameters at the center of the neutral beam and are then extended onto the three dimensional spatial grid using the function described in equation (4). The vertical and horizontal widths of the halo populations depend strongly on local plasma parameters. To describe this population via a Gaussian decay, widths as a function of plasma parameters must first be defined. For this purpose, FIDASIM was run for a matrix of ion and electron temperatures and electron densities. The resultant halo populations were fit to the same Gaussian function given in equation (4) and these fitted widths are used as a 'look-up' table when running FAST. It should be noted, however, that the single Gaussian fall-off length is often a poor description of the halo distribution and FAST, therefore, significantly underestimates the spatial extent of the halo populations. The impact of this geometry error on the calculated CXRS densities depends strongly on local plasma parameters and is somewhat mitigated by the LOS integral through the neutral distribution. This is discussed further in sections 2.3 and 4.
A simplified toroidal curvature model is implemented for the FAST code. However, the impact on the neutral densities when using it is very small. As this module increases the computation time of the FAST code it is not routinely included in the calculations. The effect of both toroidal and poloidal curvature on the neutral density distribution have also been tested with COLRAD and found to be negligible. This is consistent with the good agreement in edge neutral densities between the pencil codes and FIDASIM, as will be shown in section 2.3.
The COLRAD model, short for the collisional radiative model [20], combines the simplified beam model of the FAST code discussed above, avoiding the need for a time consuming Monte Carlo approach, and the same complete collisional radiative model used within FIDASIM. COLRAD solves the collisional radiative model for the beam neutrals of each energy component and the halo neutrals. It calculates the densities in the states with principal quantum number n=1-10 by solving the corresponding system of 10 coupled rate equations. The collisional rate coefficients in COLRAD are due to excitation, de-excitation and ionization by electron, hydrogen and impurity ion impact as well as charge exchange reactions with main ions (H or D) and impurities. The evolution along the beam trajectory is calculated on a spatial grid with 1cm step width, where all beam neutrals start in n=1 at the outermost grid point. The rates in the model vary in time as the beam penetrates regions with different n e , T e , T i and Z eff . The losses due to charge exchange of all energy components of the beam with the hydrogen background are the source for the n-levels of the halo neutrals. The population of the halo neutrals in all n-states is then calculated from the equilibrium solution of the collisional radiative model, where the corresponding rates are evaluated with the local plasma parameters at the source location on the beam axis.
Similar to FAST, within COLRAD all calculations are performed for the plasma parameters at the center of the beam and are then extended onto the 3D grid using equation (4). The shape and extent of the halo population, however, is treated more carefully. Within COLRAD characteristic falloff lengths for ionization and charge exchange reactions of the halo population are calculated for each position along the beam path. The relative strengths of these two processes is used to estimate the profile of the halo neutral cloud perpendicular to the beam trajectory. Therefore, within COLRAD the halo population is not characterized by equation (4). This ingredient was found to be critical to reproducing the radial profile of the halo as measured by BES and calculated by FIDASIM. Not taking into account the spreading of the halo cloud leads to significant differences in the shape of the calculated impurity density profiles, see section 4.
The final possibility to determine the neutral density populations in the plasma is direct BES measurements along lines of sight (LOS) parallel to those used for CXRS [7,13,14]. The D α spectra provide measurements of the total emission from the beam neutrals in the n=3 for all energy components including the halo. By using effective photon emission coefficients, this can be translated into n=3 neutral particle densities, which in conjunction with a collisional radiative model, enables the populations in other excited states (n=1, 2) to be determined. The end result is the LOS integrated neutral densities as a function of beam energy and excited state.
While this direct measurement of the neutral densities is the ideal method to determine the neutral densities in the plasma, there are several limitations to using this technique. First, the NBI sources in the NBI beam boxes are not completely separated vertically. Therefore, when multiple NBI sources are used, the BES LOS collect emission from all of them, blurring the spectra and making it difficult to unambiguously identify the emissions from the different beams and energy components. This can lead to significant errors in the deduced neutral densities. This problem is worse for NBI box I than for NBI box II. Second, if the LOS are too perpendicular to the beam, as is ideal for CXRS measurements, then there is insufficient Doppler-shift separation between the energy components for them to be clearly identified. This is the case for the edge LFS LOS of both BES systems and can also be a general problem for the third energy component. Fortunately, the third energy component is relatively unimportant for the analysis of the impurity density profiles. Third, the evaluation of the BES data itself is a complicated and time consuming process. Therefore, the BES is mainly used as a check on the attenuation codes and to evaluate the impurity densities in situations, such as beam blips (short injections of NBI power of 20 ms or less), in which the beam shapes are not well described by equation (4) and the number of neutral particles in each energy component is not well characterized. Similar analysis is needed, for example, at DIII-D [21], where the behavior of the beam in the start-up phase is also found to evolve, and not be well described by the steady-state parameters.

Comparison of different methods
The beam attenuation models included within CHICA have been thoroughly benchmarked against one another to understand the limitations of a given code and to identify the dominant physics mechanisms. To do this, CHICA was run with all three methods using a matrix of flat kinetic profiles (n e , T e , T i ) as inputs. The electron density was varied between 1 and 9×10 19 m −3 , and the electron temperature and the ion temperature between 250 eV and 5 keV. In all cases a linear pedestal assumption was used starting at ρ f =0.94 (ρ f is the normalized toroidal flux coordinate) and enforcing T e =T i =100 eV and n e =1×10 18 m −3 at the LCFS. This is necessary within the codes to ensure reasonable temperature and density values are extrapolated onto grid points outside of the LCFS. For the calculations the equilibrium from AUG discharge 33910 was used.
In figure 3 the resultant attenuations of all three beam energy components in the ground state for both NBI 3 and NBI 8 are shown. These curves are for the case T e =T i =500 eV and n e =5×10 19 m −3 , which roughly corresponds to pedestal top parameters at AUG. Here, the neutral density distributions have been integrated along the LOS of the CXRS systems viewing the respective beams and are plotted against the major radius of the intersection position at the center of the beam. The agreement between the codes is extremely good, making it difficult to distinguish the three curves per energy component. Differences are visible for the third energy component, but are small enough to be of no importance for the evaluation of the impurity densities, as will be shown in section 3. The attenuation of these components calculated by all three codes agree well across the entire matrix of densities and temperatures considered.
In addition to the ground state neutral densities, each code is capable of calculating the n=2 neutral densities. FIDASIM and COLRAD can also provide higher n-state information. These, however, are not used in the analysis. Section 3 will present a brief discussion of the effect of neglecting these populations on the total calculated CXRS impurity density. In figure 4 the calculated neutral densities in the n=2 for all three beam energy components are shown for NBI 3 at mid-radius (R=1.9 m). In the left panel the n=2 densities are shown as a function of the electron density and on the right as a function of the electron temperature. The dependence on electron density in all three codes is very similar, although the increase in n=2 population calculated by FAST is not as steep as in the other two. This discrepancy decreases as the electron temperature is increased. The excitation and de-excitation model of the beam neutrals within FAST does not include a dependence on temperature. For excitation of beam neutrals into the n=2, FAST only considers ion impact excitation, which depends on the beam energy and electron density. Ionization out of the n=2 is not considered, only de-excitation back to the ground state given by the relevant Einstein coefficient, A 21 . The slight decrease in n=2 population at low T e reported by FAST on the righthand side of figure 4 is in fact a carryover from the ground state densities, which also show this slight decrease with electron temperature for all three codes. The other codes show a larger n=2 population at low T e . This indicates that FAST is missing an atomic process that causes increased population of the n=2 at low electron temperature. The missing process is electron impact excitation, which is included in both FIDASIM and COLRAD. The population of the higher nstates included in COLRAD and FIDASIM, but not in FAST may also play a role.
The last neutral density population of interest is the halo. Figure 5 shows the ground state halo densities computed by the three codes integrated along a LOS near mid-radius as a function of electron density, electron temperature, and ion temperature. Here the halo densities are normalized by the sum of the ground state beam energy components ( j=1-3), which represents the source of the halo particles. Note that the density of the halo population tends to be larger than the densities of the ground state beam energy components, which are the source of the halo. This is because of the long lifetime  of the halo neutrals, compared to the high velocity of the injected beam neutrals as they traverse the plasma. At low densities (1×10 19 m −3 ) FIDASIM and COLRAD show a lower fraction of halo neutrals than FAST. If the calculation of the spread of the halo is switched off in COLRAD and instead the Gaussian function is used, then COLRAD reproduces the FAST result. This shows that the drop at low density is a result of the spread of the halo cloud (the ionization length becomes large compared to the beam size) rather than an incorrect calculation of the halo production or ionization in FAST. For higher ion temperatures, the spreading of the halo is also important at higher densities.
In the middle panel of figure 5 the halo densities normalized to beam densities are plotted versus electron temperature for two different ion temperatures, 500 and 2500 eV (gray). With increasing T e all three codes show very similar behavior, namely increased number of halo neutrals compared to beam neutrals. Note, the beam neutral densities do not have strong dependences on either ion or electron temperature. The changes seen in the middle and the right-hand panels of figure 5 are dominated by changes in the calculated halo densities. The increase with increasing electron temperature comes from a reduction in ionization losses in the halo population and is dominated by electron impact excitation, the only process included in FAST. At increased ion temperature, however, differences between the codes are seen. The FAST model does not include any dependence on T i and, therefore, does not change as the ion temperature is increased. Both COLRAD and FIDASIM, however, decrease indicating a strong role of ion impact ionization on the population balance. This is shown more clearly in the right panel of figure 5. Both FIDASIM and COLRAD show a strong reduction in the halo densities with respect to the beam densities as the ion temperature is increased, while FAST over predicts the population. This effect is even stronger at increased electron temperature (gray). This is because the importance of both ion and impurity ion impact ionization increases compared to electron impact ionization at higher ion temperatures.
Finally, from these ground state halo populations, excitation into the n=2 is considered. The results for this population are shown in figure 6. Here, the fractions of the halo atoms in the n=2 are shown, i.e. the populations have been normalized by the ground state halo populations. In contrast to beam neutrals, the dominant excitation process for thermal neutrals into the n=2 is electron impact excitation and this increases with electron density and decreases with electron temperature as can be seen in the left and central panels of figure 6. The n=2 population calculated by FAST is low compared to COLRAD and FIDASIM and the discrepancy increases with increasing density and ion temperature. This again indicates the importance of ion impact ionization. The results from FIDASIM and COLRAD are nearly identical, which is expected as the same excitation model is used in both.
All of these calculations were performed at an effective charge value of Z eff =1.26 created by fixed assumptions on the concentrations of various impurities in the plasma (0.05% He, B, and C). The effective charge enters primarily into the calculation of the beam stopping cross-sections for the attenuation of the ground state beam energy components. Additionally, Z eff enters into the halo calculation through its effect on the main ion density and via additional losses from charge exchange and ionizing collisions. In all codes, the main ion density is calculated from the electron density and assumptions on the impurity concentrations. In FIDASIM and COLRAD the provided Z eff value is used together with the assumption that boron is the only impurity in the plasma. In the FAST model total effective beam stopping cross-sections are built using the full array of impurity concentrations provided. Additionally, the full array of impurity concentrations is used in the calculation of the main ion dilution.
For the first run of CHICA, the impurity concentrations provided by the user are by necessity a guess. This can be given in the form of a fixed assumption on the concentration of low-Z impurities (He, Li, B, C, N, Ne, O) or as educated guesses based on the measured intensities (time dependent) of various impurity species. This feature allows changes in Z eff to be tracked reasonably well during discharges in which there are strong changes in the impurity densities, for example, during impurity seeding. In this way time dependent Z eff inputs are possible. However, CHICA is presently not capable of handing Z eff profiles. This remains as a future upgrade. In addition, CHICA is not set-up to be run iteratively. After each CHICA run, the user must compare the resultant impurity concentrations to those assumed as inputs and, if necessary, re-run. Fortunately, reduced time-resolution runs using FAST or COLRAD can be done very quickly, such that reasonable guesses on the low-Z impurity populations can be obtained, mostly eliminating the need for iterative CHICA capability.

Effective charge exchange emission rates
All of the neutral densities presented in section 2.3 enter into the calculation of the CXRS impurity densities weighted by the corresponding charge exchange effective emission rate, which renders some of these neutral densities significantly more important than others. Within CHICA, once the neutral density populations have been determined, the correct atomic data is selected based on the mass and the wavelength of the measured CX line. The evaluation of impurity density profiles requires effective emission rates for the specific transition under consideration. For most impurities, CHICA does not use the ADAS adf12 files, which require some additional processing. Rather, from the raw cross-section data, emission rates have been evaluated using the ADAS 309 code, taking into account the evolution of non-statistical populations of atomic angular momentum states due to l-mixing collisions with ions and cascade from higher n-states into the n-transition of interest. This has been done consistently for all considered transitions on a grid of beam energies, densities, ion temperatures, and Z eff values relevant to AUG. Thus, the equivalent of ADAS adf12 files are created for all relevant plasma parameter combinations and all collision energies. This approach is superior to using adf12 files, which include emission rates calculated for only a single reference point, which then needs to be extrapolated on energy, density, temperature, and Z eff grids.
In the AUG approach, the calculated emission rates are divided by the relative velocity of the donor and receiver to obtain effective charge exchange cross-sections, i.e crosssections that also include the effect of cascade radiation and the correct l-state population distributions. As a last step Maxwell averages over the appropriate velocity distributions  are performed to obtain effective charge exchange emission rates. Thus the effective rate coefficients for both beamimpact and thermal charge exchange collisions are given equal treatment starting from the raw cross-section data. The results are mono-energetic, Maxwell averaged, effective rate coefficients, v eff s á ñ , saved together with the used parameter grids.
These calculations have been done for most of the regularly measured CXRS emission lines (He, B, C, N, Ne). The n=1 and n=2 charge exchange cross-section data used for the calculations are listed in table 1. Most datasets are taken from ADAS adf01 files, only the atomic data for nitrogen have been taken from recent atomic-orbital close coupling calculations [22]. In addition, CHICA is capable of supporting ADAS adf12 files if the analysis described above has not been done for an element or transition of interest. For example, both Li and O CXRS measurements have also been made at AUG. The n=1 and n=2 ADAS adf12 files used for the analysis of these data are also listed in table 2.
A comparison of the beam-impact effective CX emission rates used at AUG and the data available in the form of adf12 files in the ADAS package is shown in figure 7 for several commonly used CXRS lines for a plasma temperature of 2 keV and electron density of 5.5×10 19 m −3 . The data typically agree to within 15% at the energies of interest. Note that the n=2 rates are two orders of magnitude larger than the n=1 rates. This means that even a very small population of neutrals in the excited states can have a non-negligible impact on the calculated impurity densities.
In figure 8 the thermal charge exchange emission rates for He, B, C, N, and Ne are shown as a function of the donor (halo) temperature for the same plasma parameters as in figure 7. When using the thermal charge exchange rates, it is always assumed that the donor and receiver (main ion and impurity) velocity distributions are the same. The n=2 thermal CX data calculated at AUG compare well, typically within 20%, with the available n=2 thermal charge exchange rates calculated in collaboration with the ADAS group (not shown). ADAS n=1 thermal effective emission rates do not exist at present. Note that the n=2 thermal rates are 4-5 orders of magnitude larger than the n=1. Additionally, at low energy (T i < 10 keV) the n=2 thermal rates are the same order of magnitude as the beam impact n=2 rates shown in figure 7. Above these energies, the rates diverge.
To see which neutral populations dominate the CXRS signal, the products of the neutral density populations and their corresponding effective emission rates for the B n=7-6 transition at 494.467 nm have been compared for NBI 3 (60 keV) and NBI 8 (93 keV) using the beam attenuation calculations presented in section 2.3, which included realistic beam densities for all energy components. This comparison is shown in figure 9 for both beams at mid-radius as a function of electron density on the left, and for NBI 3 also as a function of ion temperature on the top right. The neutral densities used in this plot were calculated with the FIDASIM model, but very similar plots are produced if either FAST or COLRAD is used.
For almost the entire range of plasma parameters considered, the ground state of the first energy component and the n=2 population of the beam halo are the dominant contributors to the measured CXRS signal. At typical AUG densities (5×10 19 m −3 ) the former constitutes roughly 45%-60% of the signal for the 60 keV beams, while the latter accounts for a further 15%-35%. The n=2 halo fraction increases for higher densities. For the higher energy beams of NBI box II (93 keV) the first energy component of the beam is more dominant accounting for 55%-75% of the CXRS signal, while the n=2 halo contributes only 10%-20%. For these beams also the ground state of the second energy component makes a significant contribution of 15%. All other neutral density populations contribute less than 10% to the total signal for the entire range of plasma parameters considered and most contribute less than 5%.
A comparison of the final results from all three codes for the entire matrix of parameters considered is shown in figure 10. Here the LOS integral of the sum of all of the neutral density populations for the edge-most LOS of each system multiplied by the respective effective emission rates (right-hand side of equation (2)) is shown for FAST and COLRAD on the y-axis, and FIDASIM on the x-axis for both NBI 3 and NBI 8. The agreement between the codes is very good, particularly for NBI 8, where the halo is less important. The relative importance of the halo for the calculations of the two beams is also the reason for the increased scatter in the FAST data for NBI 3. The values shown in figure 10 provide information on what we should expect to see regarding the absolute intensities measured by the CXRS systems on NBI 3 and NBI 8. For the entire database, the mean value for NBI 3 from FIDASIM is 3.6 and for NBI 8, 4.4. Therefore, we should expect to see 20% more intensity on the NBI 3 diagnostics than on the NBI 8. Restricting the database to more normal pedestal top parameters, however, Figure 9. Percent contribution to the total CXRS signal from different neutral density populations as a function of electron density (left) for NBI 3 and NBI 8 as calculated with the FIDASIM code at mid-radius using flat kinetic profiles as inputs. The percent contribution to the total CXRS signal as a function of ion temperature for NBI 3 is shown in the top right. we expect to see only 10% higher measured intensities on the NBI 3 system. This is also the error bar on the absolute calibration of the diagnostics. In practice, very similar measured intensities are often observed between the two systems.
Contributions to the CXRS intensity from charge exchange with higher excited state (n>2) neutral populations have not been included in the analysis. This is due primarily to a lack of available n=3 charge exchange crosssections. In Guzman et al [23] a comparison of calculated effective emission rates for boron with hydrogen in the n=1, 2, and 3 is presented ( figure 7 from [23]). This comparison assumes beam impact CXRS rather than thermal CX and does not extend below an impact energy of 5 keV amu −1 , only slightly overlapping with the standard thermal temperature range observed at AUG. Therefore, these rates can be used to estimate the importance of charge exchange with the n=3 population of the first, second, and third beam energy components, but are insufficient to properly assess the contribution from the n=3 halo. As the n=2 population of all beam energy components contributes less than 5% to the total CXRS signal, see figure 9, and the n=3 population is smaller than the n=2, it is safe to ignore the beam-impact charge exchange with n=3 when calculating CXRS densities.
To estimate the importance of the n=3 halo, assumptions must be made on the atomic data. The following discussion proceeds under the assumption that the n=3 thermal charge exchange emission rates are the same (or very similar) to the n=2 rates. The ratio of the fraction of the halo population in the n=2 to the n=3 is shown in figure 11 as a function of electron density for two different ion temperatures and the maximum and minimum beam energies present at AUG: third energy component of the 60 keV beams and full energy component of the 93 keV beams. These curves were calculated using COLRAD. The n=2 halo population becomes important for CXRS impurity density evaluation for plasma densities above 3-4×10 19 m −3 . At these densities the n=2 population is 2-4 times larger than the n=3. The dependence on beam energy is small, as can be seen by comparing the red and magenta curves and the blue and black ones. The dependence on ion temperature is more important, but electron density is the dominant dependence. The fraction of n=2 to n=3 increases with increasing density, as does the importance of the halo to the CXRS evaluation. Therefore, as the excited state halo populations becomes more important for CXRS, the n=3 population becomes smaller compared to the n=2. Assuming the worst case scenario of only a factor of two between the n=2 and n=3 halo densities, neglecting this population leads to a 10%-20% error on the derived impurity densities (too high). For beam box II at 93 keV, the situation is better, resulting in a maximum 10% error in the calculated impurity densities. These numbers refer to the absolute magnitude of the derived density, the effect on the profile shape could be more subtle as will be shown in the next section.
Note, this discussion is based on B charge exchange cross-sections, assuming identical thermal effective emission rates for the n=2 and n=3 and assuming only a factor of 2 between the population densities. This situation results in only a 10%-20% error in the calculated impurity densities, corresponding to plasma parameters in which the halo contribution is the strongest, namely high density and high ion temperature. The actual error by neglecting the n=3, is quite possibly significantly less, particularly at normal operating conditions and, therefore, would be extremely difficult to diagnose within the error bars of the experimental measurements. If n=3 charge exchange cross-section data at low energies were to become available, it would be straightforward to implement these within CHICA and test these assumptions. At this time, there are no plans to extend the CXRS analysis to include higher n-state effects.
An additional effect that can complicate the analysis of CXRS impurity densities is the so-called 'plume' [1,8]. Most CXRS measurements in fusion devices are based on charge exchange reactions between fully stripped low-Z impurities and introduced neutral atoms. The charge transfer process produces a population of hydrogen-like impurities that have a finite lifetime before they become reionized via collisions. During this time, these ions can stream along magnetic field lines to other locations in the plasma where they can be reexcited into higher n-levels and emit radiation at the same wavelength as used for the active CXRS analysis. This additional emission is known as plume emission and for CXRS measurements utilizing low-n transitions (e.g. He, n=4-3), it can make a significant spurious contribution to the measured intensity. The plume contributions to the CX spectra measured at AUG have been examined and found to be negligible for all impurities and transitions except for helium. To deal with the plume contribution to the He emission an additional, optional package has been added to CHICA and is presented in detail in a separate publication [24].

Application to experimental data
The ideal plasma discharge to provide the most complete comparison of the beam attenuation methods would feature NBI 3 and 8 without any other beam sources and have fully calibrated BES data from the systems viewing both NBI boxes. These conditions strongly reduce the number of potential discharges for this comparison. AUG discharge 33856 is interesting for this purpose as individual NBI sources were turned on sequentially, including NBI 3 and 8. Time traces from this discharge and a comparison of the kinetic profiles from the NBI 3 and NBI 8 phases are shown in figure 12. This discharge is representative of medium-density, low NBI power H-mode plasmas at AUG and features a standard magnetic equilibrium, B t =−2.5 T, I p =0.8 MA, 2.5 MW of NBI heating, 1.2 MW of ECRH, and a line-integrated density of 6.7×10 19 m −2 . The temperatures and electron densities agree very well between the two phases, enabling a direct comparison of the neutral densities calculated for the different NBI sources. More importantly, the stationarity of the discharge means the physics determining the low-Z impurity density profiles can be expected to be unchanged between the two phases, enabling a direct comparison of the resultant impurity density profile shapes from NBI 3 and NBI 8. Figure 13 shows the contributions of different neutral populations to the total B 5+ (n=7-6) emission integrated along the LOS of the diagnostics as a function of the effective measurement position of the LOS in normalized poloidal flux coordinates, ρ ψ . As in the previous section, the contribution to the total signal is given by the product of the neutral density and the corresponding effective emission rate integrated along the LOS. On the left the contributions from the ground state, first energy component is shown for all codes plus the BES. The equivalent curves for the ground state of the second energy component are shown in the center. The right column displays the contribution from the n=2 halo. These are the three dominant populations. The atomic data used for all four methods are identical. Differences stem from the calculated neutral densities. The agreement between the methods for the first and second beam energy components is very good. The largest differences can be seen in the n=2 halo profiles. Here, the profiles from FAST are too low and too flat compared to the other methods. In addition, the halo determined from the BES fits on NBI 8 has a much steeper profile than calculated by COLRAD or FIDASIM. The reason for this discrepancy is unclear, particularly as the agreement between the codes and BES data on NBI 3 is quite good. In both cases, the BES profile is based on Gaussian fits to the wings of the D α radiation. The peak of the D α line itself is blocked by a wire to prevent saturation of the detector. In this example, the fits to the wings are very good. However, it appears to result in slightly too high halo densities compared to the calculations. This becomes visible when looking at the impurity density profiles outside of mid-radius, see figure 14.
For this discharge, the first energy component contributes roughly 50%-60% to the total CXRS signal for both NBI 3 and NBI 8. For NBI 3 the second energy contribution is less than 10% across the entire profile, while for NBI 8 this component is more important contributing over 20% near the plasma edge. The halo contribution on NBI 3 (COLRAD and FIDASIM) is only 10% at the plasma edge, but increases to 35% of the total signal in the plasma core. A similar trend is seen on NBI 8, but in this case the core n=2 halo contribution does not exceed 20% of the total signal.
The corresponding boron impurity density profiles are shown in the top panel of figure 14. Here, for clarity, only the profiles from COLRAD and FIDASIM have been shown as well as the BES profile from NBI 8, which featured a different halo density profile and causes the impurity density profile to be more peaked. The absolute intensity calibration from the NBI 3 CXRS system was adjusted upwards by 20% to get the match to the NBI 8 data. This adjustment is not unreasonable considering that the absolute intensity calibration on each system has an uncertainty on the order of 10% and that the invessel optical components of the different systems are exposed to different degrees of coating and damage during plasma operation, increasing the uncertainty on the absolute and relative calibrations of the systems during an experimental campaign. In general, the uncertainty on the injected neutral beam power, as discussed in section 2.1, could also play a role in the observed intensity differences. In this case, however, the good agreement between the neutral beam attenuation codes and the BES systems, suggests that this is not the source of the mismatch.
The agreement in profile shape resulting from the two systems and the different methods is very good. This can be seen in the bottom panel of figure 14 where the normalized logarithmic gradients (R L R n n n B B B = - ) are shown. Each boron density profile from COLRAD and FIDASIM in the 400 ms time window was fit with a spline and the corresponding R L n B determined. The profiles shown here are the mean of the R L n B profiles and the error bars are the standard deviation. Therefore, these R L n B profiles do not correspond directly to the averaged profiles shown in the top panel. The R L n B profiles corresponding to the averaged profiles do fall well within the error bars shown. While small differences between the impurity density profiles calculated from the different CXRS systems (NBI 3 system versus NBI 8 system) and the different codes remain, it is difficult to pinpoint the source of these differences and highlights the challenge of determining the absolute value of R L n Z to better than 0.5 with even very high quality CXRS data. This is an important consideration for low-Z impurity transport experiments and comparisons to modelings.
The red triangles correspond to the profile derived using the BES data on NBI 8. Inside of mid-radius, where the agreement in the halo profile is still good, the BES data overlaps with the other curves. Outside of mid-radius, where the halo-profile starts to diverge, there is a change to the impurity density profile shape outside of the error bars. However, as the halo becomes less important in this region (∼10%), the effect on the profile shape is relatively small. The top panel of figure 15 shows the boron density profiles calculated using neutral densities from FIDASIM for both NBI 3 and NBI 8 with (blue full symbols) and without (red hollow symbols) including the halo contributions. The blue profiles here are identical to the FIDASIM profiles shown in figure 14. Neglecting the halo results in impurity densities that are too high and an artificial peaking of the profile, as was first shown for AUG in [7].
The bottom panel of figure 15 shows the corresponding R/Ln B profiles. In this case, neglecting the halo causes an artificial increase of order ΔR/Ln B ∼0.6 across the entire profile for NBI 8 and 1.0<ΔR/Ln B <1.5 for NBI 3. At AUG the halo is observed to have a very large impact on the evaluation of impurity density profiles. However, this does not a priori mean that this impact will translate directly to the profiles evaluated at other devices where the halo is not included in the analysis. The magnitude of the halo depends strongly on the NBI energy and is larger for lower energy beams. Moreover, it increases with electron density and decreases with Z eff . At devices with higher energy beams, higher fractions of particles in the first energy component, lower electron densities, or higher Z eff , the contribution of the n=2 halo to the total CXRS signal may well be smaller. Dedicated calculations at each machine are required for a proper assessment.

Variations along CXRS LOS
The simplest way to evaluate the LOS integrals in equation (2) is to assume that all plasma parameters, impurity density included, are constant along the LOS through the neutral beam volume and can, therefore, be taken out of the integral. In the presence of strong gradients or LOS geometries that are not near tangency to magnetic flux surfaces, however, this assumption is not necessarily valid. This is the case for the edge LOS of the core CXRS diagnostics on both NBI 3 and NBI 8. These LOS intersect the edge pedestal while still in the neutral beam volume, as can be seen in figure 2. These LOS collect significantly less emission than the innermost LOS of the edge diagnostics, which are  optimized to be perpendicular to the beam and tangent to magnetic flux surfaces. This leads to an apparent discrepancy in the measured intensities between the core and edge CXRS diagnostics.
This can be see in figure 16. In this discharge the plasma position was swept slowly across the LOS of the diagnostics by several cm allowing an in situ cross-calibration of the intensity calibrations of neighboring CXRS channels, as the intensity measured on each LOS must produce the same profile as the plasma is swept across it. In figure 16 the measured boron IV intensity profiles from the core NBI 3 and NBI 8 systems as well as the edge system on NBI 3 are shown for three different plasma positions, corresponding to three different time-points in the discharge. On the left-hand side the outermost radius of the plasma was 2.16 m. Here, the LOS from the edge diagnostic are inside of the pedestal top. In the middle panel, the outer radius is 2.14 m. Here, the edge diagnostic characterizes the boron pedestal very well and a clear decrease of the intensities on the core LOS inside of this pedestal location can be seen. On the right-hand side, the maximum plasma radius was 2.13 m, and this discrepancy is even more pronounced. The time windows shown in figure 16 were specifically chosen to exclude large type I ELMs, as these events add significant scatter to the data. As the plasma was moved away from the wall, the overall impurity content in the plasma decreased. This can be seen by comparing the intensities measured at a fixed position in the three panels of figure 16. The measured profile shape, however, remains unchanged. Therefore, for the comparison of the impurity density profiles below, a single, smooth, time dependent correction factor was applied to all of the data from all three diagnostics such that the average density measured between ρ ψ =0.87 and ρ ψ =0.93 remains constant at the value from the outermost point of the radial sweep (left panel in figure 16). In addition, an overall 10% correction factor was applied to the intensity data of the core system on NBI 8 (upward) and the edge system on NBI 3 (downward). The intensities measured on the core NBI 3 system have not been adjusted. These corrections were applied to get the match in the absolute value of the impurity densities shown in figure 18. Potential sources for these differences were already discussed in the previous section.
To evaluate the impurity density profiles for the edge LOS of the core diagnostics, one must assume a functional form for the edge impurity density profile. In CHICA, the default option for this form is: where, ρ ped.top is the normalized poloidal flux at the pedestal top, which can be set by the user before the run based on measured electron density profiles or measured edge impurity intensity profiles, and C is a constant that can be taken out of the integral. This is the standard form used. However, it is straightforward to implement other functional forms. For the evaluation of the impurity density from the LOS that intersect the edge pedestal (or other steep gradient region) it is insufficient to model the LOS as a single line-trajectory through the plasma. Rather, the full geometry of the lightcone, defined by the diameter of the lens in the optical head [11], the diameter of the focal spot, and the distance between them, is needed. The finite volume of the light-cone means that at each position along the LOS, light is collected from regions of both smaller and larger radii than the central position. In CHICA the light-cone of each LOS is split into four quadrants that are aligned with the major radius of the machine such that the geometric centers of the quadrants on the low-and high-radius sides of the cone have the maximum difference in major radius. The emission collected in each quadrant at each position ds along the LOS is given equal weight. A sketch of the light-cone geometry used in CHICA Figure 16. CXRS intensities measured by the core NBI 3 and NBI 8 diagnostics as well as the edge NBI 3 system for three different plasma positions in discharge # 31916. Here, a 10% upward correction factor was applied to the NBI 8 intensities and a 10% downward correction to the edge NBI 3 intensities. No correction was applied to the data from the NBI 3 core system. is shown in figure 17. Division of the light-cone into even smaller pieces was also tested, but found to make almost no difference (< 2%) to the LOS integrals compared to the four quadrant method.
By including the light-cone geometry and the non-constant impurity density profile along the LOS, it is possible to interpret the measured intensity profiles. Figure 18 shows the boron density profiles corresponding to the intensity profiles shown in figure 16, but including data from the entire plasma position sweep. Time frames encompassing large ELMs have been excluded. On the left-hand side, the boron density was assumed to be constant along the LOS of the diagnostics and the light-cone geometry was not included. Here, one can see the three diagnostics give three different gradients for the edge impurity density profiles between ρ ψ =0.9 and 1.0. The LOS of the core system on NBI 3 are more strongly affected than those of the NBI 8 system because they are less tangent to flux surfaces and less perpendicular to the NBI. The effect on the edge system of NBI 3 is negligible because of the very small light cones (2-3 mm spot-sizes) and because the LOS are significantly more tangent to the magnetic flux surfaces and also more perpendicular to the NBI. For the evaluation of the CXRS densities from the edge CXRS diagnostics, therefore, these effects are not routinely included and are not included in the evaluation shown in figure 18.
On the right-hand side of figure 18 the evaluation of the impurity densities taking these effects into account (ρ ped.top =0.96) is shown. Here, the densities measured along the edge LOS of the core diagnostics have been corrected upwards by the model resulting in flat impurity density profiles out to ρ ψ =0.95. Outside of this location, the core LOS do a much better job of reproducing the pedestal profile measured by the edge system. The agreement is not perfect as the effective measurement location is in the pedestal region and the functional form assumed is not a perfect model. In this region, the correction applied is extremely sensitive to the details of the assumed profile shape and further iteration and analysis would be required to fully correct the data from the core systems. In particular, although large ELMs have been removed from this dataset, small ELMs remain and cause a time dependent evolution of the edge impurity density profile shape, which would have to be included. More careful modeling of the light-cone geometry and the relative alignment of the pedestal profiles would likely also be needed. However, when the effective measurement position of the LOS is inside the top of the impurity density pedestal, the corrections introduced by the simple model reproduce the correct profile shape well.

Summary
At AUG a new framework for the evaluation of impurity densities measured by CXRS diagnostics has been developed. CHICA can assess the impurity densities using data from all of the beam-based CXRS diagnostics at AUG and includes four different methods for the evaluation of the beam neutral density populations. These methods feature different implementation and contain varying levels of sophistication. While FIDASIM represents the most comprehensive physics package included in the code, the long computation times associated with the Monte Carlo calculations make running FIDASIM as a routine tool for impurity densities impractical. Overall, the reduced physics models of the FAST and COLRAD, COLRAD in particular, perform well against FIDASIM, eliminating the need for extensive runs with FIDASIM. These codes also fare well compared to indirect measurements of the neutral density populations from BES. While in theory, BES is the ideal method for determining the neutral density integrals, the practical implementation is often challenging. At AUG, due to very small angles between the diagnostic LOS and the neutral beams, the BES evaluation at the plasma edge is not possible. In addition, when multiple NBI sources are in use the interpretation of the BES spectra becomes complicated and greatly increases the uncertainty of the analysis. Lastly, the evaluation of the BES data itself is a complicated and time consuming process and is not routinely done. Therefore, the BES is mainly used as a check on the attenuation codes when such checks are possible and to evaluate the impurity densities in situations, such as beam blips, in which the beam shapes and particle fractions are not well characterized.
CHICA is equipped with the atomic data for all of the regularly measured charge exchange spectral lines (He, Li, B, C, N, O, and Ne). This data has been taken for the most part from ADAS cross-section data and processed to produce a consistent set of effective emission rates for both beam impact and thermal charge exchange with D(H) in the n=1 and n=2. Possible contributions from n=3 populations are not included due to lack of atomic data. However, the AUG data leaves little room for n=3 contributions to play a significant role in determining the shape or magnitude of CXRS impurity density profiles.
From the neutral density calculations and the available atomic data, it is clear that for AUG neutral beams and plasma parameters, there are three neutral populations that contribute significant emission to the total measured CXRS signal. For the 60 keV beams, the measured CXRS emission is dominated by the ground state of the first energy component and the n=2 beam halo population. The latter can contribute up to 35% to the total signal. For the 93 keV beams, the first Figure 17. Sketch of the geometry used within CHICA to define the light-cone of each LOS and calculate the total collected emission. energy component is responsible for 50%-70% of the CXRS intensity, while the contribution of the n=2 halo is typically less than 20%, and the remainder comes from the ground state of the second beam energy component. For the halo calculations, it is important to not only determine the source and loss of halo neutrals, but also to determine the spread of the halo perpendicular to the beam volume. Correctly including this population in the calculation of CXRS impurity densities is critical, as neglecting it leads to incorrect overall magnitudes and an artificial peaking of the profiles for both high and low energy beams. The increase in measured R L n B values can be on the order of R L 0.5 1.5 n B < D < , which will seriously impact any impurity transport studies that compare to predictions from either neoclassical or gyrokinetic theory.
The edge LOS of the core CXRS diagnostics at AUG intersect the edge pedestal inside the neutral beam volume. Therefore, the impurity density is not constant along the LOS, complicating the interpretation of the measured CXRS intensities. Within CHICA a forward model for the edge impurity densities has been implemented that enables the reconstruction of the edge profiles out to the pedestal top and greatly improves the agreement between the core and edge CXRS diagnostics.