%N refract %F $MIR/src/subs/refract.for
%D Compute refractive index for an atmosphere.
%P rjs
%: utilities
%B
        subroutine refract(t,pdry,pvap,z,n,nu,T0,el,Tb,tau,Ldry,Lvap)

        implicit none
        integer n
        real T(n),Pdry(n),Pvap(n),z(n),nu,T0,el
        real Tb,Ldry,Lvap,tau

  Determine the sky brightness and excess path lengths for a
  parallel slab atmosphere. Liebe's model (1985) is used to determine
  the complex refractive index of air.

  Input:
    n          Number of atmospheric layers.
    T          Temperature of the layers. T(1) is the temperature at the
               lowest layer (Kelvin).
    Pdry       Partial pressure of the dry components (Pascals).
    Pvap       Partial pressure of the water vapour component (Pascals).
    z          Height of the layer.
    nu         Frequency of interest (Hz).
    T0         Astronomical brightness temperature (Kelvin). e.g. 2.7 for
               the cosmic background.
    el         Elevation angle of the source above the atmosphere (radians).
  Output:
    Tb         Brightness temperature (Kelvin).
    tau        Opacity (nepers).
    Ldry       Excess path -- dry component (meters).
    Lvap       Excess path -- water vapour component (meters).

  Reference:
    Liebe, An updated model for millimeter wave propogation in moist air,
    Radio Science, 20, 1069-1089 (1985).
