Merge pull request #22 from wirc-sjsu/develop-w21
[WRF-Fire-merge.git] / chem / aerosol_driver.F
blob9b236c5d5b421695ea4233ed18bc5737406e4faf
2 !   WRF-chem V3.0 : Original version of aerosol_driver written by Georg Grell (ESRL/GSD)
3 !                   Further developments, bugfixes and improvements  by
4 !                   William Gustafson (PNNL),Rainer Schmitz (University of Chile)  and Georg Grell
6 ! 10/12/2011 - Ravan Ahmadov (NOAA) updated to include the RACM_SOA_VBS option
7 ! 10/08/2014 - Kai Wang and Yang Zhang (NCSU) updated to include the CB05_MADE/SORGAM and CB05_MADE/VBS options
9       SUBROUTINE aerosols_driver (id,curr_secs,ktau,dtstep,ktauc,          &
10                config_flags,dtstepc,dx,                                    &
11                alt,t_phy,moist,aerwrf,p8w,t8w,p_phy,chem,rho_phy,dz8w,rh,  &
12                z,z_at_w,pbl_h,cldfra,cldfra_mp_all,vbs_nbin,               &
13                gamn2o5,cn2o5,kn2o5,yclno2,snu,sac,          &
14                h2oaj,h2oai,nu3,ac3,cor3,asulf,ahno3,anh3,cvaro1,  &
15                cvaro2,cvalk1,cvole1,cvapi1,cvapi2,cvlim1,cvlim2,vcsulf_old,&
16                vdrog3, vdrog3_vbs,brch_ratio,dgnum,dgnumwet,wetdens_ap,    &
17                del_h2so4_gasprod,dvmrdt_sv13d,dvmrcwdt_sv13d,              &
18                is_CAMMGMP_used,                                            &!BSINGH:01/31/2013: Added is_CAMMGMP_used for cam_mam_aerchem_driver
19                ph_aer01, ph_aer02, ph_aer03, ph_aer04,                     &
20                ids,ide, jds,jde, kds,kde,                                  &
21                ims,ime, jms,jme, kms,kme,                                  &
22                its,ite, jts,jte, kts,kte                                   )
24 !----------------------------------------------------------------------
25    USE module_configure
26    USE module_state_description
27    USE module_model_constants
29 ! *** add new modules of schemes here
31    USE module_aerosols_sorgam
32    USE module_gocart_aerosols
33    USE module_data_sorgam
34    USE module_mosaic_driver, only:  mosaic_aerchem_driver
35    USE module_aerosols_soa_vbs, only: soa_vbs_driver
36    USE module_aerosols_sorgam_vbs, only: sorgam_vbs_driver
37    USE module_data_soa_vbs, only: ldrog_vbs
38    USE module_cam_mam_aerchem_driver, only:  cam_mam_aerchem_driver
39    USE modal_aero_data, only:  ntot_amode_cam_mam => ntot_amode
40    USE module_cam_support, only: gas_pcnst => gas_pcnst_modal_aero, &
41         gas_pcnst_pos => gas_pcnst_modal_aero_pos
43    !  This driver calls subroutines for aerosols parameterizations.
44    !
45    !  1. MADE-SORGAM
46    !  2. MOSAIC
47    !  3. MADE-SOA_VBS
49 !----------------------------------------------------------------------
50    IMPLICIT NONE
51 !======================================================================
52 ! Grid structure in physics part of WRF
53 !----------------------------------------------------------------------
54 ! The horizontal velocities used in the physics are unstaggered
55 ! relative to temperature/moisture variables. All predicted
56 ! variables are carried at half levels except w, which is at full
57 ! levels. Some arrays with names (*8w) are at w (full) levels.
59 !----------------------------------------------------------------------
60 ! In WRF, kms (smallest number) is the bottom level and kme (largest
61 ! number) is the top level.  In your scheme, if 1 is at the top level,
62 ! then you have to reverse the order in the k direction.
64 !         kme      -   half level (no data at this level)
65 !         kme    ----- full level
66 !         kme-1    -   half level
67 !         kme-1  ----- full level
68 !         .
69 !         .
70 !         .
71 !         kms+2    -   half level
72 !         kms+2  ----- full level
73 !         kms+1    -   half level
74 !         kms+1  ----- full level
75 !         kms      -   half level
76 !         kms    ----- full level
78 !======================================================================
79 ! Definitions
80 !-----------
81 !-- alt       inverse density
82 !-- t_phy         temperature (K)
83 !-- w             vertical velocity (m/s)
84 !-- moist         moisture array (4D - last index is species) (kg/kg)
85 !-- dz8w          dz between full levels (m)
86 !-- p8w           pressure at full levels (Pa)  
87 !-- p_phy         pressure (Pa)
88 !                 points (dimensionless)
89 !-- z             3D height with lowest level being the terrain
90 !-- rho_phy       density (kg/m^3)
91 !-- R_d           gas constant for dry air ( 287. J/kg/K)
92 !-- R_v           gas constant for water vapor (461 J/k/kg)
93 !-- Cp            specific heat at constant pressure (1004 J/k/kg)
94 !-- rvovrd        R_v divided by R_d (dimensionless)
95 !-- G             acceleration due to gravity (m/s^2)
96 !-- ids           start index for i in domain
97 !-- ide           end index for i in domain
98 !-- jds           start index for j in domain
99 !-- jde           end index for j in domain
100 !-- kds           start index for k in domain
101 !-- kde           end index for k in domain
102 !-- ims           start index for i in memory
103 !-- ime           end index for i in memory
104 !-- jms           start index for j in memory
105 !-- jme           end index for j in memory
106 !-- kms           start index for k in memory
107 !-- kme           end index for k in memory
108 !-- its           start index for i in tile
109 !-- ite           end index for i in tile
110 !-- jts           start index for j in tile
111 !-- jte           end index for j in tile
112 !-- kts           start index for k in tile
113 !-- kte           end index for k in tile
114 !-- config_flags%kemit  end index for k for emissions arrays
116 !======================================================================
118    TYPE(grid_config_rec_type),  INTENT(IN   )    :: config_flags
119    LOGICAL,      INTENT(IN)       :: is_CAMMGMP_used
120    INTEGER,      INTENT(IN   )    ::                                &
121                                       ids,ide, jds,jde, kds,kde,    &
122                                       ims,ime, jms,jme, kms,kme,    &
123                                       its,ite, jts,jte, kts,kte,    &
124                                       id,ktau,ktauc,vbs_nbin(1) !BSINGH(PNNL)- Lahey compiler forces vbs_nbin to be an array
125    REAL(KIND=8), INTENT(IN   ) :: curr_secs
126    REAL,         INTENT(IN   ) :: dtstep,dtstepc,dx
128 ! moisture variables
130    REAL, DIMENSION( ims:ime, kms:kme, jms:jme, num_moist ),         &
131          INTENT(IN ) ::                                   moist
133 ! all advected chemical species
135    REAL, DIMENSION( ims:ime, kms:kme, jms:jme, num_chem ),          &
136          INTENT(INOUT ) ::                                chem
138 ! following are aerosol arrays that are not advected
140    REAL, DIMENSION( ims:ime, kms:kme, jms:jme ),                    &
141          INTENT(INOUT ) ::                                          &
142            gamn2o5,cn2o5,kn2o5,yclno2,snu,sac,                   &
143            h2oaj,h2oai,nu3,ac3,cor3,asulf,ahno3,anh3,cvaro1,cvaro2, &
144            cvalk1,cvole1,cvapi1,cvapi2,cvlim1,cvlim2,brch_ratio
146    REAL, DIMENSION( ims:ime, kms:kme, jms:jme, ntot_amode_cam_mam ), &
147          INTENT(INOUT ) ::                                   &
148            dgnum, dgnumwet, wetdens_ap
150 ! del_h2so4_gasprod is h2so4 change during gas-phase chemistry
151    REAL, DIMENSION( ims:ime, kms:kme, jms:jme ), &
152          INTENT(IN ) ::                                   &
153            del_h2so4_gasprod
155 ! arrays for aerosol/radiation feedback
157    REAL, DIMENSION( ims:ime, kms:kme, jms:jme ),                    &
158          INTENT(INOUT ) ::                                          &
159                aerwrf
161 ! aerosol/radm2 interaction
163    REAL,  DIMENSION(ims:ime,kms:kme-0,jms:jme,ldrog),               &
164                INTENT(IN   ) ::                                     &
165                                                      VDROG3
167    REAL,  DIMENSION(ims:ime,kms:kme-0,jms:jme,ldrog_vbs),           &
168                INTENT(IN   ) ::                                     &
169                                                      VDROG3_VBS
171 ! input from meteorology
172    REAL,  DIMENSION( ims:ime , kms:kme , jms:jme )         ,        &
173           INTENT(IN   ) ::                                          &
174                                                         alt,        &
175                                                       t_phy,        &
176                                                       p_phy,        &
177                                                       dz8w,         &
178                                                       rh,           & 
179                                                       z    ,        &
180                                             t8w,p8w,z_at_w ,        &
181                                                     rho_phy,        &
182                                                      cldfra,        &
183                                                      cldfra_mp_all    !Cloud fraction from CAMMGMP microphysics
185    REAL,  DIMENSION( ims:ime , jms:jme )                   ,        &
186           INTENT(IN   ) ::                                          &
187                                                       pbl_h
189 ! sulf concentration before modification by chemical mechanism
191      REAL, dimension (ims:ime,kms:kme-0,jms:jme),                   &
192                INTENT(INOUT) ::                                     &
193                                vcsulf_old
195 !  output of aerosol pH from MOSAIC 4-bin
196    REAL,  DIMENSION( ims:ime , kms:kme , jms:jme )         ,        &
197           INTENT(OUT  ) ::                                          &
198                                ph_aer01, ph_aer02, ph_aer03, ph_aer04
200 !tendencies:dvmrdt_sv13d,dvmrcwdt_sv13d are the tendencies which are passsed on from the CAM-MAM cloud chemistry
201 !           to gasaerexch subroutine
203    REAL, DIMENSION( ims:ime, kms:kme, jms:jme, gas_pcnst_pos ),          &
204         INTENT(IN ) ::                                  dvmrdt_sv13d,dvmrcwdt_sv13d 
206 ! LOCAL  VAR
207      integer :: ii,jj,kk
210 !-----------------------------------------------------------------
214 ! select which aerosol scheme to take 
216    cps_select: SELECT CASE(config_flags%chem_opt)
218    CASE (GOCART_SIMPLE,GOCARTRACM_KPP,GOCARTRADM2,MOZCART_KPP,T1_MOZCART_KPP)
219       call gocart_aerosols_driver(ktauc,dtstepc,config_flags,t_phy,moist,  &
220          chem,rho_phy,dz8w,p8w,dx,g,         &
221          ids,ide, jds,jde, kds,kde,                                        &
222          ims,ime, jms,jme, kms,kme,                                        &
223          its,ite, jts,jte, kts,kte                                         )
224    CASE (RADM2SORG,RADM2SORG_AQ,RADM2SORG_AQCHEM,RADM2SORG_KPP,CBMZSORG,CBMZSORG_AQ, &
225           CB05_SORG_AQ_KPP) 
226        CALL wrf_debug(15,'aerosols_driver calling sorgam_driver')
227        do ii=its,ite
228           do kk=kts,kte
229              do jj=jts,jte
230                 if(chem(ii,kk,jj,p_nu0).lt.1.e07)then
231                    chem(ii,kk,jj,p_nu0)=1.e7
232                 endif
233              enddo
234           enddo
235        enddo
236        call sorgam_driver (id,ktauc,dtstepc,t_phy,moist,aerwrf,p8w,t8w, &
237                alt,p_phy,chem,rho_phy,dz8w,z,z_at_w,                    &
238                h2oaj,h2oai,nu3,ac3,cor3,asulf,ahno3,anh3,cvaro1,cvaro2, &
239                cvalk1,cvole1,cvapi1,cvapi2,cvlim1,cvlim2,vcsulf_old,    &
240                vdrog3,                                                  &
241                config_flags%kemit,                                      &
242                ids,ide, jds,jde, kds,kde,                               &
243                ims,ime, jms,jme, kms,kme,                               &
244                its,ite, jts,jte, kts,kte                                )
245    CASE (CB05_SORG_VBS_AQ_KPP)
246        CALL wrf_debug(15,'aerosols_driver calling sorgam_vbs_driver')
247        do ii=its,ite
248           do kk=kts,kte
249              do jj=jts,jte
250                 if(chem(ii,kk,jj,p_nu0).lt.1.e07)then
251                    chem(ii,kk,jj,p_nu0)=1.e7
252                 endif
253              enddo
254           enddo
255        enddo
256        call sorgam_vbs_driver (id,ktauc,dtstepc,t_phy,moist,aerwrf,p8w,t8w, &
257             alt,p_phy,chem,rho_phy,dz8w,rh,z,z_at_w,                 &
258             h2oaj,h2oai,nu3,ac3,cor3,asulf,ahno3,anh3,               &
259             vcsulf_old,vdrog3_vbs,                                   &
260             config_flags%kemit,brch_ratio,                           &
261             ids,ide, jds,jde, kds,kde,                               &
262             ims,ime, jms,jme, kms,kme,                               &
263             its,ite, jts,jte, kts,kte                                )
265    CASE (RACMSORG_AQ,RACMSORG_AQCHEM_KPP,RACM_ESRLSORG_AQCHEM_KPP,RACMSORG_KPP,RACM_ESRLSORG_KPP)
266 ! ???? are separate cases needed here for radm2sorg and racmsorg packages ????
267        CALL wrf_debug(15,'aerosols_driver calling sorgam_driver')
268        do ii=its,ite
269           do kk=kts,kte
270              do jj=jts,jte
271                 if(chem(ii,kk,jj,p_nu0).lt.1.e07)then
272                    chem(ii,kk,jj,p_nu0)=1.e7
273                 endif
274              enddo
275           enddo
276        enddo
277        call sorgam_driver (id,ktauc,dtstepc,t_phy,moist,aerwrf,p8w,t8w, &
278                alt,p_phy,chem,rho_phy,dz8w,z,z_at_w,                    &
279                h2oaj,h2oai,nu3,ac3,cor3,asulf,ahno3,anh3,cvaro1,cvaro2, &
280                cvalk1,cvole1,cvapi1,cvapi2,cvlim1,cvlim2,vcsulf_old,    &
281                vdrog3,                                                  &
282                config_flags%kemit,                                      &
283                ids,ide, jds,jde, kds,kde,                               &
284                ims,ime, jms,jme, kms,kme,                               &
285                its,ite, jts,jte, kts,kte                                )
287    CASE (CBMZ_MOSAIC_4BIN, CBMZ_MOSAIC_KPP, CBMZ_MOSAIC_8BIN, CBMZ_MOSAIC_4BIN_AQ, &
288          CBMZ_MOSAIC_8BIN_AQ, SAPRC99_MOSAIC_4BIN_VBS2_KPP, &
289          MOZART_MOSAIC_4BIN_KPP, MOZART_MOSAIC_4BIN_AQ_KPP, &
290          SAPRC99_MOSAIC_8BIN_VBS2_AQ_KPP, SAPRC99_MOSAIC_8BIN_VBS2_KPP, & !BSINGH  Added "SAPRC99_MOSAIC_8BIN_VBS2_AQ_KPP" and "SAPRC99_MOSAIC_8BIN_VBS2_KPP"
291          CBMZ_MOSAIC_DMS_4BIN, CBMZ_MOSAIC_DMS_8BIN, CBMZ_MOSAIC_DMS_4BIN_AQ, CBMZ_MOSAIC_DMS_8BIN_AQ)
292        CALL wrf_debug(15,'aerosols_driver calling mosaic_aerchem_driver')
293        CALL mosaic_aerchem_driver(                                      &
294             id, curr_secs, ktau, dtstep, ktauc, dtstepc, config_flags,  &
295             t_phy, rho_phy, p_phy,                                      &
296             moist, chem,vbs_nbin,                                       &
297             ph_aer01, ph_aer02, ph_aer03, ph_aer04,                     &
298             ids,ide, jds,jde, kds,kde,                                  &
299             ims,ime, jms,jme, kms,kme,                                  &
300             its,ite, jts,jte, kts,kte                                   )
301    CASE ( RACM_SOA_VBS_KPP, RACM_SOA_VBS_AQCHEM_KPP, RACM_SOA_VBS_HET_KPP )
302        CALL wrf_debug(15,'aerosols_driver calling soa_vbs_driver')
303        do ii=its,ite
304           do kk=kts,kte
305              do jj=jts,jte
306                 if(chem(ii,kk,jj,p_nu0).lt.1.e07)then
307                    chem(ii,kk,jj,p_nu0)=1.e7
308                 endif
309              enddo
310           enddo
311        enddo
312        call soa_vbs_driver ( id,ktauc,dtstepc,t_phy,moist,aerwrf,p8w,t8w, &
313             alt,p_phy,chem,rho_phy,dz8w,rh,z,z_at_w,                 &
314             gamn2o5,cn2o5,kn2o5,yclno2,snu,sac,                    &
315             h2oaj,h2oai,nu3,ac3,cor3,asulf,ahno3,anh3,               &
316             vcsulf_old,vdrog3_vbs,                                   &
317             config_flags%kemit,brch_ratio,                           &
318             config_flags%do_isorropia,                               &
319             ids,ide, jds,jde, kds,kde,                               &
320             ims,ime, jms,jme, kms,kme,                               &
321             its,ite, jts,jte, kts,kte                                ) 
322 !--------------------------------------------------------------------------------------------------
323    CASE (CBMZ_CAM_MAM3_NOAQ, CBMZ_CAM_MAM3_AQ, CBMZ_CAM_MAM7_NOAQ, CBMZ_CAM_MAM7_AQ)
324        CALL wrf_debug(15,'aerosols_driver calling cam_mam_aerchem_driver')
325        CALL cam_mam_aerchem_driver(                                     &
326             id, curr_secs, ktau, dtstep, ktauc, dtstepc, config_flags,  &
327             t_phy, rho_phy, p_phy, p8w, alt, z, z_at_w, pbl_h, cldfra,  &
328             cldfra_mp_all, moist, chem,                                 &
329             dgnum, dgnumwet, wetdens_ap, del_h2so4_gasprod,             &
330             dvmrdt_sv13d,dvmrcwdt_sv13d,                                & 
331             is_CAMMGMP_used,                                            &
332             ids,ide, jds,jde, kds,kde,                                  &
333             ims,ime, jms,jme, kms,kme,                                  &
334             its,ite, jts,jte, kts,kte                                   )
337    CASE DEFAULT 
339    END SELECT cps_select
341    END SUBROUTINE aerosols_driver
343 !-----------------------------------------------------------------------
344 !   WRF-chem V3.0 : Original version of sum_pm_driver written by William Gustafson (PNNL)
345 !                   modified by G Grell for gocart inclusion
349    SUBROUTINE sum_pm_driver ( config_flags,                            &
350              alt, chem, h2oaj, h2oai,                                  &
351              pm2_5_dry, pm2_5_water, pm2_5_dry_ec, pm10,               &
352              tsoa,asoa,bsoa,                                           &
353              hoa_a01,hoa_a02,hoa_a03,hoa_a04,                          &
354              hoa_a05,hoa_a06,hoa_a07,hoa_a08,                          & !BSINGH Added 4 more bins for each species for SAPRC 8 bin version
355              bboa_a01,bboa_a02,bboa_a03,bboa_a04,                      &
356              bboa_a05,bboa_a06,bboa_a07,bboa_a08,                      &
357              soa_a01,soa_a02,soa_a03,soa_a04,                          &
358              soa_a05,soa_a06,soa_a07,soa_a08,                          &
359              bbsoa_a01,bbsoa_a02,bbsoa_a03,bbsoa_a04,                  &
360              bbsoa_a05,bbsoa_a06,bbsoa_a07,bbsoa_a08,                  &
361              hsoa_a01,hsoa_a02,hsoa_a03,hsoa_a04,                      &
362              hsoa_a05,hsoa_a06,hsoa_a07,hsoa_a08,                      &
363              biog_a01,biog_a02,biog_a03,biog_a04,                      &
364              biog_a05,biog_a06,biog_a07,biog_a08,                      &
365              asmpsoa_a01,asmpsoa_a02,asmpsoa_a03,asmpsoa_a04,          &
366              arosoa_a01,arosoa_a02,arosoa_a03,arosoa_a04,              &
367              arosoa_a05,arosoa_a06,arosoa_a07,arosoa_a08,              &
368              totoa_a01,totoa_a02,totoa_a03,totoa_a04,                  &
369              totoa_a05,totoa_a06,totoa_a07,totoa_a08,                  &
370              hsoa_c,hsoa_o,bbsoa_c,bbsoa_o,                            &
371              biog_v1,biog_v2,biog_v3,biog_v4,                          &
372              ant_v1,ant_v2,ant_v3,ant_v4,                              &
373              smpa_v1,smpbb_v1,                                         &
374              !BSINGH - Added cw aerosols(for VBS)
375              hoa_cw01,    hoa_cw02,    hoa_cw03,    hoa_cw04,          &
376              hoa_cw05,    hoa_cw06,    hoa_cw07,    hoa_cw08,          &
377              bboa_cw01,   bboa_cw02,   bboa_cw03,   bboa_cw04,         &
378              bboa_cw05,   bboa_cw06,   bboa_cw07,   bboa_cw08,         &
379              soa_cw01,    soa_cw02,    soa_cw03,    soa_cw04,          &
380              soa_cw05,    soa_cw06,    soa_cw07,    soa_cw08,          &
381              bbsoa_cw01,  bbsoa_cw02,  bbsoa_cw03,  bbsoa_cw04,        &
382              bbsoa_cw05,  bbsoa_cw06,  bbsoa_cw07,  bbsoa_cw08,        &
383              biog_cw01,   biog_cw02,   biog_cw03,   biog_cw04,         &
384              biog_cw05,   biog_cw06,   biog_cw07,   biog_cw08,         &
385              hsoa_cw01,   hsoa_cw02,   hsoa_cw03,   hsoa_cw04,         &
386              hsoa_cw05,   hsoa_cw06,   hsoa_cw07,   hsoa_cw08,         &
387              arosoa_cw01, arosoa_cw02, arosoa_cw03, arosoa_cw04,       &
388              arosoa_cw05, arosoa_cw06, arosoa_cw07, arosoa_cw08,       &
389              totoa_cw01,  totoa_cw02,  totoa_cw03,  totoa_cw04,        &
390              totoa_cw05,  totoa_cw06,  totoa_cw07,  totoa_cw08,        &        
391              hsoa_cw_c,   hsoa_cw_o,   bbsoa_cw_c,  bbsoa_cw_o,        &
392              biog_cw_v1,                                               &
393              ant_cw_v1,                                                &
394              !BSINGH -ENDS
395              ids,ide, jds,jde, kds,kde,                                &
396              ims,ime, jms,jme, kms,kme,                                &
397              its,ite, jts,jte, kts,kte                                  )
400    USE module_configure
401    USE module_aerosols_sorgam, only: sum_pm_sorgam
402    USE module_mosaic_driver, only: sum_pm_mosaic,sum_pm_mosaic_vbs2,sum_pm_mosaic_vbs0,sum_pm_mosaic_vbs4,&
403                                    sum_vbs9,sum_vbs2,sum_vbs0,sum_vbs4,sum_aq_vbs2
404    USE module_gocart_aerosols, only: sum_pm_gocart
405    USE module_aerosols_soa_vbs, only: sum_pm_soa_vbs
406    USE module_aerosols_sorgam_vbs, only: sum_pm_sorgam_vbs
408    IMPLICIT NONE
410    INTEGER,      INTENT(IN   )    ::                                   &
411                                       ids,ide, jds,jde, kds,kde,       &
412                                       ims,ime, jms,jme, kms,kme,       &
413                                       its,ite, jts,jte, kts,kte
415    REAL, DIMENSION( ims:ime, kms:kme, jms:jme, num_chem ),             &
416          INTENT(IN ) :: chem
418    REAL, DIMENSION( ims:ime, kms:kme, jms:jme ),                       &
419          INTENT(IN ) :: alt
420    REAL, DIMENSION( ims:ime, kms:kme, jms:jme ),                       &
421          OPTIONAL,                                                     &
422          INTENT(IN ) :: h2oaj,h2oai
424    REAL, DIMENSION( ims:ime, kms:kme, jms:jme ),                       &
425          OPTIONAL,                                                     &
426          INTENT(OUT) :: pm2_5_dry,pm2_5_water,pm2_5_dry_ec,pm10,       &
427              tsoa,asoa,bsoa,                                           &
428              hoa_a01,hoa_a02,hoa_a03,hoa_a04,                          &
429              hoa_a05,hoa_a06,hoa_a07,hoa_a08,                          &!BSINGH Added 4 more bins for each species for SAPRC 8 bin version             
430              bboa_a01,bboa_a02,bboa_a03,bboa_a04,                      &
431              bboa_a05,bboa_a06,bboa_a07,bboa_a08,                      & 
432              soa_a01,soa_a02,soa_a03,soa_a04,                          &
433              soa_a05,soa_a06,soa_a07,soa_a08,                          & 
434              bbsoa_a01,bbsoa_a02,bbsoa_a03,bbsoa_a04,                  &
435              bbsoa_a05,bbsoa_a06,bbsoa_a07,bbsoa_a08,                  &       
436              hsoa_a01,hsoa_a02,hsoa_a03,hsoa_a04,                      &
437              hsoa_a05,hsoa_a06,hsoa_a07,hsoa_a08,                      &  
438              biog_a01,biog_a02,biog_a03,biog_a04,                      &
439              biog_a05,biog_a06,biog_a07,biog_a08,                      & 
440              arosoa_a01,arosoa_a02,arosoa_a03,arosoa_a04,              &
441              arosoa_a05,arosoa_a06,arosoa_a07,arosoa_a08,              &   
442              totoa_a01,totoa_a02,totoa_a03,totoa_a04,                  &
443              totoa_a05,totoa_a06,totoa_a07,totoa_a08,                  &    
444              hsoa_c,hsoa_o,bbsoa_c,bbsoa_o,                            &
445              biog_v1,biog_v2,biog_v3,biog_v4,                          &
446              ant_v1,ant_v2,ant_v3,ant_v4,                              &
447              smpa_v1,                                                  &
448              smpbb_v1,                                                 &
449              asmpsoa_a01,asmpsoa_a02,asmpsoa_a03,asmpsoa_a04,       &!BSINGH - Not adding 5-8 bins for asmpsoa, as it is not req. for 8 bin SAPRC
450              !BSINGH - Added cw aerosols(for VBS)
451              hoa_cw01,    hoa_cw02,    hoa_cw03,    hoa_cw04,          &
452              hoa_cw05,    hoa_cw06,    hoa_cw07,    hoa_cw08,          &
453              bboa_cw01,   bboa_cw02,   bboa_cw03,   bboa_cw04,         &
454              bboa_cw05,   bboa_cw06,   bboa_cw07,   bboa_cw08,         &
455              soa_cw01,    soa_cw02,    soa_cw03,    soa_cw04,          &
456              soa_cw05,    soa_cw06,    soa_cw07,    soa_cw08,          &
457              bbsoa_cw01,  bbsoa_cw02,  bbsoa_cw03,  bbsoa_cw04,        &
458              bbsoa_cw05,  bbsoa_cw06,  bbsoa_cw07,  bbsoa_cw08,        &
459              biog_cw01,   biog_cw02,   biog_cw03,   biog_cw04,         &
460              biog_cw05,   biog_cw06,   biog_cw07,   biog_cw08,         &
461              hsoa_cw01,   hsoa_cw02,   hsoa_cw03,   hsoa_cw04,         &
462              hsoa_cw05,   hsoa_cw06,   hsoa_cw07,   hsoa_cw08,         &
463              arosoa_cw01, arosoa_cw02, arosoa_cw03, arosoa_cw04,       &
464              arosoa_cw05, arosoa_cw06, arosoa_cw07, arosoa_cw08,       &
465              totoa_cw01,  totoa_cw02,  totoa_cw03,  totoa_cw04,        &
466              totoa_cw05,  totoa_cw06,  totoa_cw07,  totoa_cw08,        &        
467              hsoa_cw_c,   hsoa_cw_o,   bbsoa_cw_c,  bbsoa_cw_o,        &
468              biog_cw_v1,                                               &
469              ant_cw_v1                                                 
470              !BSINGH -ENDS
473    TYPE(grid_config_rec_type),  INTENT(IN   )    :: config_flags
475 ! Select the active aerosol scheme and sum up pm2.5 and pm10 mass
476 ! for use in radiation and/or diagnostic purposes.
478    sum_pm_select: SELECT CASE(config_flags%chem_opt)
480    CASE (GOCART_SIMPLE,GOCARTRACM_KPP,GOCARTRADM2,MOZCART_KPP,T1_MOZCART_KPP)
481        CALL wrf_debug(15,'sum_pm_driver: calling sum_pm_gocart')
482        CALL sum_pm_gocart (                                            &
483             alt, chem,pm2_5_dry, pm2_5_dry_ec, pm10,                   &
484             ids,ide, jds,jde, kds,kde,                                 &
485             ims,ime, jms,jme, kms,kme,                                 &
486             its,ite, jts,jte, kts,kte                                  )
487    CASE (RADM2SORG,RADM2SORG_AQ,RADM2SORG_AQCHEM,RACMSORG_AQ,RACMSORG_AQCHEM_KPP,RACM_ESRLSORG_AQCHEM_KPP,RADM2SORG_KPP, &
488          RACMSORG_KPP,RACM_ESRLSORG_KPP,CBMZSORG,CBMZSORG_AQ,CB05_SORG_AQ_KPP)
489        CALL wrf_debug(15,'sum_pm_driver: calling sum_pm_sorgam')
490        CALL sum_pm_sorgam (                                            &
491             alt, chem, h2oaj, h2oai,                                   &
492             pm2_5_dry, pm2_5_water, pm2_5_dry_ec, pm10,                &
493             config_flags%dust_opt,ids,ide, jds,jde, kds,kde,           &
494             ims,ime, jms,jme, kms,kme,                                 &
495             its,ite, jts,jte, kts,kte                                  )
496    CASE (CB05_SORG_VBS_AQ_KPP)
497        CALL wrf_debug(15,'sum_pm_driver: calling sum_pm_sorgam_vbs')
498        CALL sum_pm_sorgam_vbs (                                        &
499             alt, chem, h2oaj, h2oai,                                   &
500             pm2_5_dry, pm2_5_water, pm2_5_dry_ec, pm10,                &
501             tsoa,asoa,bsoa,                                            &
502             config_flags%dust_opt,ids,ide, jds,jde, kds,kde,           &
503             ims,ime, jms,jme, kms,kme,                                 &
504             its,ite, jts,jte, kts,kte                                  )
505    CASE (RACM_SOA_VBS_KPP,RACM_SOA_VBS_AQCHEM_KPP,RACM_SOA_VBS_HET_KPP)
506        CALL wrf_debug(15,'sum_pm_driver: calling sum_pm_soa_vbs')
507        CALL sum_pm_soa_vbs (                                           &
508             alt, chem, h2oaj, h2oai,                                   &
509             pm2_5_dry, pm2_5_water, pm2_5_dry_ec, pm10,                &
510             config_flags%dust_opt,ids,ide, jds,jde, kds,kde,           &
511             ims,ime, jms,jme, kms,kme,                                 &
512             its,ite, jts,jte, kts,kte                                  )
514    CASE (CBMZ_MOSAIC_4BIN, CBMZ_MOSAIC_KPP, CBMZ_MOSAIC_8BIN, CBMZ_MOSAIC_4BIN_AQ, CBMZ_MOSAIC_8BIN_AQ, &
515          CBMZ_MOSAIC_DMS_4BIN, CBMZ_MOSAIC_DMS_8BIN, CBMZ_MOSAIC_DMS_4BIN_AQ, CBMZ_MOSAIC_DMS_8BIN_AQ, &
516          CRI_MOSAIC_8BIN_AQ_KPP, CRI_MOSAIC_4BIN_AQ_KPP)
517        CALL wrf_debug(15,'sum_pm_driver: calling sum_pm_mosaic')
518        call sum_pm_mosaic (                                            &
519             alt, chem,                                                 &
520             pm2_5_dry, pm2_5_water, pm2_5_dry_ec, pm10,                &
521             ids,ide, jds,jde, kds,kde,                                 &
522             ims,ime, jms,jme, kms,kme,                                 &
523             its,ite, jts,jte, kts,kte                                  )
525    CASE (SAPRC99_MOSAIC_4BIN_VBS2_KPP)
527        CALL wrf_debug(15,'sum_pm_driver: calling sum_pm_mosaic_vbs2')
528        call sum_pm_mosaic_vbs2 (                                       &
529             alt, chem,                                                 &
530             pm2_5_dry, pm2_5_water, pm2_5_dry_ec, pm10,                &
531             ids,ide, jds,jde, kds,kde,                                 &
532             ims,ime, jms,jme, kms,kme,                                 &
533             its,ite, jts,jte, kts,kte                                  )
535        CALL wrf_debug(15,'sum_pm_driver: calling sum_vbs2')
536        call sum_vbs2 ( config_flags%aero_diag_opt,                     &
537              alt, chem,                                                &
538              hoa_a01,hoa_a02,hoa_a03,hoa_a04,                          &
539              hoa_a05,hoa_a06,hoa_a07,hoa_a08,                          &
540              bboa_a01,bboa_a02,bboa_a03,bboa_a04,                      &
541              bboa_a05,bboa_a06,bboa_a07,bboa_a08,                      &
542              soa_a01,soa_a02,soa_a03,soa_a04,                          &
543              soa_a05,soa_a06,soa_a07,soa_a08,                          &
544              bbsoa_a01,bbsoa_a02,bbsoa_a03,bbsoa_a04,                  &
545              bbsoa_a05,bbsoa_a06,bbsoa_a07,bbsoa_a08,                  &
546              hsoa_a01,hsoa_a02,hsoa_a03,hsoa_a04,                      &
547              hsoa_a05,hsoa_a06,hsoa_a07,hsoa_a08,                      &
548              biog_a01,biog_a02,biog_a03,biog_a04,                      &
549              biog_a05,biog_a06,biog_a07,biog_a08,                      &
550              arosoa_a01,arosoa_a02,arosoa_a03,arosoa_a04,              &
551              arosoa_a05,arosoa_a06,arosoa_a07,arosoa_a08,              &
552              totoa_a01,totoa_a02,totoa_a03,totoa_a04,                  &
553              totoa_a05,totoa_a06,totoa_a07,totoa_a08,                  &
554              hsoa_c,hsoa_o,bbsoa_c,bbsoa_o,                            &
555              biog_v1,biog_v2,biog_v3,biog_v4,                          &
556              ant_v1,ant_v2,ant_v3,ant_v4,                              &
557              ids,ide, jds,jde, kds,kde,                                &
558              ims,ime, jms,jme, kms,kme,                                &
559              its,ite, jts,jte, kts,kte                                  )
561    CASE (MOZART_MOSAIC_4BIN_KPP)
563        CALL wrf_debug(15,'sum_pm_driver: calling sum_pm_mosaic_vbs0')
564        call sum_pm_mosaic_vbs0 (                                       &
565             alt, chem,                                                 &
566             pm2_5_dry, pm2_5_water, pm2_5_dry_ec, pm10,                &
567             ids,ide, jds,jde, kds,kde,                                 &
568             ims,ime, jms,jme, kms,kme,                                 &
569             its,ite, jts,jte, kts,kte                                  )
571        CALL wrf_debug(15,'sum_pm_driver: calling sum_vbs0')
572        call sum_vbs0 ( config_flags%aero_diag_opt,                     &
573              alt, chem,                                                &
574              hoa_a01,hoa_a02,hoa_a03,hoa_a04,                          &
575              bboa_a01,bboa_a02,bboa_a03,bboa_a04,                      &
576              soa_a01,soa_a02,soa_a03,soa_a04,                          &
577              bbsoa_a01,bbsoa_a02,bbsoa_a03,bbsoa_a04,                  &
578              biog_a01,biog_a02,biog_a03,biog_a04,                      &
579              asmpsoa_a01,asmpsoa_a02,asmpsoa_a03,asmpsoa_a04,              &
580              arosoa_a01,arosoa_a02,arosoa_a03,arosoa_a04,              &
581              totoa_a01,totoa_a02,totoa_a03,totoa_a04,                  &
582              biog_v1,biog_v2,biog_v3,biog_v4,                          &
583              ant_v1,ant_v2,ant_v3,ant_v4,                              &
584              smpa_v1,smpbb_v1,                              &
585              ids,ide, jds,jde, kds,kde,                                &
586              ims,ime, jms,jme, kms,kme,                                &
587              its,ite, jts,jte, kts,kte                                  )
589    CASE (MOZART_MOSAIC_4BIN_AQ_KPP)
591        CALL wrf_debug(15,'sum_pm_driver: calling sum_pm_mosaic_vbs4')
592        call sum_pm_mosaic_vbs4 (                                       &
593             alt, chem,                                                 &
594             pm2_5_dry, pm2_5_water, pm2_5_dry_ec, pm10,                &
595             ids,ide, jds,jde, kds,kde,                                 &
596             ims,ime, jms,jme, kms,kme,                                 &
597             its,ite, jts,jte, kts,kte                                  )
599        CALL wrf_debug(15,'sum_pm_driver: calling sum_vbs4')
600        call sum_vbs4 ( config_flags%aero_diag_opt,                     &
601              alt, chem,                                                &
602              hoa_a01,hoa_a02,hoa_a03,hoa_a04,                          &
603              soa_a01,soa_a02,soa_a03,soa_a04,                          &
604              biog_a01,biog_a02,biog_a03,biog_a04,                      &
605              totoa_a01,totoa_a02,totoa_a03,totoa_a04,                  &
606              biog_v1,biog_v2,biog_v3,biog_v4,                          &
607              ant_v1,ant_v2,ant_v3,ant_v4,                              &
608              ids,ide, jds,jde, kds,kde,                                &
609              ims,ime, jms,jme, kms,kme,                                &
610              its,ite, jts,jte, kts,kte                                 )
611        !BSINGH -  Added for 8 bin SAPRC VBS 2 and non-aq on (04/07/2014)
612     CASE (SAPRC99_MOSAIC_8BIN_VBS2_AQ_KPP,SAPRC99_MOSAIC_8BIN_VBS2_KPP)
613        
614        CALL wrf_debug(15,'sum_pm_driver: calling sum_pm_mosaic_vbs2')
615        call sum_pm_mosaic_vbs2 (                                       &
616             alt, chem,                                                 &
617             pm2_5_dry, pm2_5_water, pm2_5_dry_ec, pm10,                &
618             ids,ide, jds,jde, kds,kde,                                 &
619             ims,ime, jms,jme, kms,kme,                                 &
620             its,ite, jts,jte, kts,kte                                  )
622        CALL wrf_debug(15,'sum_pm_driver: calling sum_vbs2')
623        call sum_vbs2 ( config_flags%aero_diag_opt,                     &
624              alt, chem,                                                &
625              hoa_a01,hoa_a02,hoa_a03,hoa_a04,                          &
626              hoa_a05,hoa_a06,hoa_a07,hoa_a08,                          &
627              bboa_a01,bboa_a02,bboa_a03,bboa_a04,                      &
628              bboa_a05,bboa_a06,bboa_a07,bboa_a08,                      &
629              soa_a01,soa_a02,soa_a03,soa_a04,                          &
630              soa_a05,soa_a06,soa_a07,soa_a08,                          &
631              bbsoa_a01,bbsoa_a02,bbsoa_a03,bbsoa_a04,                  &
632              bbsoa_a05,bbsoa_a06,bbsoa_a07,bbsoa_a08,                  &
633              hsoa_a01,hsoa_a02,hsoa_a03,hsoa_a04,                      &
634              hsoa_a05,hsoa_a06,hsoa_a07,hsoa_a08,                      &
635              biog_a01,biog_a02,biog_a03,biog_a04,                      &
636              biog_a05,biog_a06,biog_a07,biog_a08,                      &
637              arosoa_a01,arosoa_a02,arosoa_a03,arosoa_a04,              &
638              arosoa_a05,arosoa_a06,arosoa_a07,arosoa_a08,              &
639              totoa_a01,totoa_a02,totoa_a03,totoa_a04,                  &
640              totoa_a05,totoa_a06,totoa_a07,totoa_a08,                  &
641              hsoa_c,hsoa_o,bbsoa_c,bbsoa_o,                            &
642              biog_v1,biog_v2,biog_v3,biog_v4,                          &
643              ant_v1,ant_v2,ant_v3,ant_v4,                              &
644              ids,ide, jds,jde, kds,kde,                                &
645              ims,ime, jms,jme, kms,kme,                                &
646              its,ite, jts,jte, kts,kte                                  )
650        IF( config_flags%aero_cw_diag_opt == diag_cw_aero ) THEN
651        CALL wrf_debug(15,'sum_pm_driver: calling sum_aq_vbs2')
652        call sum_aq_vbs2 (                                                  &
653              alt, chem,                                                    &
654              hoa_cw01,hoa_cw02,hoa_cw03,hoa_cw04,hoa_cw05,hoa_cw06,hoa_cw07,hoa_cw08,                          &
655              bboa_cw01,bboa_cw02,bboa_cw03,bboa_cw04,bboa_cw05,bboa_cw06,bboa_cw07,bboa_cw08,                  &
656              soa_cw01,soa_cw02,soa_cw03,soa_cw04,soa_cw05,soa_cw06,soa_cw07,soa_cw08,                          &
657              bbsoa_cw01,bbsoa_cw02,bbsoa_cw03,bbsoa_cw04,bbsoa_cw05,bbsoa_cw06,bbsoa_cw07,bbsoa_cw08,          &
658              hsoa_cw01,hsoa_cw02,hsoa_cw03,hsoa_cw04,hsoa_cw05,hsoa_cw06,hsoa_cw07,hsoa_cw08,                  &
659              biog_cw01,biog_cw02,biog_cw03,biog_cw04,biog_cw05,biog_cw06,biog_cw07,biog_cw08,                  &
660              arosoa_cw01,arosoa_cw02,arosoa_cw03,arosoa_cw04,arosoa_cw05,arosoa_cw06,arosoa_cw07,arosoa_cw08,  &
661              totoa_cw01,totoa_cw02,totoa_cw03,totoa_cw04,totoa_cw05,totoa_cw06,totoa_cw07,totoa_cw08,          &
662              hsoa_cw_c,hsoa_cw_o,bbsoa_cw_c,bbsoa_cw_o,                    &
663              biog_cw_v1,                                                   &
664              ant_cw_v1,                                                    &
665              ids,ide, jds,jde, kds,kde,                                &
666              ims,ime, jms,jme, kms,kme,                                &
667              its,ite, jts,jte, kts,kte                                  )
668        ENDIF
669        !BSINGH -ENDS
671    CASE DEFAULT 
673    END SELECT sum_pm_select
675    END SUBROUTINE sum_pm_driver