Instruments measuring global solar ultraviolet (UV) irradiance at the surface of the Earth need to collect radiation from the entire hemisphere. Entrance optics with angular response as close as possible to the ideal cosine response are necessary to perform these measurements accurately. Typically, the cosine response is obtained using a transmitting diffuser. We have developed an efficient method based on a Monte Carlo algorithm to simulate radiation transport in the solar UV diffuser assembly. The algorithm takes into account propagation, absorption, and scattering of the radiation inside the diffuser material. The effects of the inner sidewalls of the diffuser housing, the shadow ring, and the protective weather dome are also accounted for. The software implementation of the algorithm is highly optimized: a simulation of 109 photons takes approximately 10 to 15 min to complete on a typical high-end PC. The results of the simulations agree well with the measured angular responses, indicating that the algorithm can be used to guide the diffuser design process. Cost savings can be obtained when simulations are carried out before diffuser fabrication as compared to a purely trial-and-error-based diffuser optimization. The algorithm was used to optimize two types of detectors, one with a planar diffuser and the other with a spherically shaped diffuser. The integrated cosine errors—which indicate the relative measurement error caused by the nonideal angular response under isotropic sky radiance—of these two detectors were calculated to be f2=1.4% and 0.66%, respectively.
 Accurate monitoring of solar ultraviolet (UV) irradiance is of great importance because of the various implications that UV radiation has on human health. The most significant beneficial health effect of UV exposure is the vitamin D3 synthesis in the skin, which is induced by electromagnetic radiation of wavelengths shorter than 315 nm [Webb, 2006]. The effects of vitamin D deficiency have been widely studied [e.g., Holick, 2007; Lappe et al., 2007]. Harmful effects of UV exposure include—but are not limited to—photokeratitis, erythema, and different forms of skin cancer [Lucas et al., 2006]. Measurements of solar UV radiation are also essential due to the concerns of ozone depletion [WMO, 2011].
 Ultraviolet radiation scatters strongly in the atmosphere, and the diffuse UV irradiance accounts for tens of percents of the global UV irradiance at the surface of the Earth even in cloud-free conditions [Parisi et al., 2001]. Therefore, an instrument that measures the global UV irradiance needs to collect radiation from the entire hemisphere. To measure global UV irradiance correctly, the angular response of such an instrument should be proportional to the cosine of the zenith angle and independent of the azimuth angle of the radiation. Deviations from the ideal cosine response can cause significant errors in the results. In fact, the nonideal angular response of the instrument is one of the most important sources of uncertainty in solar UV irradiance measurements [Bernhard and Seckmeyer, 1999; Jokela et al., 2000]. The measurement data can be corrected, to an extent, if the angular distribution of the UV radiance at the time of the measurement is known [e.g., Feister et al., 1997; Bais et al., 1998]. Unfortunately, this approach has a limited accuracy only [Bernhard and Seckmeyer, 1999], and the quality of the entrance optics remains of utmost importance for accurate global irradiance measurements.
 Diffusers are commonly used at the entrances of both spectral [Seckmeyer et al., 1999] and broadband [Seckmeyer et al., 2007] instruments to reach near-ideal cosine responses. The angular response obtained with a flat sheet of diffusing material always deviates from the ideal cosine response due to the increase in reflectance at large incident angles. Thus, some form of diffuser shaping is required to reach low cosine errors. Various designs for improved entrance optics for instruments measuring global irradiance have been presented [e.g., Bernhard and Seckmeyer, 1997; Gröbner, 2003]. Unfortunately, optimizing the shape of the diffuser through trial-and-error can be very time-consuming and expensive. Therefore, it is advantageous to be able to model and optimize the structure of the diffuser before manufacturing.
 In this paper we present a Monte Carlo algorithm that was developed for simulating radiation transport inside a diffuser. First, the basic structure of a typical solar UV diffuser is explained. The operation principle of the Monte Carlo simulation algorithm—including the radiation propagation inside the diffuser as well as the interface effects and the effect of the weather dome—is described in detail. The algorithm validation procedure is also detailed. After that, an example on how the simulation algorithm can be used to study the effects of different parameters on the overall angular response of the diffuser assembly is presented. Finally, two optimized diffuser geometries are shown.
