get_nlaunch Subroutine

public subroutine get_nlaunch(nr_markers, papprox, papprox_tot, nlaunch)

Sets the number of MC markers launched from each beam_grid cell

Arguments

Type IntentOptional AttributesName
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)


Called by

proc~~get_nlaunch~~CalledByGraph proc~get_nlaunch get_nlaunch proc~fida_f fida_f proc~fida_f->proc~get_nlaunch proc~dcx dcx proc~dcx->proc~get_nlaunch proc~npa_f npa_f proc~npa_f->proc~get_nlaunch proc~halo halo proc~halo->proc~get_nlaunch proc~fida_weights_mc fida_weights_mc proc~fida_weights_mc->proc~get_nlaunch program~fidasim fidasim program~fidasim->proc~fida_f program~fidasim->proc~dcx program~fidasim->proc~npa_f program~fidasim->proc~halo program~fidasim->proc~fida_weights_mc

Contents

Source Code


Source Code

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