da_transform_xtoy_buoy.inc

References to this file elsewhere.
1 subroutine da_transform_xtoy_buoy (xa, xb, iv, xp, y)
2 
3    !--------------------------------------------------------------------------
4    ! Purpose: TBD
5    !--------------------------------------------------------------------------
6 
7    implicit none
8 
9    type (x_type),  intent(inout) :: xa       ! gridded analysis increment.
10    type (xb_type), intent(in)    :: xb       ! first guess state.
11    type (ob_type), intent(in)    :: iv       ! Innovation vector (O-B).
12    type (xpose_type), intent(in) :: xp       ! Domain decomposition vars.
13    type (y_type), intent(inout)  :: y        ! y = h (xa) (linear)
14 
15    integer                      :: n        ! Loop counter.
16    integer                      :: i, j     ! Index dimension.
17    real                         :: dx, dxm  ! 
18    real                         :: dy, dym  !
19 
20    if (iv%num_buoy > 0) then
21 
22       ! WHY
23       !xyh      y%buoy(:)%u = 0.0
24       !xyh      y%buoy(:)%v = 0.0
25       !xyh      y%buoy(:)%t = 0.0
26       !xyh      y%buoy(:)%p = 0.0
27       !xyh      y%buoy(:)%q = 0.0
28 
29       if (sfc_assi_options == 1) then
30          do n=iv%ob_numb(iv%current_ob_time-1)%buoy + 1, &
31             iv%ob_numb(iv%current_ob_time)%buoy
32 
33             ! [1.1] Get horizontal interpolation weights:
34 
35             i = iv%buoy(n)%loc%i
36             dy = iv%buoy(n)%loc%dy
37             dym = iv%buoy(n)%loc%dym
38             j = iv%buoy(n)%loc%j
39             dx = iv%buoy(n)%loc%dx
40             dxm = iv%buoy(n)%loc%dxm
41 
42             ! [1.2] Interpolate horizontally:
43             call da_interp_obs_lin_2d(xa % u, xp, i, j, dx, dy, dxm, dym, &
44                                   y%buoy(n)%u, iv%buoy(n)%zk)
45             call da_interp_obs_lin_2d(xa % v, xp, i, j, dx, dy, dxm, dym, &
46                                   y%buoy(n)%v, iv%buoy(n)%zk)
47             call da_interp_obs_lin_2d(xa % t, xp, i, j, dx, dy, dxm, dym, &
48                                   y%buoy(n)%t, iv%buoy(n)%zk)
49             call da_interp_obs_lin_2d(xa % q, xp, i, j, dx, dy, dxm, dym, &
50                                   y%buoy(n)%q, iv%buoy(n)%zk)
51 
52             call da_interp_lin_2d(xa % psfc, xp%ims, xp%ime, xp%jms, xp%jme, &
53                               i, j, dx, dy, dxm, dym, &
54                               y%buoy(n)%p)
55          end do
56       else if (sfc_assi_options == 2) then
57          ! [2.0] Surface assimilation approach 2
58          do n=iv%ob_numb(iv%current_ob_time-1)%buoy + 1, iv%ob_numb(iv%current_ob_time)%buoy
59             call da_transform_xtopsfc(xb,xa,xp,iv%buoy(n),y%buoy(n))
60          end do
61       end if
62    end if
63 
64 end subroutine da_transform_xtoy_buoy
65 
66