2 Structure of the Diffuser
 The basic structure of a typical solar UV diffuser assembly is shown in Figure 1. The diffuser assembly consists of a transmitting diffuser element, a shadow ring, a protective quartz weather dome, and the mechanics to hold the optical parts together. The purpose of the diffuser element is to collect radiation from the entire hemisphere. Typical diffuser materials include polytetrafluoroethylene (brand name Teflon) and various quartz-based materials. The diffuser element needs to be shaped in one way or another to increase the angular response at medium to large zenith angles. The simplest approach is to raise a planar diffuser with respect to the front surface of the diffuser housing, so that the edge of the diffuser will also contribute to the angular response of the diffuser assembly at larger zenith angles. The surface of the diffuser element can also be modified in several ways. This paper focuses on raised planar diffusers and diffusers with spherically shaped front surfaces.
 The purpose of the shadow ring is to block radiation at incident angles equal to and larger than 90°. If the shadow ring is not aligned with the front surface of the diffuser, as is the case with Figure 1, some radiation may enter the diffuser assembly at angles larger than 90°. The weather dome protects the diffuser from being contaminated in the outdoor environment. Various detection schemes can be employed: in broadband instruments, a photodetector can be positioned directly behind the diffuser, typically with a filter in between the two parts [Seckmeyer et al., 2007]. In spectral instruments, an optical fiber or a fiber bundle is usually employed to transmit the signal to the entrance of the monochromator [Seckmeyer et al., 1999].
 The parameters utilized in the diffuser simulation algorithm are listed in Figure 1. The cylindrical diffuser element is characterized by its diameter d, edge thickness t, refractive index nd, scattering coefficient μs, absorption coefficient μa, and scattering anisotropy parameter g. The front surface of the diffuser can be planar or spherical with a radius of curvature rsph. The height of the diffuser with respect to the front surface of the diffuser assembly is defined as h=t−hsw, where hsw is the height of the sidewall. The diameter of the area of the diffuser that is visible to the detector or the fiber entrance is dvis. The distance between the detector and the back surface of the diffuser is zdet. The diameter and the height of the shadow ring are dsr and hsr, respectively. The weather dome has an inner radius of rdome, a thickness of tdome, and a refractive index of ndome. The position of the weather dome is determined by zdome.
3 Simulation Algorithm
 The diffuser simulation algorithm is based on Monte Carlo ray tracing. To improve simulation efficiency, the rays are traced from the detector toward the sky—not vice versa as in reality—and are collected after they exit the front surface of the diffuser element and pass through the weather dome. Furthermore, instead of individual photon-like particles, large groups of particles are considered to allow for partial absorption and reflection of the weight of the particle. This variance reduction method was already utilized in one of the first applications of the Monte Carlo method, the neutron chain reaction simulations [Eckhardt, 1987]. In the following discussion, these packages of particles are simply referred to as “particles”.
 The workflow of the simulation algorithm is illustrated in Figure 2. At the first stage of the tracing process, a particle emanating from the detector enters the diffuser. The propagation direction of the incident particle is randomized to account for the wide acceptance angle of the detector. The particle is refracted at the material interface, and part of its weight W is lost due to reflection. Inside the diffuser element, the propagation follows the framework laid out in the article by Wang et al.  concerning the light transport in tissues. An overview of the propagation-scattering-absorption cycle is given below. A more detailed description can be found in the above article.
 When the particle encounters a diffuser-air interface, it is divided into two parts. The transmitted particle contributes to the angular response of the diffuser assembly, while the reflected particle continues to propagate inside the diffuser element. The propagation-scattering-absorption cycle is repeated until—due to absorption and reflection losses—the weight of the particle has decreased below a certain threshold value. Once the termination threshold is reached, the tracing process is repeated again for a new particle.
 The software implementation of the algorithm was carefully optimized to allow the simulations to be run on a normal PC. A typical simulation of one billion particles and roughly 100 billion random numbers takes 10 to 15 min to complete on a modern quad-core processor.
