wrf svn trunk commit r4103
[wrffire.git] / wrfv2_fire / var / da / da_buoy / da_transform_xtoy_buoy.inc
blob30fe46cbb58d899709ea8ff23a88949e8fa15a98
1 subroutine da_transform_xtoy_buoy (grid, iv, y)
3    !--------------------------------------------------------------------------
4    ! Purpose: TBD
5    !    Updated for Analysis on Arakawa-C grid
6    !    Author: Syed RH Rizvi,  MMM/ESSL/NCAR,  Date: 10/22/2008
7    !--------------------------------------------------------------------------
9    implicit none
11    type (domain),  intent(inout) :: grid
12    type (iv_type), intent(in)    :: iv       ! Innovation vector (O-B).
13    type (y_type),  intent(inout) :: y        ! y = h (grid%xa) (linear)
15    integer :: n        ! Loop counter.
17    real, allocatable :: model_u(:,:)
18    real, allocatable :: model_v(:,:)
19    real, allocatable :: model_t(:,:)
20    real, allocatable :: model_q(:,:)
21    real, allocatable :: model_psfc(:)
23    if (trace_use_dull) call da_trace_entry("da_transform_xtoy_buoy")
25    if (sfc_assi_options == sfc_assi_options_1) then
26       allocate (model_u(1,iv%info(buoy)%n1:iv%info(buoy)%n2))
27       allocate (model_v(1,iv%info(buoy)%n1:iv%info(buoy)%n2))
28       allocate (model_t(1,iv%info(buoy)%n1:iv%info(buoy)%n2))
29       allocate (model_q(1,iv%info(buoy)%n1:iv%info(buoy)%n2))
30       allocate (model_psfc(iv%info(buoy)%n1:iv%info(buoy)%n2))
31       ! [1.2] Interpolate horizontally:
32 #ifdef A2C
33       call da_interp_lin_3d (grid%xa%u, iv%info(buoy), model_u,'u')
34       call da_interp_lin_3d (grid%xa%v, iv%info(buoy), model_v,'v')
35 #else
36       call da_interp_lin_3d (grid%xa%u, iv%info(buoy), model_u)
37       call da_interp_lin_3d (grid%xa%v, iv%info(buoy), model_v)
38 #endif
39       call da_interp_lin_3d (grid%xa%t, iv%info(buoy), model_t)
40       call da_interp_lin_3d (grid%xa%q, iv%info(buoy), model_q)
42       call da_interp_lin_2d (grid%xa%psfc, iv%info(buoy), 1, model_psfc)
44       do n=iv%info(buoy)%n1,iv%info(buoy)%n2
45          y%buoy(n)%u = model_u(1,n)
46          y%buoy(n)%v = model_v(1,n)
47          y%buoy(n)%t = model_t(1,n)
48          y%buoy(n)%q = model_q(1,n)
49          y%buoy(n)%p = model_psfc(n)
50       end do
51       deallocate (model_u)
52       deallocate (model_v)
53       deallocate (model_t)
54       deallocate (model_q)
55       deallocate (model_psfc)
56    else if (sfc_assi_options == sfc_assi_options_2) then
57       ! [2.0] Surface assmiilation approach 2
58       call da_transform_xtopsfc(grid,iv,buoy,iv%buoy(:),y%buoy(:))
59    end if
61    if (trace_use_dull) call da_trace_exit("da_transform_xtoy_buoy")
63 end subroutine da_transform_xtoy_buoy