Initialize reservoir
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(NeutralParticleReservoir), | intent(inout) | :: | res | Neutral Particle Reservoir Size of reservoir |
subroutine init_reservoir(res)
!+ Initialize reservoir
type(NeutralParticleReservoir), intent(inout) :: res
!+ Neutral Particle Reservoir
!integer, intent(in) :: k
!+ Size of reservoir
real(Float64) :: randomu(2)
if (res%n.lt.1) then
res%n = 1
res%k = reservoir_size
call randu(randomu)
res%W = exp(log(randomu(1))/res%k)
res%i = res%k + floor(log(randomu(2))/log(1.0-res%W)) + 1
endif
end subroutine init_reservoir