updated top-level README and version_decl for V4.5 (#1847)
[WRF.git] / wrftladj / module_first_rk_step_part1_tl.F
blob65dda7278ab77bae555de27c45a995ad3b129c91
1 !WRF:MEDIATION_LAYER:SOLVER
3 #define BENCH_START(A)
4 #define BENCH_END(A)
6 MODULE g_module_first_rk_step_part1
8 CONTAINS
10   SUBROUTINE g_first_rk_step_part1 (   grid , config_flags              &
11                              , moist , g_moist, moist_tend, g_moist_tend             &
12                              , chem  , chem_tend                &
13                              , tracer, g_tracer, tracer_tend, g_tracer_tend  &
14                              , scalar , g_scalar, scalar_tend, g_scalar_tend         &
15                              , fdda3d, fdda2d                   &
16                              , aerod                            &
17                              , ru_tendf, g_ru_tendf, rv_tendf, g_rv_tendf               &
18                              , rw_tendf, g_rw_tendf, t_tendf , g_t_tendf               &
19                              , ph_tendf, g_ph_tendf, mu_tendf, g_mu_tendf               &
20                              , tke_tend, g_tke_tend                         &
21                              , adapt_step_flag , curr_secs      &
22                              , psim , psih , gz1oz0 , chklowq &
23                              , cu_act_flag , hol , th_phy , g_th_phy        &
24                              , pi_phy, g_pi_phy, p_phy ,g_p_phy, t_phy ,g_t_phy  &
25                              , dz8w , g_dz8w, p8w ,g_p8w, t8w ,g_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                              , feedback_is_ready                &
36                             )
37     USE module_state_description
38     USE module_model_constants
39     USE module_domain, ONLY : domain, domain_clock_get, get_ijk_from_subgrid
40     USE module_configure, ONLY : grid_config_rec_type, model_config_rec
41 !   USE module_radiation_driver, ONLY : pre_radiation_driver, radiation_driver
42 !   USE module_surface_driver, ONLY : surface_driver
43 !   USE module_cumulus_driver, ONLY : cumulus_driver
44 !   USE module_shallowcu_driver, ONLY : shallowcu_driver
45 !   USE module_pbl_driver, ONLY : pbl_driver
46 !   USE module_fr_sfire_driver_wrf, ONLY : sfire_driver_em_step
47 !   USE module_fddagd_driver, ONLY : fddagd_driver
48 !   USE module_em, ONLY : init_zero_tendency
49 !   USE module_force_scm
50 !   USE module_convtrans_prep
51 !   USE module_big_step_utilities_em, ONLY : phy_prep
52 !use module_scalar_tables
53 #ifdef DM_PARALLEL
54     USE module_dm, ONLY : local_communicator, mytask, ntasks, ntasks_x, ntasks_y, local_communicator_periodic, wrf_dm_maxval
55     USE module_comm_dm, ONLY : halo_em_phys_a_sub,halo_em_fdda_sfc_sub,halo_em_phys_a_bl_surf_sub,halo_em_phys_a_tl_sub
56 #endif
57     USE module_utility
59     USE g_module_em, ONLY : g_init_zero_tendency
60     USE g_module_big_step_utilities_em, ONLY : g_phy_prep
61     USE g_module_pbl_driver, ONLY : g_pbl_driver
62     USE g_module_cumulus_driver, ONLY : g_cumulus_driver
63     IMPLICIT NONE
65     TYPE ( domain ), INTENT(INOUT) :: grid
66     TYPE ( grid_config_rec_type ), INTENT(IN) :: config_flags
67     TYPE(WRFU_Time)                :: currentTime
69     INTEGER, INTENT(IN) :: ids, ide, jds, jde, kds, kde,     &
70                            ims, ime, jms, jme, kms, kme,     &
71                            ips, ipe, jps, jpe, kps, kpe,     &
72                            imsx,imex,jmsx,jmex,kmsx,kmex,    &
73                            ipsx,ipex,jpsx,jpex,kpsx,kpex,    &
74                            imsy,imey,jmsy,jmey,kmsy,kmey,    &
75                            ipsy,ipey,jpsy,jpey,kpsy,kpey
78     LOGICAL ,INTENT(IN)                        :: adapt_step_flag
79     REAL, INTENT(IN)                           :: curr_secs
81     REAL    ,DIMENSION(ims:ime,kms:kme,jms:jme,num_moist),INTENT(INOUT)   :: moist
82     REAL    ,DIMENSION(ims:ime,kms:kme,jms:jme,num_moist),INTENT(INOUT)   :: g_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_moist),INTENT(INOUT)   :: g_moist_tend
85     REAL    ,DIMENSION(ims:ime,kms:kme,jms:jme,num_chem),INTENT(INOUT)   :: chem
86     REAL    ,DIMENSION(ims:ime,kms:kme,jms:jme,num_chem),INTENT(INOUT)   :: chem_tend
87     REAL    ,DIMENSION(ims:ime,kms:kme,jms:jme,num_tracer),INTENT(INOUT)   :: tracer
88     REAL    ,DIMENSION(ims:ime,kms:kme,jms:jme,num_tracer),INTENT(INOUT)   :: g_tracer
89     REAL    ,DIMENSION(ims:ime,kms:kme,jms:jme,num_tracer),INTENT(INOUT)   :: tracer_tend
90     REAL    ,DIMENSION(ims:ime,kms:kme,jms:jme,num_tracer),INTENT(INOUT)   :: g_tracer_tend
91     REAL    ,DIMENSION(ims:ime,kms:kme,jms:jme,num_scalar),INTENT(INOUT)   :: scalar
92     REAL    ,DIMENSION(ims:ime,kms:kme,jms:jme,num_scalar),INTENT(INOUT)   :: g_scalar
93     REAL    ,DIMENSION(ims:ime,kms:kme,jms:jme,num_scalar),INTENT(INOUT)   :: scalar_tend
94     REAL    ,DIMENSION(ims:ime,kms:kme,jms:jme,num_scalar),INTENT(INOUT)   :: g_scalar_tend
95     REAL    ,DIMENSION(ims:ime,kms:kme,jms:jme,num_fdda3d),INTENT(INOUT)  :: fdda3d
96     REAL    ,DIMENSION(ims:ime,1:1,jms:jme,num_fdda2d),INTENT(INOUT)      :: fdda2d
97     REAL    ,DIMENSION(ims:ime,kms:kme,jms:jme,num_aerod),INTENT(INOUT)   :: aerod
98     REAL    ,DIMENSION(ims:ime,jms:jme), INTENT(INOUT)         :: psim
99     REAL    ,DIMENSION(ims:ime,jms:jme), INTENT(INOUT)         :: psih
100     REAL    ,DIMENSION(ims:ime,jms:jme), INTENT(INOUT)         :: gz1oz0
101     REAL    ,DIMENSION(ims:ime,jms:jme), INTENT(INOUT)         :: chklowq
102     LOGICAL ,DIMENSION(ims:ime,jms:jme), INTENT(INOUT)         :: cu_act_flag
103     REAL    ,DIMENSION(ims:ime,jms:jme), INTENT(INOUT)         :: hol
105     REAL    ,DIMENSION(ims:ime,kms:kme,jms:jme), INTENT(INOUT) :: th_phy
106     REAL    ,DIMENSION(ims:ime,kms:kme,jms:jme), INTENT(INOUT) :: g_th_phy
107     REAL    ,DIMENSION(ims:ime,kms:kme,jms:jme), INTENT(INOUT) :: pi_phy
108     REAL    ,DIMENSION(ims:ime,kms:kme,jms:jme), INTENT(INOUT) :: g_pi_phy
109     REAL    ,DIMENSION(ims:ime,kms:kme,jms:jme), INTENT(INOUT) :: p_phy
110     REAL    ,DIMENSION(ims:ime,kms:kme,jms:jme), INTENT(INOUT) :: g_p_phy
111     REAL    ,DIMENSION(ims:ime,kms:kme,jms:jme), INTENT(INOUT) :: t_phy
112     REAL    ,DIMENSION(ims:ime,kms:kme,jms:jme), INTENT(INOUT) :: g_t_phy
113     REAL    ,DIMENSION(ims:ime,kms:kme,jms:jme), INTENT(INOUT) :: dz8w
114     REAL    ,DIMENSION(ims:ime,kms:kme,jms:jme), INTENT(INOUT) :: g_dz8w
115     REAL    ,DIMENSION(ims:ime,kms:kme,jms:jme), INTENT(INOUT) :: p8w
116     REAL    ,DIMENSION(ims:ime,kms:kme,jms:jme), INTENT(INOUT) :: g_p8w
117     REAL    ,DIMENSION(ims:ime,kms:kme,jms:jme), INTENT(INOUT) :: t8w
118     REAL    ,DIMENSION(ims:ime,kms:kme,jms:jme), INTENT(INOUT) :: g_t8w
120     REAL    ,DIMENSION(ims:ime,kms:kme,jms:jme), INTENT(INOUT) :: ru_tendf
121     REAL    ,DIMENSION(ims:ime,kms:kme,jms:jme), INTENT(INOUT) :: g_ru_tendf
122     REAL    ,DIMENSION(ims:ime,kms:kme,jms:jme), INTENT(INOUT) :: rv_tendf
123     REAL    ,DIMENSION(ims:ime,kms:kme,jms:jme), INTENT(INOUT) :: g_rv_tendf
124     REAL    ,DIMENSION(ims:ime,kms:kme,jms:jme), INTENT(INOUT) :: rw_tendf
125     REAL    ,DIMENSION(ims:ime,kms:kme,jms:jme), INTENT(INOUT) :: g_rw_tendf
126     REAL    ,DIMENSION(ims:ime,kms:kme,jms:jme), INTENT(INOUT) :: ph_tendf
127     REAL    ,DIMENSION(ims:ime,kms:kme,jms:jme), INTENT(INOUT) :: g_ph_tendf
128     REAL    ,DIMENSION(ims:ime,kms:kme,jms:jme), INTENT(INOUT) :: t_tendf
129     REAL    ,DIMENSION(ims:ime,kms:kme,jms:jme), INTENT(INOUT) :: g_t_tendf
130     REAL    ,DIMENSION(ims:ime,kms:kme,jms:jme), INTENT(INOUT) :: tke_tend
131     REAL    ,DIMENSION(ims:ime,kms:kme,jms:jme), INTENT(INOUT) :: g_tke_tend
133     REAL    ,DIMENSION(ims:ime,jms:jme), INTENT(INOUT) :: mu_tendf
134     REAL    ,DIMENSION(ims:ime,jms:jme), INTENT(INOUT) :: g_mu_tendf
136     INTEGER, INTENT(IN)                           ::  k_start, k_end
137     LOGICAL, INTENT(IN), OPTIONAL                 ::  f_flux
138     LOGICAL, INTENT(IN), OPTIONAL :: feedback_is_ready  ! For WRF-CMAQ coupled model, indicates feedback information is available
140 ! Local
141     REAL, DIMENSION( ims:ime, jms:jme ) :: exch_temf  ! 1/7/09 WA
143     REAL, DIMENSION( ims:ime, jms:jme ) :: ht_loc, mixht
144     INTEGER                             :: ij
145     INTEGER  num_roof_layers
146     INTEGER  num_wall_layers
147     INTEGER  num_road_layers
148     INTEGER  iswater
149     LOGICAL  :: l_flux
150     INTEGER  :: isurban
151     INTEGER  rk_step
152     INTEGER                         :: yr, month, day, hr, minute, sec, rc
153     CHARACTER*80                    :: mesg
155    INTEGER                         :: sids , side , sjds , sjde , skds , skde , &
156                                       sims , sime , sjms , sjme , skms , skme , &
157                                       sips , sipe , sjps , sjpe , skps , skpe
159    CHARACTER (LEN=256) :: mminlu
161 #if ( WRF_DFI_RADAR == 1 )
162     INTEGER  do_capsupress   ! =1 do CAP supress, other = don't
163 #endif
165   CALL get_ijk_from_subgrid (  grid ,                   &
166                             sids, side, sjds, sjde, skds, skde,    &
167                             sims, sime, sjms, sjme, skms, skme,    &
168                             sips, sipe, sjps, sjpe, skps, skpe    )
170  ! initialize all tendencies to zero in order to update physics
171  ! tendencies first (separate from dry dynamics).
173    l_flux=.FALSE.
174    if (present(f_flux)) l_flux=f_flux
176     rk_step = 1
178 BENCH_START(g_init_zero_tend_tim)
179        !$OMP PARALLEL DO   &
180        !$OMP PRIVATE ( ij )
182        DO ij = 1 , grid%num_tiles
184          CALL wrf_debug ( 200 , ' call init_zero_tendency' )
185          CALL g_init_zero_tendency(ru_tendf,  g_ru_tendf, &
186                                    rv_tendf,  g_rv_tendf, &
187                                    rw_tendf,  g_rw_tendf, &
188                                    ph_tendf,  g_ph_tendf, &
189                                    t_tendf,   g_t_tendf,  &
190                                    tke_tend, g_tke_tend, &
191                                    mu_tendf,  g_mu_tendf,  &
192                                    moist_tend, g_moist_tend,  &
193                                    scalar_tend, g_scalar_tend, &
194                                    tracer_tend, g_tracer_tend, &
195                                    num_tracer,                   &
196                                    num_moist,num_chem,num_scalar, &
197                                    rk_step,                          &
198                                    ids, ide, jds, jde, kds, kde,     &
199                                    ims, ime, jms, jme, kms, kme,     &
200                                    grid%i_start(ij), grid%i_end(ij), &
201                                    grid%j_start(ij), grid%j_end(ij), &
202                                    k_start, k_end                   )
204        END DO
205        !$OMP END PARALLEL DO
206 BENCH_END(g_init_zero_tend_tim)
208 #ifdef DM_PARALLEL
209 #     include "HALO_EM_PHYS_A_TL.inc"
210 #endif
212       !$OMP PARALLEL DO   &
213       !$OMP PRIVATE ( ij )
214       DO ij = 1 , grid%num_tiles
216         CALL wrf_debug ( 200 , ' call g_phy_prep' )
217         CALL g_phy_prep ( config_flags,                           &
218                         grid%mut,grid%g_mut, grid%muu, grid%g_muu, grid%muv, grid%g_muv, &
219                         grid%u_2,grid%g_u_2, grid%v_2,grid%g_v_2,             &
220                         grid%p,grid%g_p, grid%pb, grid%alt,grid%g_alt,        &
221                         grid%ph_2,grid%g_ph_2, grid%phb, grid%t_2,grid%g_t_2, &
222                         moist,g_moist, num_moist,                             &
223                         grid%rho,grid%g_rho, th_phy,g_th_phy, p_phy,g_p_phy, pi_phy,g_pi_phy, &
224                         grid%u_phy,grid%g_u_phy, grid%v_phy,grid%g_v_phy,                         &
225                         p8w,g_p8w, grid%t_phy,grid%g_t_phy, t8w,g_t8w, grid%z,grid%g_z, &
226                         grid%z_at_w,grid%g_z_at_w, dz8w,g_dz8w,               &
227                         grid%p_hyd,grid%g_p_hyd, grid%p_hyd_w,grid%g_p_hyd_w, &
228                         grid%dnw,                                             &
229                         grid%fnm, grid%fnp, grid%znw, grid%p_top,             &
230                         ids, ide, jds, jde, kds, kde,           &
231                         ims, ime, jms, jme, kms, kme,           &
232                         grid%i_start(ij), grid%i_end(ij),       &
233                         grid%j_start(ij), grid%j_end(ij),       &
234                         k_start, k_end                         )
235       ENDDO
236       !$OMP END PARALLEL DO
238 BENCH_END(g_phy_prep_tim)
240 !*********
241 ! pbl
243 #ifdef DM_PARALLEL
244       IF ( config_flags%bl_pbl_physics .EQ. 98 ) THEN
245 #     include "HALO_EM_PHYS_A_BL_SURF.inc"
246       ENDIF
247 #endif
249       CALL wrf_debug ( 200 , ' call g_pbl_driver' )
250 BENCH_START(g_pbl_driver_tim)
251       CALL g_pbl_driver(                                                              &
252      &         AKHS=grid%akhs          ,AKMS=grid%akms                              &
253      &        ,BL_PBL_PHYSICS=config_flags%bl_pbl_physics                           &
254      &        ,BLDT=grid%bldt, CURR_SECS=curr_secs, ADAPT_STEP_FLAG=adapt_step_flag &
255      &        ,BLDTACTTIME=grid%bldtacttime                                         & 
256      &        ,BR=grid%br              ,CHKLOWQ=chklowq    ,CT=grid%ct              &
257      &        ,DT=grid%dt              ,DX=grid%dx              ,DZ8W=dz8w          &
258      &        ,EXCH_H=grid%exch_h     ,EXCH_M=grid%exch_m                           &
259      &        ,FM=grid%fm         ,FHH=grid%fh                                      &
260      &        ,F=grid%f  ,GRDFLX=grid%grdflx      &
261      &        ,GZ1OZ0=gz1oz0      ,HFX=grid%hfx  ,HT=grid%ht                        &
262      &        ,ID=grid%id         ,ITIMESTEP=grid%itimestep     ,KPBL=grid%kpbl          &
263      &        ,LH=grid%lh ,LOWLYR=grid%lowlyr ,P8W=grid%p_hyd_w, P8WD=grid%g_p_hyd_w   &
264      &        ,PBLH=grid%pblh, PI_PHY=pi_phy, PI_PHYD=g_pi_phy ,PSIH=psih          &
265      &        ,PSIM=psim   ,P_PHY=grid%p_hyd, QFX=grid%qfx            &
266      &        ,QSFC=grid%qsfc          ,QZ0=grid%qz0  ,MIXHT=mixht                  &
267      &        ,RA_LW_PHYSICS=config_flags%ra_lw_physics                   &
268      &        ,RHO=grid%rho            ,RQCBLTEN=grid%rqcblten  ,RQIBLTEN=grid%rqiblten  &
269      &        ,RQCBLTEND=grid%g_rqcblten  ,RQIBLTEND=grid%g_rqiblten  &
270      &        ,RQVBLTEN=grid%rqvblten  ,RQVBLTEND=grid%g_rqvblten                  &
271      &        ,RTHBLTEN=grid%rthblten ,RTHBLTEND=grid%g_rthblten                   &
272      &        ,RUBLTEN=grid%rublten, RUBLTEND=grid%g_rublten                 &
273      &        ,RVBLTEN=grid%rvblten ,RVBLTEND=grid%g_rvblten   ,SNOW=grid%snow       ,STEPBL=grid%stepbl      &
274      &        ,THZ0=grid%thz0          ,TH_PHY=th_phy                               &
275      &        ,TSK=grid%tsk ,T_PHY=grid%t_phy, T_PHYD=grid%g_t_phy  ,UST=grid%ust       &
276      &        ,U10=grid%u10 ,UZ0=grid%uz0 ,U_FRAME=grid%u_frame ,U_PHY=grid%u_phy ,U_PHYD=grid%g_u_phy &
277      &        ,V10=grid%v10 ,VZ0=grid%vz0 ,V_FRAME=grid%v_frame ,V_PHY=grid%v_phy ,V_PHYD=grid%g_v_phy &
278               ,T2=grid%t2 &
279      &        ,WARM_RAIN=grid%warm_rain                    ,WSPD=grid%wspd          &
280      &        ,XICE=grid%xice   ,XLAND=grid%xland  ,Z=grid%z ,ZD=grid%g_z      &
281      &        ,ZNT=grid%znt                                                    &
282 ! paj: topo_wind
283      &        ,CTOPO=grid%ctopo,CTOPO2=grid%ctopo2                                   &
284 ! variables added for BEP
285      &          ,FRC_URB2D=grid%frc_urb2d                                                  &
286      &          ,A_U_BEP=grid%a_u_bep,A_V_BEP=grid%a_v_bep,A_T_BEP=grid%a_t_bep          &
287      &          ,A_Q_BEP=grid%a_q_bep                                                    &
288      &          ,B_U_BEP=grid%b_u_bep,B_V_BEP=grid%b_v_bep,B_T_BEP=grid%b_t_bep          &
289      &          ,B_Q_BEP=grid%b_q_bep                                                    &
290      &          ,SF_BEP=grid%sf_bep,VL_BEP=grid%vl_bep                                   &
291      &          ,A_E_BEP=grid%a_e_bep,B_E_BEP=grid%b_e_bep,DLG_BEP=grid%dlg_bep          &
292      &          ,DL_U_BEP=grid%dl_u_bep                                                  &
293      &          ,SF_SFCLAY_PHYSICS=config_flags%sf_sfclay_physics                        &
294      &          ,SF_URBAN_PHYSICS=config_flags%sf_urban_physics                          &
295 ! Bep changes end
296 ! add tke_pbl, and turbulent fluxes
297      &          ,TKE_PBL=grid%tke_pbl,EL_PBL=grid%el_pbl,WU_TUR=grid%wu_tur,WV_tur=grid%wv_tur,WT_tur=grid%wt_tur,WQ_tur=grid%wq_tur   &
298 ! end add tke_pbl, and turbulent fluxes
299      &        ,IDS=ids,IDE=ide, JDS=jds,JDE=jde, KDS=kds,KDE=kde          &
300      &        ,IMS=ims,IME=ime, JMS=jms,JME=jme, KMS=kms,KME=kme          &
301      &        ,I_START=grid%i_start,I_END=min(grid%i_end, ide-1)          &
302      &        ,J_START=grid%j_start,J_END=min(grid%j_end, jde-1)          &
303      &        ,KTS=k_start, KTE=min(k_end,kde-1)                          &
304      &        ,NUM_TILES=grid%num_tiles                                   &
305           ! Variables Required by ACM PBL  - jp
306      &        ,ZNU=grid%znu,ZNW=grid%znw,MUT=grid%mut,P_TOP=grid%p_top    &
307      &        ,MUTD=grid%g_mut                                           &
308           ! Variables required by TEMF PBL - WA 9/9/08
309               ,te_temf=grid%te_temf                                 &
310               ,kh_temf=grid%kh_temf,km_temf=grid%km_temf            &
311               ,shf_temf=grid%shf_temf,qf_temf=grid%qf_temf          &
312               ,uw_temf=grid%uw_temf,vw_temf=grid%vw_temf            &
313               ,hd_temf=grid%hd_temf,lcl_temf=grid%lcl_temf          &
314               ,wupd_temf=grid%wupd_temf,mf_temf=grid%mf_temf          &
315               ,thup_temf=grid%thup_temf,qtup_temf=grid%qtup_temf          &
316               ,qlup_temf=grid%qlup_temf          &
317               ,cf3d_temf=grid%cf3d_temf,cfm_temf=grid%cfm_temf          &
318               ,hct_temf=grid%hct_temf                               &
319               ,flhc=grid%flhc,flqc=grid%flqc                        &
320               ,exch_temf=exch_temf                      &
321           ! optional
322      &        ,QV_CURR=moist(ims,kms,jms,P_QV), F_QV=F_QV                 &
323      &        ,QV_CURRD=g_moist(ims,kms,jms,P_QV)                        &
324      &        ,QC_CURR=moist(ims,kms,jms,P_QC), F_QC=F_QC                 &
325      &        ,QR_CURR=moist(ims,kms,jms,P_QR), F_QR=F_QR                 &
326      &        ,QI_CURR=moist(ims,kms,jms,P_QI), F_QI=F_QI                 &
327      &        ,QS_CURR=moist(ims,kms,jms,P_QS), F_QS=F_QS                 &
328      &        ,QG_CURR=moist(ims,kms,jms,P_QG), F_QG=F_QG                 &
329      &        ,HOL=HOL, MOL=grid%mol, REGIME=grid%REGIME                  &
330 !mynn mp
331      &        ,QKE=scalar(ims,kms,jms,P_qke_adv), tsq=grid%tsq, qsq=grid%qsq  &
332      &        ,cov=grid%cov                                               &
333      &        ,DQKE=grid%dqke,QWT=grid%qWT                                &
334      &        ,QSHEAR=grid%qSHEAR,QBUOY=grid%qBUOY,QDISS=grid%qDISS       &
335      &        ,tke_budget=config_flags%tke_budget                         &
336      &        ,rmol=grid%rmol, ch=grid%ch                                 &
337      &        ,qcg=grid%qcg, grav_settling=config_flags%grav_settling     &
338 !GWD for ARW
339      &        ,GWD_OPT=config_flags%gwd_opt &
340      &        ,DTAUX3D=grid%dtaux3d,DTAUY3D=grid%dtauy3d &
341      &        ,DTAUX3DD=grid%g_dtaux3d,DTAUY3DD=grid%g_dtauy3d &
342      &        ,DUSFCG=grid%dusfcg,DVSFCG=grid%dvsfcg &
343      &        ,DUSFCGD=grid%g_dusfcg,DVSFCGD=grid%g_dvsfcg &
344      &        ,VAR2D=grid%var2d,OC12D=grid%oc12d     &
345      &        ,OA1=grid%oa1,OA2=grid%oa2,OA3=grid%oa3,OA4=grid%oa4        &
346      &        ,OL1=grid%ol1,OL2=grid%ol2,OL3=grid%ol3,OL4=grid%ol4        &
347      &        ,MFSHCONV=grid%mfshconv                                     & 
348      &        ,MASSFLUX_EDKF=grid%massflux_EDKF                           & 
349      &        ,ENTR_EDKF=grid%entr_EDKF, DETR_EDKF=grid%detr_EDKF         &
350      &        ,THL_UP=grid%thl_up                                         &
351      &        ,THV_UP=grid%thv_up, RT_UP=grid%rt_up ,RV_UP=grid%rv_up     &
352      &        ,RC_UP=grid%rc_up, U_UP=grid% u_up, V_UP=grid%v_up          &
353      &        ,FRAC_UP=grid%frac_up, RC_MF=grid%RC_MF                     &
354 ! For Wind Turbine Drag Parameterizations
355      &        ,phb=grid%phb                                               &
356      &        ,XLAT_U=grid%xlat_u,XLONG_U=grid%xlong_u                    &
357 !Variables required for camuwpbl scheme
358      &        ,Z_AT_W=grid%z_at_w,CLDFRA=grid%cldfra                      &
359      &        ,RTHRATENLW=grid%rthratenlw,TAURESX2D=grid%tauresx2d        &
360      &        ,TAURESY2D=grid%tauresy2d                                   &
361      &        ,TPERT2D=grid%tpert2d,QPERT2D=grid%qpert2d                  &
362      &        ,WPERT2D=grid%wpert2d                                       &
363      &        ,XLAT_V=grid%xlat_v,XLONG_V=grid%xlong_v                    &
364      &        )
365                                                          
367 BENCH_END(g_pbl_driver_tim)
370 ! cumulus para.
372       CALL wrf_debug ( 200 , ' call g_cumulus_driver' )
374 BENCH_START(g_cu_driver_tim)
375       CALL g_cumulus_driver(grid                                             &
376                  ! Prognostic variables
377      &             ,U=grid%u_phy, V=grid%v_phy, TH=th_phy, THD=g_th_phy, T=grid%t_phy, TD=grid%g_t_phy  &
378      &             ,W=grid%w_2, P=grid%p_hyd, PD=grid%g_p_hyd, PI=pi_phy, RHO=grid%rho, RHOD=grid%g_rho &
379                  ! Other arguments
380      &             ,ITIMESTEP=grid%itimestep ,DT=grid%dt      ,DX=grid%dx              &
381      &             ,CUDT=grid%cudt,CURR_SECS=curr_secs,ADAPT_STEP_FLAG=adapt_step_flag &
382      &             ,CUDTACTTIME=grid%cudtacttime                                       &
383      &             ,RAINC=grid%rainc   ,RAINCV=grid%raincv   ,PRATEC=grid%pratec       &
384      &             ,RAINCVD=grid%g_raincv, PRATECD=grid%g_pratec                       &
385      &             ,NCA=grid%nca                                                       &
386      &             ,HTOP=grid%cutop     ,HBOT=grid%cubot       ,KPBL=grid%kpbl         &
387      &             ,Z=grid%z ,Z_AT_W=grid%z_at_w ,MAVAIL=grid%mavail ,PBLH=grid%pblh   &
388      &             ,DZ8W=dz8w     ,P8W=grid%p_hyd_w, PSFC=grid%psfc, TSK=grid%tsk      &
389      &             ,ZD=grid%g_z, DZ8WD=g_dz8w                                        &
390      &             ,TKE_PBL=grid%tke_pbl, UST=grid%ust                                 &
391      &             ,W0AVG=grid%w0avg   ,STEPCU=grid%stepcu                             &
392      &             ,CLDEFI=grid%cldefi ,LOWLYR=grid%lowlyr ,XLAND=grid%xland           &
393      &             ,APR_GR=grid%apr_gr ,APR_W=grid%apr_w   ,APR_MC=grid%apr_mc         &
394      &             ,APR_ST=grid%apr_st ,APR_AS=grid%apr_as ,APR_CAPMA=grid%apr_capma   &
395      &             ,APR_CAPME=grid%apr_capme          ,APR_CAPMI=grid%apr_capmi     &
396      &             ,MASS_FLUX=grid%mass_flux          ,XF_ENS=grid%xf_ens           &
397      &             ,PR_ENS=grid%pr_ens ,HT=grid%ht,EDT_OUT=grid%edt_out             &
398      &             ,imomentum=grid%imomentum,clos_choice=grid%clos_choice           &
399      &             ,ishallow=config_flags%ishallow                                  &
400      &             ,cugd_tten=grid%cugd_tten,cugd_qvten=grid%cugd_qvten,cugd_qcten=grid%cugd_qcten   &
401      &             ,cugd_ttens=grid%cugd_ttens,cugd_qvtens=grid%cugd_qvtens   &
402      &             ,ENSDIM=config_flags%ensdim ,MAXIENS=config_flags%maxiens ,MAXENS=config_flags%maxens         &
403      &             ,MAXENS2=config_flags%maxens2 ,MAXENS3=config_flags%maxens3       &
404      &             ,CU_ACT_FLAG=cu_act_flag   ,WARM_RAIN=grid%warm_rain   &
405      &             ,HFX=grid%hfx, QFX=grid%qfx                            &
406      &             ,CLDFRA=grid%cldfra, TPERT2D=grid%tpert2d              &
407      &             ,GSW=grid%gsw,cugd_avedx=config_flags%cugd_avedx       &
408      &             ,k22_shallow=grid%k22_shallow,kbcon_shallow=grid%kbcon_shallow &
409      &             ,ktop_shallow=grid%ktop_shallow,xmb_shallow=grid%xmb_shallow   &
410      &             ,PERIODIC_X=(config_flags%polar .OR. config_flags%periodic_x)  &
411      &             ,PERIODIC_Y=config_flags%periodic_y                    &
412                  ! Zhang-McFarlane outputs
413      &             ,CAPE=grid%cape ,ZMMU=grid%zmmu ,ZMMD=grid%zmmd        &
414      &             ,ZMDT=grid%zmdt ,ZMDQ=grid%zmdq                        &
415      &             ,DLF=grid%dlf, RLIQ=grid%rliq                          &
416      &             ,PCONVB=grid%pconvb, PCONVT=grid%pconvt                &
417      &             ,EVAPTZM=grid%evaptzm, FZSNTZM=grid%fzsntzm, EVSNTZM=grid%evsntzm     &
418      &             ,EVAPQZM=grid%evapqzm, ZMFLXPRC=grid%zmflxprc          &
419      &             ,ZMFLXSNW=grid%zmflxsnw, ZMNTPRPD=grid%zmntprpd        &
420      &             ,ZMNTSNPD=grid%zmntsnpd, ZMEIHEAT=grid%zmeiheat        &
421      &             ,CMFMC=grid%cmfmc, CMFMCDZM=grid%cmfmcdzm              &
422      &             ,PRECCDZM=grid%preccdzm, PRECZ=grid%precz              &
423      &             ,ZMMTU=grid%zmmtu, ZMMTV=grid%zmmtv  &
424      &             ,ZMUPGU=grid%zmupgu, ZMUPGD=grid%zmupgd                &
425      &             ,ZMVPGU=grid%zmvpgu, ZMVPGD=grid%zmvpgd                &
426      &             ,ZMICUU=grid%zmicuu, ZMICUD=grid%zmicud                &
427      &             ,ZMICVU=grid%zmicvu, ZMICVD=grid%zmicvd                &
428      &             ,ZMDICE=grid%zmdice, ZMDLIQ=grid%zmdliq                &
429                  ! Selection flag
430      &             ,pgcon=config_flags%sas_pgcon                          &
431      &             ,CU_PHYSICS=config_flags%cu_physics                    &
432      &             ,BL_PBL_PHYSICS=config_flags%bl_pbl_physics            &
433      &             ,SF_SFCLAY_PHYSICS=config_flags%sf_sfclay_physics      &
434      &             ,KFETA_TRIGGER=config_flags%kfeta_trigger              &
435                  ! Dimension arguments
436      &             ,IDS=ids,IDE=ide, JDS=jds,JDE=jde, KDS=kds,KDE=kde     &
437      &             ,IMS=ims,IME=ime, JMS=jms,JME=jme, KMS=kms,KME=kme     &
438      &             ,IPS=ips,IPE=ipe, JPS=jps,JPE=jpe, KPS=kps,KPE=kpe     &
439      &             ,I_START=grid%i_start,I_END=min(grid%i_end, ide-1)     &
440      &             ,J_START=grid%j_start,J_END=min(grid%j_end, jde-1)     &
441      &             ,KTS=k_start, KTE=min(k_end,kde-1)                     &
442      &             ,NUM_TILES=grid%num_tiles                              &
443                  ! Moisture tendency arguments
444      &             ,RQVCUTEN=grid%rqvcuten , RQCCUTEN=grid%rqccuten       &
445      &             ,RQVCUTEND=grid%g_rqvcuten                            &
446      &             ,RQSCUTEN=grid%rqscuten , RQICUTEN=grid%rqicuten       &
447      &             ,RQRCUTEN=grid%rqrcuten                                &
448      &             ,RQVBLTEN=grid%rqvblten , RQVFTEN=grid%rqvften         &
449                  ! Other tendency arguments
450      &             ,RTHRATEN=grid%rthraten , RTHBLTEN=grid%rthblten       &
451      &             ,RUCUTEN=grid%rucuten   , RVCUTEN=grid%rvcuten         &
452      &             ,RTHCUTEN=grid%rthcuten , RTHFTEN=grid%rthften         &
453      &             ,RTHCUTEND=grid%g_rthcuten                            &
454                  ! Moisture tracer arguments
455      &             ,QV_CURR=moist(ims,kms,jms,P_QV), F_QV=F_QV            &
456      &             ,QV_CURRD=g_moist(ims,kms,jms,P_QV)                   &
457      &             ,QC_CURR=moist(ims,kms,jms,P_QC), F_QC=F_QC            &
458      &             ,QR_CURR=moist(ims,kms,jms,P_QR), F_QR=F_QR            &
459      &             ,QI_CURR=moist(ims,kms,jms,P_QI), F_QI=F_QI            &
460      &             ,QS_CURR=moist(ims,kms,jms,P_QS), F_QS=F_QS            &
461      &             ,QG_CURR=moist(ims,kms,jms,P_QG), F_QG=F_QG            &
462 ! Variables for Tiedtke and NSAS schemes
463      &             ,ZNU=grid%znu                                          &
464      &             ,MP_PHYSICS=config_flags%mp_physics                    &
465      &             ,GD_CLOUD=grid%GD_CLOUD,GD_CLOUD2=grid%GD_CLOUD2       &
466      &             ,cfu1=grid%cfu1,cfd1=grid%cfd1,dfu1=grid%dfu1,efu1=grid%efu1,dfd1=grid%dfd1,efd1=grid%efd1,f_flux=l_flux)
467 BENCH_END(g_cu_driver_tim)
470   END SUBROUTINE g_first_rk_step_part1
472 END MODULE g_module_first_rk_step_part1