da_transform_xtoy_ships.inc

References to this file elsewhere.
1 subroutine da_transform_xtoy_ships (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_ships > 0) then
21       !xyh y%ships(:)%u = 0.0
22       !xyh y%ships(:)%v = 0.0
23       !xyh y%ships(:)%t = 0.0
24       !xyh y%ships(:)%p = 0.0
25       !xyh y%ships(:)%q = 0.0
26 
27       if (sfc_assi_options == 1) then
28          do n=iv%ob_numb(iv%current_ob_time-1)%ships + 1, iv%ob_numb(iv%current_ob_time)%ships
29             ! [1.1] Get horizontal interpolation weights:
30 
31             i = iv%ships(n)%loc%i
32             dy = iv%ships(n)%loc%dy
33             dym = iv%ships(n)%loc%dym
34             j = iv%ships(n)%loc%j
35             dx = iv%ships(n)%loc%dx
36             dxm = iv%ships(n)%loc%dxm
37 
38             ! [1.2] Interpolate horizontally:
39             call da_interp_obs_lin_2d(xa % u, xp, i, j, dx, dy, dxm, dym, &
40                                    y%ships(n)%u, iv%ships(n)%zk)
41             call da_interp_obs_lin_2d(xa % v, xp, i, j, dx, dy, dxm, dym, &
42                                    y%ships(n)%v, iv%ships(n)%zk)
43             call da_interp_obs_lin_2d(xa % t, xp, i, j, dx, dy, dxm, dym, &
44                                    y%ships(n)%t, iv%ships(n)%zk)
45             call da_interp_obs_lin_2d(xa % q, xp, i, j, dx, dy, dxm, dym, &
46                                    y%ships(n)%q, iv%ships(n)%zk)
47 
48             call da_interp_lin_2d(xa % psfc, xp%ims, xp%ime, xp%jms, xp%jme, &
49                                i, j, dx, dy, dxm, dym, &
50                                y%ships(n)%p)
51          end do
52       else if (sfc_assi_options == 2) then
53           ! [2.0] Surface assimilation approach 2
54           do n=iv%ob_numb(iv%current_ob_time-1)%ships + 1, iv%ob_numb(iv%current_ob_time)%ships
55              call da_transform_xtopsfc(xb,xa,xp,iv%ships(n),y%ships(n))
56          end do
57       end if
58    end if
59 
60 end subroutine da_transform_xtoy_ships
61 
62