Merge remote-tracking branch 'origin/release-v4.5.2'
[WRF.git] / var / da / da_physics / da_tprh_to_q_lin.inc
blobc0227b779ecc35ce14987692bec9dd47a762978a
1 subroutine da_tprh_to_q_lin(grid)
3    !---------------------------------------------------------------------------
4    ! Purpose: Convert T/pressure/rh to specific humidity increments.
5    !
6    ! Method: q~ = q (rh~/rh + qs~/qs)
7    !---------------------------------------------------------------------------
9    implicit none
10    
11    type (domain), intent(inout) :: grid
12    
13    real :: qs_prime_over_qs(its:ite,jts:jte,kts:kte) ! qs~/qs.
15    if (trace_use) call da_trace_entry("da_tprh_to_q_lin")
17    !---------------------------------------------------------------------------
18    ! [1.0] Calculate saturation specific humidity ratio qs~/qs:
19    !---------------------------------------------------------------------------
21    call da_tp_to_qs_lin( grid, qs_prime_over_qs )
22    
23    !---------------------------------------------------------------------------
24    ! [2.0] Calculate specific humidity increment:
25    !---------------------------------------------------------------------------
27    grid%xa % q(its:ite,jts:jte,kts:kte) = grid%xb % q(its:ite,jts:jte,kts:kte) * &
28                                ( grid%xa % rh(its:ite,jts:jte,kts:kte) / &
29                                  grid%xb % rh(its:ite,jts:jte,kts:kte) + &
30                                  qs_prime_over_qs(its:ite,jts:jte,kts:kte) )
32    if (trace_use) call da_trace_exit("da_tprh_to_q_lin")
34 end subroutine da_tprh_to_q_lin