update_reservoir Subroutine

public subroutine update_reservoir(res, vn, wght)

Store neutrals in reservoir

Arguments

TypeIntentOptionalAttributesName
type(NeutralParticleReservoir), intent(inout) :: res

beam_grid indices

real(kind=Float64), intent(in), dimension(3):: vn

Neutral particle velocity [cm/s]

real(kind=Float64), intent(in) :: wght

Neutral weight


Calls

proc~~update_reservoir~~CallsGraph proc~update_reservoir update_reservoir proc~init_reservoir init_reservoir proc~update_reservoir->proc~init_reservoir interface~randind randind proc~update_reservoir->interface~randind interface~randu randu proc~update_reservoir->interface~randu proc~init_reservoir->interface~randu

Called by

proc~~update_reservoir~~CalledByGraph proc~update_reservoir update_reservoir proc~merge_reservoirs merge_reservoirs proc~merge_reservoirs->proc~update_reservoir proc~update_neutrals update_neutrals proc~update_neutrals->proc~update_reservoir proc~store_photon_birth store_photon_birth proc~store_photon_birth->proc~update_reservoir proc~merge_neutral_populations merge_neutral_populations proc~merge_neutral_populations->proc~merge_reservoirs proc~dcx dcx proc~dcx->proc~store_photon_birth proc~parallel_merge_reservoirs parallel_merge_reservoirs proc~dcx->proc~parallel_merge_reservoirs proc~store_neutrals store_neutrals proc~dcx->proc~store_neutrals proc~parallel_merge_populations parallel_merge_populations proc~dcx->proc~parallel_merge_populations proc~parallel_merge_reservoirs->proc~merge_reservoirs proc~fida_f fida_f proc~fida_f->proc~store_photon_birth proc~fida_f->proc~parallel_merge_reservoirs proc~fida_mc fida_mc proc~fida_mc->proc~store_photon_birth proc~fida_mc->proc~parallel_merge_reservoirs proc~pfida_f pfida_f proc~pfida_f->proc~store_photon_birth proc~pfida_f->proc~parallel_merge_reservoirs proc~halo halo proc~halo->proc~update_neutrals proc~halo->proc~store_photon_birth proc~halo->proc~merge_neutral_populations proc~halo->proc~parallel_merge_reservoirs proc~halo->proc~parallel_merge_populations proc~pfida_mc pfida_mc proc~pfida_mc->proc~store_photon_birth proc~pfida_mc->proc~parallel_merge_reservoirs proc~store_neutrals->proc~update_neutrals program~fidasim fidasim program~fidasim->proc~dcx program~fidasim->proc~fida_f program~fidasim->proc~fida_mc program~fidasim->proc~pfida_f program~fidasim->proc~halo program~fidasim->proc~pfida_mc proc~ndmc ndmc program~fidasim->proc~ndmc proc~parallel_merge_populations->proc~parallel_merge_reservoirs proc~ndmc->proc~store_neutrals proc~ndmc->proc~parallel_merge_populations

Contents

Source Code


Source Code

subroutine update_reservoir(res, vn, wght)
    !+ Store neutrals in reservoir
    type(NeutralParticleReservoir), intent(inout) :: res
        !+ [[libfida:beam_grid]] indices
    real(Float64), dimension(3), intent(in)       :: vn
        !+ Neutral particle velocity [cm/s]
    real(Float64), intent(in)                     :: wght
        !+ Neutral weight

    integer, dimension(1) :: randomi
    real(Float64), dimension(2) :: randomu

    !print*, res%n, res%k, res%i
    !$OMP CRITICAL(update_reservoir_1)
    if (res%n.le.res%k) then
        if (res%n.le.0) then
            call init_reservoir(res)
        endif
        res%R(res%n)%w = wght
        res%R(res%n)%v = vn
    elseif (res%n.eq.res%i) then
        call randind(res%k, randomi)
        res%R(randomi(1)) = NeutralParticle(wght, vn)
        call randu(randomu)
        res%W = res%W*exp(log(randomu(1))/res%k)
        res%i = res%i + floor(log(randomu(2))/log(1.0-res%W)) + 1
    endif
    res%n = res%n + 1
    !$OMP END CRITICAL(update_reservoir_1)

end subroutine update_reservoir