1 subroutine da_tpq_to_rh_lin(grid)
3 !---------------------------------------------------------------------------
4 ! Purpose: Convert T/pressure/q to relative humidity increments.
6 ! Method: r~ = r (q~/q - qs~/qs).
8 ! When q approaching to zero, the above formula its undefined. The
9 ! general formula below must be used:
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)
15 !---------------------------------------------------------------------------
19 type (domain), intent(inout) ::grid
21 real :: qs(its:ite,jts:jte,kts:kte)
22 real :: es(its:ite,jts:jte,kts:kte)
23 real :: qs_prime_over_qs(its:ite,jts:jte,kts:kte)
25 if (trace_use_dull) call da_trace_entry("da_tpq_to_rh_lin")
27 !---------------------------------------------------------------------------
28 ! [1.0] Calculate saturation specific humidity ratio qs~/qs:
29 !---------------------------------------------------------------------------
31 call da_tp_to_qs_lin(grid, qs_prime_over_qs )
33 !--------------------------------------------------------------------------
34 ! [2.0] Culcalete background saturation specific humidity qs:
35 !--------------------------------------------------------------------------
37 call da_tp_to_qs1(grid, es, qs)
39 !---------------------------------------------------------------------------
40 ! [3.0] Calculate relative humidity increment:
41 !---------------------------------------------------------------------------
43 grid%xa % rh(its:ite,jts:jte,kts:kte) = 100.0 * &
44 ( grid%xa % q(its:ite,jts:jte,kts:kte) / &
45 qs(its:ite,jts:jte,kts:kte) ) - &
46 grid%xb % rh(its:ite,jts:jte,kts:kte) * &
47 qs_prime_over_qs(its:ite,jts:jte,kts:kte)
49 if (trace_use_dull) call da_trace_exit("da_tpq_to_rh_lin")
51 end subroutine da_tpq_to_rh_lin