da_tpq_to_rh_lin.inc
References to this file elsewhere.
1 subroutine da_tpq_to_rh_lin( xb, xp, xa )
2
3 !---------------------------------------------------------------------------
4 ! Purpose: Convert T/pressure/q to relative humidity increments.
5 !
6 ! Method: r~ = r (q~/q - qs~/qs).
7 !
8 ! When q approaching to zero, the above formula is undefined. The
9 ! general formula below must be used:
10 !
11 ! Method: r~ = 100 * (q~/qs - q*(qs~/qs)/qs))
12 ! = 100 * q~/qs - (100*q/qs)*(qs~/qs)
13 ! = 100 * q~/qs - rh * (qs~/qs)
14 !
15 !---------------------------------------------------------------------------
16
17 implicit none
18
19 type (xb_type), intent(in) :: xb ! First guess structure.
20 type (xpose_type), intent(in) :: xp ! Dimensions and xpose buffers.
21 type (x_type), intent(inout) :: xa ! increment structure.
22
23 integer :: is, ie ! 1st dim. end points.
24 integer :: js, je ! 2nd dim. end points.
25 integer :: ks, ke ! 3rd dim. end points.
26 real, dimension(xp%its:xp%ite,xp%jts:xp%jte,xp%kts:xp%kte) :: qs, es, &
27 qs_prime_over_qs
28
29 !---------------------------------------------------------------------------
30 ! [1.0] initialise:
31 !---------------------------------------------------------------------------
32
33 is = xp%its; ie = xp%ite
34 js = xp%jts; je = xp%jte
35 ks = xp%kts; ke = xp%kte
36
37 !---------------------------------------------------------------------------
38 ! [1.0] Calculate saturation specific humidity ratio qs~/qs:
39 !---------------------------------------------------------------------------
40
41 call da_tp_to_qs_lin( xb, xp, xa, qs_prime_over_qs )
42
43 !--------------------------------------------------------------------------
44 ! [2.0] Culcalete background saturation specific humidity qs:
45 !--------------------------------------------------------------------------
46
47 call da_tp_to_qs1( xb, xp, es, qs)
48
49 !---------------------------------------------------------------------------
50 ! [3.0] Calculate relative humidity increment:
51 !---------------------------------------------------------------------------
52
53 xa % rh(is:ie,js:je,ks:ke) = 100. * &
54 ( xa % q(is:ie,js:je,ks:ke) / &
55 qs(is:ie,js:je,ks:ke) ) - &
56 xb % rh(is:ie,js:je,ks:ke) * &
57 qs_prime_over_qs(is:ie,js:je,ks:ke)
58
59 end subroutine da_tpq_to_rh_lin
60
61