1 subroutine da_transform_xtoy_tamdar_sfc_adj(grid, iv, jo_grad_y, jo_grad_x)
3 !-----------------------------------------------------------------------
5 !-----------------------------------------------------------------------
9 type (domain), intent(in) :: grid
10 type (iv_type), intent(in) :: iv ! obs. inc vector (o-b).
11 type (y_type) , intent(inout) :: jo_grad_y ! grad_y(jo)
12 type (x_type) , intent(inout) :: jo_grad_x ! grad_x(jo)
14 integer :: n ! Loop counter.
16 real, allocatable :: model_u(:,:)
17 real, allocatable :: model_v(:,:)
18 real, allocatable :: model_t(:,:)
19 real, allocatable :: model_q(:,:)
20 real, allocatable :: model_psfc(:)
22 real, allocatable :: ub(:,:)
23 real, allocatable :: vb(:,:)
25 if (trace_use_dull) call da_trace_entry("da_transform_xtoy_tamdar_sfc_adj")
27 if (sfc_assi_options == sfc_assi_options_1) then
29 allocate (model_u(1,iv%info(tamdar_sfc)%n1:iv%info(tamdar_sfc)%n2))
30 allocate (model_v(1,iv%info(tamdar_sfc)%n1:iv%info(tamdar_sfc)%n2))
31 allocate (model_t(1,iv%info(tamdar_sfc)%n1:iv%info(tamdar_sfc)%n2))
32 allocate (model_q(1,iv%info(tamdar_sfc)%n1:iv%info(tamdar_sfc)%n2))
33 allocate (model_psfc(iv%info(tamdar_sfc)%n1:iv%info(tamdar_sfc)%n2))
35 allocate (ub(1,iv%info(tamdar_sfc)%n1:iv%info(tamdar_sfc)%n2))
36 allocate (vb(1,iv%info(tamdar_sfc)%n1:iv%info(tamdar_sfc)%n2))
38 call da_interp_lin_3d (grid%xb%u, iv%info(tamdar_sfc), ub)
39 call da_interp_lin_3d (grid%xb%v, iv%info(tamdar_sfc), vb)
41 ! [1.2] Interpolate horizontally:
42 do n=iv%info(tamdar_sfc)%n1,iv%info(tamdar_sfc)%n2
43 if(wind_sd_tamdar)then
44 call da_uv_to_sd_adj(jo_grad_y%tamdar_sfc(n)%u, &
45 jo_grad_y%tamdar_sfc(n)%v, model_u(1,n), model_v(1,n), ub(1,n), vb(1,n))
47 model_u(1,n) = jo_grad_y%tamdar_sfc(n)%u
48 model_v(1,n) = jo_grad_y%tamdar_sfc(n)%v
50 model_t(1,n) = jo_grad_y%tamdar_sfc(n)%t
51 model_q(1,n) = jo_grad_y%tamdar_sfc(n)%q
52 model_psfc(n) = jo_grad_y%tamdar_sfc(n)%p
56 call da_interp_lin_3d_adj (jo_grad_x%u, iv%info(tamdar_sfc), model_u,'u')
57 call da_interp_lin_3d_adj (jo_grad_x%v, iv%info(tamdar_sfc), model_v,'v')
59 call da_interp_lin_3d_adj (jo_grad_x%u, iv%info(tamdar_sfc), model_u)
60 call da_interp_lin_3d_adj (jo_grad_x%v, iv%info(tamdar_sfc), model_v)
62 call da_interp_lin_3d_adj (jo_grad_x%t, iv%info(tamdar_sfc), model_t)
63 call da_interp_lin_3d_adj (jo_grad_x%q, iv%info(tamdar_sfc), model_q)
65 call da_interp_lin_2d_adj (jo_grad_x%psfc, iv%info(tamdar_sfc), 1, model_psfc)
72 deallocate (model_psfc)
76 else if (sfc_assi_options == sfc_assi_options_2) then
77 call da_transform_xtopsfc_adj(grid,iv,tamdar_sfc,iv%tamdar_sfc(:), jo_grad_y%tamdar_sfc(:),jo_grad_x)
80 if (trace_use_dull) call da_trace_exit("da_transform_xtoy_tamdar_sfc_adj")
82 end subroutine da_transform_xtoy_tamdar_sfc_adj