1 subroutine da_pt_to_rho_adj(grid)
3 !---------------------------------------------------------------------------
4 ! Purpose: Adjoint of da_pt_to_rho.
6 ! Assumptions: 1) Model level stored top down
7 !---------------------------------------------------------------------------
11 type (domain), intent(inout) :: grid
13 integer :: i,j,k ! Loop counter.
15 integer :: is, ie, js, je
19 if (trace_use) call da_trace_entry("da_pt_to_rho_adj")
27 if (test_transforms) then
34 if (is < ids) is = ids
35 if (js < jds) js = jds
37 if (ie > ide) ie = ide
38 if (je > jde) je = jde
41 !---------------------------------------------------------------------------
42 ! Calculate rho increments:
43 !---------------------------------------------------------------------------
48 temp = grid%xa%rho(i,j,k) * grid%xb%rho(i,j,k)
50 grid%xa%p(i,j,k) = grid%xa%p(i,j,k) + temp/grid%xb%p(i,j,k)
52 grid%xa%t(i,j,k) = grid%xa%t(i,j,k) - temp/grid%xb%t(i,j,k)
54 grid%xa%rho(i,j,k) = 0.0
59 if (trace_use) call da_trace_exit("da_pt_to_rho_adj")
61 end subroutine da_pt_to_rho_adj