3.2 Propagation and Absorption
 The absorption coefficient μa and the scattering coefficient μs indicate the absorption and the scattering probabilities per unit path length. The cumulative distribution function F(s) of the free path s—the distance the particle travels without being scattered or absorbed—is therefore
where χ is uniformly distributed in the interval (0,1). In order to generate numbers that follow the correct distribution from uniformly distributed numbers χ of a pseudo-random number generator, a transformation of probability densities is required. Calculating s=F−1(χ) and noting that χand (1−χ) yield identical probability distributions, the free path s can be obtained as
This equation is sampled at the beginning of each propagation step in order to determine the distance to travel. The direction of travel is defined by the directional cosines of the particle (μx,μy,μz) which are updated after each scattering event (see section 3.3).
 Propagation is followed by the weight of the particle W being decreased due to absorption as [Wang et al., 1995]
In all practical diffuser materials, scattering dominates over absorption (μs>>μa).
 In the algorithm, the scattering is governed by Henyey-Greenstein scattering phase function [Henyey and Greenstein, 1941]. The cosine of the deflection angle α is calculated as [Witt, 1977]
where χ is a uniformly distributed random number in the interval [0,1), and −1≤g≤1 is the scattering anisotropy parameter. Value of g=0 corresponds to isotropic scattering. Positive and negative values of the anisotropy parameter g indicate forward and backward directed scattering, respectively [Henyey and Greenstein, 1941; Wang et al., 1995]. Small values of |g| are expected of the potential diffuser materials. The azimuthal scattering angle β is calculated as
 The new directional cosines (μx,μy,μz) are calculated from the old directional cosines and the scattering angles of equations (4) and (5) as described in [Wang et al., 1995].
3.4 Material Interfaces
 In order to find out the refraction and the reflection angles at the material interface, the coordinates at which the particle crosses the interface and the surface normal vector at those coordinates need to be calculated. The distance ssph to the spherical front surface of the diffuser of Figure 1, for example, can be determined by solving the quadratic equation
for ssph. In the equation, and x, y, and z are the coordinates of the particle inside the diffuser, and μx, μy, and μz are its directional cosines. The origin of the coordinates is at the center of the lower surface of the diffuser. If the free path of the particle is larger than the distance to the surface (s>ssph), refraction and reflection occur.
 The coordinates at the surface of the diffuser (xs,ys,zs) can now be calculated as
The inner normal vector of a spherical surface is
Similar techniques are used to calculate the surface coordinates and the surface normal vectors on the flat facets and on the cylindrical sidewall of the diffuser.
 The reflection and refraction at the spherical front surface of the diffuser are illustrated in Figure 3. The directional cosine vectors for reflection and refraction are
where is the incident directional cosine vector and n1 and n2 are the refractive indices of the first and the second material. Angles ν1 and ν2 correspond to the incident and the refraction angles with respect to the surface normal (see Figure 3) and can be obtained from
and Snell's law
 Below the angle of total internal reflection,
the reflectance R and the transmittance T at the material interface are calculated as [Wang et al., 1995]
These equations correspond to Fresnel reflectance and transmittance for unpolarized radiation. For s- and p-polarized radiation, corresponding forms of equation (14) can be used [Born and Wolf, 1999, pp. 42].
 Above the angle of total internal reflection, all radiation is reflected and T=0. The reflected particle will continue to propagate inside the diffuser in the direction of . The weight of the reflected particle is RW, where W is the weight of the incident particle. If the transmitted particle hits either the shadow ring or the sidewall of the diffuser, it is assumed to be absorbed. The transmitted, unabsorbed particles (weight TW) will contribute to the overall angular response of the diffuser assembly.
