SCALE-RM
Functions/Subroutines
scale_specfunc Module Reference

module SPECFUNC More...

Functions/Subroutines

real(rp) function, public sf_gamma (x)
 Gamma function. More...
 

Detailed Description

module SPECFUNC

Description
Special functions
Author
Team SCALE
History
  • 2013-02-06 (S.Nishizawa) [new] SF_gamma

Function/Subroutine Documentation

◆ sf_gamma()

real(rp) function, public scale_specfunc::sf_gamma ( real(rp), intent(in)  x)

Gamma function.

Parameters
[in]xinput

Definition at line 48 of file scale_specfunc.F90.

Referenced by scale_atmos_phy_mp_convert::atmos_phy_mp_bulk2bin(), scale_atmos_phy_mp_sn14::atmos_phy_mp_sn14(), scale_atmos_phy_mp_tomita08::atmos_phy_mp_tomita08_setup(), and scale_atmos_phy_mp_sn14::ice_multiplication_kij().

48  implicit none
49 
50  real(RP), intent(in) :: x
51  real(RP) :: SF_gamma
52 
53  real(DP), parameter :: LRTP = 0.9189385332046727_dp ! log(sqrt(2*PI))
54  real(DP) :: Ag, dx, work
55  !---------------------------------------------------------------------------
56 
57  dx = real(x-1.0_RP, kind=dp)
58 
59  ag = 0.999999999999809932276847004735_dp &
60  + 676.520368121885098567009190444_dp / ( dx + 1.0_dp ) &
61  - 1259.13921672240287047156078755_dp / ( dx + 2.0_dp ) &
62  + 771.323428777653078848652825889_dp / ( dx + 3.0_dp ) &
63  - 176.615029162140599065845513540_dp / ( dx + 4.0_dp ) &
64  + 12.5073432786869048144589368533_dp / ( dx + 5.0_dp ) &
65  - 0.138571095265720116895547069851_dp / ( dx + 6.0_dp ) &
66  + 9.98436957801957085956266899569e-6_dp / ( dx + 7.0_dp ) &
67  + 1.50563273514931155833835577539e-7_dp / ( dx + 8.0_dp )
68 
69  work = exp( lrtp + (dx+0.5_dp)*log(dx+7.5_dp) - (dx+7.5_dp) + log(ag) )
70  sf_gamma = real(work, kind=rp)
71 
72  return
Here is the caller graph for this function: