Radiative Transfer and Surface Property Modelling

Level Layer Conversion

EFFECTIVE_LAYER_TP

 NAME:
       Effective_Layer_TP

 PURPOSE:
       Function to calculate the effective atmospheric layer temperature and
       pressure by weighting level values with the integrated layer density.

 CALLING SEQUENCE:
       Error_Status = Effective_Layer_TP( Height,                 &  ! Input
                                          Pressure,               &  ! Input
                                          Temperature,            &  ! Input
                                          Water_Vapor_Pressure,   &  ! Input
                                          Effective_Pressure,     &  ! Output
                                          Effective_Temperature,  &  ! Output
                                          RCS_Id     =RCS_Id,     &  ! Revision control
                                          Message_Log=Message_Log )  ! Error messaging

 INPUT ARGUMENTS:
       Height:                 Heights of the atmospheric levels.
                               UNITS:      metres, m
                               TYPE:       REAL(fp)
                               DIMENSION:  Rank-1 (N x 1, where N>1)
                               ATTRIBUTES: INTENT(IN)

       Pressure:               Pressure of the atmospheric levels.
                               UNITS:      hectoPascals, hPa
                               TYPE:       REAL(fp)
                               DIMENSION:  Same as Height
                               ATTRIBUTES: INTENT(IN)

       Temperature:            Temperature of the atmospheric levels.
                               UNITS:      Kelvin, K
                               TYPE:       REAL(fp)
                               DIMENSION:  Same as Height
                               ATTRIBUTES: INTENT(IN)

       Water_Vapor_Pressure:   Water vapor partial pressure at the atmospheric levels
                               UNITS:      hectoPascals, hPa
                               TYPE:       REAL(fp)
                               DIMENSION:  Same as Height
                               ATTRIBUTES: INTENT(IN)

 OPTIONAL INPUT ARGUMENTS:
       Message_Log:            Character string specifying a filename in which any
                               Messages will be logged. If not specified, or if an
                               error occurs opening the log file, the default action
                               is to output Messages to standard output.
                               UNITS:      N/A
                               TYPE:       CHARACTER(*)
                               DIMENSION:  Scalar
                               ATTRIBUTES: INTENT(IN), OPTIONAL

 OUTPUT ARGUMENTS:
       Effective_Pressure:     Effective layer pressure.
                               UNITS:      hectoPascals, hPa
                               TYPE:       REAL(fp)
                               DIMENSION:  Rank-1 (N-1 x 1)
                               ATTRIBUTES: INTENT(OUT)

       Effective_Temperature:  Effective layer temperature.
                               UNITS:      Kelvin, K
                               TYPE:       REAL(fp)
                               DIMENSION:  Same as Effective_Pressure
                               ATTRIBUTES: INTENT(OUT)


 OPTIONAL OUTPUT ARGUMENTS:
       RCS_Id:                 Character string containing the Revision Control
                               System Id field for the module.
                               UNITS:      N/A
                               TYPE:       CHARACTER(*)
                               DIMENSION:  Scalar
                               ATTRIBUTES: INTENT(OUT), OPTIONAL

 FUNCTION RESULT:
       Error_Status:           The return value is an integer defining the error status.
                               The error codes are defined in the ERROR_HANDLER module.
                               If == SUCCESS the calculation was successful
                                  == FAILURE an unrecoverable error occurred
                               UNITS:      N/A
                               TYPE:       INTEGER
                               DIMENSION:  Scalar

 PROCEDURE:
       Based on:

       Gallery, W.O., F.X. Kneizys, and S.A. Clough, "Air mass computer
         program for atmospheric transmittance/radiance calculation: FSCATM",
         AFGL-TR-83-0065, 9 March 1983.

       The effective pressure and temperature is defined as,
               __
              \           
               >  p.rho.dz
              /__         
         _
         p = -----------------     ..............................................(1)
                 __
                \         
                 >  rho.dz
                /__       

       and

               __
              \           
               >  T.rho.dz
              /__         
         _
         T = -----------------     ..............................................(2)
                 __
                \         
                 >  rho.dz
                /__

       where dz == layer thickness.

       Note that the denominators of eqns(1) and (2) can also be referred to as the
       column density.

       The pressure and total density are both assumed to follow an exponential
       profile with scale heights H_p and H_rho respectively. For a single layer
       the numerator of eqn(1) can be written as,

          __ k
         \                H_p.H_rho
          >  p.rho.dz = ------------- ( p(k-1).rho(k-1) - p(k).rho(k) )     .....(3)
         /__             H_p + H_rho
            k-1

       Similarly for the numerator of eqn(2) using the ideal gas law,
       p = R_air.rho.T, we get

          __ k
         \                H_p
          >  T.rho.dz = -------( p(l-1) - p(l) )     ............................(4)
         /__             R_air
            k-1

       and the denominator is given by,

          __ k
         \           
          >  rho.dz = H_rho ( rho(l-1) - rho(l) )     ...........................(5)
         /__         
            k-1

       where the scale heights are defined as,

                -( z(l) - z(l-1 ) )        
         H_p = ---------------------     ........................................(6)
                ln( p(l) / p(l-1) )        

       and

                    -( z(l) - z(l-1 ) )
         H_rho = -------------------------     ..................................(7)
                  ln( rho(l) / rho(l-1) )


       Note that in eqn.(4) the gas constant is that for *air*, not *dry air*. To
       determine this the effective molecular weight of air (as a function of pressure)
       must be determined.

       Breaking down the units of the components, 

         units(p)  = hPa
                   = 100 Pa
                   = 100 N.m^-2
                   = 100 kg.m.s^-2.m^-2
                   = 100 kg.m^-1.s^-2

                          m2
         units(eqn(3)) = ----( 100 kg.m^-1.s^-2  .  kg.m^-3 )
                          m 

                       = 100 kg^2.m^-3.s^-2

                          m  . 100 kg.m^-1.s^-2
         units(eqn(4)) = -----------------------
                              J.g^-1.K^-1

                          m  . 100 kg.m^-1.s^-2
                       = ------------------------
                           kg.m^2.s^-2.g^-1.K^-1

                       = 100 K.g.m^-2
                       = 0.1 K.kg.m^-2

         units(eqn(5)) = m  .  kg.m^-3
                       = kg.m^-2  
                     
       So the units of the final equations are:

               _     units(eqn(3))
         units(p) = ---------------
                     units(eqn(5))  

                          100 kg^2.m^-3.s^-2
                  = --------------------
                         kg.m^-2  

                  = 100 kg.m^-1.s^-2
                  = 100 kg.m.s^-2.m^-2
                  = 100 N.m^-2
                  = 100 Pa
                  = hPa

               _     units(eqn(4))
         units(T) = ---------------
                     units(eqn(5))  

                     0.1 K.kg.m^-2
                  = ---------------
                       kg.m^-2  

                  = 0.1 K

       So the final temperatures must be multiplied by 0.1 to get units of K.

       Note for the above units breakdown of eqn(4) that the gas constant
       for air is computed in units of J.g^-1.K^-1, *NOT* the SI units of
       J.kg^-1.K^-1. This is done solely to save the conversion operation
       of g->kg for each loop iteration. Otherwise, for a gas constant in
       units of J.kg^-1.K^-1, the final scaling factor for the effective
       temperature would be 100, not 0.1.

 CREATION HISTORY:
       Written by:     Paul van Delst, CIMSS/SSEC, 03-May-2000
                       paul.vandelst@ssec.wisc.edu

