Sample uniformally in beam grid cell
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in), | dimension(3) | :: | ind | Cell index |
|
real(kind=Float64), | intent(out), | dimension(3) | :: | ri | Position in cell |
subroutine mc_beam_grid(ind, ri)
!+ Sample uniformally in beam grid cell
integer, dimension(3), intent(in) :: ind
!+ Cell index
real(Float64), dimension(3), intent(out) :: ri
!+ Position in cell
real(Float64), dimension(3) :: random3
call randu(random3)
ri(1) = beam_grid%xc(ind(1)) + beam_grid%dr(1)*(random3(1) - 0.5)
ri(2) = beam_grid%yc(ind(2)) + beam_grid%dr(2)*(random3(2) - 0.5)
ri(3) = beam_grid%zc(ind(3)) + beam_grid%dr(3)*(random3(3) - 0.5)
end subroutine mc_beam_grid