1 subroutine da_transform_vptox_adj(grid, vp, be, ep)
3 !--------------------------------------------------------------------------
4 ! Purpose: Adjoint for Physical transform of variables
5 ! Updated for Analysis on Arakawa-C grid
6 ! Author: Syed RH Rizvi, MMM/ESSL/NCAR, Date: 10/22/2008
7 !--------------------------------------------------------------------------
11 type (domain), intent(inout) :: grid
12 type (vp_type), intent(inout) :: vp ! CV on grid structure.
13 type (ep_type), intent(in) :: ep ! Ensemble perturbation.
14 type (be_type), intent(in), optional :: be ! Background errors.
16 integer :: i, k, j, ij, k1 ! Loop counters.
18 if (trace_use) call da_trace_entry("da_transform_vptox_adj")
20 !---------------------------------------------------------------------------
21 ! [4] Add flow-dependent increments in model space (grid%xa):
22 !---------------------------------------------------------------------------
24 if (be % ne > 0 .and. alphacv_method == alphacv_method_xa) then
25 call da_add_flow_dependence_xa_adj(be % ne, ep, grid%xa, vp)
28 !--------------------------------------------------------------------------
29 ! [3] Transform to model variable space:
30 !--------------------------------------------------------------------------
32 if ((use_radarobs .and. use_radar_rf) .or. (use_rad .and. crtm_cloud) ) then
33 ! Pseudo RH --> Total water mixing ratio:
34 vp%v4(its:ite,jts:jte,kts:kte) = vp%v4(its:ite,jts:jte,kts:kte) &
35 + grid%xa%qt(its:ite,jts:jte,kts:kte) * grid%xb%qs(its:ite,jts:jte,kts:kte)
37 ! Pseudo RH --> Water vapor mixing ratio:
40 do ij = 1 , grid%num_tiles
42 do j = grid%j_start(ij),grid%j_end(ij)
44 vp%v4(i,j,k) = vp%v4(i,j,k) + grid%xa%q(i,j,k) * grid%xb%qs(i,j,k)
53 if ((fg_format==fg_format_wrf_arw_regional .or. &
54 fg_format==fg_format_wrf_arw_global ) .and. ide == ipe ) then
59 if ((fg_format==fg_format_wrf_arw_regional .or. &
60 fg_format==fg_format_wrf_arw_global ) .and. jde == jpe ) then
66 #include "HALO_PSICHI_UV_ADJ.inc"
70 if ((fg_format==fg_format_wrf_arw_regional .or. &
71 fg_format==fg_format_wrf_arw_global ) .and. ide == ipe ) then
76 if ((fg_format==fg_format_wrf_arw_regional .or. &
77 fg_format==fg_format_wrf_arw_global ) .and. jde == jpe ) then
84 ! Transform psi and chi to u and v:
86 call da_psichi_to_uv_adj(grid%xa % u, grid%xa % v, grid%xb % coefx, grid%xb % coefy, vp % v1, vp % v2)
88 !--------------------------------------------------------------------------
89 ! [2] Impose statistical balance constraints:
90 !--------------------------------------------------------------------------
93 !$OMP PRIVATE ( ij, k, j, k1, i )
94 do ij = 1 , grid%num_tiles
98 do j= grid%j_start(ij),grid%j_end(ij)
100 vp%v1(i,j,k) = vp%v1(i,j,k) + be%reg_ps(j,k)*grid%xa%psfc(i,j)
104 do j= grid%j_start(ij),grid%j_end(ij)
106 vp%v5(i,j,1) = grid%xa%psfc(i,j)
113 do j = grid%j_start(ij),grid%j_end(ij)
115 vp%v1(i,j,k1) = vp%v1(i,j,k1) + be%reg_t(j,k,k1)*grid%xa%t(i,j,k)
121 do j = grid%j_start(ij),grid%j_end(ij)
123 vp%v3(i,j,k) = grid%xa%t(i,j,k)
130 do j = grid%j_start(ij),grid%j_end(ij)
132 vp%v1(i,j,k) = vp%v1(i,j,k) + be%reg_chi(j,k)*vp%v2(i,j,k)
138 !$OMP END PARALLEL DO
140 !---------------------------------------------------------------------------
141 ! [1] Add flow-dependent increments in control variable space (vp):
142 !---------------------------------------------------------------------------
144 if (be % ne > 0 .and. alphacv_method == alphacv_method_vp) then
145 call da_add_flow_dependence_vp_adj(be % ne, ep, vp)
148 if (trace_use) call da_trace_exit("da_transform_vptox_adj")
150 end subroutine da_transform_vptox_adj