Back to home page

MITgcm

 
 

    


File indexing completed on 2018-03-02 18:37:46 UTC

view on githubraw file Latest commit add29e06 on 2018-01-31 20:35:05 UTC
b2ea1d2979 Jean*0001 module simple_sat_vapor_pres_mod
                0002 
                0003 !-----------------------------------------------------------------------
                0004 !
                0005 !                 simple saturation vapor pressure
                0006 !
                0007 !      routines for computing the saturation vapor pressure (es) and
                0008 !      the derivative of es with respect to temperature
                0009 !
                0010 !      uses a simple formula based on constant latent heat
                0011 !
                0012 !-----------------------------------------------------------------------
                0013 !
                0014 !                               usage
                0015 !                               -----
                0016 !
                0017 !                       call lookup_es  (temp,es)
                0018 !
                0019 !                       call lookup_des (temp,des)
                0020 !
                0021 !    arguments
                0022 !    ---------
                0023 !      temp    intent in       temperature in degrees kelvin
                0024 !      es      intent out      saturation vapor pressure in Pascals
                0025 !      des     intent out      derivative of saturation vapor pressure
                0026 !                              with respect to temperature (Pascals/degree)
                0027 !
                0028 !-----------------------------------------------------------------------
                0029 
                0030 ! use        fms_mod, only:  write_version_number,   &
                0031 !                            error_mesg, FATAL
                0032 
                0033  use      constants_mod, only:  hlv,rvgas
                0034 
                0035 
                0036 implicit none
                0037 private
                0038 
                0039  public :: lookup_es, lookup_des
                0040  public :: escomp, descomp ! for backward compatibility
                0041                            ! use lookup_es, lookup_des instead
                0042 
                0043 !-----------------------------------------------------------------------
                0044  interface lookup_es
                0045    module procedure lookup_es_0d, lookup_es_1d, lookup_es_2d, lookup_es_3d
                0046  end interface
                0047 ! for backward compatibility (to be removed soon)
                0048  interface escomp
                0049    module procedure lookup_es_0d, lookup_es_1d, lookup_es_2d, lookup_es_3d
                0050  end interface
                0051 !-----------------------------------------------------------------------
                0052  interface lookup_des
                0053    module procedure lookup_des_0d, lookup_des_1d, lookup_des_2d, lookup_des_3d
                0054  end interface
                0055 ! for backward compatibility (to be removed soon)
                0056  interface descomp
                0057    module procedure lookup_des_0d, lookup_des_1d, lookup_des_2d, lookup_des_3d
                0058  end interface
                0059 !-----------------------------------------------------------------------
                0060 !  cvs version and tag name
                0061 
                0062 character(len=128) :: version = '$Id: simple_sat_vapor_pres_mod.F90,v 1.1 2013/05/08 22:14:15 jmc Exp $'
                0063 character(len=128) :: tagname = '$Name:  $'
                0064 
                0065 !-----------------------------------------------------------------------
                0066 ! module variables
                0067 
                0068 
                0069 ! constants used in formula:
                0070  real, parameter :: T0 = 273.16,      &   ! K
                0071                     e0 = 610.78           ! Pa
                0072 
                0073 contains
                0074 
                0075 !#######################################################################
                0076 
                0077  subroutine lookup_es_0d ( temp, esat )
                0078 
                0079  real, intent(in)  :: temp
                0080  real, intent(out) :: esat
                0081 
                0082 !-----------------------------------------------
                0083 
                0084  esat = e0 * exp( -hlv/rvgas*(1.0/temp-1.0/T0))
                0085 
                0086 !-----------------------------------------------
                0087 
                0088  end subroutine lookup_es_0d
                0089 
                0090 !#######################################################################
                0091 
                0092  subroutine lookup_es_1d ( temp, esat )
                0093 
                0094  real, intent(in)  :: temp(:)
                0095  real, intent(out) :: esat(:)
                0096 
                0097 !-----------------------------------------------
                0098 
                0099  esat = e0 * exp( -hlv/rvgas*(1.0/temp-1.0/T0))
                0100 
                0101 !-----------------------------------------------
                0102 
                0103  end subroutine lookup_es_1d
                0104 
                0105 !#######################################################################
                0106 
                0107  subroutine lookup_es_2d ( temp, esat )
                0108 
                0109  real, intent(in)  :: temp(:,:)
                0110  real, intent(out) :: esat(:,:)
                0111 
                0112 !-----------------------------------------------
                0113 
                0114  esat = e0 * exp( -hlv/rvgas*(1.0/temp-1.0/T0))
                0115 
                0116 !-----------------------------------------------
                0117 
                0118  end subroutine lookup_es_2d
                0119 
                0120 !#######################################################################
                0121 
                0122  subroutine lookup_es_3d ( temp, esat )
                0123 
                0124  real, intent(in)  :: temp(:,:,:)
                0125  real, intent(out) :: esat(:,:,:)
                0126 
                0127 !-----------------------------------------------
                0128 
                0129  esat = e0 * exp( -hlv/rvgas*(1.0/temp-1.0/T0))
                0130 
                0131 
                0132 !-----------------------------------------------
                0133 
                0134  end subroutine lookup_es_3d
                0135 
                0136 !#######################################################################
                0137 !  routines for computing derivative of es
                0138 !#######################################################################
                0139 
                0140  subroutine lookup_des_0d ( temp, desat )
                0141 
                0142  real, intent(in)  :: temp
                0143  real, intent(out) :: desat
                0144 
                0145 !-----------------------------------------------
                0146 
                0147    desat =  e0*hlv/(rvgas*temp**2)*exp( -hlv/rvgas*(1.0/temp-1.0/T0))
                0148 
                0149 !-----------------------------------------------
                0150 
                0151  end subroutine lookup_des_0d
                0152 
                0153 !#######################################################################
                0154 
                0155  subroutine lookup_des_1d ( temp, desat )
                0156 
                0157  real, intent(in)  :: temp (:)
                0158  real, intent(out) :: desat(:)
                0159 
                0160 !-----------------------------------------------
                0161 
                0162    desat =  e0*hlv/(rvgas*temp**2)*exp( -hlv/rvgas*(1.0/temp-1.0/T0))
                0163 
                0164 !-----------------------------------------------
                0165 
                0166  end subroutine lookup_des_1d
                0167 
                0168 !#######################################################################
                0169 
                0170  subroutine lookup_des_2d ( temp, desat )
                0171 
                0172  real, intent(in)  :: temp (:,:)
                0173  real, intent(out) :: desat(:,:)
                0174 
                0175 !-----------------------------------------------
                0176 
                0177    desat =  e0*hlv/(rvgas*temp**2)*exp( -hlv/rvgas*(1.0/temp-1.0/T0))
                0178 
                0179 !-----------------------------------------------
                0180 
                0181  end subroutine lookup_des_2d
                0182 
                0183 !#######################################################################
                0184 
                0185  subroutine lookup_des_3d ( temp, desat )
                0186 
                0187  real, intent(in)  :: temp (:,:,:)
                0188  real, intent(out) :: desat(:,:,:)
                0189 
                0190 !-----------------------------------------------
                0191 
                0192    desat =  e0*hlv/(rvgas*temp**2)*exp( -hlv/rvgas*(1.0/temp-1.0/T0))
                0193 
                0194 
                0195 !-----------------------------------------------
                0196 
                0197  end subroutine lookup_des_3d
                0198 
                0199 !#######################################################################
                0200 
                0201 end module simple_sat_vapor_pres_mod
                0202