3.5 Weather Dome
 The protective weather dome has an effect on the direction of propagation as well as on the weight of the transmitted particle. Assuming that the diameter of the spherical weather dome is significantly larger than that of the diffuser and that the wall of the dome is relatively thin, the weather dome can be approximated as a flat sheet of material around the point at which the particle first hits the inner surface of the dome, as is illustrated in Figure 4. Furthermore, the nonuniformity of the thickness of the wall is assumed to remove interference effects between the dome surfaces. The radiation is reflected back and forth between the two surfaces and the total transmittance of the weather dome can be calculated from a geometrical series
where Tin, Tout, Rin, and Rout correspond to the transmittances and the reflectances at the inner and outer surfaces of the weather dome, respectively. In the algorithm, these values are approximated by the transmittances and the reflectances at the first two material interfaces (see Figure 4). All transmitted particles are assumed to travel in the direction of the first component that is transmitted through both material interfaces. The zenith angle of the first transmitted particle is calculated exactly, without using the flat sheet approximation. Based on equations (14)–(16), approximately 7.7% of the weight of the particle is reflected from the weather dome, assuming normal incidence and weather dome refractive index of 1.5.
 The weather dome can also increase the overall angular response at large zenith angles if a particle that is reflected at the inner surface of the weather dome exits the detector structure at some other point of the weather dome. This effect is illustrated in Figure 5. The phenomenon only occurs if the diameter of the diffuser is close to that of the weather dome. In case of a relatively small diffuser, the reflected particles will always travel toward the detector, corresponding to a situation where the radiation enters the diffuser assembly at a zenith angle larger than 90°.
4 Algorithm Validation and Simulation Results
 The simulation algorithm was validated by comparing the simulated and the measured angular responses of a prototype detector, consisting of a planar diffuser, an aperture, and a photodiode—see Figure 6a. The measurement setup, shown schematically in Figure 6b, consisted of a beam-expanded helium-cadmium (HeCd) laser and a rotary stage on which the prototype detector was mounted. The rotation axis of the rotary stage was aligned with the front surface for the planar diffuser. The effect of the position of the rotation axis on the angular response has been studied by Poikonen et al. . The variations in the irradiance level of the laser during the measurement sequence were tracked with a monitor detector. The incident angle of the radiation was varied from −90° to 90° with 1° steps, and the photodetector signal was recorded with a current-to-voltage converter and a digital multimeter.
 The wavelength of the HeCd laser was 325 nm. The degree of polarization of the laser beam was less than 12%, which was calculated to alter the angular response by less than 2.2% relative to an unpolarized beam at angles below 75°. The spatial uniformity of the expanded laser beam was investigated by measuring the irradiance at various parts of the beam using a 2 mm aperture and a photodiode. The beam was scanned in 1 mm intervals along three horizontal lines, one passing through the center of the beam and the others 2.5 mm above and below that line. The standard deviation of the irradiance values was 3.8% (k=1) within the area of the 15 mm diameter diffuser. The output of the laser comprised multiple transverse modes. Therefore, the beam profile was not Gaussian but rather oscillated around the average value. Due to the relatively large surface area of the studied diffuser sample, these variations in irradiance are effectively averaged out and the inhomogeneity of the expanded laser beam was calculated to affect the measured angular response of the prototype detector by less than 1%.
 The diffuser element under study was made of synthetic, “bubbled” quartz where small gas pockets acted as scattering centers. The diameter and the thickness of the planar diffuser were d=15 mm and t=2 mm, respectively. The diameter of the visible area of the diffuser was dvis=13 mm. The simulation results were first matched with the results of the measurement with a nonraised diffuser (h=0 mm) by tuning the scattering coefficient μs. For the selected diffuser material, a value of μs=23 cm−1 was obtained. The absorption coefficient μa was set to 100th of the value of the scattering coefficient. The decrease (increase) of 100% in the absorption coefficient increased (decreased) the angular response by less than 1.5% at angles below 75°. The assumption of uniform scattering (g=0) turned out to yield the best results. The height of the diffuser was then increased to h=1 and 2 mm in both the simulations and the measurements, and the angular responses were compared again. The shadow ring (inner diameter dsr=27 mm) was kept in level with the front surface of the diffuser in both cases. Figure 7 shows a relatively good agreement between the measured and the simulated angular responses. The cosine errors f2(θ) of the figure (shown as dotted lines) were calculated as [International Commission on Illumination, 1982]
