da_tpq_to_rh_lin1.inc

References to this file elsewhere.
1 subroutine da_tpq_to_rh_lin1( t, p, es, rh, t_prime, p_prime, q_prime, rh_prime )
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) - rh*(qs~/qs)
12    !---------------------------------------------------------------------------
13 
14    implicit none
15 
16    real, intent(in)  :: t        ! Temperature.
17    real, intent(in)  :: p        ! Pressure.
18    real, intent(in)  :: es       ! Saturation vapour pressure.
19    real, intent(in)  :: rh       ! Relative Humidity.
20    real, intent(in)  :: t_prime  ! Temperature increment.
21    real, intent(in)  :: p_prime  ! Pressure increment.
22    real, intent(in)  :: q_prime  ! Pressure increment.
23    real, intent(out) :: rh_prime ! Pressure increment.
24    
25    real :: es1, qs  ! Saturation specific humidity.
26    real :: qs_prime_over_qs ! qs~/qs.
27 
28    if (trace_use_dull) call da_trace_entry("da_tpq_to_rh_lin1")
29 
30    !---------------------------------------------------------------------------
31    ! [1.0] Calculate saturation specific humidity ratio qs~/qs:
32    !---------------------------------------------------------------------------
33 
34    call da_tp_to_qs_lin1( t, p, es, t_prime, p_prime, qs_prime_over_qs )
35    
36    !--------------------------------------------------------------------------
37    ! [2.0] Culcalete background saturation specific humidity qs:
38    !--------------------------------------------------------------------------
39 
40    call da_tp_to_qs( t, p, es1, qs) 
41    
42    !---------------------------------------------------------------------------
43    ! [3.0] Calculate relative humidity increment:
44    !---------------------------------------------------------------------------
45 
46    rh_prime = 100.0 * (q_prime / qs) - rh * qs_prime_over_qs
47 
48    if (trace_use_dull) call da_trace_exit("da_tpq_to_rh_lin1")
49 
50 end subroutine da_tpq_to_rh_lin1
51 
52