da_prho_to_t_adj.inc

References to this file elsewhere.
1 subroutine da_prho_to_t_adj(grid) 
2 
3    !---------------------------------------------------------------------------
4    !  Purpose: Adjoint of da_prho_to_t.
5    !
6    !  Method:  Standard adjoint coding.
7    !
8    !  Assumptions: 1) Model level stored top down.
9    !---------------------------------------------------------------------------
10 
11    implicit none
12    
13    type (domain), intent(inout)  :: grid
14 
15    integer :: is, ie       ! 1st dim. end points.
16    integer :: js, je       ! 2nd dim. end points.
17    integer :: k            ! Loop counter.
18    real    :: temp(its:ite,jts:jte) ! Temporary array.
19 
20    if (trace_use) call da_trace_entry("da_prho_to_t_adj")
21 
22    !---------------------------------------------------------------------------
23    !  [1.0] initialise:
24    !---------------------------------------------------------------------------
25 
26    is = its
27    ie = ite
28    js = jts
29    je = jte
30    
31    if (test_transforms) then
32       is = its-1
33       js = jts-1
34 
35       ie = ite+1
36       je = jte+1
37 
38       if (is < ids) is = ids
39       if (js < jds) js = jds
40 
41       if (ie > ide) ie = ide
42       if (je > jde) je = jde
43    end if
44 
45    !---------------------------------------------------------------------------
46    ! [2.0] Calculate temperature increments:
47    !---------------------------------------------------------------------------
48 
49    do k = kts, kte
50       temp(is:ie,js:je) = grid%xa % t(is:ie,js:je,k) * grid%xb % t(is:ie,js:je,k)
51 
52       grid%xa % p(is:ie,js:je,k) = grid%xa % p(is:ie,js:je,k) &
53          + temp(is:ie,js:je) / grid%xb % p(is:ie,js:je,k)
54                          
55       grid%xa % rho(is:ie,js:je,k) = grid%xa % rho(is:ie,js:je,k) &
56          - temp(is:ie,js:je) / grid%xb % rho(is:ie,js:je,k)
57    end do  
58 
59    if (trace_use) call da_trace_exit("da_prho_to_t_adj")
60                              
61 end subroutine da_prho_to_t_adj
62 
63