where S(θ) is the measured signal at incident angle θ.
 It can be seen in Figure 7 that the optimal height of the diffuser, as far as the angular response is concerned, is approximately h=1 mm for this detector configuration. Below h=1 mm, the angular response of the detector is smaller than the ideal cosine response at all zenith angles. When the height of the diffuser is increased, the angular response at medium zenith angles will eventually rise above the ideal cosine response, indicating that the detector will get too much signal at these zenith angles. The “edge effect”, where the exposed sides of the diffuser element contribute to the overall angular response of the diffuser assembly, plays an important role in the diffuser optimization process, because it allows the angular response of the diffuser assembly to be increased at medium to large zenith angles as compared to a nonraised diffuser. In order to extend the effect of the raised diffuser edges to still larger zenith angles, the diameter of the shadow ring can be increased. The zenith angle θsr at which the shadow ring starts blocking the radiation incident on the diffuser assembly can be estimated as
where dsr is the diameter of the shadow ring, and d and h are the diameter and the height of the diffuser, respectively. The equation also illustrates how a change in one parameter value can affect the optimal value of other parameters, making experimental optimization of the diffuser structure a complex task with many free parameters.
 The simulation algorithm provides an easy way to study how different parameters affect the overall angular response of the diffuser assembly. As an example, the angular responses of a diffuser assembly at various heights of the shadow ring hsr, ranging from 0.5 to 1.0 mm, are plotted in Figure 8. The bubbled quartz material of the validation measurements was chosen as the diffuser material of all further simulations. The diameter and the thickness of the planar diffuser were d=10 mm and t=2 mm, respectively. The height of the diffuser was h=1 mm in all cases, which means that hsr=1 mm corresponds to a full shadow ring. Figure 8 indicates that the angular response at large zenith angles can be improved by slightly lowering the shadow ring with respect to the front surface of the diffuser. The integrated cosine errors [International Commission on Illumination, 1982]
