Merge remote-tracking branch 'origin/release-v4.5.2'
[WRF.git] / var / da / da_transfer_model / da_transfer_wrftoxb_chem.inc
blobf320a4cd5eb80487d9c9ec9dfe76cb6929efbd33
1 subroutine da_transfer_wrftoxb_chem(grid)
3    !---------------------------------------------------------------------------
4    ! Purpose: Transfers fields from WRF to first guess structure.
5    !    Updated for Analysis on Arakawa-C grid
6    !    Author: Syed RH Rizvi,  MMM/ESSL/NCAR,  Date: 10/22/2008
7    !
8    ! Purpose: Transfers Chem fields from WRF to first guess structure.
9    !    Author: Wei Sun,  MMM/NCAR,  Date: 02/11/2019
10    !---------------------------------------------------------------------------
12    implicit none
13    
14    type(domain), intent(inout)        :: grid
16    integer :: ic, i, j, k, ij
18    if (trace_use) call da_trace_entry("da_transfer_wrftoxb_chem")
20    !$OMP PARALLEL DO &
21    !$OMP PRIVATE ( ic, ij, i, j, k )
22    do ij = 1 , grid%num_tiles
24    ! Need to ensure scaling factors never drop to zero, which could happen if 4D-Var increment is too large
25    do ic = PARAM_FIRST_SCALAR, num_chem
26       do j=grid%j_start(ij),grid%j_end(ij)
27          do i=its,ite
28             do k=kts,kte
29                   grid%xbchem%chem_ic(i,j,k,ic) = grid%chem(i,j,k,ic)
30             end do
31          end do
32       end do
33    end do
35    end do
36    !$OMP END PARALLEL DO
38 #ifdef DM_PARALLEL
39 #include "HALO_CHEM_XB.inc"
40 #endif
42    if (trace_use) call da_trace_exit("da_transfer_wrftoxb_chem")
44 end subroutine da_transfer_wrftoxb_chem