rsv_pol Function

public function rsv_pol(k, xp, yp, xps)

Arguments

Type IntentOptional AttributesName
integer, intent(in) :: k
real(kind=dp), intent(in) :: xp(:)
real(kind=dp), intent(in) :: yp(:)
real(kind=dp), intent(in) :: xps

Return Value real(kind=dp)


Called by

proc~~rsv_pol~~CalledByGraph proc~rsv_pol rsv_pol proc~reservoir_subbasin reservoir_subbasin proc~reservoir_subbasin->proc~rsv_pol proc~reservoir_process reservoir_process proc~reservoir_process->proc~rsv_pol proc~reservoir_initial_values reservoir_initial_values proc~reservoir_initial_values->proc~rsv_pol proc~reservoir_initialise reservoir_initialise proc~reservoir_initialise->proc~reservoir_initial_values proc~time_process_day time_process_day proc~time_process_day->proc~reservoir_subbasin proc~time_process_day->proc~reservoir_process proc~initialise initialise proc~initialise->proc~reservoir_initialise 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~initialise program~swim->proc~time_process_years

Contents

Source Code


Source Code

  real(dp) function rsv_pol(k, xp, yp, xps)
    !**** Interpolation using function POLygon ***
    integer, intent(in) :: k
    real(dp), intent(in) :: xp(:), yp(:), xps
    real(dp) :: x0, xt
    integer :: i, ih

    RSV_POL = 0.
    x0 = xps
    if (x0 < xp(1)) x0 = xp(1)
    do i = 1, k
      ih = i
      xt = ABS (xp(i) - x0)
      if (xt <= 1.E-6) then
        RSV_POL = yp(ih)
        exit
      end if
      if (x0 <= xp(i)) then
        RSV_POL = yp(i - 1) + (yp(i) - yp(i - 1)) * (x0 - xp(i - 1)) / (xp(i) - xp(i - 1))
        exit
      end if
    end do
  end function RSV_POL