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