Sampling in scattering; how to keep track of the coordinates

14 Views Asked by At

I'm working on a monte carlo simulation involving scattering. The challenge is that I'd like the initial direction of the particle to be isotropic. But collisions after are no longer isotropic, but forward peeked.

Currently I start with sampling the position for the first interaction isotropically by sampling the azimuthal angle phi uniformly between 0 and 2$\pi$. I sample $r$ by the inverse method and the cosine of the polar angle by $\cos(\theta)=\rho*2-1$ where $\rho \in [0,1]$.

This works to get a uniform distrubution in a sphere around the starting point. However, after this first interaction, I want the sampling to be forward peeked. The PDF of $\mu$ ($\mu\equiv \cos(\theta)$) is given by the orange line in figure: PDF of $\mu$. This mu is not the new polar angle, but the angle between the original position before the interaction and afterwards.

I now face the problem where I want to sample my new angles in a new coordinate system (the one with the initial direction as the y axis). In this coordinate system i want to sample the previously described $\mu$, a new free flight path $r$ and a new angle $phi$. The angle $phi$ is then the rotation around the new y axis. But I want to express these new coordinates in my original coordinate system. A further difficulty is that, if certain conditions are met, I want to repeat the second step in the sampling multiple times (each time with the previous direction as the new y axis).

I first thought that I could combine the scattering angle $\mu$ with the original polar angle and express the new coordinates in terms of the original x,y and z. However, this becomes quite complicated, given that $\phi$ in the second sampling also influences, for example, the z-coordinate.

I'm thinking about working with transformed coordinate systems and then after sampling transforming back to the original. I'm a bit lost however in what the most efficient approach is. Any help or suggestions is very welcome!