1 subroutine da_transform_vvtovp_adj(grid, evec, eval, vertical_wgt, vp, vv, mz, levels)
3 !---------------------------------------------------------------------------
4 ! Purpose: Adjoint of da_transform_vvtovp.
5 !---------------------------------------------------------------------------
9 type (domain), intent(in) :: grid
10 integer, intent(in) :: mz ! # vertical modes.
11 integer, intent(in) :: levels ! no. of vertical levels
13 real*8, intent(in) :: evec(jds:jde,kds:kde,1:mz) ! Eigenvectors.
14 real*8, intent(in) :: eval(jds:jde,1:mz) ! Eigenvalues.
15 real, intent(in) :: vertical_wgt(ims:ime,jms:jme,kms:kme) ! Weighting.
16 real, intent(inout) :: vp(ims:ime,jms:jme,kms:kme)! CV in level space.
17 real, intent(out) :: vv(ims:ime,jms:jme,kms:kme)! CV in EOF space.
19 integer :: i, j, m, k, ij ! Loop counters.
22 if (trace_use_dull) call da_trace_entry("da_transform_vvtovp_adj")
24 !-------------------------------------------------------------------
25 ! [1.0] Apply inner-product weighting if vertical_ip /= vertical_ip_0:
26 !-------------------------------------------------------------------
28 if (vertical_ip /= vertical_ip_0) then
29 vp(its:ite,jts:jte,kts:levels) = vp(its:ite,jts:jte,kts:levels) / &
30 vertical_wgt(its:ite,jts:jte,kts:levels)
33 !-------------------------------------------------------------------
34 ! [2.0] Perform vv(i,j,m) = L^{1/2} E^T vp(i,j,k) transform:
35 !-------------------------------------------------------------------
38 !$OMP PRIVATE ( ij, m, k, j, i, temp )
39 do ij = 1 , grid%num_tiles
40 vv(:,grid%j_start(ij):grid%j_end(ij),:) = 0.0
43 do j = grid%j_start(ij), grid%j_end(ij)
44 temp = evec(j,k,m) * eval(j,m)
47 vv(i,j,m) = vv(i,j,m) + temp*vp(i,j,k)
55 if (trace_use_dull) call da_trace_exit("da_transform_vvtovp_adj")
57 end subroutine da_transform_vvtovp_adj