truncateSpawn Subroutine

private subroutine truncateSpawn(iter_data, SignTemp, i, j, scFVal, SignProd)

Arguments

Type IntentOptional Attributes Name
type(fcimc_iter_data), intent(inout) :: iter_data
real(kind=dp), intent(inout) :: SignTemp(lenof_sign)
integer, intent(in) :: i
integer, intent(in) :: j
real(kind=dp), intent(in) :: scFVal
real(kind=dp), intent(in) :: SignProd

Contents

Source Code


Source Code

    subroutine truncateSpawn(iter_data, SignTemp, i, j, scFVal, SignProd)
        type(fcimc_iter_data), intent(inout) :: iter_data
        real(dp), intent(inout) :: SignTemp(lenof_sign)
        integer, intent(in) :: i, j ! i: index of ilut in SpawnedParts, j: part index
        real(dp), intent(in) :: scFVal, SignProd

        real(dp) :: maxSpawns

        ! we allow n_truncate_spawns unit walkers to be created per spawn event
        maxSpawns = n_truncate_spawns * scFVal * get_num_spawns(SpawnedParts(:, i))

        ! truncate the new walkers to a maximum value
        if (abs(SignTemp(j)) > maxSpawns) then
            iter_data%nremoved(j) = iter_data%nremoved(j) + &
                                    abs(SignTemp(j)) - sign(maxSpawns, SignProd)
            ! log the truncated weight
            truncatedWeight = truncatedWeight + abs(SignTemp(j)) - maxSpawns
            ! reduce the sign to maxSpawns
            SignTemp(j) = sign(maxSpawns, SignTemp(j))
        end if

    end subroutine truncateSpawn