Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer | :: | Nr_a | ||||
real(kind=rp), | intent(in), | dimension(Nr_a) | :: | r_a | ||
real(kind=rp), | intent(in), | dimension(Nr_a) | :: | nRE | ||
real(kind=rp), | intent(in) | :: | rm |
FUNCTION fRE_BMC(Nr_a,r_a,nRE,rm)
REAL(rp), INTENT(IN) :: rm
INTEGER :: Nr_a
REAL(rp), INTENT(IN),dimension(Nr_a) :: r_a,nRE
REAL(rp) :: fRE_BMC
REAL(rp) :: D
REAL(rp) :: g0
REAL(rp) :: g1
REAL(rp) :: f0
REAL(rp) :: f1
REAL(rp) :: m
INTEGER :: index
!write(6,*) r_a(Nr_a),rm
index = MINLOC(ABS(r_a - rm),1)
! index of gamma supplied to function in Hollmann input gamma range
D = r_a(index) - rm
!write(6,*) index
!write(6,*) ''
! linear interpolation of Hollmann input gamma range to gamma supplied
! to function
if (D.GT.0) then
f0 = nRE(index-1)
g0 = r_a(index-1)
f1 = nRE(index)
g1 = r_a(index)
else
f0 = nRE(index)
g0 = r_a(index)
f1 = nRE(index+1)
g1 = r_a(index+1)
end if
m = (f1-f0)/(g1-g0)
fRE_BMC = f0 + m*(rm - g0)
! end of linear interpolation, fRE_H is evaluation of input Hollmann energy
! distribution PDF at gamma supplied to function
END FUNCTION fRE_BMC