CREATE_SUBLEVELS

 NAME:
       Create_Sublevels

 PURPOSE:
       Function to create the sublevels used to integrate input profiles
       to obtain average layer quantities. This routine is called before
       Integrate_Sublevels.

       Adapted from the UMBC INTLEV.F function supplied with the AIRS RTA.

 CALLING SEQUENCE:
       Error_Status = Create_Sublevels( Level_Pressure,         &  ! Input
                                        Level_Temperature,      &  ! Input
                                        Level_Absorber,         &  ! Input
                                        n_Per_Layer,            &  ! Input
                                        Sublevel_Pressure,      &  ! Output
                                        Sublevel_Temperature,   &  ! Output
                                        Sublevel_Absorber,      &  ! Output
                                        RCS_Id     =RCS_Id,     &  ! Revision control
                                        Message_Log=Message_Log )  ! Error messaging

 INPUT ARGUMENTS:
       Level_Pressure:        Pressure of the atmospheric levels.
                              UNITS:      hectoPascals, hPa
                              TYPE:       REAL(fp)
                              DIMENSION:  Rank-1 (K)
                                            K == number of levels
                              ATTRIBUTES: INTENT(IN)

       Level_Temperature:     Temperature of the atmospheric levels.
                              UNITS:      Kelvin, K
                              TYPE:       REAL(fp)
                              DIMENSION:  Same as Level_Pressure
                              ATTRIBUTES: INTENT(IN)

       Level_Absorber:        Absorber concentrations at the atmospheric levels
                              UNITS:      Doesn't matter - as long as they are
                                          LEVEL specific.
                              TYPE:       REAL(fp)
                              DIMENSION:  Rank-2 (K x J)
                                            K == number of levels
                                            J == number of absorbers
                              ATTRIBUTES: INTENT(IN)

       n_Per_Layer:           Number of sublevels to create in each layer.
                              Value must be > or = 1.
                              UNITS:      N/A
                              TYPE:       INTEGER
                              DIMENSION:  Scalar
                              ATTRIBUTES: INTENT(IN)


 OPTIONAL INPUT ARGUMENTS:
       Message_Log:           Character string specifying a filename
                              in which any Messages will be logged.
                              If not specified, or if an error occurs
                              opening the log file, the default action
                              is to output Messages to standard output.
                              UNITS:      N/A
                              TYPE:       CHARACTER(*)
                              DIMENSION:  Scalar
                              ATTRIBUTES: INTENT(IN), OPTIONAL

 OUTPUT ARGUMENTS:
       Sublevel_Pressure:     Pressure of the atmospheric sublevels.
                              UNITS:      hectoPascals, hPa
                              TYPE:       REAL(fp)
                              DIMENSION:  Rank-1 (Ks)
                                            Ks == number of sublevels
                                               == ( (K-1) * n_Per_Layer ) + 1
                              ATTRIBUTES: INTENT(IN)

       Sublevel_Temperature:  Temperature of the atmospheric sublevels.
                              UNITS:      Kelvin, K
                              TYPE:       REAL(fp)
                              DIMENSION:  Same as output Sublevel_Pressure argument
                              ATTRIBUTES: INTENT(IN)

       Sublevel_Absorber:     Absorber concentrations at the atmospheric Levels
                              UNITS:      Same as input
                              TYPE:       REAL(fp)
                              DIMENSION:  Rank-2 (Ks x J)
                                            Ks == number of sublevels
                                            J  == number of absorbers
                              ATTRIBUTES: INTENT(IN)


 OPTIONAL OUTPUT ARGUMENTS:
       RCS_Id:                Character string containing the Revision Control
                              System Id field for the module.
                              UNITS:      N/A
                              TYPE:       CHARACTER(*)
                              DIMENSION:  Scalar
                              ATTRIBUTES: INTENT(OUT), OPTIONAL

 FUNCTION RESULT:
       Error_Status:          The return value is an integer defining the error
                              status. The error codes are defined in the
                              ERROR_HANDLER module.
                              If == SUCCESS the calculation was successful
                                 == FAILURE an unrecoverable error occurred
                              UNITS:      N/A
                              TYPE:       INTEGER
                              DIMENSION:  Scalar

 PROCEDURE:
       The assumption is made that temperature and absorber amount vary
       linearly with ln(p). To improve the quadrature in integrating Level
       amounts to a layer value, each input layer, k, is split into N(k)
       sublayers equally spaced in ln(p),

                                 ln(p[k+1]) - ln(p[k]
         ln(p[n+1]) - ln(p[n] = ---------------------
                                          N(k)

       given the pressures, p(1) - p(K) of the input Levels.

       Once the sublevels are defined, the level temperatures and absorber
       amounts are linearly interpolated at the specific number of sublevels
       and those interpolates are associated with the sublevel pressures.

       The last corresponding level/sublevel is assigned explicitly.

       Currently, N is independent of k. That is, the same number of sublevels
       are created for each layer.

 CREATION HISTORY:
       Written by:     Paul van Delst, CIMSS/SSEC 19-Jan-2001
                       paul.vandelst@ssec.wisc.edu

INTEGRATE_SUBLEVELS

 NAME:
       Integrate_Sublevels

 PURPOSE:
       Function to integrate the sublevel values created by Create_Sublevels
       to provide average layer temperature and absorber amount. Layer
       pressure is provided by default, i.e. not from integration.

       Adapted from the UMBC INTEG.F function supplied with the AIRS RTA.

 CALLING SEQUENCE:
       Error_Status = Integrate_Sublevels( Sublevel_Height,        &  ! Input
                                           Sublevel_Pressure,      &  ! Input
                                           Sublevel_Temperature,   &  ! Input
                                           Sublevel_Absorber,      &  ! Input
                                           n_Per_Layer,            &  ! Input
                                           H2O_J_Index,            &  ! Input
                                           Layer_Pressure,         &  ! Output
                                           Layer_Temperature,      &  ! Output
                                           Layer_Absorber,         &  ! Output
                                           RCS_Id     =RCS_Id,     &  ! Revision control
                                           Message_Log=Message_Log )  ! Error messaging

 INPUT ARGUMENTS:
       Sublevel_Height:       Altitude of the atmospheric sublevels.
                              UNITS:      metres, m
                              TYPE:       REAL(fp)
                              DIMENSION:  Rank-1 (Ks)
                                            Ks == number of sublevels
                              ATTRIBUTES: INTENT(IN)

       Sublevel_Pressure:     Pressure of the atmospheric sublevels.
                              UNITS:      hectoPascals, hPa
                              TYPE:       REAL(fp)
                              DIMENSION:  Same as input Sublevel_Height argument
                              ATTRIBUTES: INTENT(IN)

       Sublevel_Temperature:  Temperature of the atmospheric sublevels.
                              UNITS:      Kelvin, K
                              TYPE:       REAL(fp)
                              DIMENSION:  Same as input Sublevel_Height argument
                              ATTRIBUTES: INTENT(IN)

       Sublevel_Absorber:     Absorber concentrations at the atmospheric
                              sublevels
                              UNITS:      ppmv
                              TYPE:       REAL(fp)
                              DIMENSION:  Rank-2 (Ks x J)
                                            Ks == number of Sublevels
                                            J  == number of absorbers
                              ATTRIBUTES: INTENT(IN)

       n_Per_Layer:           Number of sublevel for each layer.
                              Value must be > or = 1.
                              UNITS:      N/A
                              TYPE:       INTEGER
                              DIMENSION:  Scalar
                              ATTRIBUTES: INTENT(IN)

       H2O_J_Index:           The "J" dimension array index position
                              of water vapor in the input SubLevel_Absorber
                              array - which is dimensioned Ks x J.
                              This is necessary to properly convert the
                              sublevel absorber amounts from ppmv to
                              kmol.cm^-2.
                              UNITS:      N/A
                              TYPE:       INTEGER
                              DIMENSION:  Scalar
                              ATTRIBUTES: INTENT(IN)

 OPTIONAL INPUT ARGUMENTS:
       Message_Log:           Character string specifying a filename
                              in which any Messages will be logged.
                              If not specified, or if an error occurs
                              opening the log file, the default action
                              is to output Messages to standard output.
                              UNITS:      N/A
                              TYPE:       CHARACTER(*)
                              DIMENSION:  Scalar
                              ATTRIBUTES: INTENT(IN), OPTIONAL

 OUTPUT ARGUMENTS:
       Layer_Pressure:        Average pressure of the atmospheric layers
                              UNITS:      hectoPascals, hPa
                              TYPE:       REAL(fp)
                              DIMENSION:  Rank-1 (K-1)
                                            K-1 == number of layers
                              ATTRIBUTES: INTENT(IN)

       Layer_Temperature:     Average temperature of the atmospheric layers
                              UNITS:      Kelvin, K
                              TYPE:       REAL(fp)
                              DIMENSION:  Same as output Layer_Pressure argument
                              ATTRIBUTES: INTENT(IN)

       Layer_Absorber:        Average absorber concentrations of the
                              atmospheric layers
                              UNITS:      kmol.cm^-2.
                              TYPE:       REAL(fp)
                              DIMENSION:  Rank-2 (K-1 x J)
                                            K-1 == number of layers
                                            J   == number of absorbers
                              ATTRIBUTES: INTENT(IN)

 OPTIONAL OUTPUT ARGUMENTS:
       RCS_Id:                Character string containing the Revision Control
                              System Id field for the module.
                              UNITS:      N/A
                              TYPE:       CHARACTER(*)
                              DIMENSION:  Scalar
                              ATTRIBUTES: INTENT(OUT), OPTIONAL

 FUNCTION RESULT:
       Error_Status:          The return value is an integer defining the error
                              status. The error codes are defined in the
                              ERROR_HANDLER module.
                              If == SUCCESS the calculation was successful
                                 == FAILURE an unrecoverable error occurred
                              UNITS:      N/A
                              TYPE:       INTEGER
                              DIMENSION:  Scalar

 PROCEDURE:
       The average layer pressure is simply determined using,

                                 p(k) - p(k-1)
         Layer_Pressure(k) = --------------------
                              LOG( p(k)/p(k-1) )

       The average layer temperature is determined by summing
       the density weighted layer temperature T.rho subLAYER
       across the sublayers and normalising by the sum of the
       subLAYER density,

                               __ N(k)
                              \
                               >   Trho      [ units of kmol.cm^-2.ppmv^-1.K ]
                              /__
                                  1
         Layer_Temperature = -----------
                               __ N(k)
                              \
                               >   rho       [ units of kmol.cm^-2.ppmv^-1 ]
                              /__
                                  1


                               __ N(k)
                              \      1.0e-11
                               >    --------- * dz * p
                              /__       R
                                  1
                           = ---------------------------
                               __ N(k)
                              \       1.0e-11
                               >     --------- * dz * p
                              /__      R . T
                                  1


                               __ N(k)
                              \
                               >     dz . p
                              /__
                                  1
                           = ----------------
                               __ N(k)
                              \      dz . p
                               >    --------
                              /__       T
                                  1

      in units of Kelvin

      In the UMBC KLAYERS code, the numerator corresponds to the final
      TSUM value (with each sublayer value corresponding to RJUNK),
      the denominator to AJUNK, and the result to TLAY.

      The average layer absorber amount is determined by simply summing
      the sublayer absorber amount across the sublayers,

                          __ N(k)
                         \      Trho . ppmv
        Layer_Absorber =  >    -------------
                         /__        T
                             1

                          __ N(k)
                         \      1.0e-11             ppmv
                       =  >    --------- . dz . p .------
                         /__       R                 T
                             1

       in units of kmol.cm^-2

       This corresponds to ASUM (and eventually ALAY) in the 
       UMBC KLAYERS code.

       Currently, N is independent of k. That is, the same number of sublevels
       is assumed for each layer.

 CREATION HISTORY:
       Written by:     Paul van Delst, CIMSS/SSEC 19-Jan-2001
                       paul.vandelst@ssec.wisc.edu