updated top-level README and version_decl for V4.5 (#1847)
[WRF.git] / dyn_em / module_first_rk_step_part1.F
blobf5eb26734dd87266f07a12c7c0ba0afac73a5d36
1 !WRF:MEDIATION_LAYER:SOLVER
3 #define BENCH_START(A)
4 #define BENCH_END(A)
6 MODULE module_first_rk_step_part1
8 CONTAINS
10   SUBROUTINE first_rk_step_part1 (   grid , config_flags              &
11                              , moist , moist_tend               &
12                              , chem  , chem_tend                &
13                              , tracer, tracer_tend              &
14                              , scalar , scalar_tend             &
15                              , fdda3d, fdda2d                   &
16                              , aerod                            &
17                              , ru_tendf, rv_tendf               &
18                              , rw_tendf, t_tendf                &
19                              , ph_tendf, mu_tendf               &
20                              , tke_tend                         &
21                              , adapt_step_flag , curr_secs      &
22                              , psim , psih , gz1oz0 , chklowq   &
23                              , cu_act_flag , hol , th_phy       &
24                              , pi_phy , p_phy , t_phy           &
25                              , dz8w , p8w , t8w                 &
26                              , ids, ide, jds, jde, kds, kde     &
27                              , ims, ime, jms, jme, kms, kme     &
28                              , ips, ipe, jps, jpe, kps, kpe     &
29                              , imsx,imex,jmsx,jmex,kmsx,kmex    &
30                              , ipsx,ipex,jpsx,jpex,kpsx,kpex    &
31                              , imsy,imey,jmsy,jmey,kmsy,kmey    &
32                              , ipsy,ipey,jpsy,jpey,kpsy,kpey    &
33                              , k_start , k_end                  &
34                              , f_flux                           &
35                              , aerocu                           &
36                              , restart_flag                     &
37                              , feedback_is_ready                &
38                             )
39     USE module_state_description
40     USE module_model_constants
41     USE module_domain, ONLY : domain, domain_clock_get, get_ijk_from_subgrid
42     USE module_configure, ONLY : grid_config_rec_type, model_config_rec
43     USE module_radiation_driver, ONLY : pre_radiation_driver, radiation_driver
44     USE module_surface_driver, ONLY : surface_driver
45     USE module_cumulus_driver, ONLY : cumulus_driver
46     USE module_shallowcu_driver, ONLY : shallowcu_driver
47     USE module_pbl_driver, ONLY : pbl_driver
48     USE module_fr_fire_driver_wrf, ONLY : fire_driver_em_step
49     USE module_fddagd_driver, ONLY : fddagd_driver
50     USE module_em, ONLY : init_zero_tendency
51     USE module_force_scm
52     USE module_convtrans_prep
53     USE module_big_step_utilities_em, ONLY : phy_prep
54 !use module_scalar_tables
55 #ifdef DM_PARALLEL
56     USE module_dm, ONLY : local_communicator, mytask, ntasks, ntasks_x, ntasks_y, local_communicator_periodic, wrf_dm_maxval
57     USE module_comm_dm, ONLY : halo_em_phys_a_sub,halo_em_fdda_sfc_sub,halo_pwp_sub,halo_em_chem_e_3_sub, &
58     halo_em_chem_e_5_sub, halo_em_hydro_noahmp_sub
59 #if ( WRFPLUS == 1 )
60     USE module_comm_dm, ONLY : halo_em_phys_a_bl_surf_sub
61 #endif
62 #endif
63     USE module_utility
64     IMPLICIT NONE
66     TYPE ( domain ), INTENT(INOUT) :: grid
67     TYPE ( grid_config_rec_type ), INTENT(IN) :: config_flags
68     TYPE(WRFU_Time)                :: currentTime
70     INTEGER, INTENT(IN) :: ids, ide, jds, jde, kds, kde,     &
71                            ims, ime, jms, jme, kms, kme,     &
72                            ips, ipe, jps, jpe, kps, kpe,     &
73                            imsx,imex,jmsx,jmex,kmsx,kmex,    &
74                            ipsx,ipex,jpsx,jpex,kpsx,kpex,    &
75                            imsy,imey,jmsy,jmey,kmsy,kmey,    &
76                            ipsy,ipey,jpsy,jpey,kpsy,kpey
79     LOGICAL ,INTENT(IN)                        :: adapt_step_flag
80     REAL, INTENT(IN)                           :: curr_secs
82     REAL    ,DIMENSION(ims:ime,kms:kme,jms:jme,num_moist),INTENT(INOUT)   :: moist
83     REAL    ,DIMENSION(ims:ime,kms:kme,jms:jme,num_moist),INTENT(INOUT)   :: moist_tend
84     REAL    ,DIMENSION(ims:ime,kms:kme,jms:jme,num_chem),INTENT(INOUT)   :: chem
85     REAL    ,DIMENSION(ims:ime,kms:kme,jms:jme,num_chem),INTENT(INOUT)   :: chem_tend
86     REAL    ,DIMENSION(ims:ime,kms:kme,jms:jme,num_tracer),INTENT(INOUT)   :: tracer
87     REAL    ,DIMENSION(ims:ime,kms:kme,jms:jme,num_tracer),INTENT(INOUT)   :: tracer_tend
88     REAL    ,DIMENSION(ims:ime,kms:kme,jms:jme,num_scalar),INTENT(INOUT)   :: scalar
89     REAL    ,DIMENSION(ims:ime,kms:kme,jms:jme,num_scalar),INTENT(INOUT)   :: scalar_tend
90     REAL    ,DIMENSION(ims:ime,kms:kme,jms:jme,num_fdda3d),INTENT(INOUT)  :: fdda3d
91     REAL    ,DIMENSION(ims:ime,1:1,jms:jme,num_fdda2d),INTENT(INOUT)      :: fdda2d
92     REAL    ,DIMENSION(ims:ime,kms:kme,jms:jme,num_aerod),INTENT(INOUT)   :: aerod
93     REAL    ,DIMENSION(ims:ime,kms:kme,jms:jme,num_aerocu),INTENT(INOUT), OPTIONAL  ::aerocu
94     REAL    ,DIMENSION(ims:ime,jms:jme), INTENT(INOUT)         :: psim
95     REAL    ,DIMENSION(ims:ime,jms:jme), INTENT(INOUT)         :: psih
96     REAL    ,DIMENSION(ims:ime,jms:jme), INTENT(INOUT)         :: gz1oz0
97     REAL    ,DIMENSION(ims:ime,jms:jme), INTENT(INOUT)         :: chklowq
98     LOGICAL ,DIMENSION(ims:ime,jms:jme), INTENT(INOUT)         :: cu_act_flag
99     REAL    ,DIMENSION(ims:ime,jms:jme), INTENT(INOUT)         :: hol
101     REAL    ,DIMENSION(ims:ime,kms:kme,jms:jme), INTENT(INOUT) :: th_phy
102     REAL    ,DIMENSION(ims:ime,kms:kme,jms:jme), INTENT(INOUT) :: pi_phy
103     REAL    ,DIMENSION(ims:ime,kms:kme,jms:jme), INTENT(INOUT) :: p_phy
104     REAL    ,DIMENSION(ims:ime,kms:kme,jms:jme), INTENT(INOUT) :: t_phy
105     REAL    ,DIMENSION(ims:ime,kms:kme,jms:jme), INTENT(INOUT) :: dz8w
106     REAL    ,DIMENSION(ims:ime,kms:kme,jms:jme), INTENT(INOUT) :: p8w
107     REAL    ,DIMENSION(ims:ime,kms:kme,jms:jme), INTENT(INOUT) :: t8w
109     REAL    ,DIMENSION(ims:ime,kms:kme,jms:jme), INTENT(INOUT) :: ru_tendf
110     REAL    ,DIMENSION(ims:ime,kms:kme,jms:jme), INTENT(INOUT) :: rv_tendf
111     REAL    ,DIMENSION(ims:ime,kms:kme,jms:jme), INTENT(INOUT) :: rw_tendf
112     REAL    ,DIMENSION(ims:ime,kms:kme,jms:jme), INTENT(INOUT) :: ph_tendf
113     REAL    ,DIMENSION(ims:ime,kms:kme,jms:jme), INTENT(INOUT) :: t_tendf
114     REAL    ,DIMENSION(ims:ime,kms:kme,jms:jme), INTENT(INOUT) :: tke_tend
116     REAL    ,DIMENSION(ims:ime,jms:jme), INTENT(INOUT) :: mu_tendf
118     INTEGER, INTENT(IN)                           ::  k_start, k_end
119     LOGICAL, INTENT(IN), OPTIONAL                 ::  f_flux
121     LOGICAL, INTENT(IN), OPTIONAL                 :: restart_flag  
123     LOGICAL, INTENT(IN), OPTIONAL :: feedback_is_ready  ! For WRF-CMAQ coupled model, indicates feedback information is available
125 ! Local
126     real :: HYDRO_dt
127     REAL, DIMENSION( ims:ime, jms:jme ) :: exch_temf  ! 1/7/09 WA
129     REAL, DIMENSION( ims:ime, jms:jme ) :: ht_loc, mixht
130     REAL, DIMENSION( ims:ime, jms:jme ) :: hpbl_hold
131     INTEGER                             :: i, j, istart, iend, jstart, jend
135     INTEGER                             :: ij
136     INTEGER  num_roof_layers
137     INTEGER  num_wall_layers
138     INTEGER  num_road_layers
139     INTEGER  iswater
140     LOGICAL  :: l_flux
141     INTEGER  :: isurban
142     INTEGER  rk_step
143     INTEGER                         :: yr, month, day, hr, minute, sec, rc
144     CHARACTER*80                    :: mesg
146    INTEGER                         :: sids , side , sjds , sjde , skds , skde , &
147                                       sims , sime , sjms , sjme , skms , skme , &
148                                       sips , sipe , sjps , sjpe , skps , skpe
150    CHARACTER (LEN=256) :: mminlu
151    CHARACTER (LEN=1000) :: message
152    LOGICAL    :: do_bioe
154 !  Added flag to use MEGANv2.1 file   BJG 3/28/19
155    LOGICAL   :: do_meganfile
157 #if ( WRF_DFI_RADAR == 1 )
158     INTEGER  do_capsupress   ! =1 do CAP supress, other = don't
159 #endif
161   CALL get_ijk_from_subgrid (  grid ,                   &
162                             sids, side, sjds, sjde, skds, skde,    &
163                             sims, sime, sjms, sjme, skms, skme,    &
164                             sips, sipe, sjps, sjpe, skps, skpe    )
166  ! initialize all tendencies to zero in order to update physics
167  ! tendencies first (separate from dry dynamics).
169    l_flux=.FALSE.
170    if (present(f_flux)) l_flux=f_flux
172     rk_step = 1
174 BENCH_START(init_zero_tend_tim)
175        !$OMP PARALLEL DO   &
176        !$OMP PRIVATE ( ij )
178        DO ij = 1 , grid%num_tiles
180          CALL wrf_debug ( 200 , ' call init_zero_tendency' )
181          CALL init_zero_tendency ( ru_tendf, rv_tendf, rw_tendf,     &
182                                    ph_tendf, t_tendf, tke_tend,      &
183                                    mu_tendf,                         &
184                                    moist_tend,chem_tend,scalar_tend, &
185                                    tracer_tend,num_tracer,           &
186                                    num_moist,num_chem,num_scalar,    &
187                                    rk_step,                          &
188                                    ids, ide, jds, jde, kds, kde,     &
189                                    ims, ime, jms, jme, kms, kme,     &
190                                    grid%i_start(ij), grid%i_end(ij), &
191                                    grid%j_start(ij), grid%j_end(ij), &
192                                    k_start, k_end                   )
194        END DO
195        !$OMP END PARALLEL DO
196 BENCH_END(init_zero_tend_tim)
198 #ifdef DM_PARALLEL
199 #     include "HALO_EM_PHYS_A.inc"
200 #endif
202       !$OMP PARALLEL DO   &
203       !$OMP PRIVATE ( ij )
204       DO ij = 1 , grid%num_tiles
206         CALL wrf_debug ( 200 , ' call phy_prep' )
207         CALL phy_prep ( config_flags,                                    &
208                         grid%mut, grid%muu, grid%muv,                    &
209                         grid%c1h, grid%c2h, grid%c1f, grid%c2f,          &
210                         grid%u_2, grid%v_2, grid%p, grid%pb, grid%alt,   &
211                         grid%ph_2, grid%phb, grid%t_2, moist, num_moist, &
212                         grid%rho,th_phy, grid%th_phy_m_t0,               &
213                         p_phy, pi_phy, grid%u_phy, grid%v_phy,           &
214                         p8w, t_phy, t8w, grid%z, grid%z_at_w, dz8w,      &
215                         grid%p_hyd, grid%p_hyd_w, grid%dnw,              &
216                         grid%fnm, grid%fnp, grid%znw, grid%p_top,        &
217                         ids, ide, jds, jde, kds, kde,                    &
218                         ims, ime, jms, jme, kms, kme,                    &
219                         grid%i_start(ij), grid%i_end(ij),                &
220                         grid%j_start(ij), grid%j_end(ij),                &
221                         k_start, k_end                                   )
222       ENDDO
223       !$OMP END PARALLEL DO
225 BENCH_END(phy_prep_tim)
227 ! radiation
228      CALL domain_clock_get( grid, current_time=currentTime, &
229                             current_timestr=mesg )
230      CALL WRFU_TimeGet( currentTime, YY=yr, dayOfYear=day, H=hr, M=minute, S=sec, rc=rc)
231          IF( rc/= WRFU_SUCCESS)THEN
232          CALL wrf_error_fatal('WRFU_TimeGet failed')
233          ENDIF
235 ! this driver is only needed to handle non-local shadowing effects
236       CALL pre_radiation_driver ( grid, config_flags                           &
237      &        ,itimestep=grid%itimestep, ra_call_offset=grid%ra_call_offset    &
238      &        ,XLAT=grid%xlat, XLONG=grid%xlong, GMT=grid%gmt                  &
239      &        ,julian=grid%julian, xtime=grid%xtime, RADT=grid%radt            &
240      &        ,STEPRA=grid%stepra                                              &
241      &        ,ht=grid%ht,dx=grid%dx,dy=grid%dy                                &
242      &        ,dx2d=grid%dx2d,area2d=grid%area2d                               &
243      &        ,sina=grid%sina,cosa=grid%cosa                                   &
244      &        ,shadowmask=grid%shadowmask,slope_rad=config_flags%slope_rad     &
245      &        ,topo_shading=config_flags%topo_shading                          &
246      &        ,shadlen=config_flags%shadlen,ht_shad=grid%ht_shad,ht_loc=ht_loc &
247      &        ,ht_shad_bxs=grid%ht_shad_bxs, ht_shad_bxe=grid%ht_shad_bxe      &
248      &        ,ht_shad_bys=grid%ht_shad_bys, ht_shad_bye=grid%ht_shad_bye      &
249      &        ,nested=config_flags%nested, min_ptchsz=grid%min_ptchsz          &
250      &        ,spec_bdy_width=config_flags%spec_bdy_width                      &
251             ! indexes
252      &        ,IDS=ids,IDE=ide, JDS=jds,JDE=jde, KDS=kds,KDE=kde               &
253      &        ,IMS=ims,IME=ime, JMS=jms,JME=jme, KMS=kms,KME=kme               &
254      &        ,IPS=ips,IPE=ipe, JPS=jps,JPE=jpe, KPS=kps,KPE=kpe               &
255      &        ,i_start=grid%i_start,i_end=min(grid%i_end, ide-1)               &
256      &        ,j_start=grid%j_start,j_end=min(grid%j_end, jde-1)               &
257      &        ,kts=k_start, kte=min(k_end,kde-1)                               &
258      &        ,num_tiles=grid%num_tiles                                        )
260       CALL wrf_debug ( 200 , ' call radiation_driver' )
261 BENCH_START(rad_driver_tim)
263       CALL radiation_driver(                                                  &
264      &         p_top=grid%p_top & !DJW 140312 added p_top for vertical nesting
265      &        ,ACFRCV=grid%acfrcv      ,ACFRST=grid%acfrst      ,ALBEDO=grid%albedo  &
266      &        ,CFRACH=grid%cfrach      ,CFRACL=grid%cfracl      ,CFRACM=grid%cfracm  &
267      &        ,CUPPT=grid%cuppt        ,CZMEAN=grid%czmean      ,DT=grid%dt          &
268      &        ,DZ8W=dz8w               ,EMISS=grid%emiss        ,GLW=grid%glw        &
269      &        ,GMT=grid%gmt            ,GSW=grid%gsw            ,HBOT=grid%hbot      &
270      &        ,HTOP=grid%htop          ,HBOTR=grid%hbotr        ,HTOPR=grid%htopr    &
271      &        ,ICLOUD=config_flags%icloud                                            &
272      &        ,ITIMESTEP=grid%itimestep,JULDAY=grid%julday      , JULIAN=grid%julian &
273      &        ,JULYR=grid%julyr        ,LW_PHYSICS=config_flags%ra_lw_physics        &
274      &        ,NCFRCV=grid%ncfrcv      ,NCFRST=grid%ncfrst      ,NPHS=1              &
275      &        ,o3input=config_flags%o3input     ,O3rad=grid%o3rad                    &
276      &        ,aer_opt=config_flags%aer_opt ,aerod=aerod(:,:,:,P_ocarbon:P_upperaer) &
277      &        ,swint_opt=config_flags%swint_opt                                      &
278      &        ,solar_opt=config_flags%solar_diagnostics                              &
279      &        ,P8W=grid%p_hyd_w        ,P=grid%p_hyd            ,PI=pi_phy           &
280      &        ,RADT=grid%radt          ,RA_CALL_OFFSET=grid%ra_call_offset           &
281      &        ,RHO=grid%rho            ,RLWTOA=grid%rlwtoa                           &
282      &        ,RSWTOA=grid%rswtoa      ,RTHRATEN=grid%rthraten                       &
283      &        ,RTHRATENLW=grid%rthratenlw       ,RTHRATENSW=grid%rthratensw          &
284      &        ,RTHRATENLWC=grid%rthratenlwc     ,RTHRATENSWC=grid%rthratenswc        &
285      &        ,SNOW=grid%snow          ,STEPRA=grid%stepra      ,SWDOWN=grid%swdown  &
286      &        ,SWDOWNC=grid%swdownc    ,SW_PHYSICS=config_flags%ra_sw_physics        &
287      &        ,T8W=t8w                 ,T=grid%t_phy           ,TAUCLDC=grid%taucldc &
288      &        ,TAUCLDI=grid%taucldi    ,TSK=grid%tsk            ,VEGFRA=grid%vegfra  &
289      &        ,WARM_RAIN=grid%warm_rain ,XICE=grid%xice         ,XLAND=grid%xland    &
290      &        ,XLAT=grid%xlat          ,XLONG=grid%xlong        ,YR=yr               &
291            ! SSiB LSM radiation components (fds 06/2010)
292      &        ,ALSWVISDIR=grid%alswvisdir ,ALSWVISDIF=grid%alswvisdif      &  !ssib 
293      &        ,ALSWNIRDIR=grid%alswnirdir ,ALSWNIRDIF=grid%alswnirdif      &  !ssib
294      &        ,SWVISDIR=grid%swvisdir ,SWVISDIF=grid%swvisdif              &  !ssib
295      &        ,SWNIRDIR=grid%swnirdir ,SWNIRDIF=grid%swnirdif              &  !ssib
296      &        ,SF_SURFACE_PHYSICS=config_flags%sf_surface_physics          &  !ssib
297 ! WRF-solar and aerosol variables from jararias 2013/8 and 2013/11
298      &       ,SWDDIR=grid%swddir,SWDDNI=grid%swddni,SWDDIF=grid%swddif                              & 
299      &       ,SWDDIRC=grid%swddirc, SWDDNIC=grid%swddnic                                            &
300      &       ,Gx=grid%Gx,Bx=grid%Bx,gg=grid%gg,bb=grid%bb                                           &
301      &       ,swdown_ref=grid%swdown_ref,swddir_ref=grid%swddir_ref                                 &
302      &       ,coszen_ref=grid%coszen_ref                                                            &
303      &       ,aer_type=config_flags%aer_type                                                        &
304      &       ,aer_aod550_opt=config_flags%aer_aod550_opt,aer_aod550_val=config_flags%aer_aod550_val &
305      &       ,aer_angexp_opt=config_flags%aer_angexp_opt,aer_angexp_val=config_flags%aer_angexp_val &
306      &       ,aer_ssa_opt=config_flags%aer_ssa_opt,aer_ssa_val=config_flags%aer_ssa_val             &
307      &       ,aer_asy_opt=config_flags%aer_asy_opt,aer_asy_val=config_flags%aer_asy_val             &
308      &       ,aod5502d=grid%aod5502d,angexp2d=grid%angexp2d,aerssa2d=grid%aerssa2d                  &
309      &       ,aerasy2d=grid%aerasy2d,aod5503d=grid%aod5503d                                         &
310      &       ,taod5502d=grid%taod5502d,taod5503d=grid%taod5503d                                     & ! Trude
311 !Optional solar variables
312      &        ,DECLINX=grid%declin ,SOLCONX=grid%solcon ,COSZEN=grid%coszen ,HRANG=grid%hrang    &
313      &        , CEN_LAT=grid%cen_lat                                      &
314      &        ,Z=grid%z                                                   &
315      &        ,ALEVSIZ=grid%alevsiz, no_src_types=grid%no_src_types       &
316      &        ,LEVSIZ=grid%levsiz, N_OZMIXM=num_ozmixm                    &
317      &        ,N_AEROSOLC=num_aerosolc                                    &
318      &        ,PAERLEV=grid%paerlev   ,ID=grid%id                         &
319      &        ,CAM_ABS_DIM1=grid%cam_abs_dim1, CAM_ABS_DIM2=grid%cam_abs_dim2 &
320      &        ,CAM_ABS_FREQ_S=grid%cam_abs_freq_s                         &
321      &        ,XTIME=grid%xtime                                           &
322               ,CURR_SECS=curr_secs, ADAPT_STEP_FLAG=adapt_step_flag       &
323 #if ( EM_CORE == 1)
324      &        ,swdown2=grid%swdown2, swddni2=grid%swddni2                 & ! FARMS coupling
325      &        ,swddif2=grid%swddif2, swddir2=grid%swddir2                 & ! FARMS coupling
326      &        ,swdownc2=grid%swdownc2, swddnic2=grid%swddnic2             & ! FARMS coupling
327      &        ,couple_farms=config_flags%couple_farms                     &
328 #endif
329 ! WRF-Solar EPS: FARMS
330      &       ,multi_perturb=config_flags% multi_perturb                   & 
331      &       ,pert_farms=config_flags%pert_farms                          & 
332      &       ,perts_albedo=grid%pert3d(:,:,:,P_PALBEDO)                   &
333      &       ,perts_aod=grid%pert3d(:,:,:,P_PAOD)                         &
334      &       ,perts_angstrom=grid%pert3d(:,:,:,P_PANGSTROM)               &
335      &       ,perts_assymfac=grid%pert3d(:,:,:,P_PASSYMFAC)               &
336      &       ,perts_qvapor=grid%pert3d(:,:,:,P_PQVAPOR)                   &
337      &       ,perts_qcloud=grid%pert3d(:,:,:,P_PQCLOUD)                   &
338      &       ,perts_qsnow=grid%pert3d(:,:,:,P_PQSNOW)                     &
339      &       ,pert_farms_albedo=config_flags%pert_farms_albedo            &
340      &       ,pert_farms_aod=config_flags%pert_farms_aod                  &
341      &       ,pert_farms_angexp=config_flags%pert_farms_angexp            &
342      &       ,pert_farms_aerasy=config_flags%pert_farms_aerasy            &
343      &       ,pert_farms_qv=config_flags%pert_farms_qv                    &
344      &       ,pert_farms_qc=config_flags%pert_farms_qc                    &
345      &       ,pert_farms_qs=config_flags%pert_farms_qs                    &
346 ! WRF-Solar EPS: cld3
347      &       ,pert_cld3=config_flags%pert_cld3                            &
348      &       ,perts_th=grid%pert3d(:,:,:,P_PTH)                             &
349      &       ,pert_cld3_qv=config_flags%pert_cld3_qv                      &
350      &       ,pert_cld3_t=config_flags%pert_cld3_t                        &
351 !BSINGH - For WRFCuP scheme
352      &        ,CU_PHYSICS=config_flags%cu_physics                         & !CuP, wig 5-Oct-2006
353      &        ,SHALLOWCU_FORCED_RA=config_flags%shallowcu_forced_ra       & !CuP, wig
354      &        ,CUBOT=grid%cubot, CUTOP=grid%cutop                         & !CuP, wig 9-Oct-2006
355      &        ,CLDFRA_CUP=grid%cldfra_cup                                 & !CuP, wig 1-Oct-2006
356      &        ,SHALL=grid%shall                                           & !CuP, wig 4-Feb-2008
357 !BSINGH - ENDS
358             ! indexes
359      &        ,IDS=ids,IDE=ide, JDS=jds,JDE=jde, KDS=kds,KDE=kde          &
360      &        ,IMS=ims,IME=ime, JMS=jms,JME=jme, KMS=kms,KME=kme          &
361      &        ,i_start=grid%i_start,i_end=min(grid%i_end, ide-1)          &
362      &        ,j_start=grid%j_start,j_end=min(grid%j_end, jde-1)          &
363      &        ,kts=k_start, kte=min(k_end,kde-1)                          &
364      &        ,num_tiles=grid%num_tiles                                   &
365             ! Optional
366 !JJS 20101020 vvvvv
367 #if ( WRF_CHEM == 1)
368      &        , CHEM=chem                                                 &
369      &        , AOD_OUT=grid%aod_out                                      &
370      &        , AOD2D_OUT=grid%aod2d_out                                  &  !goddardrad
371      &        , ATOP2D_OUT=grid%atop2d_out                                &  !goddardrad
372      &        , CHEM_OPT=config_flags%chem_opt                            &
373      &        , GSFCRAD_GOCART_COUPLING=config_flags%gsfcrad_gocart_coupling &
374 #endif
375      &        , TLWDN=grid%tlwdn, TLWUP=grid%tlwup                        & ! goddard schemes
376      &        , SLWDN=grid%slwdn, SLWUP=grid%slwup                        & ! goddard schemes
377      &        , TSWDN=grid%tswdn, TSWUP=grid%tswup                        & ! goddard schemes
378      &        , SSWDN=grid%sswdn, SSWUP=grid%sswup                        & ! goddard schemes
379      &        , RE_CLOUD_GSFC=grid%re_cloud_gsfc                          & ! goddard schemes
380      &        , RE_RAIN_GSFC=grid%re_rain_gsfc                            & ! goddard schemes
381      &        , RE_ICE_GSFC=grid%re_ice_gsfc                              & ! goddard schemes
382      &        , RE_SNOW_GSFC=grid%re_snow_gsfc                            & ! goddard schemes
383      &        , RE_GRAUPEL_GSFC=grid%re_graupel_gsfc                      & ! goddard schemes
384      &        , RE_HAIL_GSFC=grid%re_hail_gsfc                            & ! goddard schemes
385      &        , COD2D_OUT=grid%cod2d_out                                  & ! goddardrad
386      &        , CTOP2D_OUT=grid%ctop2d_out                                & ! goddardrad
387 !JJS 20101020 ^^^^^
388 !ZCX+ cloud fraction for CLWRF
389      &        , CLDT=grid%cldt, ZNU=grid%znu                              &
390 !ZCX-
391      &        , CLDFRA=grid%cldfra, CLDFRA_MP_ALL=grid%cldfra_mp_all      &
392      &        , CCLDFRA=grid%ccldfra                                      &
393      &        , QCCONV=grid%qcconv, QICONV=grid%qiconv                    &
394      &        , BMJ_RAD_FEEDBACK=config_flags%bmj_rad_feedback            &
395      &        , LRADIUS=grid%LRADIUS,IRADIUS=grid%IRADIUS                 & !BSINGH(01/22/2014)
396      &        , CLDFRA_DP=grid%cldfra_dp                                  & ! ckay for subgrid cloud
397      &        , CLDFRA_SH=grid%cldfra_sh                                  &
398      &        , icloud_bl=config_flags%icloud_bl                          &
399      &        , cldovrlp=config_flags%cldovrlp                            &
400      &        , idcor=config_flags%idcor                                  &
401      &        , qc_bl=grid%qc_bl,qi_bl=grid%qi_bl,cldfra_bl=grid%cldfra_bl&
402      &        , re_cloud=grid%re_cloud, re_ice=grid%re_ice, re_snow=grid%re_snow & ! G. Thompson
403      &        , has_reqc=grid%has_reqc, has_reqi=grid%has_reqi, has_reqs=grid%has_reqs & ! G. Thompson
404      &        , PB=grid%pb                                                &
405      &        , F_ICE_PHY=grid%f_ice_phy,F_RAIN_PHY=grid%f_rain_phy       &
406      &        , F_QNC=F_QNC                                               &
407      &        , QNC_CURR=scalar(ims,kms,jms,P_QNC)                        &
408      &        , QV=moist(ims,kms,jms,P_QV), F_QV=F_QV                     &
409      &        , QC=moist(ims,kms,jms,P_QC), F_QC=F_QC                     &
410      &        , QR=moist(ims,kms,jms,P_QR), F_QR=F_QR                     &
411      &        , QI=moist(ims,kms,jms,P_QI), F_QI=F_QI                     &
412      &        , QI2=moist(ims,kms,jms,P_QI2), F_QI2=F_QI2                 & ! for P3
413      &        , QI3=moist(ims,kms,jms,P_QI3), F_QI3=F_QI3                 & ! for Jensen ISHMAEL
414      &        , QS=moist(ims,kms,jms,P_QS), F_QS=F_QS                     &
415      &        , QG=moist(ims,kms,jms,P_QG), F_QG=F_QG                     &
416      &        , QH=moist(ims,kms,jms,P_QH), F_QH=F_QH                     & ! goddardrad
417      &        , QNDROP=scalar(ims,kms,jms,P_QNDROP), F_QNDROP=F_QNDROP    &
418      &        ,QNIFA=scalar(ims,kms,jms,P_QNIFA),F_QNIFA=F_QNIFA          & !Trude
419      &        ,QNWFA=scalar(ims,kms,jms,P_QNWFA),F_QNWFA=F_QNWFA          & !Trude
420      &        ,QNBCA=scalar(ims,kms,jms,P_QNBCA)                          &
421      &        ,wif_input_opt=config_flags%wif_input_opt                   &
422      &        ,qc_tot=grid%qc_tot, qi_tot=grid%qi_tot                     & ! Solar diag
423      &        ,ACSWUPT=grid%acswupt    ,ACSWUPTC=grid%acswuptc            &
424      &        ,ACSWDNT=grid%acswdnt    ,ACSWDNTC=grid%acswdntc            &
425      &        ,ACSWUPB=grid%acswupb    ,ACSWUPBC=grid%acswupbc            &
426      &        ,ACSWDNB=grid%acswdnb    ,ACSWDNBC=grid%acswdnbc            &
427      &        ,ACLWUPT=grid%aclwupt    ,ACLWUPTC=grid%aclwuptc            &
428      &        ,ACLWDNT=grid%aclwdnt    ,ACLWDNTC=grid%aclwdntc            &
429      &        ,ACLWUPB=grid%aclwupb    ,ACLWUPBC=grid%aclwupbc            &
430      &        ,ACLWDNB=grid%aclwdnb    ,ACLWDNBC=grid%aclwdnbc            &
431      &        ,SWUPT=grid%swupt,SWUPTC=grid%swuptc,SWUPTCLN=grid%swuptcln &
432      &        ,SWDNT=grid%swdnt,SWDNTC=grid%swdntc,SWDNTCLN=grid%swdntcln &
433      &        ,SWUPB=grid%swupb,SWUPBC=grid%swupbc,SWUPBCLN=grid%swupbcln &
434      &        ,SWDNB=grid%swdnb,SWDNBC=grid%swdnbc,SWDNBCLN=grid%swdnbcln &
435      &        ,LWUPT=grid%lwupt,LWUPTC=grid%lwuptc,LWUPTCLN=grid%lwuptcln &
436      &        ,LWDNT=grid%lwdnt,LWDNTC=grid%lwdntc,LWDNTCLN=grid%lwdntcln &
437      &        ,LWUPB=grid%lwupb,LWUPBC=grid%lwupbc,LWUPBCLN=grid%lwupbcln &
438      &        ,LWDNB=grid%lwdnb,LWDNBC=grid%lwdnbc,LWDNBCLN=grid%lwdnbcln &
439      &        ,LWCF=grid%lwcf                                                  &
440      &        ,SWCF=grid%swcf                                                  &
441      &        ,OLR=grid%olr                                                    &
442      &        ,AERODM=grid%aerodm, PINA=grid%pina, AODTOT=grid%aodtot          &
443      &        ,OZMIXM=grid%ozmixm, PIN=grid%pin                                &
444      &        ,M_PS_1=grid%m_ps_1, M_PS_2=grid%m_ps_2, AEROSOLC_1=grid%aerosolc_1        &
445      &        ,AEROSOLC_2=grid%aerosolc_2, M_HYBI0=grid%m_hybi                      &
446      &        ,ABSTOT=grid%abstot, ABSNXT=grid%absnxt, EMSTOT=grid%emstot                &
447      &        ,RADTACTTIME=grid%radtacttime                                         &  
448      &        ,ICLOUD_CU=config_flags%ICLOUD_CU                            &
449      &        ,QC_CU=grid%QC_CU , QI_CU=grid%QI_CU                         &
450      &        ,CALC_CLEAN_ATM_DIAG=config_flags%calc_clean_atm_diag                  &
451 #if (WRF_CHEM == 1)
452      &        ,AER_RA_FEEDBACK=config_flags%aer_ra_feedback                &
453      &        ,PM2_5_DRY=grid%pm2_5_dry, PM2_5_WATER=grid%pm2_5_water               &
454      &        ,PM2_5_DRY_EC=grid%pm2_5_dry_ec                                  &
455      &        ,TAUAER300=grid%tauaer1, TAUAER400=grid%tauaer2 & ! jcb
456      &        ,TAUAER600=grid%tauaer3, TAUAER999=grid%tauaer4 & ! jcb
457      &        ,GAER300=grid%gaer1, GAER400=grid%gaer2, GAER600=grid%gaer3, GAER999=grid%gaer4 & ! jcb
458      &        ,WAER300=grid%waer1, WAER400=grid%waer2, WAER600=grid%waer3, WAER999=grid%waer4 & ! jcb
459      &        ,TAUAERlw1  =grid%tauaerlw1,  TAUAERlw2=grid%tauaerlw2    & 
460      &        ,TAUAERlw3  =grid%tauaerlw3,  TAUAERlw4=grid%tauaerlw4    & 
461      &        ,TAUAERlw5  =grid%tauaerlw5,  TAUAERlw6=grid%tauaerlw6    & 
462      &        ,TAUAERlw7  =grid%tauaerlw7,  TAUAERlw8=grid%tauaerlw8    & 
463      &        ,TAUAERlw9  =grid%tauaerlw9,  TAUAERlw10=grid%tauaerlw10    & 
464      &        ,TAUAERlw11 =grid%tauaerlw11, TAUAERlw12=grid%tauaerlw12    & 
465      &        ,TAUAERlw13 =grid%tauaerlw13, TAUAERlw14=grid%tauaerlw14    & 
466      &        ,TAUAERlw15 =grid%tauaerlw15, TAUAERlw16=grid%tauaerlw16   & 
467      &        ,progn=config_flags%progn                                            &
468 #endif
469      &         ,slope_rad=config_flags%slope_rad,topo_shading=config_flags%topo_shading     &
470      &         ,shadowmask=grid%shadowmask,ghg_input=config_flags%ghg_input   &
471      &         ,ht=grid%ht,dx=grid%dx,dy=grid%dy,dx2d=grid%dx2d,area2d=grid%area2d &           
472      &         ,diffuse_frac=grid%diffuse_frac &  
473      &         ,obscur=grid%ECOBSC, mask=grid%ECMASK                       &
474      &         ,elat_track=grid%elat_track,elon_track=grid%elon_track      &
475      &         ,SW_ECLIPSE=config_flags%ra_sw_eclipse                      &         
476      &         ,IS_CAMMGMP_USED = grid%is_CAMMGMP_used    &
477      &         ,cw_rad=grid%cw_rad                     &
478      &         ,shcu_physics=config_flags%shcu_physics                     &
479      &         ,MP_PHYSICS=CONFIG_FLAGS%MP_PHYSICS        &
480      &         ,EFCG=grid%EFCG,EFCS=grid%EFCS,EFIG=grid%EFIG &
481      &         ,EFIS=grid%EFIS,EFSG=grid%EFSG,aercu_opt=config_flags%aercu_opt & 
482      &         ,EFSS=grid%EFSS,QS_CU=grid%QS_CU &
483      &         ,feedback_is_ready=feedback_is_ready   &
484 #if ( WRF_CMAQ == 1)
485      &         ,mass_ws_i=grid%mass_ws_i              &
486      &         ,mass_ws_j=grid%mass_ws_j              &
487      &         ,mass_ws_k=grid%mass_ws_k              &
488      &         ,mass_in_i=grid%mass_in_i              &
489      &         ,mass_in_j=grid%mass_in_j              &
490      &         ,mass_in_k=grid%mass_in_k              &
491      &         ,mass_ec_i=grid%mass_ec_i              &
492      &         ,mass_ec_j=grid%mass_ec_j              &
493      &         ,mass_ec_k=grid%mass_ec_k              &
494      &         ,mass_ss_i=grid%mass_ss_i              &
495      &         ,mass_ss_j=grid%mass_ss_j              &
496      &         ,mass_ss_k=grid%mass_ss_k              &
497      &         ,mass_h2o_i=grid%mass_h2o_i            &
498      &         ,mass_h2o_j=grid%mass_h2o_j            &
499      &         ,mass_h2o_k=grid%mass_h2o_k            &
500      &         ,dgn_i=grid%dgn_i                      &
501      &         ,dgn_j=grid%dgn_j                      &
502      &         ,dgn_k=grid%dgn_k                      &
503      &         ,sig_i=grid%sig_i                      &
504      &         ,sig_j=grid%sig_j                      &
505      &         ,sig_k=grid%sig_k                      &
506      &         ,sw_gtauxar_01=grid%sw_gtauxar_01      &
507      &         ,sw_gtauxar_02=grid%sw_gtauxar_02      &
508      &         ,sw_gtauxar_03=grid%sw_gtauxar_03      &
509      &         ,sw_gtauxar_04=grid%sw_gtauxar_04      &
510      &         ,sw_gtauxar_05=grid%sw_gtauxar_05      &
511      &         ,sw_ttauxar_01=grid%sw_ttauxar_01      &
512      &         ,sw_ttauxar_02=grid%sw_ttauxar_02      &
513      &         ,sw_ttauxar_03=grid%sw_ttauxar_03      &
514      &         ,sw_ttauxar_04=grid%sw_ttauxar_04      &
515      &         ,sw_ttauxar_05=grid%sw_ttauxar_05      &
516      &         ,sw_asy_fac_01=grid%sw_asy_fac_01      &
517      &         ,sw_asy_fac_02=grid%sw_asy_fac_02      &
518      &         ,sw_asy_fac_03=grid%sw_asy_fac_03      &
519      &         ,sw_asy_fac_04=grid%sw_asy_fac_04      &
520      &         ,sw_asy_fac_05=grid%sw_asy_fac_05      &
521      &         ,sw_ssa_01=grid%sw_ssa_01              &
522      &         ,sw_ssa_02=grid%sw_ssa_02              &
523      &         ,sw_ssa_03=grid%sw_ssa_03              &
524      &         ,sw_ssa_04=grid%sw_ssa_04              &
525      &         ,sw_ssa_05=grid%sw_ssa_05              &
526      &         ,ozone=grid%ozone                      &
527      &         ,sw_zbbcddir=grid%sw_zbbcddir          &
528      &         ,sw_dirdflux=grid%sw_dirdflux          &
529      &         ,sw_difdflux=grid%sw_difdflux          &
530 #endif
531                                                       )
533 BENCH_END(rad_driver_tim)
535 !********* Surface driver
536 ! surface
538 BENCH_START(surf_driver_tim)
540 !gmm halo of wtd and riverflow for leafhydro
541 #ifdef DM_PARALLEL
542   IF ( ( config_flags%sf_surface_physics.eq.NOAHMPSCHEME ) .and. ( config_flags%opt_run.eq.5 ) ) THEN
543        IF ( mod(grid%itimestep,grid%STEPWTD).eq.0 )  THEN
544 #     include "HALO_EM_HYDRO_NOAHMP.inc"
545        ENDIF
546   ENDIF
547 #endif
549 !-----------------------------------------------------------------
550 ! urban related variable are added to arguments of surface_driver
551 !-----------------------------------------------------------------
552       num_roof_layers = grid%num_soil_layers !urban
553       num_wall_layers = grid%num_soil_layers !urban
554       num_road_layers = grid%num_soil_layers !urban
555       CALL nl_get_iswater(grid%id, iswater)
556       CALL nl_get_isurban(grid%id, isurban)
557       call nl_get_mminlu(grid%id, mminlu)
559 #ifdef DM_PARALLEL
560 #     include "HALO_PWP.inc"
561 #endif
563       CALL wrf_debug ( 200 , ' call surface_driver' )
565       if( grid%num_nests .lt. 1 )then
566           HYDRO_dt = 0
567       else
568           HYDRO_dt = -1
569       endif
571 !  Ensure WRF_Chem is compiled if bio_emiss_opt is tested, and add flag to read MEGANv2.1
572 !  file if bio_emiss_opt is set properly (even if chem_opt == 0).  
573 !  Also explicitly set do_bioe to .false. if chem_opt <= 0.   BJG 3/28/19
574 #if( WRF_USE_CLM == 1) && (WRF_CHEM == 1)
575       if( config_flags%bio_emiss_opt == MEGAN2_CLM ) then
576         do_meganfile = .true.
577         if(config_flags%chem_opt > 0) then !czhao +++++
578           do_bioe = grid%itimestep == 1 .or. mod( grid%itimestep,grid%stepbioe ) == 0
579         else
580           do_bioe = .false.
581         endif
582       else
583         do_bioe = .false.
584         do_meganfile = .false.
585       endif !czhao-----
586 #else
587       do_bioe = .false.
588       do_meganfile = .false.
589 #endif
593       CALL surface_driver(                                                &
594      &        HYDRO_dt=HYDRO_dt,  sfcheadrt=grid%sfcheadrt,               &
595      &        INFXSRT=grid%INFXSRT,  soldrain=grid%soldrain,              &
596      &        qtiledrain=grid%qtiledrain,ZWATBLE2D=grid%ZWATBLE2D,        & ! tile drainage for WRF-Hydro
597      &         ACGRDFLX=grid%acgrdflx  ,ACHFX=grid%achfx        ,ACLHF=grid%aclhf        &
598      &        ,ACSNOM=grid%acsnom      ,ACSNOW=grid%acsnow      ,AKHS=grid%akhs          &
599      &        ,AKMS=grid%akms          ,ALBBCK=grid%albbck      ,ALBEDO=grid%albedo      &
600      &        ,EMBCK=grid%embck                                                          &
601      &        ,BR=grid%br              ,CANWAT=grid%canwat      ,CHKLOWQ=chklowq    &
602      &        ,CT=grid%ct              ,DT=grid%dt         ,DX=grid%dx              &
603      &        ,DX2D=grid%dx2d          ,AREA2d=grid%area2d                          &
604      &        ,DZ8W=dz8w          ,DZS=grid%dzs            ,FLHC=grid%flhc          &
605      &        ,FM=grid%fm         ,FHH=grid%fh                                      &
606      &        ,FLQC=grid%flqc          ,GLW=grid%glw            ,GRDFLX=grid%grdflx      &
607      &        ,GSW=grid%gsw    ,SWDOWN=grid%swdown        ,GZ1OZ0=gz1oz0      ,HFX=grid%hfx              &
608      &        ,HT=grid%ht              ,IFSNOW=config_flags%ifsnow      ,ISFFLX=config_flags%isfflx      &
609      &        ,FRACTIONAL_SEAICE=config_flags%fractional_seaice           &
610      &        ,SEAICE_ALBEDO_OPT=config_flags%seaice_albedo_opt           &
611      &        ,SEAICE_ALBEDO_DEFAULT=config_flags%seaice_albedo_default   &
612      &        ,SEAICE_THICKNESS_OPT=config_flags%seaice_thickness_opt     &
613      &        ,SEAICE_THICKNESS_DEFAULT=config_flags%seaice_thickness_default     &
614      &        ,SEAICE_SNOWDEPTH_OPT=config_flags%seaice_snowdepth_opt     &
615      &        ,SEAICE_SNOWDEPTH_MAX=config_flags%seaice_snowdepth_max     &
616      &        ,SEAICE_SNOWDEPTH_MIN=config_flags%seaice_snowdepth_min     &
617      &        ,TICE2TSK_IF2COLD=config_flags%tice2tsk_if2cold             &
618      &        ,IFNDALBSI=grid%ifndalbsi, IFNDICEDEPTH=grid%ifndicedepth   &
619 #if ( WRF_CHEM == 1 )
620               ,NE_AREA=grid%ne_area,E_BIO=grid%e_bio &
621 #endif
622               ,IFNDSNOWSI=grid%ifndsnowsi, DO_BIOE=do_bioe, DO_MEGANFILE=do_meganfile          &
623      &        ,ISLTYP=grid%isltyp      ,ITIMESTEP=grid%itimestep, JULIAN_IN=grid%julian                  &
624      &        ,IRRIGATION=grid%irrigation,SF_SURF_IRR_SCHEME=config_flags%sf_surf_irr_scheme  & 
625      &        ,IRR_DAILY_AMOUNT=config_flags%irr_daily_amount                                                & 
626      &        ,IRR_START_HOUR=config_flags%irr_start_hour,IRR_NUM_HOURS=config_flags%irr_num_hours           &
627      &        ,IRR_START_JULIANDAY=config_flags%irr_start_julianday                                          &
628      &        ,IRR_END_JULIANDAY=config_flags%irr_end_julianday                                              &
629      &        ,IRR_FREQ=config_flags%irr_freq,IRR_PH=config_flags%irr_ph,IRR_RAND_FIELD=grid%irr_rand_field  & 
630      &        ,IVGTYP=grid%ivgtyp      ,LH=grid%lh              ,LOWLYR=grid%lowlyr      &
631      &        ,MAVAIL=grid%mavail      ,NUM_SOIL_LAYERS=config_flags%num_soil_layers        &
632      &        ,P8W=grid%p_hyd_w            ,PBLH=grid%pblh          ,PI_PHY=pi_phy      &
633      &        ,PSFC=grid%psfc          ,PSHLTR=grid%pshltr      ,PSIH=psih          &
634      &        ,BLDT=grid%bldt     ,CURR_SECS=curr_secs, ADAPT_STEP_FLAG=adapt_step_flag  &
635      &        ,BLDTACTTIME=grid%bldtacttime                                              & 
636      &        ,PSIM=psim          ,P_PHY=grid%p_hyd        ,Q10=grid%q10            &
637      &        ,Q2=grid%q2              ,QFX=grid%qfx            ,QSFC=grid%qsfc          &
638      &        ,QSHLTR=grid%qshltr      ,QZ0=grid%qz0            ,RAINCV=grid%raincv      &
639      &        ,RA_LW_PHYSICS=config_flags%ra_lw_physics         ,RHO=grid%rho            &
640      &        ,RMOL=grid%rmol          ,SFCEVP=grid%sfcevp      ,SFCEXC=grid%sfcexc      &
641      &        ,SFCRUNOFF=grid%sfcrunoff,ACRUNOFF=grid%ACRUNOFF                           &
642      &        ,opt_thcnd=config_flags%opt_thcnd                                          &
643      &        ,SF_SFCLAY_PHYSICS=config_flags%sf_sfclay_physics                        &
644      &        ,BL_PBL_PHYSICS=config_flags%bl_pbl_physics                              &
645      &        ,SF_SURFACE_PHYSICS=config_flags%sf_surface_physics  ,SH2O=grid%sh2o          &
646      &        ,SHDMAX=grid%shdmax      ,SHDMIN=grid%shdmin      ,SMOIS=grid%smois        &
647      &        ,SMSTAV=grid%smstav      ,SMSTOT=grid%smstot      ,SNOALB=grid%snoalb      &
648      &        ,SNOW=grid%snow          ,SNOWC=grid%snowc        ,SNOWH=grid%snowh        &
649      &        ,SMCREL=grid%smcrel                                                        &
650      &        ,SST=grid%sst            ,SST_INPUT=grid%sst_input,SST_UPDATE=grid%sst_update                  &
651      &        ,SSTSK=grid%sstsk        ,DTW=grid%dtw            ,SST_SKIN=grid%sst_skin  &
652      &        ,SCM_FORCE_SKINTEMP=grid%scm_force_skintemp                                &
653      &        ,SCM_FORCE_FLUX=grid%scm_force_flux                                        &
654      &        ,STEPBL=grid%stepbl      ,TH10=grid%th10          ,TH2=grid%th2            &
655      &        ,THZ0=grid%thz0          ,TH_PHY=th_phy      ,TKE_PBL=grid%tke_pbl    &
656      &        ,TMN=grid%tmn            ,TSHLTR=grid%tshltr      ,TSK=grid%tsk            &
657      &        ,TYR=grid%tyr            ,TYRA=grid%tyra          ,TDLY=grid%tdly          &
658      &        ,TLAG=grid%tlag          ,LAGDAY=config_flags%lagday      ,NYEAR=grid%nyear        &
659      &        ,NDAY=grid%nday          ,TMN_UPDATE=grid%tmn_update      ,YR=yr            &
660      &        ,TSLB=grid%tslb          ,T_PHY=t_phy        ,U10=grid%u10            &
661      &        ,URATX=grid%uratx        ,VRATX=grid%vratx   ,TRATX=grid%tratx        &
662      &        ,UDRUNOFF=grid%udrunoff  ,UST=grid%ust       ,UZ0=grid%uz0            &
663      &        ,U_FRAME=grid%u_frame    ,U_PHY=grid%u_phy   ,V10=grid%v10            &
664      &        ,U10E=grid%u10e          ,V10E=grid%v10e                              &
665      &        ,UOCE=grid%uoce          ,VOCE=grid%voce                              &
666      &        ,VEGFRA=grid%vegfra      ,VZ0=grid%vz0       ,V_FRAME=grid%v_frame    &
667      &        ,V_PHY=grid%v_phy        ,WARM_RAIN=grid%warm_rain                    &
668      &        ,WSPD=grid%wspd          ,XICE=grid%xice     ,XLAND=grid%xland        &
669      &        ,MAX_EDOM=grid%num_ext_model_couple_dom      ,CPLMASK=grid%cplmask    &
670      &        ,Z0=grid%z0              ,Z=grid%z        ,ZNT=grid%znt               &
671      &        ,ZS=grid%zs              ,ALBSI=grid%albsi , ICEDEPTH=grid%icedepth   &
672      &        ,SNOWSI=grid%snowsi                                                   &
673      &        ,XICEM=grid%xicem   ,ISICE=grid%landuse_isice                         &
674      &        ,USTM=grid%ustm          ,CK=grid%ck         ,CKA=grid%cka            &
675      &                                 ,CD=grid%cd         ,CDA=grid%cda            &
676      &        ,ISFTCFLX=config_flags%isftcflx, IZ0TLND=config_flags%iz0tlnd         &
677      &        ,SF_OCEAN_PHYSICS=config_flags%sf_ocean_physics                       &
678      &        ,OML_HML0=config_flags%oml_hml0 ,OML_GAMMA=config_flags%oml_gamma     &
679      &        ,TML=grid%tml, T0ML=grid%t0ml, HML=grid%hml, H0ML=grid%h0ml           &
680      &        ,HUML=grid%huml, HVML=grid%hvml, F=grid%f                             &
681      &        ,TMOML=grid%TMOML,ISWATER=iswater                                     &
682      &        ,OML_RELAXATION_TIME=grid%OML_RELAXATION_TIME                         &
683      &        ,shalwater_z0=config_flags%shalwater_z0                               &
684      &        ,water_depth=grid%water_depth                                         & 
685      &        ,shalwater_depth=config_flags%shalwater_depth                         & 
686      &        ,lakedepth2d=grid%lakedepth2d,    savedtke12d=grid%savedtke12d        &   
687      &        ,snowdp2d=grid%snowdp2d,          h2osno2d=grid%h2osno2d              & !lake
688      &        ,snl2d=grid%snl2d,                t_grnd2d=grid%t_grnd2d              &   
689      &        ,t_lake3d=grid%t_lake3d,          lake_icefrac3d=grid%lake_icefrac3d  & !lake  
690      &        ,z_lake3d=grid%z_lake3d,          dz_lake3d=grid%dz_lake3d            &   
691      &        ,t_soisno3d=grid%t_soisno3d,      h2osoi_ice3d=grid%h2osoi_ice3d      & !lake
692      &        ,h2osoi_liq3d=grid%h2osoi_liq3d,  h2osoi_vol3d=grid%h2osoi_vol3d      &   
693      &        ,z3d=grid%z3d,                    dz3d=grid%dz3d                      & !lake
694      &        ,zi3d=grid%zi3d,                  watsat3d=grid%watsat3d              &   
695      &        ,csol3d=grid%csol3d,              tkmg3d=grid%tkmg3d                  & !lake     
696      &        ,tkdry3d=grid%tkdry3d,            tksatu3d=grid%tksatu3d              &   
697      &        ,LakeModel=grid%sf_lake_physics,  lake_min_elev=grid%lake_min_elev    & !lake  
698 #if ( EM_CORE == 1)
699      &        ,LakeMask=grid%LakeMask                                               & !lake
700      &        ,restart_flag=restart_flag                                            & !flag showing if is a restart timestep
701 #endif
702 ! CLM Varaibles
703      &        ,NUMC=grid%numc,NUMP=grid%nump,SABV=grid%sabv,SABG=grid%sabg,         &
704      &         LWUP=grid%lwup,SNL=grid%snl,                                         &
705      &         HISTORY_INTERVAL=config_flags%history_interval ,                     & !ylu add hist inverval for accumulation T max/min
706      &         SNOWDP=grid%snowdp, WTC=grid%wtc,WTP=grid%wtp, H2OSNO=grid%h2osno,   &
707      &         T_GRND=grid%t_grnd,T_VEG=grid%t_veg,                                 &
708      &         H2OCAN=grid%h2ocan, H2OCAN_COL=grid%h2ocan_col,T2M_MAX=grid%t2m_max, &
709      &         T2M_MIN=grid%t2m_min,T2CLM=grid%t2clm,                               &
710      &         T_REF2M=grid%t_ref2m,H2OSOI_LIQ_S1=grid%h2osoi_liq_s1,               &
711      &         H2OSOI_LIQ_S2=grid%h2osoi_liq_s2,                                    &
712      &         H2OSOI_LIQ_S3=grid%h2osoi_liq_s3,H2OSOI_LIQ_S4=grid%h2osoi_liq_s4,   &
713      &         H2OSOI_LIQ_S5=grid%h2osoi_liq_s5,                                    &
714      &         H2OSOI_LIQ1=grid%h2osoi_liq1,H2OSOI_LIQ2=grid%h2osoi_liq2,           &
715      &         H2OSOI_LIQ3=grid%h2osoi_liq3,H2OSOI_LIQ4=grid%h2osoi_liq4,           &
716      &         H2OSOI_LIQ5=grid%h2osoi_liq5,H2OSOI_LIQ6=grid%h2osoi_liq6,           &
717      &         H2OSOI_LIQ7=grid%h2osoi_liq7,H2OSOI_LIQ8=grid%h2osoi_liq8,           &
718      &         H2OSOI_LIQ9=grid%h2osoi_liq9, H2OSOI_LIQ10=grid%h2osoi_liq10,        &
719      &         H2OSOI_ICE_S1=grid%h2osoi_ice_s1,H2OSOI_ICE_S2=grid%h2osoi_ice_s2,   &
720      &         H2OSOI_ICE_S3=grid%h2osoi_ice_s3, H2OSOI_ICE_S4=grid%h2osoi_ice_s4,  &
721      &         H2OSOI_ICE_S5=grid%h2osoi_ice_s5,                                    &
722      &         H2OSOI_ICE1=grid%h2osoi_ice1, H2OSOI_ICE2=grid%h2osoi_ice2,          &
723      &         H2OSOI_ICE3=grid%h2osoi_ice3,H2OSOI_ICE4=grid%h2osoi_ice4,           &
724      &         H2OSOI_ICE5=grid%h2osoi_ice5, H2OSOI_ICE6=grid%h2osoi_ice6,          &
725      &         H2OSOI_ICE7=grid%h2osoi_ice7,H2OSOI_ICE8=grid%h2osoi_ice8,           &
726      &         H2OSOI_ICE9=grid%h2osoi_ice9,H2OSOI_ICE10=grid%h2osoi_ice10,         &
727      &         T_SOISNO_S1=grid%t_soisno_s1,T_SOISNO_S2=grid%t_soisno_s2,           &
728      &         T_SOISNO_S3=grid%t_soisno_s3,T_SOISNO_S4=grid%t_soisno_s4,           &
729      &         T_SOISNO_S5=grid%t_soisno_s5,T_SOISNO1=grid%t_soisno1,               &
730      &         T_SOISNO2=grid%t_soisno2,T_SOISNO3=grid%t_soisno3,                   &
731      &         T_SOISNO4=grid%t_soisno4,T_SOISNO5=grid%t_soisno5,                   &
732      &         T_SOISNO6=grid%t_soisno6,T_SOISNO7=grid%t_soisno7,                   &
733      &         T_SOISNO8=grid%t_soisno8,T_SOISNO9=grid%t_soisno9,                   &
734      &         T_SOISNO10=grid%t_soisno10,DZSNOW1=grid%dzsnow1,DZSNOW2=grid%dzsnow2,& 
735      &         DZSNOW3=grid%dzsnow3,DZSNOW4=grid%dzsnow4, DZSNOW5=grid%dzsnow5,     &
736      &         SNOWRDS1=grid%snowrds1,SNOWRDS2=grid%snowrds2,                       &
737      &         SNOWRDS3=grid%snowrds3 ,SNOWRDS4=grid%snowrds4,                      &
738      &         SNOWRDS5=grid%snowrds5,                                              &
739      &         T_LAKE1=grid%t_lake1,T_LAKE2=grid%t_lake2,T_LAKE3=grid%t_lake3,      &
740      &         T_LAKE4=grid%t_lake4,                                                &
741      &         T_LAKE5=grid%t_lake5,T_LAKE6=grid%t_lake6, T_LAKE7=grid%t_lake7,     &
742      &         T_LAKE8=grid%t_lake8, T_LAKE9=grid%t_lake9,T_LAKE10=grid%t_lake10,   &
743      &         H2OSOI_VOL1=grid%h2osoi_vol1,H2OSOI_VOL2=grid%h2osoi_vol2,           &
744      &         H2OSOI_VOL3=grid%h2osoi_vol3,H2OSOI_VOL4=grid%h2osoi_vol4,           &
745      &         H2OSOI_VOL5=grid%h2osoi_vol5,                                        &
746      &         H2OSOI_VOL6=grid%h2osoi_vol6,H2OSOI_VOL7=grid%h2osoi_vol7,           &
747      &         H2OSOI_VOL8=grid%h2osoi_vol8,                                        &
748      &         H2OSOI_VOL9=grid%h2osoi_vol9,H2OSOI_VOL10=grid%h2osoi_vol10,         &
749      &         MAXPATCH=config_flags%maxpatch,                                      &
750      &         INEST=grid%id,ALBEDOsubgrid=grid%ALBEDOsubgrid,                      &
751      &         LHsubgrid=grid%LHsubgrid,                                            &
752      &         HFXsubgrid=grid%HFXsubgrid,LWUPsubgrid=grid%LWUPsubgrid,             &
753      &         Q2subgrid=grid%Q2subgrid,SABVsubgrid=grid%SABVsubgrid,               &
754      &         SABGsubgrid=grid%SABGsubgrid,NRAsubgrid=grid%NRAsubgrid,             &
755      &         SWUPsubgrid=grid%SWUPsubgrid,LHsoi=grid%LHsoi,                       &
756      &         LHveg=grid%LHveg, LHtran=grid%LHtran                                 &
757                ,t_veg24=grid%t_veg24,            t_veg240=grid%t_veg240,            & !voce accum variables
758                fsun24=grid%fsun24,              fsun240=grid%fsun240,               & !voce accum variables
759                fsd24=grid%fsd24,                fsd240=grid%fsd240,                 & !voce accum variables
760                fsi24=grid%fsi24,                fsi240=grid%fsi240,                 & !voce accum variables
761                laip=grid%laip,                                                      & !voce accum variables
762                pct_pft_input=grid%pct_pft_input,num_pft_input=grid%num_pft_clm,  &
763                input_pft_flag=config_flags%input_pft                             &
764 ! end of CLM variables
765      &        ,SLOPE_RAD=config_flags%slope_rad,TOPO_SHADING=config_flags%topo_shading & ! solar
766      &        ,SHADOWMASK=grid%shadowmask,DIFFUSE_FRAC=grid%diffuse_frac               & ! solar
767      &        ,SLOPE=grid%slope, SLP_AZI=grid%slp_azi, SWNORM=grid%swnorm              & ! solar
768      &        ,DECLIN=grid%declin ,SOLCON=grid%solcon ,COSZEN=grid%coszen ,HRANG=grid%hrang    &
769      &        ,xlat_urb2d=grid%XLAT                                       & !I urban
770      &        ,NUM_ROOF_LAYERS=num_roof_layers                            & !I urban
771      &        ,NUM_WALL_LAYERS=num_wall_layers                            & !I urban
772      &        ,NUM_ROAD_LAYERS=num_road_layers                            &
773      &        ,DZR=grid%dzr ,DZB=grid%dzb ,DZG=grid%dzg                   & !I urban
774      &        ,TR_URB2D=grid%tr_urb2d ,TB_URB2D=grid%tb_urb2d             &
775      &        ,TG_URB2D=grid%tg_urb2d                                     & !H urban
776      &        ,TC_URB2D=grid%tc_urb2d ,QC_URB2D=grid%qc_urb2d             & !H urban
777      &        ,UC_URB2D=grid%uc_urb2d                                     & !H urban
778      &        ,XXXR_URB2D=grid%xxxr_urb2d                                 &
779      &        ,XXXB_URB2D=grid%xxxb_urb2d                                 & !H urban
780      &        ,XXXG_URB2D=grid%xxxg_urb2d                                 &
781      &        ,XXXC_URB2D=grid%xxxc_urb2d                                 & !H urban
782      &        ,CMCR_URB2D=grid%cmcr_urb2d,TGR_URB2D=grid%tgr_urb2d        & !H urban
783      &        ,TGRL_URB3D=grid%tgrl_urb3d,SMR_URB3D=grid%smr_urb3d        & !H urban
784      &        ,JULIAN=grid%julday, JULYR=grid%julyr                       & !I urban
785      &        ,DRELR_URB2D=grid%drelr_urb2d,DRELB_URB2D=grid%drelb_urb2d  & !H urban
786      &        ,DRELG_URB2D=grid%drelg_urb2d                               & !H urban
787      &        ,FLXHUMR_URB2D=grid%flxhumr_urb2d                           & !H urban
788      &        ,FLXHUMB_URB2D=grid%flxhumb_urb2d                           & !H urban
789      &        ,FLXHUMG_URB2D=grid%flxhumg_urb2d                           & !H urban
790      &        ,TRL_URB3D=grid%trl_urb3d   ,TBL_URB3D=grid%tbl_urb3d       & !H urban
791      &        ,TGL_URB3D=grid%tgl_urb3d                                   & !H urban
792      &        ,SH_URB2D=grid%sh_urb2d     ,LH_URB2D=grid%lh_urb2d         &
793      &        ,G_URB2D=grid%g_urb2d                                       & !H urban
794      &        ,RN_URB2D=grid%rn_urb2d     , TS_URB2D=grid%ts_urb2d        & !H urban
795      &        ,FRC_URB2D=grid%frc_urb2d                                   & !H urban
796      &        ,UTYPE_URB2D=grid%utype_urb2d                               & !H urban
797      &        ,SWDDIR=grid%swddir,SWDDIF=grid%swddif                      & !multi-layer urban _gl
798          ! Optional urban for BEP scheme
799      &        ,SF_URBAN_PHYSICS=config_flags%sf_urban_physics             &
800      &        ,num_urban_ndm = config_flags%num_urban_ndm                 & !multi-layer urban
801      &        ,urban_map_zrd = config_flags%urban_map_zrd                 & !multi-layer urban
802      &        ,urban_map_zwd = config_flags%urban_map_zwd                 & !multi-layer urban
803      &        ,urban_map_gd  = config_flags%urban_map_gd                  & !multi-layer urban
804      &        ,urban_map_zd  = config_flags%urban_map_zd                  & !multi-layer urban
805      &        ,urban_map_zdf = config_flags%urban_map_zdf                 & !multi-layer urban
806      &        ,urban_map_bd  = config_flags%urban_map_bd                  & !multi-layer urban
807      &        ,urban_map_wd  = config_flags%urban_map_wd                  & !multi-layer urban
808      &        ,urban_map_gbd = config_flags%urban_map_gbd                 & !multi-layer urban
809      &        ,urban_map_fbd = config_flags%urban_map_fbd                 & !multi-layer urban
810      &        ,urban_map_zgrd = config_flags%urban_map_zgrd               & !multi-layer urban
811      &        ,NUM_URBAN_HI=config_flags%num_urban_hi                     & !multi-layer urban
812      &        ,use_wudapt_lcz=config_flags%use_wudapt_lcz                 & !wudapt
813      &        ,TSK_RURAL=grid%tsk_rural                                   & !multi-layer urban
814      &        ,TRB_URB4D=grid%trb_urb4d,TW1_URB4D=grid%tw1_urb4d          & !multi-layer urban
815      &        ,TW2_URB4D=grid%tw2_urb4d,TGB_URB4D=grid%tgb_urb4d          & !multi-layer urban
816      &        ,TLEV_URB3D=grid%tlev_urb3d                               & !multi-layer urban
817      &        ,QLEV_URB3D=grid%qlev_urb3d                               & !multi-layer urban
818      &        ,TW1LEV_URB3D=grid%tw1lev_urb3d                           & !multi-layer urban
819      &        ,TW2LEV_URB3D=grid%tw2lev_urb3d                           & !multi-layer urban
820      &        ,TGLEV_URB3D=grid%tglev_urb3d                             & !multi-layer urban
821      &        ,TFLEV_URB3D=grid%tflev_urb3d                             & !multi-layer urban
822      &        ,SF_AC_URB3D=grid%sf_ac_urb3d                             & !multi-layer urban
823      &        ,LF_AC_URB3D=grid%lf_ac_urb3d                             & !multi-layer urban
824      &        ,CM_AC_URB3D=grid%cm_ac_urb3d                             & !multi-layer urban
825      &        ,SFVENT_URB3D=grid%sfvent_urb3d                           & !multi-layer urban
826      &        ,LFVENT_URB3D=grid%lfvent_urb3d                           & !multi-layer urban
827      &        ,SFWIN1_URB3D=grid%sfwin1_urb3d                           & !multi-layer urban
828      &        ,SFWIN2_URB3D=grid%sfwin2_urb3d                           & !multi-layer urban
829      &        ,SFW1_URB3D=grid%sfw1_urb3d,SFW2_URB3D=grid%sfw2_urb3d      & !multi-layer urban
830      &        ,SFR_URB3D=grid%sfr_urb3d,SFG_URB3D=grid%sfg_urb3d          & !multi-layer urban
831      &        ,EP_PV_URB3D=grid%ep_pv_urb3d                               & !GRZ
832      &        ,T_PV_URB3D=grid%t_pv_urb3d                                 & !GRZ
833      &        ,TRV_URB4D=grid%trv_urb4d                                   & !GRZ
834      &        ,QR_URB4D=grid%qr_urb4d                                     & !GRZ
835      &        ,QGR_URB3D=grid%qgr_urb3d                                   & !GRZ
836      &        ,TGR_URB3D=grid%tgr_urb3d                                   & !GRZ
837      &        ,DRAIN_URB4D=grid%drain_urb4d                               & !GRZ
838      &        ,DRAINGR_URB3D=grid%draingr_urb3d                           & !GRZ
839      &        ,SFRV_URB3D=grid%sfrv_urb3d                                 & !GRZ
840      &        ,LFRV_URB3D=grid%lfrv_urb3d                                 & !GRZ
841      &        ,DGR_URB3D=grid%dgr_urb3d                                   & !GRZ
842      &        ,DG_URB3D=grid%dg_urb3d                                     & !GRZ
843      &        ,LFR_URB3D=grid%lfr_urb3d                                   & !GRZ
844      &        ,LFG_URB3D=grid%lfg_urb3d                                   & !GRZ
845      &        ,LP_URB2D=grid%lp_urb2d,HI_URB2D=grid%hi_urb2d              & !multi-layer urban
846      &        ,LB_URB2D=grid%lb_urb2d,HGT_URB2D=grid%hgt_urb2d            & !multi-layer urban
847      &        ,MH_URB2D=grid%mh_urb2d,STDH_URB2D=grid%stdh_urb2d          & !SLUCM
848      &        ,LF_URB2D=grid%lf_urb2d                                           & 
849      &        ,GMT=grid%gmt,XLAT=grid%xlat,XLONG=grid%xlong,JULDAY=grid%julday  &
850      &        ,A_U_BEP=grid%a_u_bep,A_V_BEP=grid%a_v_bep,A_T_BEP=grid%a_t_bep   &
851      &        ,A_Q_BEP=grid%a_q_bep                                             &
852      &        ,B_U_BEP=grid%b_u_bep,B_V_BEP=grid%b_v_bep,B_T_BEP=grid%b_t_bep   &
853      &        ,B_Q_BEP=grid%b_q_bep                                             &
854      &        ,SF_BEP=grid%sf_bep,VL_BEP=grid%vl_bep                            &
855      &        ,A_E_BEP=grid%a_e_bep,B_E_BEP=grid%b_e_bep,DLG_BEP=grid%dlg_bep   &
856      &        ,DL_U_BEP=grid%dl_u_bep                                           &
857      &        ,CMR_SFCDIF=grid%cmr_sfcdif, CHR_SFCDIF=grid%chr_sfcdif     & !I/O urban
858      &        ,CMC_SFCDIF=grid%cmc_sfcdif, CHC_SFCDIF=grid%chc_sfcdif     & !I/O urban
859      &        ,CMGR_SFCDIF=grid%cmgr_sfcdif, CHGR_SFCDIF=grid%chgr_sfcdif & !I/O urban
860            ! P-X LSM Variables
861      &        ,LANDUSEF=grid%landusef, SOILCTOP=grid%soilctop             &   ! P-X LSM
862      &        ,SOILCBOT=grid%soilcbot                                     &   ! P-X LSM
863      &        ,RA=grid%ra, RS=grid%rs, LAI=grid%lai, IMPERV=grid%imperv   &   ! P-X LSM
864      &        ,CANFRA=grid%canfra, NLCAT=grid%num_land_cat                &   ! P-X LSM
865      &        ,NSCAT=grid%num_soil_cat                                    &   ! P-X LSM
866      &        ,VEGF_PX=grid%vegf_px, SNOWNCV=grid%snowncv                 &   ! P-X LSM
867      &        ,ANAL_INTERVAL=config_flags%auxinput9_interval_s+config_flags%auxinput9_interval_m*60  &   ! P-X LSM
868      &        ,PXLSM_SMOIS_INIT=config_flags%pxlsm_smois_init             &   ! P-X LSM
869      &        ,PXLSM_SOIL_NUDGE=config_flags%pxlsm_soil_nudge             &   ! P-X LSM
870            ! SSiB LSM variables (fds 06/2010)
871      &        ,alswvisdir=grid%alswvisdir, alswvisdif=grid%alswvisdif    & !ssib
872      &        ,alswnirdir=grid%alswnirdir, alswnirdif=grid%alswnirdif    & !ssib
873      &        ,swvisdir=grid%swvisdir, swvisdif=grid%swvisdif            & !ssib
874      &        ,swnirdir=grid%swnirdir, swnirdif=grid%swnirdif            & !ssib 
875      &        ,ssib_br=grid%ssib_br,  ssib_fm=grid%ssib_fm               & !ssib
876      &        ,ssib_fh=grid%ssib_fh,  ssib_cm=grid%ssib_cm               & !ssib
877      &        ,ssibxdd=grid%ssibxdd,  ssib_lhf=grid%ssib_lhf             & !ssib
878      &        ,ssib_shf=grid%ssib_shf, ssib_ghf=grid%ssib_ghf            & !ssib
879      &        ,ssib_egs=grid%ssib_egs, ssib_eci=grid%ssib_eci            & !ssib
880      &        ,ssib_ect=grid%ssib_ect, ssib_egi=grid%ssib_egi            & !ssib
881      &        ,ssib_egt=grid%ssib_egt, ssib_sdn=grid%ssib_sdn            & !ssib
882      &        ,ssib_sup=grid%ssib_sup, ssib_ldn=grid%ssib_ldn            & !ssib
883      &        ,ssib_lup=grid%ssib_lup, ssib_wat=grid%ssib_wat            & !ssib
884      &        ,ssib_shc=grid%ssib_shc, ssib_shg=grid%ssib_shg            & !ssib
885      &        ,ssib_lai=grid%ssib_lai, ssib_vcf=grid%ssib_vcf            & !ssib
886      &        ,ssib_z00=grid%ssib_z00, ssib_veg=grid%ssib_veg            & !ssib
887      &        ,cldfra=grid%cldfra                                        & !ssib
888      &        ,ISNOW=grid%isnow, SWE=grid%swe, SNOWDEN=grid%snowden      & !ssib snow
889      &        ,SNOWDEPTH=grid%snowdepth, TKAIR=grid%tkair                & !ssib snow
890      &        ,DZO1=grid%dzo1, WO1=grid%wo1, TSSN1=grid%tssn1, TSSNO1=grid%tssno1     & !ssib snow
891      &        ,BWO1=grid%bwo1, BTO1=grid%bto1, CTO1=grid%cto1, FIO1=grid%fio1         & !ssib snow
892      &        ,FLO1=grid%flo1, BIO1=grid%bio1, BLO1=grid%blo1, HO1=grid%ho1           & !ssib snow
893      &        ,DZO2=grid%dzo2, WO2=grid%wo2, TSSN2=grid%tssn2, TSSNO2=grid%tssno2     & !ssib snow
894      &        ,BWO2=grid%bwo2, BTO2=grid%bto2, CTO2=grid%cto2, FIO2=grid%fio2         & !ssib snow
895      &        ,FLO2=grid%flo2, BIO2=grid%bio2, BLO2=grid%blo2, HO2=grid%ho2           & !ssib snow
896      &        ,DZO3=grid%dzo3, WO3=grid%wo3, TSSN3=grid%tssn3, TSSNO3=grid%tssno3     & !ssib snow
897      &        ,BWO3=grid%bwo3, BTO3=grid%bto3, CTO3=grid%cto3, FIO3=grid%fio3         & !ssib snow
898      &        ,FLO3=grid%flo3, BIO3=grid%bio3, BLO3=grid%blo3, HO3=grid%ho3           & !ssib snow
899      &        ,DZO4=grid%dzo4, WO4=grid%wo4, TSSN4=grid%tssn4, TSSNO4=grid%tssno4     & !ssib snow
900      &        ,BWO4=grid%bwo4, BTO4=grid%bto4, CTO4=grid%cto4, FIO4=grid%fio4         & !ssib snow
901      &        ,FLO4=grid%flo4, BIO4=grid%bio4, BLO4=grid%blo4, HO4=grid%ho4           & !ssib snow
902      &        ,RA_SW_PHYSICS=config_flags%ra_sw_physics                  & !ssib
903 !------------------------------------------------------------------------------
904            ! Optional PX LSM nudging
905      &        ,t2_ndg_old=grid%t2_ndg_old                  &
906      &        ,q2_ndg_old=grid%q2_ndg_old                  &
907      &        ,t2_ndg_new=grid%t2_ndg_new                  &
908      &        ,q2_ndg_new=grid%q2_ndg_new                  &
909      &        ,sn_ndg_old=grid%sn_ndg_old                  &
910      &        ,sn_ndg_new=grid%sn_ndg_new                  &
911      &        ,pxlsm_modis_veg=config_flags%pxlsm_modis_veg                   &
912      &        ,LAI_PX=grid%lai_px                                             &
913      &        ,WWLT_PX=grid%wwlt_px, WFC_PX=grid%wfc_px                       &
914      &        ,WSAT_PX=grid%wsat_px, CLAY_PX=grid%clay_px                     &
915      &        ,CSAND_PX=grid%csand_px, FMSAND_PX=grid%fmsand_px               &
916 ! for Noah-MP LSM
917      &        ,idveg=config_flags%dveg,         iopt_crs=config_flags%opt_crs &
918      &        ,iopt_btr=config_flags%opt_btr,   iopt_run=config_flags%opt_run &
919      &        ,iopt_sfc=config_flags%opt_sfc,   iopt_frz=config_flags%opt_frz &
920      &        ,iopt_inf=config_flags%opt_inf,   iopt_rad=config_flags%opt_rad &
921      &        ,iopt_alb=config_flags%opt_alb,   iopt_snf=config_flags%opt_snf &
922      &        ,iopt_tbot=config_flags%opt_tbot, iopt_stc=config_flags%opt_stc & 
923      &        ,iopt_gla=config_flags%opt_gla,   iopt_rsf=config_flags%opt_rsf & 
924      &        ,iopt_soil=config_flags%opt_soil, iopt_pedo=config_flags%opt_pedo  &
925      &        ,iopt_crop=config_flags%opt_crop, iopt_irr=config_flags%opt_irr    &
926      &        ,iopt_irrm=config_flags%opt_irrm                                   &
927      &        ,iopt_infdv=config_flags%opt_infdv,iopt_tdrn=config_flags%opt_tdrn &
928      &        ,soiltstep=config_flags%soiltstep
929      &        , isnowxy=grid%isnowxy  ,    tvxy=grid%tvxy    ,    tgxy=grid%tgxy     &
930      &        ,canicexy=grid%canicexy ,canliqxy=grid%canliqxy,   eahxy=grid%eahxy    &
931      &        ,   tahxy=grid%tahxy    ,    cmxy=grid%cmxy    ,    chxy=grid%chxy     &
932      &        ,  fwetxy=grid%fwetxy   ,sneqvoxy=grid%sneqvoxy,alboldxy=grid%alboldxy &
933      &        , qsnowxy=grid%qsnowxy  ,qrainxy=grid%qrainxy  ,wslakexy=grid%wslakexy &
934      &        , zwtxy=grid%zwtxy                                                     &
935      &        ,    waxy=grid%waxy     ,    wtxy=grid%wtxy    ,  tsnoxy=grid%tsnoxy   &
936      &        , zsnsoxy=grid%zsnsoxy  , snicexy=grid%snicexy , snliqxy=grid%snliqxy  &
937      &        ,lfmassxy=grid%lfmassxy ,rtmassxy=grid%rtmassxy,stmassxy=grid%stmassxy &
938      &        ,  woodxy=grid%woodxy   ,stblcpxy=grid%stblcpxy,fastcpxy=grid%fastcpxy &
939      &        , grainxy=grid%grainxy  ,   gddxy=grid%gddxy   ,   pgsxy=grid%pgsxy    &
940      &        , cropcat=grid%cropcat                                                 &
941      &        ,planting=grid%planting , harvest=grid%harvest ,season_gdd=grid%season_gdd  &
942      &        , soilcomp=grid%soilcomp                                               &
943      &        , soilcl1=grid%soilcl1  , soilcl2=grid%soilcl2                         &
944      &        , soilcl3=grid%soilcl3  , soilcl4=grid%soilcl4                         &
945      &        ,  xsaixy=grid%xsaixy   , taussxy=grid%taussxy                         &
946      &        ,  t2mvxy=grid%t2mvxy   ,  t2mbxy=grid%t2mbxy                          &
947      &        ,  q2mvxy=grid%q2mvxy   ,  q2mbxy=grid%q2mbxy                          & 
948      &        ,  tradxy=grid%tradxy   ,   neexy=grid%neexy   ,   gppxy=grid%gppxy    &
949      &        ,   nppxy=grid%nppxy    ,  fvegxy=grid%fvegxy  , runsfxy=grid%runsfxy  &
950      &        , runsbxy=grid%runsbxy  ,  ecanxy=grid%ecanxy  ,  edirxy=grid%edirxy   &
951      &        , etranxy=grid%etranxy  ,   fsaxy=grid%fsaxy   ,  firaxy=grid%firaxy   &
952      &        ,  aparxy=grid%aparxy   ,   psnxy=grid%psnxy   ,   savxy=grid%savxy    &
953      &        ,   sagxy=grid%sagxy    , rssunxy=grid%rssunxy , rsshaxy=grid%rsshaxy  &
954      &        ,  bgapxy=grid%bgapxy   ,  wgapxy=grid%wgapxy  ,   tgvxy=grid%tgvxy    &
955      &        ,   tgbxy=grid%tgbxy    ,   chvxy=grid%chvxy   ,   chbxy=grid%chbxy    &
956      &        ,   shgxy=grid%shgxy    ,   shcxy=grid%shcxy   ,   shbxy=grid%shbxy    &
957      &        ,   evgxy=grid%evgxy    ,   evbxy=grid%evbxy   ,   ghvxy=grid%ghvxy    &
958      &        ,   ghbxy=grid%ghbxy    ,   irgxy=grid%irgxy   ,   ircxy=grid%ircxy    &
959      &        ,   irbxy=grid%irbxy    ,    trxy=grid%trxy    ,   evcxy=grid%evcxy    &
960      &        ,chleafxy=grid%chleafxy ,  chucxy=grid%chucxy                          &                       
961      &        ,  chv2xy=grid%chv2xy   ,  chb2xy=grid%chb2xy , chstarxy=grid%chstarxy &
962 ! Noah-MP extra output fields
963      &        ,    qintsxy=grid%qintsxy    ,   qintrxy=grid%qintrxy   ,   qdripsxy=grid%qdripsxy   &
964      &        ,   qdriprxy=grid%qdriprxy   ,  qthrosxy=grid%qthrosxy  ,   qthrorxy=grid%qthrorxy   &
965      &        ,   qsnsubxy=grid%qsnsubxy   ,  qsnfroxy=grid%qsnfroxy  ,    qsubcxy=grid%qsubcxy    &
966      &        ,    qfrocxy=grid%qfrocxy    ,   qfrzcxy=grid%qfrzcxy   ,   qmeltcxy=grid%qmeltcxy   &
967      &        ,   qsnbotxy=grid%qsnbotxy   , pondingxy=grid%pondingxy ,      PAHXY=grid%PAHXY      &
968      &        ,     PAHGXY=grid%PAHGXY     ,    PAHVXY=grid%PAHVXY    ,     PAHBXY=grid%PAHBXY     &
969      &        ,    qmeltxy=grid%qmeltxy    ,   FPICEXY=grid%FPICEXY   ,   qevacxy=grid%qevacxy     &
970      &        ,    qdewcxy=grid%qdewcxy    ,   RAINLSM=grid%RAINLSM   ,    SNOWLSM=grid%SNOWLSM    &
971      &        ,   forctlsm=grid%forctlsm   ,  forcqlsm=grid%forcqlsm  ,   forcplsm=grid%forcplsm   &
972      &        ,   forczlsm=grid%forczlsm   ,  forcwlsm=grid%forcwlsm                               &
973      &        ,  acc_ssoil=grid%acc_ssoil  ,acc_qinsur=grid%acc_qinsur,  acc_qseva=grid%acc_qseva  &
974      &        , acc_etrani=grid%acc_etrani ,   eflxbxy=grid%eflxbxy                                &
975      &        , soilenergy=grid%soilenergy ,snowenergy=grid%snowenergy,    canhsxy=grid%canhsxy    &
976      &        , ACC_DWATERXY=grid%ACC_DWATERXY, ACC_PRCPXY=grid%ACC_PRCPXY,ACC_ECANXY=grid%ACC_ECANXY &
977      &        , ACC_ETRANXY=grid%ACC_ETRANXY, ACC_EDIRXY=grid%ACC_EDIRXY  &
978 ! Noah-MP irrigation
979      &        , IRFRACT=grid%IRFRACT  , SIFRACT=grid%SIFRACT ,MIFRACT=grid%MIFRACT   &
980      &        , FIFRACT=grid%FIFRACT  , IRNUMSI=grid%IRNUMSI ,IRNUMMI=grid%IRNUMMI   &
981      &        , IRNUMFI=grid%IRNUMFI  , IRWATSI=grid%IRWATSI ,IRWATMI=grid%IRWATMI   &
982      &        , IRWATFI=grid%IRWATFI  , IRELOSS=grid%IRELOSS ,IRSIVOL=grid%IRSIVOL   &
983      &        , IRMIVOL=grid%IRMIVOL  , IRFIVOL=grid%IRFIVOL ,IRRSPLH=grid%IRRSPLH   &                       
984 ! Noah-MP tile drainage
985      &        , QTDRAIN=grid%QTDRAIN  , TD_FRACTION=grid%TD_FRACTION                 &
986 ! Optional hydro variables in NOAHMP
987      &        ,smcwtdxy=grid%smcwtdxy ,rechxy=grid%rechxy ,deeprechxy=grid%deeprechxy &
988      &        ,fdepthxy=grid%fdepthxy, areaxy=grid%areaxy, rivercondxy=grid%rivercondxy  &
989      &        ,riverbedxy=grid%riverbedxy, eqzwt=grid%eqzwt, pexpxy=grid%pexpxy &
990      &        ,qrfxy=grid%qrfxy, qspringxy=grid%qspringxy, qslatxy=grid%qslatxy, qrfsxy=grid%qrfsxy, qlatxy=grid%qlatxy &
991      &        ,qspringsxy=grid%qspringsxy, smoiseq=grid%smoiseq, wtddt=config_flags%wtddt, stepwtd=grid%stepwtd &
992      &        ,gecros_state=grid%gecros_state                                   &   ! Optional gecros crop
993            ! Noah UA changes
994      &        ,ua_phys=config_flags%ua_phys,flx4=grid%flx4,fvb=grid%fvb       &
995      &        ,fbur=grid%fbur,fgsn=grid%fgsn                                  &
996            ! Indexes
997      &        ,IDS=ids,IDE=ide, JDS=jds,JDE=jde, KDS=kds,KDE=kde          &
998      &        ,IMS=ims,IME=ime, JMS=jms,JME=jme, KMS=kms,KME=kme          &
999      &        ,IPS=ips,IPE=ipe, JPS=jps,JPE=jpe, KPS=kps,KPE=kpe          &
1000      &        , I_START=grid%i_start,I_END=min(grid%i_end, ide-1)         &
1001      &        , J_START=grid%j_start,J_END=min(grid%j_end, jde-1)         &
1002      &        , KTS=k_start, KTE=min(k_end,kde-1)                         &
1003      &        , NUM_TILES=grid%num_tiles                                  &
1004           ! Variables required by TEMF PBL - WA 1/7/09
1005               ,te_temf=grid%te_temf,hd_temf=grid%hd_temf                  &
1006               ,fCor=grid%f,exch_temf=exch_temf,wm_temf=grid%wm_temf       &
1007           ! Variables required by IDEAL SCM sfc scheme - WA 1/6/10
1008               ,hfx_force=grid%hfx_force,lh_force=grid%lh_force            &
1009               ,tsk_force=grid%tsk_force                                   &
1010               ,hfx_force_tend=grid%hfx_force_tend                         &
1011               ,lh_force_tend=grid%lh_force_tend                           &
1012               ,tsk_force_tend=grid%tsk_force_tend                         &
1013            ! Optional
1014      &        ,QV_CURR=moist(ims,kms,jms,P_QV), F_QV=F_QV                 &
1015      &        ,QC_CURR=moist(ims,kms,jms,P_QC), F_QC=F_QC                 &
1016      &        ,QR_CURR=moist(ims,kms,jms,P_QR), F_QR=F_QR                 &
1017      &        ,QI_CURR=moist(ims,kms,jms,P_QI), F_QI=F_QI                 &
1018      &        ,QS_CURR=moist(ims,kms,jms,P_QS), F_QS=F_QS                 &
1019      &        ,QG_CURR=moist(ims,kms,jms,P_QG), F_QG=F_QG                 &
1020      &        ,CAPG=grid%capg, EMISS=grid%emiss, HOL=hol,MOL=grid%mol     &
1021      &        ,T2OBS=grid%t2obs, Q2OBS=grid%q2obs                         &
1022      &        ,RAINBL=grid%rainbl,SR=grid%sr,RAINSHV=grid%rainshv         &
1023      &        ,GRAUPELNCV=grid%graupelncv, HAILNCV=grid%hailncv           &
1024      &        ,RAINNCV=grid%rainncv,REGIME=grid%regime,T2=grid%t2,THC=grid%thc            &
1025      &        ,QSG=grid%qsg,QVG=grid%qvg,QCG=grid%qcg,SOILT1=grid%soilt1,TSNAV=grid%tsnav & ! ruc lsm
1026      &        ,SMFR3D=grid%smfr3d,KEEPFR3DFLAG=grid%keepfr3dflag,DEW=grid%dew             & ! ruc lsm
1027      &        ,POTEVP=grid%POTEVP, SNOPCX=grid%SNOPCX, SOILTB=grid%SOILTB                 & ! ruc lsm
1028      &        ,rhosnf=grid%rhosnf ,precipfr=grid%precipfr                 &   ! RUC LSM
1029      &        ,snowfallac=grid%snowfallac                                 &   ! RUC LSM
1030      &        ,MOSAIC_LU=config_flags%mosaic_lu                           & ! RUC LSM
1031      &        ,MOSAIC_SOIL=config_flags%mosaic_soil                       &   ! RUC LSM
1032      &        ,ISURBAN=isurban, MMINLU=TRIM(mminlu)                       &
1033      &        ,SNOTIME = grid%SNOTIME                                     &
1034      &        ,RDLAI2D=config_flags%rdlai2d                               &
1035      &        ,usemonalb=config_flags%usemonalb                           &
1036      &        ,NOAHRES=grid%noahres                                       &
1037      &        ,TSK_SAVE=grid%tsk_save                                     &
1038      &        ,ch=grid%ch                                                 &
1039      &        ,fgdp=grid%fgdp,dfgdp=grid%dfgdp,vdfg=grid%vdfg             & !Katata - fogdes
1040      &        ,grav_settling=config_flags%grav_settling                   & !Katata - fogdes
1041      &        ,OM_TMP=grid%om_tmp, OM_S=grid%om_s, OM_U=grid%om_u, OM_V=grid%om_v   & !cyl:3DPWP
1042      &        ,OM_DEPTH=grid%om_depth, OM_ML=grid%OM_ML, OM_LON=grid%om_lon         & !cyl:3DPWP
1043      &        ,OM_LAT=grid%om_lat                                                  & !cy:3DPWP
1044      &        , okms = 1, okme=config_flags%ocean_levels                  & ! cyl:3DPWP
1045      &        ,rdx=grid%rdx, rdy=grid%rdy,msfu=grid%msfu,msfv=grid%msfv,msft=grid%msft &!cyl: 3DPWP
1046      &        ,XTIME=grid%xtime,OM_TINI=grid%om_tini,OM_SINI=grid%om_sini,id=grid%id,omdt=config_flags%omdt &!cyl: 3DPWP 
1047      &        ,sf_surface_mosaic=config_flags%sf_surface_mosaic,  mosaic_cat=config_flags%mosaic_cat    &
1048      &        ,mosaic_cat_index=grid%mosaic_cat_index                                                   &  !danli mosaic
1049      &        ,landusef2=grid%landusef2,TSK_mosaic=grid%TSK_mosaic,QSFC_mosaic=grid%QSFC_mosaic         &
1050      &        ,TSLB_mosaic=grid%TSLB_mosaic,SMOIS_mosaic=grid%SMOIS_mosaic,SH2O_mosaic=grid%SH2O_mosaic &  !danli mosaic
1051      &        ,CANWAT_mosaic=grid%CANWAT_mosaic,SNOW_mosaic=grid%SNOW_mosaic                            &
1052      &        ,SNOWH_mosaic=grid%SNOWH_mosaic,SNOWC_mosaic=grid%SNOWC_mosaic                            &  !danli mosaic
1053      &        ,ALBEDO_mosaic=grid%ALBEDO_mosaic,ALBBCK_mosaic=grid%ALBBCK_mosaic                        &
1054      &        ,EMISS_mosaic=grid%EMISS_mosaic, EMBCK_mosaic=grid%EMBCK_mosaic                           &
1055      &        ,ZNT_mosaic=grid%ZNT_mosaic, Z0_mosaic=grid%Z0_mosaic                                     &  !danli mosaic
1056      &        ,HFX_mosaic=grid%HFX_mosaic,QFX_mosaic=grid%QFX_mosaic, LH_mosaic=grid%LH_mosaic          &
1057      &        ,GRDFLX_mosaic=grid%GRDFLX_mosaic,SNOTIME_mosaic=grid%SNOTIME_mosaic                      &  !danli mosaic
1058      &        ,RS_mosaic=grid%RS_mosaic,LAI_mosaic=grid%LAI_mosaic                                      &
1059      &        ,TR_URB2D_mosaic=grid%TR_URB2D_mosaic,TB_URB2D_mosaic=grid%TB_URB2D_mosaic                &  !danli mosaic 
1060      &        ,TG_URB2D_mosaic=grid%TG_URB2D_mosaic,TC_URB2D_mosaic=grid%TC_URB2D_mosaic                &  !danli mosaic 
1061      &        ,QC_URB2D_mosaic=grid%QC_URB2D_mosaic,UC_URB2D_mosaic=grid%UC_URB2D_mosaic                &  !danli mosaic
1062      &        ,TRL_URB3D_mosaic=grid%TRL_URB3D_mosaic,TBL_URB3D_mosaic=grid%TBL_URB3D_mosaic            &  !danli mosaic 
1063      &        ,TGL_URB3D_mosaic=grid%TGL_URB3D_mosaic                                                   &  !danli mosaic 
1064      &        ,SH_URB2D_mosaic=grid%SH_URB2D_mosaic,LH_URB2D_mosaic=grid%LH_URB2D_mosaic                &  !danli mosaic 
1065      &        ,G_URB2D_mosaic=grid%G_URB2D_mosaic,RN_URB2D_mosaic=grid%RN_URB2D_mosaic                  &  !danli mosaic 
1066      &        ,TS_URB2D_mosaic=grid%TS_URB2D_mosaic                                                     &  !danli mosaic 
1067      &        ,TS_RUL2D_mosaic=grid%TS_RUL2D_mosaic                                                     &  !danli mosaic
1068      &        ,ZOL=grid%ZOL                                                                             &
1069      &        ,SDA_HFX=grid%SDA_HFX, SDA_QFX=grid%SDA_QFX,HFX_BOTH=grid%HFX_BOTH                        &  !fasdas
1070      &        ,QFX_BOTH=grid%QFX_BOTH,QNORM=grid%QNORM,fasdas=config_flags%fasdas                       &  !fasdas
1071      &        ,XLAIDYN=grid%XLAIDYN                                                                     &
1072      &        ,spp_lsm=config_flags%spp_lsm,pattern_spp_lsm=grid%pattern_spp_lsm     & !SPP
1073      &        ,field_sf=grid%field_sf                                                & !SPP
1074      &        ,spp_pbl=config_flags%spp_pbl,pattern_spp_pbl=grid%pattern_spp_pbl     & !SPP
1075   ! WRF-Solar EPS: Noah LSM
1076      &        ,multi_perturb=config_flags% multi_perturb                             & 
1077      &        ,pert_noah=config_flags%pert_noah                                      &
1078      &        ,perts_qvapor=grid%pert3d(:,:,:,P_PQVAPOR)                             &
1079      &        ,perts_th=grid%pert3d(:,:,:,P_PTH)                                     &
1080      &        ,perts_smois=grid%pert3d(:,:,:,P_PSMOIS)                               &
1081      &        ,perts_tsoil=grid%pert3d(:,:,:,P_PTSOIL)                               &
1082      &        ,pert_noah_qv=config_flags%pert_noah_qv                                &
1083      &        ,pert_noah_t=config_flags%pert_noah_t                                  &
1084      &        ,pert_noah_smois=config_flags%pert_noah_smois                          &
1085      &        ,pert_noah_tslb=config_flags%pert_noah_tslb                            &
1086      &                                                           )
1088 #ifdef WRF_HYDRO
1089         if(HYDRO_dt .gt. 1 ) call wrf_drv_HYDRO(HYDRO_dt, grid,  &
1090      &     grid%i_start(1),min(grid%i_end(1), ide-1),      &
1091      &     grid%j_start(1),min(grid%j_end(1), jde-1) )
1092 #endif
1094 BENCH_END(surf_driver_tim)
1096 !*********
1097 ! pbl
1098 #if ( WRFPLUS == 1 )
1099 #ifdef DM_PARALLEL
1100       IF ( config_flags%bl_pbl_physics .EQ. 98 ) THEN
1101 #     include "HALO_EM_PHYS_A_BL_SURF.inc"
1102       ENDIF
1103 #endif
1104 #endif
1106       CALL wrf_debug ( 200 , ' call pbl_driver' )
1107 BENCH_START(pbl_driver_tim)
1108       CALL pbl_driver(                                                              &
1109      &         AKHS=grid%akhs          ,AKMS=grid%akms                              &
1110      &        ,BL_PBL_PHYSICS=config_flags%bl_pbl_physics                           &
1111      &        ,WINDFARM_OPT=config_flags%windfarm_opt,power=grid%power              &
1112      &        ,BLDT=grid%bldt, CURR_SECS=curr_secs, ADAPT_STEP_FLAG=adapt_step_flag &
1113      &        ,BLDTACTTIME=grid%bldtacttime                               &  
1114      &        ,BR=grid%br         ,CHKLOWQ=chklowq    ,CT=grid%ct                   &
1115      &        ,DT=grid%dt         ,DX=grid%dx         ,DY=grid%dy                   &
1116      &        ,DX2D=grid%dx2d     ,AREA2D=grid%area2d                               &
1117      &        ,DZ8W=dz8w          ,HPBL_HOLD=hpbl_hold                              &
1118      &        ,EXCH_H=grid%exch_h     ,EXCH_M=grid%exch_m                           &
1119      &        ,FM=grid%fm         ,FHH=grid%fh                                      &
1120      &        ,F=grid%f  ,GRDFLX=grid%grdflx      &
1121      &        ,GZ1OZ0=gz1oz0      ,HFX=grid%hfx            ,HT=grid%ht              &
1122      &        ,ID=grid%id         ,ITIMESTEP=grid%itimestep     ,KPBL=grid%kpbl          &
1123      &        ,LH=grid%lh              ,LOWLYR=grid%lowlyr      ,P8W=grid%p_hyd_w   &
1124      &        ,PBLH=grid%pblh          ,PI_PHY=pi_phy      ,PSIH=psih          &
1125      &        ,PSIM=psim          ,P_PHY=grid%p_hyd        ,QFX=grid%qfx            &
1126      &        ,QSFC=grid%qsfc          ,QZ0=grid%qz0  ,MIXHT=mixht                  &
1127      &        ,RA_LW_PHYSICS=config_flags%ra_lw_physics                   &
1128      &        ,RHO=grid%rho            ,RQCBLTEN=grid%rqcblten  ,RQIBLTEN=grid%rqiblten  &
1129      &        ,RQVBLTEN=grid%rqvblten  ,RTHBLTEN=grid%rthblten  ,RUBLTEN=grid%rublten    &
1130      &        ,RVBLTEN=grid%rvblten    ,SNOW=grid%snow          ,STEPBL=grid%stepbl      &
1131      &        ,THZ0=grid%thz0          ,TH_PHY=th_phy                               &
1132      &        ,TSK=grid%tsk            ,T_PHY=grid%t_phy        ,UST=grid%ust       &
1133      &        ,U10=grid%u10 ,UZ0=grid%uz0      ,U_FRAME=grid%u_frame    ,U_PHY=grid%u_phy   &
1134      &        ,V10=grid%v10 ,VZ0=grid%vz0      ,V_FRAME=grid%v_frame    ,V_PHY=grid%v_phy   &
1135      &        ,W=grid%w_2   ,UOCE=grid%uoce    ,VOCE=grid%voce                              &
1136               ,T2=grid%t2 &
1137      &        ,WARM_RAIN=grid%warm_rain                    ,WSPD=grid%wspd     &
1138      &        ,XICE=grid%xice          ,XLAND=grid%xland        ,Z=grid%z                &
1139      &        ,ZNT=grid%znt                                                    &
1140      &        ,ysu_topdown_pblmix=config_flags%ysu_topdown_pblmix              &
1141      &        ,shinhong_tke_diag=config_flags%shinhong_tke_diag               &
1142 ! paj: topo_wind
1143      &        ,CTOPO=grid%ctopo,CTOPO2=grid%ctopo2                                   &
1144 ! variables added for BEP
1145      &          ,FRC_URB2D=grid%frc_urb2d                                                  &
1146      &          ,A_U_BEP=grid%a_u_bep,A_V_BEP=grid%a_v_bep,A_T_BEP=grid%a_t_bep          &
1147      &          ,A_Q_BEP=grid%a_q_bep                                                    &
1148      &          ,B_U_BEP=grid%b_u_bep,B_V_BEP=grid%b_v_bep,B_T_BEP=grid%b_t_bep          &
1149      &          ,B_Q_BEP=grid%b_q_bep                                                    &
1150      &          ,SF_BEP=grid%sf_bep,VL_BEP=grid%vl_bep                                   &
1151      &          ,A_E_BEP=grid%a_e_bep,B_E_BEP=grid%b_e_bep,DLG_BEP=grid%dlg_bep          &
1152      &          ,DL_U_BEP=grid%dl_u_bep                                                  &
1153      &          ,SF_SFCLAY_PHYSICS=config_flags%sf_sfclay_physics                        &
1154      &          ,SF_URBAN_PHYSICS=config_flags%sf_urban_physics                          &
1155 ! Bep changes end
1156 ! add tke_pbl, and turbulent fluxes
1157      &          ,TKE_PBL=grid%tke_pbl,EL_PBL=grid%el_pbl,WU_TUR=grid%wu_tur              &
1158      &          ,WV_tur=grid%wv_tur,WT_tur=grid%wt_tur,WQ_tur=grid%wq_tur                &
1159      &          ,DISS_PBL=grid%diss_pbl,TPE_PBL=grid%tpe_pbl                             &
1160      &          ,TKE_ADV=scalar(ims,kms,jms,P_tke_adv)                                   &
1161      &          ,DISS_ADV=scalar(ims,kms,jms,P_diss_adv)                                 &
1162      &          ,TPE_ADV=scalar(ims,kms,jms,P_tpe_adv),PR_PBL=grid%pr_pbl                &
1163 ! end add tke_pbl, and turbulent fluxes
1164 ! GBMPBL change: add exch_tke, rthraten
1165      &        ,EXCH_TKE=grid%exch_tke, RTHRATEN=grid%rthraten             &
1166      &        ,IDS=ids,IDE=ide, JDS=jds,JDE=jde, KDS=kds,KDE=kde          &
1167      &        ,IMS=ims,IME=ime, JMS=jms,JME=jme, KMS=kms,KME=kme          &
1168      &        ,I_START=grid%i_start,I_END=min(grid%i_end, ide-1)          &
1169      &        ,J_START=grid%j_start,J_END=min(grid%j_end, jde-1)          &
1170      &        ,KTS=k_start, KTE=min(k_end,kde-1)                          &
1171      &        ,NUM_TILES=grid%num_tiles                                   &
1172           ! Variables Required by ACM PBL  - jp
1173      &        ,ZNU=grid%znu,ZNW=grid%znw,MUT=grid%mut,P_TOP=grid%p_top    &
1174           ! Variables required by TEMF PBL - WA 9/9/08
1175               ,te_temf=grid%te_temf                                 &
1176               ,kh_temf=grid%kh_temf,km_temf=grid%km_temf            &
1177               ,shf_temf=grid%shf_temf,qf_temf=grid%qf_temf          &
1178               ,uw_temf=grid%uw_temf,vw_temf=grid%vw_temf            &
1179               ,hd_temf=grid%hd_temf,lcl_temf=grid%lcl_temf          &
1180               ,wupd_temf=grid%wupd_temf,mf_temf=grid%mf_temf          &
1181               ,thup_temf=grid%thup_temf,qtup_temf=grid%qtup_temf          &
1182               ,qlup_temf=grid%qlup_temf          &
1183               ,cf3d_temf=grid%cf3d_temf,cfm_temf=grid%cfm_temf          &
1184               ,hct_temf=grid%hct_temf                               &
1185               ,flhc=grid%flhc,flqc=grid%flqc                        &
1186               ,exch_temf=exch_temf                      &
1187           ! optional
1188      &        ,QV_CURR=moist(ims,kms,jms,P_QV), F_QV=F_QV                 &
1189      &        ,QC_CURR=moist(ims,kms,jms,P_QC), F_QC=F_QC                 &
1190      &        ,QR_CURR=moist(ims,kms,jms,P_QR), F_QR=F_QR                 &
1191      &        ,QI_CURR=moist(ims,kms,jms,P_QI), F_QI=F_QI                 &
1192      &        ,QS_CURR=moist(ims,kms,jms,P_QS), F_QS=F_QS                 &
1193      &        ,QG_CURR=moist(ims,kms,jms,P_QG), F_QG=F_QG                 &
1194      &        ,QNIFA_CURR=scalar(ims,kms,jms,P_QNIFA),F_QNIFA=F_QNIFA     &
1195      &        ,QNWFA_CURR=scalar(ims,kms,jms,P_QNWFA),F_QNWFA=F_QNWFA     &
1196      &        ,QNBCA_CURR=scalar(ims,kms,jms,P_QNBCA),F_QNBCA=F_QNBCA     &
1197      &        ,HOL=HOL, MOL=grid%mol, REGIME=grid%REGIME                  &
1198 !mynn mp@
1199      &        ,QKE=grid%qke, Sh3d=grid%sh3d, Sm3d=grid%sm3d               &
1200      &        ,QKE_ADV=scalar(ims,kms,jms,P_qke_adv)                      & !ACF-QKE advection
1201      &        ,bl_mynn_tkeadvect=config_flags%bl_mynn_tkeadvect           & !ACF-QKE advection
1202      &        ,tsq=grid%tsq, qsq=grid%qsq, cov=grid%cov                   &
1203      &        ,DQKE=grid%dqke,QWT=grid%qWT                                &
1204      &        ,QSHEAR=grid%qSHEAR,QBUOY=grid%qBUOY,QDISS=grid%qDISS       &
1205      &        ,tke_budget=config_flags%tke_budget                         &
1206      &        ,bl_mynn_cloudpdf=config_flags%bl_mynn_cloudpdf             &
1207      &        ,bl_mynn_mixlength=config_flags%bl_mynn_mixlength           &
1208      &        ,icloud_bl=config_flags%icloud_bl                           &
1209      &        ,qc_bl=grid%qc_bl,qi_bl=grid%qi_bl,cldfra_bl=grid%cldfra_bl &
1210      &        ,bl_mynn_edmf=config_flags%bl_mynn_edmf                     &
1211      &        ,bl_mynn_edmf_mom=config_flags%bl_mynn_edmf_mom             &
1212      &        ,bl_mynn_edmf_tke=config_flags%bl_mynn_edmf_tke             &
1213      &        ,bl_mynn_mixscalars=config_flags%bl_mynn_mixscalars         &
1214      &        ,bl_mynn_output=config_flags%bl_mynn_output                 &
1215      &        ,bl_mynn_cloudmix=config_flags%bl_mynn_cloudmix             &
1216      &        ,bl_mynn_mixqt=config_flags%bl_mynn_mixqt                   &
1217      &        ,bl_mynn_closure=config_flags%bl_mynn_closure               &
1218      &        ,edmf_a=grid%edmf_a,edmf_w=grid%edmf_w                      &
1219      &        ,edmf_thl=grid%edmf_thl,edmf_qt=grid%edmf_qt                &
1220      &        ,edmf_ent=grid%edmf_ent,edmf_qc=grid%edmf_qc                &
1221      &        ,sub_thl3D=grid%sub_thl3D,sub_sqv3D=grid%sub_sqv3D          &
1222      &        ,det_thl3D=grid%det_thl3D,det_sqv3D=grid%det_sqv3D          &
1223      &        ,rmol=grid%rmol, ch=grid%ch                                 &
1224      &        ,qcg=grid%qcg, grav_settling=config_flags%grav_settling     &
1225 !    &        ,K_m=grid%K_m, K_h=grid%K_h, K_q=grid%K_q                   &
1226      &        ,vdfg=grid%vdfg,nupdraft=grid%nupdraft,maxMF=grid%maxmf     &
1227      &        ,ktop_plume=grid%ktop_plume                                 &
1228      &        ,spp_pbl=config_flags%spp_pbl                               &
1229      &        ,pattern_spp_pbl=grid%pattern_spp_pbl                       &
1230      &        ,restart=config_flags%restart,cycling=config_flags%cycling  &
1231 !EEPS for ARW
1232      &        ,pek=grid%pek_pbl,pep=grid%pep_pbl                          &
1233      &        ,PEK_ADV=scalar(ims,kms,jms,P_pek_adv)                      &!TKEadvection
1234      &        ,PEP_ADV=scalar(ims,kms,jms,P_pep_adv)                      &!TKEadvection
1235 !GWD for ARW
1236      &        ,GWD_OPT=config_flags%gwd_opt &
1237      &        ,gwd_diags=config_flags%gwd_diags &
1238      &        ,DTAUX3D=grid%dtaux3d,DTAUY3D=grid%dtauy3d &
1239      &        ,DUSFCG=grid%dusfcg,DVSFCG=grid%dvsfcg &
1240      &        ,VAR2D=grid%var2d,OC12D=grid%oc12d     &
1241      &        ,OA1=grid%oa1,OA2=grid%oa2,OA3=grid%oa3,OA4=grid%oa4        &
1242      &        ,OL1=grid%ol1,OL2=grid%ol2,OL3=grid%ol3,OL4=grid%ol4        &
1243      &        ,SINA=grid%sina,COSA=grid%cosa                              &
1244      &        ,dtaux3d_ls=grid%dtaux3d_ls,dtauy3d_ls=grid%dtauy3d_ls      &
1245      &        ,dtaux3d_bl=grid%dtaux3d_bl,dtauy3d_bl=grid%dtauy3d_bl      &
1246      &        ,dtaux3d_ss=grid%dtaux3d_ss,dtauy3d_ss=grid%dtauy3d_ss      &
1247      &        ,dtaux3d_fd=grid%dtaux3d_fd,dtauy3d_fd=grid%dtauy3d_fd      &
1248      &        ,DUSFCG_ls=grid%dusfcg_ls,DVSFCG_ls=grid%dvsfcg_ls &
1249      &        ,DUSFCG_bl=grid%dusfcg_bl,DVSFCG_bl=grid%dvsfcg_bl &
1250      &        ,DUSFCG_ss=grid%dusfcg_ss,DVSFCG_ss=grid%dvsfcg_ss &
1251      &        ,DUSFCG_fd=grid%dusfcg_fd,DVSFCG_fd=grid%dvsfcg_fd &
1252      &        ,VAR2DLS=grid%var2dls,OC12DLS=grid%oc12dls                  &
1253      &        ,OA1LS=grid%oa1ls,OA2LS=grid%oa2ls,OA3LS=grid%oa3ls         &
1254      &        ,OA4LS=grid%oa4ls,OL1LS=grid%ol1ls,OL2LS=grid%ol2ls         &
1255      &        ,OL3LS=grid%ol3ls,OL4LS=grid%ol4ls                          &
1256      &        ,VAR2DSS=grid%var2dss,OC12DSS=grid%oc12dss                  &
1257      &        ,OA1SS=grid%oa1ss,OA2SS=grid%oa2ss,OA3SS=grid%oa3ss         &
1258      &        ,OA4SS=grid%oa4ss,OL1SS=grid%ol1ss,OL2SS=grid%ol2ss         &
1259      &        ,OL3SS=grid%ol3ss,OL4SS=grid%ol4ss                          &
1260      &        ,MFSHCONV=config_flags%mfshconv                             &
1261      &        ,MASSFLUX_EDKF=grid%massflux_EDKF                           & 
1262      &        ,ENTR_EDKF=grid%entr_EDKF, DETR_EDKF=grid%detr_EDKF         &
1263      &        ,THL_UP=grid%thl_up                                         &
1264      &        ,THV_UP=grid%thv_up, RT_UP=grid%rt_up ,RV_UP=grid%rv_up     &
1265      &        ,RC_UP=grid%rc_up, U_UP=grid% u_up, V_UP=grid%v_up          &
1266      &        ,FRAC_UP=grid%frac_up, RC_MF=grid%RC_MF                     &
1267 ! For Wind Turbine Drag Parameterizations
1268      &        ,phb=grid%phb                                               &
1269      &        ,XLAT_U=grid%xlat_u,XLONG_U=grid%xlong_u                    &
1270   ! WRF-Solar EPS: MYNN
1271      &        ,multi_perturb=config_flags%multi_perturb                   &
1272      &        ,pert_mynn=config_flags%pert_mynn                           &
1273      &        ,perts_qvapor=grid%pert3d(:,:,:,P_PQVAPOR)                  &
1274      &        ,perts_qcloud=grid%pert3d(:,:,:,P_PQCLOUD)                  &
1275      &        ,perts_th=grid%pert3d(:,:,:,P_PTH)                          &
1276      &        ,perts_tke=grid%pert3d(:,:,:,P_PTKE)                        &
1277      &        ,pert_mynn_qv=config_flags%pert_mynn_qv                     &
1278      &        ,pert_mynn_qc=config_flags%pert_mynn_qc                     &
1279      &        ,pert_mynn_t=config_flags%pert_mynn_t                       &
1280      &        ,pert_mynn_qke=config_flags%pert_mynn_qke                   &
1281 !Variables required for camuwpbl scheme
1282      &        ,Z_AT_W=grid%z_at_w,CLDFRA_OLD_MP=grid%cldfra_old_mp        &
1283      &        ,CLDFRA=grid%cldfra                                         &
1284      &        ,RTHRATENLW=grid%rthratenlw,TAURESX2D=grid%tauresx2d        &
1285      &        ,TAURESY2D=grid%tauresy2d                                   &
1286      &        ,TPERT2D=grid%tpert2d,QPERT2D=grid%qpert2d                  &
1287      &        ,WPERT2D=grid%wpert2d,WSEDL3D=grid%wsedl3d                  &
1288      &        ,TURBTYPE3D=grid%turbtype3d,SMAW3D=grid%smaw3d              &
1289      &        ,QNC_CURR=scalar(ims,kms,jms,P_QNC), F_QNC=f_qnc            &
1290      &        ,QNI_CURR=scalar(ims,kms,jms,P_QNI), F_QNI=f_qni            &
1291      &        ,RQNIBLTEN=grid%rqniblten                                   &
1292      &        ,XLAT_V=grid%xlat_v,XLONG_V=grid%xlong_v,FNM=grid%fnm       &
1293      &        ,FNP=grid%fnp, IS_CAMMGMP_USED = grid%is_CAMMGMP_used       &
1294 ! for grims shallow convection with ysupbl
1295      &        ,WSTAR=grid%wstar_ysu,DELTA=grid%delta_ysu                  &
1296 ! for pbl mixing of scalars and tracers
1297      &        ,SCALAR=scalar,SCALAR_TEND=scalar_tend,NUM_SCALAR=num_scalar&
1298      &        ,TRACER=tracer,TRACER_TEND=tracer_tend,NUM_TRACER=num_tracer&
1299      &        ,SCALAR_PBLMIX=config_flags%scalar_pblmix                   &
1300      &        ,TRACER_PBLMIX=config_flags%tracer_pblmix                   &
1301 #if (WRF_CHEM == 1)
1302      &        ,mynn_chem_vertmx=config_flags%mynn_chem_vertmx             &
1303      &        ,CHEM=chem,VD=grid%dep_vel                                  &
1304      &        ,NCHEM=num_chem,kdvel=config_flags%kdepvel                  &
1305      &        ,ndvel=config_flags%ndepvel                                 &
1306      &        ,NUM_VERT_MIX=grid%num_vert_mix                             &
1307 #endif
1308      &        ,QNORM=grid%QNORM, fasdas=config_flags%fasdas               & !fasdas
1309      &        )
1311 #if (WRF_CHEM == 1)
1312 #ifdef DM_PARALLEL
1313      IF ( num_chem >= PARAM_FIRST_SCALAR .AND. (config_flags%bl_pbl_physics == &
1314      & mynnpblscheme)  ) then
1315          CALL wrf_debug ( 200 , ' call HALO CHEM AFTER PBL' )
1316          IF      ( config_flags%h_sca_adv_order <= 4 ) THEN
1317 #      include "HALO_EM_CHEM_E_3.inc"
1318          ELSE IF ( config_flags%h_sca_adv_order <= 6 ) THEN
1319 #      include "HALO_EM_CHEM_E_5.inc"
1320          ELSE
1321               WRITE(message,*)'solve_em: invalid h_sca_adv_order = ',&
1322               & config_flags%h_sca_adv_order
1323         ENDIF
1324      ENDIF
1325 #endif
1326 #endif
1328 BENCH_END(pbl_driver_tim)
1330 !*****
1331 ! fire 
1333 ! Jan Mandel's call to SFIRE
1335       IF ((grid%sr_x > 0 .OR. grid%sr_y > 0) .AND. config_flags%ifire == 2) THEN
1337 BENCH_START(fire_driver_tim)
1338         if(config_flags%ifire.eq.2)then 
1339             ! initialization moved to start_em:start_domain_em
1340 !            if(grid%initestep.eq.1) &
1341 !            call fire_driver_em_init (  grid , config_flags    &
1342 !            ,ids,ide, kds,kde, jds,jde                              &
1343 !            ,ims,ime, kms,kme, jms,jme                              &
1344 !            ,ips,ipe, kps,kpe, jps,jpe  )
1345             ! one timestep of the fire model
1346             call fire_driver_em_step (  grid , config_flags    &
1347             ,ids,ide, kds,kde, jds,jde                              &
1348             ,ims,ime, kms,kme, jms,jme                              &
1349             ,ips,ipe, kps,kpe, jps,jpe                              &
1350             ,grid%rho,grid%z_at_w,dz8w)
1351         endif
1353 BENCH_END(fire_driver_tim)
1354        ENDIF
1357 ! cumulus para.
1359       CALL wrf_debug ( 200 , ' call cumulus_driver' )
1361 #if ( WRF_DFI_RADAR == 1 )
1362       do_capsupress=0
1363          if(grid%dfi_stage == DFI_FWD ) do_capsupress=1
1364          if(grid%itimestep <= 31 .and. grid%dfi_stage == DFI_FST ) do_capsupress=1
1365 #endif
1367 BENCH_START(cu_driver_tim)
1368       CALL cumulus_driver(grid                                             &
1369                  ! Prognostic variables
1370      &             ,U=grid%u_phy   ,V=grid%v_phy   ,TH=th_phy  ,T=grid%t_phy                  &
1371      &             ,W=grid%w_2     ,P=grid%p_hyd   ,PI=pi_phy  ,RHO=grid%rho             &
1372                  ! Other arguments
1373      &             ,ITIMESTEP=grid%itimestep ,DT=grid%dt      ,DX=grid%dx              &
1374      &             ,DX2D=grid%dx2d, AREA2D=grid%area2d                                 &
1375      &             ,CUDT=grid%cudt,CURR_SECS=curr_secs,ADAPT_STEP_FLAG=adapt_step_flag &
1376      &             ,CCLDFRA=grid%ccldfra     ,CONVCLD=grid%convcld                     &
1377      &             ,QCCONV=grid%qcconv     ,QICONV=grid%qiconv                         &
1378      &             ,CUDTACTTIME=grid%cudtacttime                                       & 
1379      &             ,RAINC=grid%rainc   ,RAINCV=grid%raincv   ,PRATEC=grid%pratec       &
1380      &             ,NCA=grid%nca                                                       &
1381      &             ,CLDFRA_DP=grid%cldfra_dp  ,CLDFRA_SH=grid%cldfra_sh                &
1382      &             ,QC_CU=grid%QC_CU, QI_CU=grid%QI_CU, QR_CU=grid%QR_CU, QS_CU=grid%QS_CU &
1383      &             ,NC_CU=grid%NC_CU, NI_CU=grid%NI_CU, NR_CU=grid%NR_CU, NS_CU=grid%NS_CU &
1384      &             ,CCN_CU=grid%CCN_CU, CU_UAF=grid%CU_UAF                                 &
1385      &             ,UDR_KF=grid%udr_kf,DDR_KF=grid%ddr_kf                              & ! kf_edrates
1386      &             ,UER_KF=grid%uer_kf,DER_KF=grid%der_kf,TIMEC_KF=grid%timec_kf       &
1387      &             ,KF_EDRATES=config_flags%kf_edrates                                 &
1388      &             ,HTOP=grid%cutop     ,HBOT=grid%cubot       ,KPBL=grid%kpbl         &
1389      &             ,Z=grid%z ,Z_AT_W=grid%z_at_w ,MAVAIL=grid%mavail ,PBLH=grid%pblh   &
1390      &             ,HPBL_HOLD=hpbl_hold                                                &
1391      &             ,DZ8W=dz8w     ,P8W=grid%p_hyd_w, PSFC=grid%psfc, TSK=grid%tsk      &
1392      &             ,TKE_PBL=grid%tke_pbl, UST=grid%ust                                 &
1393      &             ,W0AVG=grid%w0avg   ,STEPCU=grid%stepcu                             &
1394      &             ,CLDEFI=grid%cldefi ,LOWLYR=grid%lowlyr ,XLAND=grid%xland           &
1395      &             ,APR_GR=grid%apr_gr ,APR_W=grid%apr_w   ,APR_MC=grid%apr_mc         &
1396      &             ,APR_ST=grid%apr_st ,APR_AS=grid%apr_as ,APR_CAPMA=grid%apr_capma   &
1397      &             ,APR_CAPME=grid%apr_capme          ,APR_CAPMI=grid%apr_capmi     &
1398      &             ,MASS_FLUX=grid%mass_flux          ,XF_ENS=grid%xf_ens           &
1399      &             ,PR_ENS=grid%pr_ens ,HT=grid%ht,EDT_OUT=grid%edt_out             &
1400      &             ,imomentum=grid%imomentum,clos_choice=grid%clos_choice           &
1401      &             ,ishallow=config_flags%ishallow                                  &
1402      &             ,cugd_tten=grid%cugd_tten,cugd_qvten=grid%cugd_qvten,cugd_qcten=grid%cugd_qcten   &
1403      &             ,cugd_ttens=grid%cugd_ttens,cugd_qvtens=grid%cugd_qvtens   &
1404      &             ,ENSDIM=config_flags%ensdim ,MAXIENS=config_flags%maxiens ,MAXENS=config_flags%maxens         &
1405      &             ,MAXENS2=config_flags%maxens2 ,MAXENS3=config_flags%maxens3       &
1406      &             ,CU_ACT_FLAG=cu_act_flag   ,WARM_RAIN=grid%warm_rain   &
1407      &             ,HFX=grid%hfx, QFX=grid%qfx                            &
1408      &             ,CLDFRA=grid%cldfra,CLDFRA_MP_ALL=grid%cldfra_mp_all  &
1409      &             ,TPERT2D=grid%tpert2d                                 &
1410      &             ,GSW=grid%gsw,cugd_avedx=config_flags%cugd_avedx       &
1411      !BSINGH - For WRFCuP scheme
1412      &             ,AKPBL=grid%akpbl,BR=grid%br, REGIME=grid%regime, T2=grid%t2, Q2=grid%q2   & !CuP, wig 3-Aug-2006
1413      &             ,SLOPESFC=grid%slopeSfc, SLOPEEZ=grid%slopeEZ                    & !CuP, wig 7-Aug-2006
1414      &             ,SIGMASFC=grid%sigmaSfc, SIGMAEZ=grid%sigmaEZ                    & !CuP, wig 7-Aug-2006
1415      &             ,CUPFLAG=grid%cupflag                                       & !CuP, wig 9-Oct-2006
1416      &             ,CLDFRA_CUP=grid%cldfra_cup, CLDFRATEND_CUP=grid%cldfratend_cup  & !CuP, wig 18-Sep-2006
1417      &             ,SHALL=grid%shall, TAUCLOUD=grid%taucloud, TACTIVE=grid%tactive       & !CuP, wig 18-Sep-2006
1418      &             ,TSTAR=grid%tstar, LNTERMS=grid%lnterms, LNINT=grid%lnint             & !CuP, wig 4-Oct-2006
1419      &             ,ACTIVEFRAC=grid%activeFrac                                 & !CuP, lkb
1420      &             ,NUMBINS=config_flags%numBins                               & !CuP, wig
1421      &             ,THBINSIZE=config_flags%thBinSize                           & !CuP, wig
1422      &             ,RBINSIZE=config_flags%rBinSize                             & !CuP, wig
1423      &             ,MINDEEPFREQ=config_flags%minDeepFreq                       & !CuP, wig
1424      &             ,MINSHALLOWFREQ=config_flags%minShallowFreq                 & !CuP, wig
1425      &             ,WCLOUDBASE=grid%wCloudBase                                 & !CuP, lkb
1426      &             ,WACT_CUP=grid%wact_cup                                     & !CuP, rce 25-aug-2011
1427      &             ,WULCL_CUP=grid%wulcl_cup                                   & !CuP, rce 23-jan-2012
1428      &             ,WUP_CUP=grid%wup_cup                                       & !CuP, rce 15-mar-2013 !BSINGH(12/05/2013)
1429      &             ,QC_IC_CUP=grid%qc_ic_cup                                   & !CuP, rce 29-aug-2011
1430      &             ,QNDROP_IC_CUP=grid%qndrop_ic_cup                           & !CuP, rce 29-aug-2011
1431      &             ,QC_IU_CUP=grid%qc_iu_cup                                   & !CuP, rce 08-feb-2012
1432      &             ,FCVT_QC_TO_PR_CUP=grid%fcvt_qc_to_pr_cup                   & !CuP, rce 12-apr-2012
1433      &             ,FCVT_QC_TO_QI_CUP=grid%fcvt_qc_to_qi_cup                   & !CuP, rce 12-apr-2012
1434      &             ,FCVT_QI_TO_PR_CUP=grid%fcvt_qi_to_pr_cup                   & !CuP, rce 12-apr-2012
1435      &             ,MFUP_CUP=grid%mfup_cup                                     & !CuP, rce 23-jan-2012
1436      &             ,MFUP_ENT_CUP=grid%mfup_ent_cup                             & !CuP, rce 23-jan-2012
1437      &             ,MFDN_CUP=grid%mfdn_cup                                     & !CuP, rce 12-apr-2012
1438      &             ,MFDN_ENT_CUP=grid%mfdn_ent_cup                             & !CuP, rce 12-apr-2012
1439      &             ,UPDFRA_CUP=grid%updfra_cup                                 & !CuP, rce 23-jan-2012
1440      &             ,TCLOUD_CUP=grid%tcloud_cup                                 & !CuP, rce 06-feb-2012
1441      !BSINGH -ENDS
1442      &             ,k22_shallow=grid%k22_shallow,kbcon_shallow=grid%kbcon_shallow &
1443      &             ,ktop_shallow=grid%ktop_shallow,xmb_shallow=grid%xmb_shallow   &
1444      &             ,ktop_deep=grid%ktop_deep                              &
1445      &             ,PERIODIC_X=(config_flags%polar .OR. config_flags%periodic_x)  &
1446      &             ,PERIODIC_Y=config_flags%periodic_y                    &
1447      &             ,IS_CAMMGMP_USED = grid%is_CAMMGMP_used  & !BSINGH - TKE at the interfaces for Zhang-McFarlane Scheme 
1448                  ! Zhang-McFarlane outputs
1449      &             ,EVAPCDP3D=grid%evapcdp3d, ICWMRDP3D=grid%icwmrdp3d    & !Balwinder.Singh@pnnl.gov: For CAM's wetscavenging
1450      &             ,RPRDDP3D=grid%rprddp3d                                & 
1451      &             ,CAPE=grid%cape ,ZMMU=grid%zmmu ,ZMMD=grid%zmmd        &
1452      &             ,ZMDT=grid%zmdt ,ZMDQ=grid%zmdq                        &
1453      &             ,DLF=grid%dlf, RLIQ=grid%rliq                          &
1454      &             ,PCONVB=grid%pconvb, PCONVT=grid%pconvt                &
1455      &             ,EVAPTZM=grid%evaptzm, FZSNTZM=grid%fzsntzm, EVSNTZM=grid%evsntzm     &
1456      &             ,EVAPQZM=grid%evapqzm, ZMFLXPRC=grid%zmflxprc          &
1457      &             ,ZMFLXSNW=grid%zmflxsnw, ZMNTPRPD=grid%zmntprpd        &
1458      &             ,ZMNTSNPD=grid%zmntsnpd, ZMEIHEAT=grid%zmeiheat        &
1459      &             ,CMFMC=grid%cmfmc, CMFMCDZM=grid%cmfmcdzm              &
1460      &             ,PRECCDZM=grid%preccdzm, PRECZ=grid%precz              &
1461      &             ,ZMMTU=grid%zmmtu, ZMMTV=grid%zmmtv  &
1462      &             ,ZMUPGU=grid%zmupgu, ZMUPGD=grid%zmupgd                &
1463      &             ,ZMVPGU=grid%zmvpgu, ZMVPGD=grid%zmvpgd                &
1464      &             ,ZMICUU=grid%zmicuu, ZMICUD=grid%zmicud                &
1465      &             ,ZMICVU=grid%zmicvu, ZMICVD=grid%zmicvd                &
1466      &             ,ZMDICE=grid%zmdice, ZMDLIQ=grid%zmdliq                &
1467      &             ,dp3d=grid%dp3d, du3d=grid%du3d, ed3d=grid%ed3d        &
1468      &             ,eu3d=grid%eu3d, md3d=grid%md3d, mu3d=grid%mu3d        &
1469      &             ,dsubcld2d=grid%dsubcld2d,ideep2d=grid%ideep2d         &
1470      &             ,jt2d=grid%jt2d,maxg2d=grid%maxg2d                     &
1471      &             ,lengath2d=grid%lengath2d                              &
1472                  ! Selection flag
1473      &             ,pgcon=config_flags%sas_pgcon                          &
1474      &             ,BMJ_RAD_FEEDBACK=config_flags%bmj_rad_feedback        &
1475      &             ,CU_PHYSICS=config_flags%cu_physics                    &
1476      &             ,BL_PBL_PHYSICS=config_flags%bl_pbl_physics            &
1477      &             ,SF_SFCLAY_PHYSICS=config_flags%sf_sfclay_physics      &
1478      !BSINGH - For WRFCuP scheme
1479      &             ,SHCU_AEROSOLS_OPT=config_flags%shcu_aerosols_opt           & !CuP, rce 22-aug-2011
1480      !BSINGH -ENDS
1481      &             ,KFETA_TRIGGER=config_flags%kfeta_trigger              &
1482      &             ,NSAS_DX_FACTOR=config_flags%nsas_dx_factor            &
1483                  ! Dimension arguments
1484      &             ,IDS=ids,IDE=ide, JDS=jds,JDE=jde, KDS=kds,KDE=kde     &
1485      &             ,IMS=ims,IME=ime, JMS=jms,JME=jme, KMS=kms,KME=kme     &
1486      &             ,IPS=ips,IPE=ipe, JPS=jps,JPE=jpe, KPS=kps,KPE=kpe     &
1487      &             ,I_START=grid%i_start,I_END=min(grid%i_end, ide-1)     &
1488      &             ,J_START=grid%j_start,J_END=min(grid%j_end, jde-1)     &
1489      &             ,KTS=k_start, KTE=min(k_end,kde-1)                     &
1490      &             ,NUM_TILES=grid%num_tiles                              &
1491                  ! Moisture tendency arguments
1492      &             ,RQVCUTEN=grid%rqvcuten , RQCCUTEN=grid%rqccuten       &
1493      &             ,RQSCUTEN=grid%rqscuten , RQICUTEN=grid%rqicuten       &
1494      &             ,RQRCUTEN=grid%rqrcuten , RQCNCUTEN=grid%rqcncuten     &
1495      &             ,RQINCUTEN=grid%rqincuten                              &
1496      &             ,RQVBLTEN=grid%rqvblten , RQVFTEN=grid%rqvften         &
1497                  ! Other tendency arguments
1498      &             ,RTHRATEN=grid%rthraten , RTHBLTEN=grid%rthblten       &
1499      &             ,RUCUTEN=grid%rucuten   , RVCUTEN=grid%rvcuten         &
1500      &             ,RTHCUTEN=grid%rthcuten , RTHFTEN=grid%rthften         &
1501                  ! Moisture tracer arguments
1502      &             ,QV_CURR=moist(ims,kms,jms,P_QV), F_QV=F_QV            &
1503      &             ,QC_CURR=moist(ims,kms,jms,P_QC), F_QC=F_QC            &
1504      &             ,QR_CURR=moist(ims,kms,jms,P_QR), F_QR=F_QR            &
1505      &             ,QI_CURR=moist(ims,kms,jms,P_QI), F_QI=F_QI            &
1506      &             ,QS_CURR=moist(ims,kms,jms,P_QS), F_QS=F_QS            &
1507      &             ,QG_CURR=moist(ims,kms,jms,P_QG), F_QG=F_QG            &
1508      &             ,ZOL=grid%ZOL                                          & !ckay
1509 ! Variables for Tiedtke and NSAS schemes
1510      &             ,ZNU=grid%znu                                          &
1511      &             ,MP_PHYSICS=config_flags%mp_physics                    &
1512      &             ,GD_CLOUD=grid%GD_CLOUD,GD_CLOUD2=grid%GD_CLOUD2       &
1513 #if (WRF_CHEM == 1)
1514      &             ,CHEM_OPT=config_flags%chem_opt                             & !CuP, rce 22-aug-2011 !BSINGH - For WRFCuP scheme
1515      &             ,CONV_TR_WETSCAV=config_flags%conv_tr_wetscav          &
1516      &             ,CONV_TR_AQCHEM=config_flags%conv_tr_aqchem            &
1517      &             ,CHEM_CONV_TR=config_flags%chem_conv_tr                &
1518      &             ,TRACEROPT=config_flags%tracer_opt                     &
1519 #endif
1521 #if ( WRF_DFI_RADAR == 1 )
1522      &             ,DO_CAPSUPPRESS=do_capsupress                          &
1523 #endif
1524      &             ,cfu1=grid%cfu1,cfd1=grid%cfd1,dfu1=grid%dfu1,efu1=grid%efu1,dfd1=grid%dfd1,efd1=grid%efd1,f_flux=l_flux &
1525                    ,alevsiz_cu=grid%alevsiz_cu,num_months=grid%num_months               &
1526                    ,no_src_types_cu=grid%no_src_types_cu                                &
1527                    ,aercu_opt=config_flags%aercu_opt                                    &
1528                    ,aercu_fct=config_flags%aercu_fct                                    &
1529                    ,aeromcu=grid%aeromcu,aerocu=aerocu(:,:,:,P_cu_sulfate:P_cu_phibcar) &
1530                    ,aeropcu=grid%aeropcu,ID=grid%id                                     &
1531                    ,JULDAY=grid%julday, JULIAN=grid%julian                              &
1532                    ,aerovar=grid%aerovar,EFCS=grid%EFCS,EFIS=grid%EFIS,EFSS=grid%EFSS)
1533 BENCH_END(cu_driver_tim)
1535 ! this for calculating (G3 scheme only)  time averaged variables for online (WRF-CHem) or offline (other models) chem runs
1537      if(config_flags%cu_diag.eq.1)then
1538       !$OMP PARALLEL DO   &
1539       !$OMP PRIVATE ( ij )
1540       DO ij = 1 , grid%num_tiles
1541            call convtrans_prep(grid%gd_cloud,grid%gd_cloud2,grid%gd_cloud_a,&
1542      &          grid%QC_CU,grid%raincv,grid%raincv_a,grid%raincv_b,     &
1543      &          grid%gd_cldfr,moist,p_QV,p_QC,p_qi,T_PHY,P_PHY,num_moist,    &
1544      &          grid%gd_cloud2_a,grid%QI_CU,grid%convtrans_avglen_m,&
1545      &          adapt_step_flag,curr_secs,                &
1546      &          grid%itimestep,grid%dt,                                      &
1547      &          config_flags%cu_physics,                                     &
1548      &          ids,ide, jds,jde, kds,kde,                                   &
1549      &          ims,ime, jms,jme, kms,kme                                    &
1550      &          ,ITS=grid%i_start(ij),ITE=min(grid%i_end(ij), ide-1)                 &
1551      &          ,JTS=grid%j_start(ij),JTE=min(grid%j_end(ij), jde-1)                 &
1552      &          ,KTS=k_start, KTE=min(k_end,kde-1))
1553       ENDDO
1554       !$OMP END PARALLEL DO
1555      endif
1557 ! shallow cumulus parameterization
1558       CALL wrf_debug ( 200 , ' call shallow_cumulus_driver' )
1560 BENCH_START(shcu_driver_tim)
1561       CALL shallowcu_driver(                                              &
1562      &              IDS=ids,IDE=ide, JDS=jds,JDE=jde, KDS=kds,KDE=kde     &
1563      &             ,IMS=ims,IME=ime, JMS=jms,JME=jme, KMS=kms,KME=kme     &
1564      &             ,IPS=ips,IPE=ipe, JPS=jps,JPE=jpe, KPS=kps,KPE=kpe     &
1565      &             ,I_START=grid%i_start, I_END=min(grid%i_end, ide-1)    &
1566      &             ,J_START=grid%j_start, J_END=min(grid%j_end, jde-1)    &
1567      &             ,KTS=k_start, KTE=min(k_end, kde-1)                    &
1568      &             ,NUM_TILES=grid%num_tiles                              &
1569      &             ,U=grid%u_phy, V=grid%v_phy, TH=th_phy, T=t_phy        &
1570      &             ,P=grid%p_hyd, PI=pi_phy, RHO=grid%rho, MOIST=moist    &
1571      &             ,NUM_MOIST=num_moist                                   &
1572      &             ,ITIMESTEP=grid%itimestep, DT=grid%dt, DX=grid%dx      &
1573      &             ,DX2D=grid%dx2d, AREA2D=grid%area2d                    &
1574      &             ,CUDT=grid%cudt                                        &
1575      &             ,CURR_SECS=curr_secs, ADAPT_STEP_FLAG=adapt_step_flag  &
1576      &             ,RAINSH=grid%rainsh, PRATESH=grid%pratesh, NCA=grid%nca&
1577      &             ,RAINSHV=grid%rainshv                                  &
1578      &             ,Z=grid%z, Z_AT_W=grid%z_at_w, DZ8W=dz8w               &
1579      &             ,MAVAIL=grid%mavail, PBLH=grid%pblh, P8W=grid%p_hyd_w  &
1580      &             ,TKE_PBL=grid%tke_pbl                                  &
1581      &             ,CLDFRA=grid%cldfra, CLDFRA_OLD=grid%cldfra_old        &
1582      &             ,CLDFRA_OLD_MP=grid%cldfra_old_mp                      &
1583      &             ,CLDFRA_CONV=grid%cldfra_conv                          &
1584      &             ,CLDFRASH=grid%cldfrash, HTOP=grid%htop, HBOT=grid%hbot&
1585      &             ,SHCU_PHYSICS=grid%shcu_physics                        &
1586      &             ,QV_CURR=moist(ims,kms,jms,P_QV)                       &
1587      &             ,QC_CURR=moist(ims,kms,jms,P_QC)                       &
1588      &             ,QR_CURR=moist(ims,kms,jms,P_QR)                       &
1589      &             ,QI_CURR=moist(ims,kms,jms,P_QI)                       &
1590      &             ,QS_CURR=moist(ims,kms,jms,P_QS)                       &
1591      &             ,QG_CURR=moist(ims,kms,jms,P_QG)                       &
1592      &             ,QNC_CURR=scalar(ims,kms,jms,P_QNC)                    & !BSINGH - Neede for UWSHCU scheme
1593      &             ,QNI_CURR=scalar(ims,kms,jms,P_QNI)                    & !BSINGH - Neede for UWSHCU schem 
1594 #if (WRF_CHEM == 1)
1595      &             ,CHEM=chem,chem_opt=config_flags%chem_opt              &
1596 #endif
1597      &             ,DLF=grid%dlf, RLIQ=grid%rliq, RLIQ2=grid%rliq2        &
1598      &             ,DLF2=grid%dlf2                                        & ! Required for CAMMGMP microphysics scheme
1599      &             ,CMFMC=grid%cmfmc, CMFMC2=grid%cmfmc2                  &
1600      &             ,CUSH=grid%cush, SNOWSH=grid%snowsh                    &
1601      &             ,ICWMRSH=grid%icwmrsh, RPRDSH=grid%rprdsh              &
1602      &             ,CBMF=grid%cbmf_cu, CMFSL=grid%cmfsl, CMFLQ=grid%cmflq &
1603      &             ,EVAPCSH=grid%evapcsh                                  &
1604      &             ,RQVSHTEN=grid%rqvshten, RQCSHTEN=grid%rqcshten        &
1605      &             ,RQRSHTEN=grid%rqrshten, RQISHTEN=grid%rqishten        &
1606      &             ,RQSSHTEN=grid%rqsshten, RQGSHTEN=grid%rqgshten        &
1607      &             ,RQCNSHTEN=grid%rqcnshten, RQINSHTEN=grid%rqinshten    &  
1608      &             ,RQVBLTEN=grid%rqvblten, RQVFTEN=grid%rqvften          &
1609      &             ,RUSHTEN=grid%rushten, RVSHTEN=grid%rvshten            &
1610      &             ,RTHSHTEN=grid%rthshten, RTHRATEN=grid%rthraten        &
1611      &             ,RTHBLTEN=grid%rthblten, RTHFTEN=grid%rthften          &
1612      &             ,F_QV=f_qv,F_QC=f_qc,F_QR=f_qr                         &
1613      &             ,F_QI=f_qi,F_QS=f_qs,F_QG=f_qg                         &
1614      &             ,HT=grid%ht                                            &
1615      &             ,SHFRC3D=grid%shfrc3d                                  & !Balwinder.Singh@pnnl.gov: For CAM's wetscavenging
1616      &             ,IS_CAMMGMP_USED = grid%is_CAMMGMP_used                &
1617      &             ,WSTAR=grid%wstar_ysu,DELTA=grid%delta_ysu             &
1618      &             ,KPBL=grid%kpbl,ZNU=grid%znu                           &
1619      &             ,RAINCV=grid%raincv                                    &
1620      &             ,W=grid%w_2 ,XLAND=grid%xland                          &
1621      &             ,HFX=grid%hfx, QFX=grid%qfx                            &
1622      &             ,MP_PHYSICS=config_flags%mp_physics                    &
1623      &             ,pgcon=config_flags%sas_pgcon                          &
1624      &             ,RDCASHTEN=grid%RDCASHTEN, RQCDCSHTEN=grid%RQCDCSHTEN  & ! Deng sh
1625      &             ,W0AVG=grid%W0AVG                                      &
1626      &             ,clddpthb=grid%clddpthb, cldtopb=grid%cldtopb          &
1627      &             ,cldareaa=grid%cldareaa, cldareab=grid%cldareab        &
1628      &             ,cldliqa=grid%cldliqa, cldliqb=grid%cldliqb            &
1629      &             ,cldfra_sh=grid%cldfra_sh,ca_rad=grid%ca_rad,  cw_rad=grid%cw_rad                &
1630      &             ,wub=grid%wub, pblmax=grid%pblmax, xlong=grid%xlong    &
1631      &             ,rainshvb=grid%rainshvb, capesave=grid%capesave        &
1632      &             ,radsave=grid%radsave, ainckfsa=grid%ainckfsa          &
1633      &             ,ltopb=grid%ltopb, kdcldtop=grid%kdcldtop              &
1634      &             ,kdcldbas=grid%kdcldbas                                &
1635      &             ,el_pbl=grid%el_pbl                                    &
1636      &             ,rthratenlw=grid%rthratenlw, rthratensw=grid%rthratensw & 
1637      &             ,exch_h=grid%exch_h                                    &
1638      &             ,dnw=grid%dnw, XTIME=grid%XTIME, XTIME1=grid%XTIME1    &
1639      &             ,GMT=grid%gmt                                          &
1640      &             ,qke=grid%qke                                          &
1641      &             ,PBLHAVG=grid%PBLHAVG, TKEAVG=grid%TKEAVG              &
1642      &             ,BL_PBL_PHYSICS=config_flags%bl_pbl_physics            &
1643   ! WRF-Solar EPS
1644      &             ,multi_perturb=config_flags%multi_perturb              & 
1645      &             ,pert_deng=config_flags%pert_deng                      &
1646      &             ,perts_qvapor=grid%pert3d(:,:,:,P_PQVAPOR)             &
1647      &             ,perts_qcloud=grid%pert3d(:,:,:,P_PQCLOUD)             &
1648      &             ,perts_th=grid%pert3d(:,:,:,P_PTH)                     &
1649      &             ,perts_w=grid%pert3d(:,:,:,P_PW)                       &
1650      &             ,pert_deng_qv=config_flags%pert_deng_qv                &
1651      &             ,pert_deng_qc=config_flags%pert_deng_qc                &
1652      &             ,pert_deng_t=config_flags%pert_deng_t                  &
1653      &             ,pert_deng_w=config_flags%pert_deng_w                  &
1654      &                                                                    )
1656 #if (WRF_CHEM == 1)
1657 #ifdef DM_PARALLEL
1658       IF( config_flags%shcu_physics == CAMUWSHCUSCHEME ) THEN
1659          CALL wrf_debug ( 200 , ' call HALO CHEM AFTER SHALLOW CUMULUS' )
1660          IF      ( config_flags%h_sca_adv_order <= 4 ) THEN
1661 #      include "HALO_EM_CHEM_E_3.inc"
1662          ELSE IF ( config_flags%h_sca_adv_order <= 6 ) THEN
1663 #      include "HALO_EM_CHEM_E_5.inc"
1664          ELSE
1665             WRITE(message,*)'module_first_rk_step_part1: invalid h_sca_adv_order = ',config_flags%h_sca_adv_order
1666             CALL wrf_error_fatal(TRIM(message))
1667          ENDIF
1668       ENDIF
1669 #endif
1670 #endif
1671 BENCH_END(shcu_driver_tim)
1673 ! JPH call force_scm to update bl tendencies
1674       CALL force_scm(itimestep=grid%itimestep,dt=grid%dt                  &
1675      &             ,scm_force=config_flags%scm_force                      &
1676      &             ,dx=config_flags%scm_force_dx                          &
1677      &             ,num_force_layers=grid%num_force_layers                &
1678      &             ,scm_th_adv=config_flags%scm_th_adv                    &
1679      &             ,scm_qv_adv=config_flags%scm_qv_adv                    &
1680      &             ,scm_ql_adv=config_flags%scm_ql_adv                    &
1681      &             ,scm_wind_adv=config_flags%scm_wind_adv                &
1682      &             ,scm_vert_adv=config_flags%scm_vert_adv                &
1683      &             ,scm_th_t_tend=config_flags%scm_th_t_tend              &
1684      &             ,scm_qv_t_tend=config_flags%scm_qv_t_tend              &
1685      &             ,scm_soilT_force=config_flags%scm_soilT_force          &
1686      &             ,scm_soilQ_force=config_flags%scm_soilQ_force          &
1687      &      ,scm_force_th_largescale=config_flags%scm_force_th_largescale &
1688      &      ,scm_force_qv_largescale=config_flags%scm_force_qv_largescale &
1689      &      ,scm_force_ql_largescale=config_flags%scm_force_ql_largescale &
1690      &      ,scm_force_wind_largescale=config_flags%scm_force_wind_largescale &
1691      &             ,u_base=grid%u_base,v_base=grid%v_base                 &
1692      &             ,z_base=grid%z_base                                    &
1693      &             ,z_force=grid%z_force,z_force_tend=grid%z_force_tend   &
1694      &             ,u_g=grid%u_g,v_g=grid%v_g                             &
1695      &             ,u_g_tend=grid%u_g_tend,v_g_tend=grid%v_g_tend         &
1696      &             ,w_subs=grid%w_subs, w_subs_tend=grid%w_subs_tend      &
1697      &             ,th_upstream_x=grid%th_upstream_x                      &
1698      &             ,th_upstream_x_tend=grid%th_upstream_x_tend            &
1699      &             ,th_upstream_y=grid%th_upstream_y                      &
1700      &             ,th_upstream_y_tend=grid%th_upstream_y_tend            &
1701      &             ,qv_upstream_x=grid%qv_upstream_x                      &
1702      &             ,qv_upstream_x_tend=grid%qv_upstream_x_tend            &
1703      &             ,qv_upstream_y=grid%qv_upstream_y                      &
1704      &             ,qv_upstream_y_tend=grid%qv_upstream_y_tend            &
1705      &             ,ql_upstream_x=grid%ql_upstream_x                      &
1706      &             ,ql_upstream_x_tend=grid%ql_upstream_x_tend            &
1707      &             ,ql_upstream_y=grid%ql_upstream_y                      &
1708      &             ,ql_upstream_y_tend=grid%ql_upstream_y_tend            &
1709      &             ,u_upstream_x=grid%u_upstream_x                        &
1710      &             ,u_upstream_x_tend=grid%u_upstream_x_tend              &
1711      &             ,u_upstream_y=grid%u_upstream_y                        &
1712      &             ,u_upstream_y_tend=grid%u_upstream_y_tend              &
1713      &             ,v_upstream_x=grid%v_upstream_x                        &
1714      &             ,v_upstream_x_tend=grid%v_upstream_x_tend              &
1715      &             ,v_upstream_y=grid%v_upstream_y                        &
1716      &             ,v_upstream_y_tend=grid%v_upstream_y_tend              &
1717      &             ,th_t_tend=grid%th_t_tend                              &
1718      &             ,qv_t_tend=grid%qv_t_tend                              &
1719      &             ,tau_x=grid%tau_x                                      &
1720      &             ,tau_x_tend=grid%tau_x_tend                            &
1721      &             ,tau_y=grid%tau_y                                      &
1722      &             ,tau_y_tend=grid%tau_y_tend                            &
1723      &             ,th_largescale=grid%th_largescale                      &
1724      &             ,th_largescale_tend=grid%th_largescale_tend            &
1725      &             ,qv_largescale=grid%qv_largescale                      &
1726      &             ,qv_largescale_tend=grid%qv_largescale_tend            &
1727      &             ,ql_largescale=grid%ql_largescale                      &
1728      &             ,ql_largescale_tend=grid%ql_largescale_tend            &
1729      &             ,u_largescale=grid%u_largescale                      &
1730      &             ,u_largescale_tend=grid%u_largescale_tend            &
1731      &             ,v_largescale=grid%v_largescale                      &
1732      &             ,v_largescale_tend=grid%v_largescale_tend            &
1733      &             ,tau_largescale=grid%tau_largescale                    &
1734      &             ,tau_largescale_tend=grid%tau_largescale_tend          &
1735      &             ,num_force_soil_layers=config_flags%num_force_soil_layers &
1736      &             ,num_soil_layers=config_flags%num_soil_layers          &
1737      &             ,soil_depth_force=grid%soil_depth_force                &
1738      &             ,zs=grid%zs                                            &
1739      &             ,tslb=grid%tslb,smois=grid%smois                       &
1740      &             ,t_soil_forcing_val=grid%t_soil_forcing_val            &
1741      &             ,t_soil_forcing_tend=grid%t_soil_forcing_tend          &
1742      &             ,q_soil_forcing_val=grid%q_soil_forcing_val            &
1743      &             ,q_soil_forcing_tend=grid%q_soil_forcing_tend          &
1744      &             ,tau_soil=grid%tau_soil                                &
1745      &             ,z=grid%z,z_at_w=grid%z_at_w                           &
1746      &             ,th=th_phy, qv=moist(ims,kms,jms,P_QV)                 &
1747      &             ,ql=moist(ims,kms,jms,P_QC)                            &
1748      &             ,u=grid%u_phy, v=grid%v_phy                                      &
1749      &             ,thten=grid%rthblten, qvten=grid%rqvblten              &
1750      &             ,qlten=grid%rqcblten                                   &
1751      &             ,uten=grid%rublten, vten=grid%rvblten                  &
1752      &             ,IDS=ids,IDE=ide, JDS=jds,JDE=jde, KDS=kds,KDE=kde     &
1753      &             ,IMS=ims,IME=ime, JMS=jms,JME=jme, KMS=kms,KME=kme     &
1754      &             ,IPS=ips,IPE=ipe, JPS=jps,JPE=jpe, KPS=kps,KPE=kpe     &
1755      &             ,KTS=k_start, KTE=min(k_end,kde-1)                     &
1756      &              )
1758 #ifdef DM_PARALLEL
1759 #     include "HALO_EM_FDDA_SFC.inc"
1760 #endif
1761       CALL wrf_debug ( 200 , ' call fddagd_driver' )
1763 BENCH_START(fdda_driver_tim)
1764       CALL fddagd_driver(itimestep=grid%itimestep,dt=grid%dt,xtime=grid%XTIME,      &
1765                   id=grid%id,                                                       &
1766                   RUNDGDTEN=grid%rundgdten,RVNDGDTEN=grid%rvndgdten,                &
1767                   RTHNDGDTEN=grid%rthndgdten,RPHNDGDTEN=grid%rphndgdten,            &
1768                   RQVNDGDTEN=grid%rqvndgdten,RMUNDGDTEN=grid%rmundgdten,            &
1770 ! FASDAS
1772                   SDA_HFX=grid%SDA_HFX, SDA_QFX=grid%SDA_QFX,      &
1773                   HFX_FDDA=grid%HFX_FDDA,  & 
1775 ! END FASDAS
1777                   u_ndg_old=fdda3d(ims,kms,jms,P_u_ndg_old),                        &
1778                   v_ndg_old=fdda3d(ims,kms,jms,P_v_ndg_old),                        &
1779                   t_ndg_old=fdda3d(ims,kms,jms,P_t_ndg_old),                        &
1780                   ph_ndg_old=fdda3d(ims,kms,jms,P_ph_ndg_old),                      &
1781                   q_ndg_old=fdda3d(ims,kms,jms,P_q_ndg_old),                        &
1782                   mu_ndg_old=fdda2d(ims,1,jms,P_mu_ndg_old),                        &
1783                   u_ndg_new=fdda3d(ims,kms,jms,P_u_ndg_new),                        &
1784                   v_ndg_new=fdda3d(ims,kms,jms,P_v_ndg_new),                        &
1785                   t_ndg_new=fdda3d(ims,kms,jms,P_t_ndg_new),                        &
1786                   ph_ndg_new=fdda3d(ims,kms,jms,P_ph_ndg_new),                      &
1787                   q_ndg_new=fdda3d(ims,kms,jms,P_q_ndg_new),                        &
1788                   mu_ndg_new=fdda2d(ims,1,jms,P_mu_ndg_new),                        &
1789                   u3d=grid%u_2,v3d=grid%v_2,th_phy=th_phy,                          &
1790                   ph=grid%ph_2,rho=grid%rho,moist=moist,                            &
1791                   p_phy=p_phy,pi_phy=pi_phy,p8w=p8w,t_phy=grid%t_phy,               &
1792                   dz8w=dz8w,z=grid%z,z_at_w=grid%z_at_w,                            &
1793                   grid=grid,config_flags=config_flags,dx=grid%DX,n_moist=num_moist, &
1794                   STEPFG=grid%STEPFG,                                               &
1795                   pblh=grid%pblh,ht=grid%ht,REGIME=grid%regime,ZNT=grid%znt         &
1796                    ,IDS=ids,IDE=ide, JDS=jds,JDE=jde, KDS=kds,KDE=kde               &
1797                    ,IMS=ims,IME=ime, JMS=jms,JME=jme, KMS=kms,KME=kme               &
1798                    ,I_START=grid%i_start,I_END=min(grid%i_end, ide-1)               &
1799                    ,J_START=grid%j_start,J_END=min(grid%j_end, jde-1)               &
1800                    ,KTS=k_start, KTE=min(k_end,kde-1)                               &
1801                    , num_tiles=grid%num_tiles,                                      &
1802                    u10=grid%u10, v10=grid%v10, th2=grid%th2, q2=grid%q2,            &
1803                    u10_ndg_old=grid%u10_ndg_old,                    &
1804                    v10_ndg_old=grid%v10_ndg_old,                    &
1805                    t2_ndg_old=grid%t2_ndg_old,                      &
1806                    th2_ndg_old=grid%th2_ndg_old,                    &
1807                    q2_ndg_old=grid%q2_ndg_old,                      &
1808                    rh_ndg_old=grid%rh_ndg_old,                      &
1809                    psl_ndg_old=grid%psl_ndg_old,                    &
1810                    ps_ndg_old=grid%ps_ndg_old,                      &
1811                    tob_ndg_old=grid%tob_ndg_old,                                    &
1812                    odis_ndg_old=grid%odis_ndg_old,                                  &
1813                    u10_ndg_new=grid%u10_ndg_new,                    &
1814                    v10_ndg_new=grid%v10_ndg_new,                    &
1815                    t2_ndg_new=grid%t2_ndg_new,                      &
1816                    th2_ndg_new=grid%th2_ndg_new,                    &
1817                    q2_ndg_new=grid%q2_ndg_new,                      &
1818                    rh_ndg_new=grid%rh_ndg_new,                      &
1819                    psl_ndg_new=grid%psl_ndg_new,                    &
1820                    ps_ndg_new=grid%ps_ndg_new,                      &
1821                    tob_ndg_new=grid%tob_ndg_new,                                    &
1822                    odis_ndg_new=grid%odis_ndg_new                                   &
1823                    ,IPS=ips,IPE=ipe, JPS=jps,JPE=jpe, KPS=kps,KPE=kpe               &
1824                    ,IMSX=imsx,IMEX=imex,JMSX=jmsx,JMEX=jmex,KMSX=kmsx,KMEX=kmex     &
1825                    ,IPSX=ipsx,IPEX=ipex,JPSX=jpsx,JPEX=jpex,KPSX=kpsx,KPEX=kpex     &
1826                    ,IMSY=imsy,IMEY=imey,JMSY=jmsy,JMEY=jmey,KMSY=kmsy,KMEY=kmey     &
1827                    ,IPSY=ipsy,IPEY=ipey,JPSY=jpsy,JPEY=jpey,KPSY=kpsy,KPEY=kpey     )
1829 BENCH_END(fdda_driver_tim)
1831   END SUBROUTINE first_rk_step_part1
1833 END MODULE module_first_rk_step_part1