# Advances in Simulating Radiative Transfer in Complex Environments
## 2 Model Description
### The Indexed View Sphere (IVS) Algorithm
While the height angles are constant within a view sphere, the azimuthal angle and, thus, the number of view facets changes with increased height angles. This implies that the weighing factor is not identical for all view facets, but depended on the number of view facets in a particular height ring. The individual weighting factor accounting for the contribution of a view facet is calculated by:  
\[\omega=\frac{1}{\lambda(h)}\cdot\frac{1}{r_{cnt}} \tag{6}\]  
with \(\lambda(h)\) as the number of view facets in a given height angle and \(r_{cnt}\) as the number of height rings for a particular view direction, e.g., downward view or upward view. The transmission factor for vegetation \(\tau_{Veg}\) is calculated within the raytracing and accounts for a partial obstruction of radiation due to vegetation in the ray's path. The calculation of transmission is carried out using the exponential extinction coefficient accounting for leaf orientation \(\varphi\) (currently set to 0.5), the local leaf area density (LAD), and the path length through the vegetation cells:  
\[\tau_{Veg}=\;\mathrm{e}^{-(\varphi\cdot\;\mathrm{LAD}\cdot dRay)} \tag{7}\]  
Further advancements have been undertaken with regards to the ray tracing algorithm. While in previous versions, the segment length for the ray would be determined only once for a given angle, the new algorithm tries to find an appropriate length for the ray segments based on current grid dimensions as well as the azimuthal and height angle. Determining a segment's length is not only critical for the calculation speed as short rays drastically increase computational effort but also for the quality of the resulting radiation calculation. With the discretization of space in models such as ENVI-met an optimal ray length is very hard to determine. With typical cell dimensions of 2 to 5 m in \(x\), \(y\), and \(z\)[28], too short ray segments might lead to an over-representation of cells, which are only marginally clipped by a ray, since the whole cell would count as \"hit\" by the ray. Too large ray segments, however, might lead to not detecting/not taking into account objects in the path of a ray. To determine an optimal vector length increment for the ray trace, given the azimuthal and height angle, the normalized contribution weight (\(dx_{nught}\), \(dy_{nught}\), and \(dz_{mught}\)) of the \(x,y\), and \(z\) axis onto the resulting vector is calculated at first:  
\[\left( \begin{array}{c}dx_{nught}\\ dy_{nught}\\ dz_{nught}\end{array} \right)=\left( \begin{array}{c}|\cos(h)\cdot\cos(az)|\\ |\cos(h)\cdot\sin(az)|\\ |\sin(h)|\end{array} \right) \tag{8}\] \[dxyz_{sum}=dx_{wght}+dy_{wght}+dz_{wght}\] \[\left( \begin{array}{c}dx_{nught}\\ dy_{mught}\\ dz_{mught}\end{array} \right)=\left( \begin{array}{c}dx_{wght}/dxyz_{sum}\\ dy_{wght}/dxyz_{sum}\\ dz_{wght}/dxyz_{sum}\end{array} \right)\]  
By taking into account the cell dimensions of the current cell, the normalized weights for all axes are then used to scale the length of the three-dimensional vector:  
\[dRay(i,j,k)=\vartheta\cdot\left(dx(i,j,k)\cdot dx_{nught}+dy(i,j,k)\cdot dy_{ nught}+dz(i,j,k)\cdot dz_{nught}\right) \tag{9}\]  
with \(\vartheta\) as a scaling factor of the vector length. This scaling factor should ensure that cells are detected, which only partially lie along the path of the vector, i.e., a segment of the ray ends within the cell's boundaries. While a small scaling factor ensures a very precise ray tracing detecting all cells hit by a ray, it also leads to increased calculation time. Even more importantly, cells that might only lie very marginally in the path of the ray, i.e., clipped only very slightly, may be overrepresented in the further calculation. Test simulations showed that a scaling factors between 0.25 and 0.5 led to a good compromise between accuracy of the ray tracing and representation of cells clipped by the ray. To determine the increments in the \(x,y\), and \(z\) direction, the calculated vector length \(dRay(i,j,k)\) is then again calculated by:  
\[\left(