
18.3. SUBROUTINES FOR PARTICLE TRANSPORT AND DEFLECTION 323
rotate.f
Rotates ~u −→ ~u
0
according to cos(Θ).
C23456789|123456789|123456789|123456789|123456789|123456789|123456789|12
subroutine rotate(u,v,w,ws)
implicit none
C Rotates the direction vectors (u,v,w) after a scatter by polar cosine ws
C Some notation conventions:
C Theta, Phi refer to the scattering angles in the reference frame where the
C z-axis is aligned with the initial particle direction
C theta, phi refer to the original particle directions with respect to the
C laboratory frame of reference
real
* u, ! Input: initial x-axis direction cosine
* ! Output: final x-axis direction cosine
* v, ! Input: initial y-axis direction cosine
* ! Output: final y-axis direction cosine
* w, ! Input: initial z-axis direction cosine
* ! Output: final z-axis direction cosine
* ws ! Input: cos(Theta)
real
* sinThetas, ! Internal: sin(Theta), scattering angle
* sintheta, ! Internal: sin(theta), initial angle theta
* sinthetai, ! Internal: 1/sin(theta)
* cosphi, ! Internal: cos(phi), initial angle phi
* sinphi, ! Internal: sin(phi), initial angle phi
* us, ! Internal: scattering x-direction cosine,
! sin(Theta)*cos(Phi)
* vs, ! Internal: scattering y-direction cosine
! sin(Theta)*sin(Phi)
* u2v2 ! Internal: u**2 + v**2 = sin(Theta)**2
C Determine the azimuthal direction cosines