gamma_distribution Function

public function gamma_distribution(rn1, ai, k7)

Arguments

Type IntentOptional AttributesName
real(kind=dp) :: rn1
real(kind=dp) :: ai
integer :: k7

Return Value real(kind=dp)


Calls

proc~~gamma_distribution~~CallsGraph proc~gamma_distribution gamma_distribution proc~random_n random_n proc~gamma_distribution->proc~random_n float float proc~random_n->float

Called by

proc~~gamma_distribution~~CalledByGraph proc~gamma_distribution gamma_distribution proc~soil_curve_number_alpha soil_curve_number_alpha proc~soil_curve_number_alpha->proc~gamma_distribution proc~runsubbasin runsubbasin proc~runsubbasin->proc~soil_curve_number_alpha proc~time_process_day time_process_day proc~time_process_day->proc~runsubbasin proc~time_process_month time_process_month proc~time_process_month->proc~time_process_day proc~time_process_years time_process_years proc~time_process_years->proc~time_process_month program~swim swim program~swim->proc~time_process_years

Contents

Source Code


Source Code

  function gamma_distribution(rn1, ai, k7)
    !**** PURPOSE: THIS FUNCTION PROVIDES NUMBERS rn1 FROM A GAMMA DISTRIBUTION,
    !              GIVEN TWO RANDOM NUMBERS ai & k7
    !**** CALLED IN: ALPHA
    !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    !     PARAMETERS & VARIABLES
    !
    !      >>>>> STATIC PARAMETERS
    !      fu = local par
    !      rn = local par
    !      xn1 = local par
    !      xx = local par
    !      >>>>>
    !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    integer k7
    real(dp) rn1, ai, fu, rn, xx, gamma_distribution

    dimension k7(4)

    do while (.true.)
      gamma_distribution = rn1
      xx = rn1 * ai
      rn = random_n(k7)
      fu = xx ** xn1 * exp(xn1 * (1. - xx))
      rn1 = rn
      if (fu .ge. rn) exit
    end do
    return
  end function gamma_distribution