Sets the number of MC markers launched from each beam_grid cell
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer(kind=Int64), | intent(in) | :: | nr_markers | Approximate total number of markers to launch |
||
real(kind=Float64), | intent(in), | dimension(:,:,:) | :: | papprox | beam_grid cell weights |
|
real(kind=Float64), | intent(in) | :: | papprox_tot | Total cell weights |
||
real(kind=Float64), | intent(out), | dimension(:,:,:) | :: | nlaunch | Number of mc markers to launch for each cell: nlaunch(x,y,z) |
subroutine get_nlaunch(nr_markers,papprox,papprox_tot,nlaunch)
!+ Sets the number of MC markers launched from each [[libfida:beam_grid]] cell
integer(Int64), intent(in) :: nr_markers
!+ Approximate total number of markers to launch
real(Float64), dimension(:,:,:), intent(in) :: papprox
!+ [[libfida:beam_grid]] cell weights
real(Float64), intent(in) :: papprox_tot
!+ Total cell weights
real(Float64), dimension(:,:,:), intent(out) :: nlaunch
!+ Number of mc markers to launch for each cell: nlaunch(x,y,z)
integer :: i, j, k
nlaunch = nr_markers*papprox/sum(papprox)
where ((nlaunch.gt.0.0).and.(nlaunch.lt.5.0))
nlaunch = 5.0
endwhere
nlaunch = floor(nlaunch)
end subroutine get_nlaunch