da_tp_to_qs1.inc

References to this file elsewhere.
1 subroutine da_tp_to_qs1( xb, xp, es, qs)
2 
3    !---------------------------------------------------------------------------
4    !  Purpose: Convert T/p to saturation specific humidity.
5    !
6    !  Method: qs = es_alpha * es / ( p - ( 1 - rd_over_rv ) * es ).
7    !          use Rogers & Yau (1989) formula: es = a exp( bTc / (T_c + c) ).
8    !
9    !  This da_tp_to_qs1 was added and called by the corrected subroutine
10    !       da_tpq_to_rh_lin.
11    !---------------------------------------------------------------------------
12 
13    implicit none
14 
15    type (xb_type), intent(in)    :: xb           ! First guess structure.
16    type (xpose_type), intent(in) :: xp           ! Dimensions and xpose buffers.
17    real, dimension(xp%its:xp%ite,xp%jts:xp%jte,xp%kts:xp%kte), intent(out):: &
18                                     es, qs
19 
20    integer                       :: is, ie       ! 1st dim. end points.
21    integer                       :: js, je       ! 2nd dim. end points.
22    integer                       :: ks, ke       ! 3rd dim. end points.
23    integer                       :: i, j, k      ! Loop counters.
24    real                          :: t_c          ! Working variable.
25 
26    !---------------------------------------------------------------------------
27    ! [1.0] initialise:
28    !---------------------------------------------------------------------------
29 
30    is = xp%its; ie = xp%ite
31    js = xp%jts; je = xp%jte
32    ks = xp%kts; ke = xp%kte      
33 
34    do k = ks, ke
35       do j = js, je
36          do i = is, ie
37 
38             !------------------------------------------------------------------
39             ! [1.0] initialise:
40             !------------------------------------------------------------------
41 
42             t_c = xb % t(i,j,k) - t_kelvin
43    
44             !------------------------------------------------------------------
45             ! [2.0] Calculate saturation vapour pressure:
46             !------------------------------------------------------------------
47 
48             es(i,j,k) = es_alpha * exp( es_beta * t_c / ( t_c + es_gamma ) )
49    
50             !------------------------------------------------------------------
51             ! [3.0] Calculate saturation specific humidity:
52             !------------------------------------------------------------------
53 
54             qs(i,j,k) = rd_over_rv * es(i,j,k) / &
55                      (xb % p(i,j,k) - rd_over_rv1 * es(i,j,k))
56 
57          end do
58       end do
59    end do
60 
61 end subroutine da_tp_to_qs1
62 
63