Routines for determining the saturation vapor pressure (ES) and the derivative of ES with respect to temperature.
constants_mod
fms_mod
call lookup_es ( temp, esat )
| temp | Temperature in degrees Kelvin. [real, dimension(scalar)] [real, dimension(:)] [real, dimension(:,:)] [real, dimension(:,:,:)] |
| esat | Saturation vapor pressure in pascals.
May be a scalar, 1d, 2d, or 3d array.
Must have the same order and size as temp. [real, dimension(scalar)] [real, dimension(:)] [real, dimension(:,:)] [real, dimension(:,:,:)] |
call lookup_des ( temp, desat )
| temp | Temperature in degrees Kelvin. [real, dimension(scalar)] [real, dimension(:)] [real, dimension(:,:)] [real, dimension(:,:,:)] |
| desat | Derivative of saturation vapor pressure w.r.t. temperature
in pascals/degree. May be a scalar, 1d, 2d, or 3d array.
Must have the same order and size as temp. [real, dimension(scalar)] [real, dimension(:)] [real, dimension(:,:)] [real, dimension(:,:,:)] |
es = compute_es ( temp )
| temp | Temperature in degrees Kelvin. [real, dimension(:)] [real, dimension(scalar)] [real, dimension(:,:)] [real, dimension(:,:,:)] |
| es | Saturation vapor pressure in pascals.
May be a scalar, 1d, 2d, or 3d array.
Must have the same order and size as temp. [real, dimension(:)] [real, dimension(scalar)] [real, dimension(:,:)] [real, dimension(:,:,:)] |
call sat_vapor_pres_init
use sat_vapor_pres_mod
implicit none
integer, parameter :: ipts=500, jpts=100, kpts=50, nloop=1
real, dimension(ipts,jpts,kpts) :: t,es,esn,des,desn
integer :: n
generate temperatures between 120K and 340K
call random_number (t)
t = 130. + t * 200.
initialize the tables (optional)
call sat_vapor_pres_init
compute actual es and "almost" actual des
es = compute_es (t)
des = compute_des (t)
do n = 1, nloop
es and des
call lookup_es (t, esn)
call lookup_des (t,desn)
enddo
terminate, print deviation from actual
print *, 'size=',ipts,jpts,kpts,nloop
print *, 'err es = ', sum((esn-es)**2)
print *, 'err des = ', sum((desn-des)**2)
contains
----------------------------------
routine to estimate derivative
function compute_des (tem) result (des)
real, intent(in) :: tem(:,:,:)
real, dimension(size(tem,1),size(tem,2),size(tem,3)) :: des,esp,esm
real, parameter :: tdel = .01
esp = compute_es (tem+tdel)
esm = compute_es (tem-tdel)
des = (esp-esm)/(2*tdel)
end function compute_des
----------------------------------
end program test_sat_vapor_pres
No error checking is done to make sure that the size of the input and output fields match.
es (T) = ES(t) + ES'(t) * dt + 0.5 * ES''(t) * dt**2
es'(T) = ES'(t) + ES''(t) * dt
where t = lookup table temperature closest to T
dt = T - t 4. Internal (private) parameters tcmin The minimum temperature (in deg C) in the lookup tables.
[integer, default: tcmin = -160]
tcmax The maximum temperature (in deg C) in the lookup tables.
[integer, default: tcmin = +100]