of the example diffuser assembly at the shadow ring heights of hsr=1 mm and hsr=0.7 mm were f2=1.79% and f2=1.55%, respectively. Were the integration interval of equation (19) extended to a zenith angle of 89°, the corresponding integrated cosine errors would be % and %. The obvious drawback of lowering the shadow ring below the diffuser surface is the increased angular response at very large zenith angles and nonzero response at zenith angles equal to or larger than 90°.
 In Figure 9, the angular responses and the corresponding cosine errors of two optimized diffuser assembly geometries—one with a raised planar diffuser (green lines) and the other with a spherically shaped diffuser (red lines)—are presented. For comparison, the angular response of a nonraised diffuser that is otherwise identical to the raised planar diffuser is also plotted in the same figure (blue lines). In all cases, the diameter of the diffuser and the inner surface of the shadow ring were set to d=20 mm and dsr=38 mm, respectively. A weather dome (inner radius rdome=21 mm) was incorporated in all designs of Figure 9.
 The thickness of the planar diffuser was set to t=2 mm to ensure sufficient transmittance as well as a strong enough edge effect. The diffuser was optimized by tuning the height of the diffuser, the height of the shadow ring, and the diameter of the visible area of the diffuser. The values of these parameters were h=2 mm, hsr=1 mm, and dvis=18 mm. The integrated cosine errors of the nonraised and raised diffusers were f2=7.4% and 1.4%, respectively. The edge thickness of the spherically shaped diffuser was set to t=1 mm. In addition to the previously mentioned parameter values, the radius of curvature of the spherical front surface of the diffuser rsphcould now be tuned to improve the angular response. The optimized parameter values for the shaped diffuser were h=1 mm, hsr=2.6 mm, dvis=18 mm, and rsph=21 mm. The integrated cosine error of the shaped diffuser was f2=0.66%.
 The simulations revealed that the angular response of the diffuser assembly is highly sensitive to changes in some of the parameter values, especially the diameter of the visible area of the diffuser. This finding indicates that the manufacturing tolerances of both the diffuser elements and the detector mechanics have to be very low in order to reach good cosine response. It also suggests that some fine tuning of the geometry may still be required during the detector assembly process. It was also discovered that future material characterizations should be carried out in raised diffuser geometry for easier determination of the scattering coefficient μs of the material.
 While Henyey-Greenstein scattering phase function of equation (4) is used in a wide range of applications involving scattering, another form of scattering phase function might be better suited to describe individual scattering events in certain diffuser materials. However, as most particles scatter multiple times before exiting the diffuser, the error caused by the potential inaccuracy in the scattering phase functions of individual scatterers is likely to be averaged out to some extent. Different scattering phase functions can be implemented by modifying equations (4) and (5) to correspond to the actual probability distributions of the scattering angles. At this stage, the simulation algorithm assumes the diffuser elements to be volume diffusers with smooth surfaces. This assumption was valid for the polished quartz sample that was used for the algorithm validation. Further research is needed to accommodate surface roughness in the algorithm.
 Currently, the algorithm is limited to modeling planar diffusers and diffusers with spherical front surfaces. While it was shown that good angular responses can be achieved with these simple geometries alone, the algorithm can also be further developed to account for more complex diffuser geometries. To accommodate new diffuser shapes in the algorithm, one simply needs to specify a method to calculate the coordinates at which the particle crosses the material interface, as well as a method to determine the surface normal vector at these coordinates. For certain diffuser geometries, e.g., hollow domes and thin, shaped membranes, there is a chance that a particle exiting the diffuser at one point will reenter the diffuser at some other point. This possibility needs to be accounted for in the algorithm as a special case.
 The algorithm also assumes that the detector located behind the diffuser has wide acceptance angle, i.e., that the detector receives signal from the entire visible area of the diffuser (defined by diameter dvis in Figure 1). Detectors and fibers with narrow acceptance angle can be accounted for by decreasing the effective visible area of the diffuser dvis and/or by altering the angular distribution of the particles that emanate from the detector and enter the diffuser to match the angular response of the detector or the fiber system. However, as the angular response of the diffuser assembly is highly sensitive to the size of the visible area of the diffuser, it is recommended to limit the size of visible area of the diffuser mechanically and not, for example, through the acceptance angle the optical fiber.
 New light-blocking elements, such as additional shadow rings, can be incorporated in the design by calculating whether or not a particle exiting the diffuser at given coordinates and in a given direction would collide with that element. If the light-blocking element is outside the weather dome, the effect of the dome on the direction of propagation of the particle needs to be taken into account.
 An algorithm for optimizing diffusers was developed. The algorithm utilizes Monte Carlo ray tracing to model radiation transport inside the diffuser assembly. Apart from the shape of the diffuser element itself, the algorithm also takes into account the various surrounding structures that affect the overall angular response, such as the inner sidewalls of the diffuser housing, the shadow ring, and the protective weather dome. A comparison between the simulated and the measured angular responses of simple planar diffusers confirmed that the algorithm adequately models the radiation transport in the diffuser assembly. Therefore, the algorithm can be utilized to guide the diffuser optimization process. The angular responses of two optimized diffuser assemblies—one raised planar diffuser and one spherically shaped diffuser—were presented.
 The work leading to this study was partly funded by the European Metrology Research Programme (EMRP) ENV03 Project “Traceability for surface spectral solar ultraviolet radiation”. The EMRP is jointly funded by the EMRP participating countries within EURAMET and the European Union.