Merge remote-tracking branch 'origin/release-v4.6.1'
[WRF.git] / chem / photolysis_driver.F
blob5ac6772ecb8a768c79c89af5798ed9decb6a7953
1 !WRF:MODEL_LAYER:CHEMISTRY
3       SUBROUTINE photolysis_driver (id,curr_secs,ktau,dtstep,            &
4                config_flags,haveaer,                                     &
5                dt_cld,af_dir,af_dn,af_up,par,erythema,                   &
6                gmt,julday,t_phy,moist,aerwrf,p8w,t8w,p_phy,              &
7                chem,rho_phy,dz8w,xlat,xlong,z,z_at_w,gd_cloud,gd_cloud2, &
8                bl_cld,bl_cld2,                                           &
9                ph_macr,ph_o31d,ph_o33p,ph_no2,                           &
10                ph_clno2,                                                 &
11                ph_no3o2,                                                 &
12                ph_no3o,ph_hno2,ph_hno3,ph_hno4,ph_h2o2,                  &
13                ph_ch2or,ph_ch2om,ph_ch3cho,ph_ch3coch3,                  &
14                ph_ch3coc2h5,ph_hcocho,ph_ch3cocho,                       &
15                ph_hcochest,ph_ch3o2h,ph_ch3coo2h,ph_ch3ono2,             &
16                ph_hcochob, ph_n2o5,ph_o2,ph_n2o,                         &
17                ph_pan,ph_mpan,ph_acetol,ph_gly,                          &
18                ph_bigald,ph_mek,ph_c2h5ooh,ph_c3h7ooh,ph_pooh,           &
19                ph_rooh,ph_xooh,ph_isopooh,ph_alkooh,                     &
20                ph_mekooh,ph_tolooh,ph_terpooh,ph_mvk,                    &
21                ph_glyald,ph_hyac,                                        &
22                ph_cl2,ph_hocl,ph_fmcl,                                   &
23                nref0, nw0, tuv_jmax0,                                    &
24                ph_radfld, ph_adjcoe, ph_prate,                           &
25                wc, zref,                                                 &
26                tauaer1,tauaer2,tauaer3,tauaer4,                          &
27                gaer1,gaer2,gaer3,gaer4,                                  &
28                waer1,waer2,waer3,waer4,                                  &
29                bscoef1,bscoef2,bscoef3,bscoef4,                          &
30                l2aer,l3aer,l4aer,l5aer,l6aer,l7aer,                      &
31                pm2_5_dry,pm2_5_water,uvrad,ivgtyp,                       &
32                o3_gfs_du,                                                &
33                ids,ide, jds,jde, kds,kde,                                &
34                ims,ime, jms,jme, kms,kme,                                &
35                its,ite, jts,jte, kts,kte                                 )
37 !------------------------------------------------------------------------
38    USE module_configure
39    USE module_state_description
40    USE module_model_constants
41    USE module_phot_mad
42    USE module_phot_fastj
43    USE module_ftuv_driver
44    USE module_phot_tuv, only : tuv_driver
46    INTEGER,      INTENT(IN   ) :: id,julday,                           &
47                                   ids,ide, jds,jde, kds,kde,           &
48                                   ims,ime, jms,jme, kms,kme,           &
49                                   its,ite, jts,jte, kts,kte
50    INTEGER,      INTENT(IN   ) :: ktau
51    REAL(KIND=8), INTENT(IN   ) :: curr_secs
52    REAL,         INTENT(IN   ) :: dtstep,gmt
54 ! advected moisture variables
56    REAL, DIMENSION( ims:ime, kms:kme, jms:jme, num_moist ),            &
57          INTENT(IN ) ::                                   moist
59 !  aerosol interaction
61    REAL, DIMENSION( ims:ime, kms:kme, jms:jme ),                       & 
62          INTENT(INOUT ) ::                                             &
63                pm2_5_dry,pm2_5_water, aerwrf
65 ! arrays that hold the photolysis rates
68    REAL, DIMENSION( ims:ime, kms:kme, jms:jme ),                       &  
69          INTENT(INOUT ) ::                                             &
70            ph_macr,ph_o31d,ph_o33p,ph_no2,                             &
71            ph_clno2,                                                   &
72            ph_no3o2,ph_no3o,ph_hno2,                                   &
73            ph_hno3,ph_hno4,ph_h2o2,ph_ch2or,ph_ch2om,ph_ch3cho,        &  
74            ph_ch3coch3,ph_ch3coc2h5,ph_hcocho,ph_ch3cocho,             &  
75            ph_hcochest,ph_ch3o2h,ph_ch3coo2h,ph_ch3ono2,ph_hcochob,    &
76            ph_n2o5,ph_o2,ph_n2o,ph_pan,ph_mpan,ph_acetol,ph_gly,       &
77            ph_bigald,ph_mek,ph_c2h5ooh,ph_c3h7ooh,ph_pooh,ph_rooh,     &
78            ph_xooh,ph_isopooh,ph_alkooh,ph_mekooh,ph_tolooh,           &
79            ph_terpooh,ph_mvk,ph_glyald,ph_hyac,                        &
80            ph_cl2,ph_hocl,ph_fmcl
82    REAL, INTENT(INOUT)  ::                                             &
83            dt_cld(ims:ime,kms:kme,jms:jme),                            &
84            af_dir(ims:ime,kms:kme,jms:jme),                            &
85            af_dn(ims:ime,kms:kme,jms:jme),                             &
86            af_up(ims:ime,kms:kme,jms:jme),                             &
87            par(ims:ime,kms:kme,jms:jme),                               &
88            erythema(ims:ime,kms:kme,jms:jme)
90    INTEGER,      INTENT(IN   ) :: nref0, nw0, tuv_jmax0 
91    real, dimension( ims:ime, nref0, jms:jme, nw0 ),                    &
92             intent(out  ) :: ph_radfld
93    real, dimension( ims:ime, nref0, jms:jme, tuv_jmax0 ),              &
94             intent(out  ) :: ph_adjcoe
95    real, dimension( ims:ime, nref0, jms:jme, tuv_jmax0 ),              &
96             intent(out  ) :: ph_prate
97    real, dimension(nw0),                                               &
98             intent(out  ) :: wc
99    real, dimension(nref0),                                             &
100             intent(out  ) :: zref
101    REAL, DIMENSION( ims:ime, kms:kme, jms:jme ),                       &  
102          OPTIONAL,                                                     &
103          INTENT(INOUT ) ::                                             &
104            gd_cloud,gd_cloud2,bl_cld,bl_cld2
106 ! arrays that hold the aerosol optical properties
108    REAL, DIMENSION( ims:ime, kms:kme, jms:jme ),                       &  
109          INTENT(IN ) ::                                                &
110            tauaer1,tauaer2,tauaer3,tauaer4,                            &
111            gaer1,gaer2,gaer3,gaer4,                                    &
112            waer1,waer2,waer3,waer4,                                    &
113            bscoef1,bscoef2,bscoef3,bscoef4                              
114    REAL, DIMENSION( ims:ime, kms:kme, jms:jme, 1:4 ),                  &  
115          INTENT(IN ) ::                                                &
116            l2aer,l3aer,l4aer,l5aer,l6aer,l7aer
118 ! array that holds all advected chemical species
120    REAL, DIMENSION( ims:ime, kms:kme, jms:jme, num_chem ),             &
121          INTENT(INOUT ) ::                                   chem
123 ! on input from meteorological part of model
125    REAL,  DIMENSION( ims:ime , kms:kme , jms:jme )         ,           &
126           INTENT(IN   ) ::                                             &
127                                                       t_phy,           &
128                                                       p_phy,           &
129                                                       dz8w,            &
130                                           t8w,p8w,z,z_at_w,            &
131                                                     rho_phy
132    REAL,  DIMENSION( ims:ime , jms:jme )                   ,           &
133           INTENT(INOUT   ) ::  uvrad
134    REAL,  DIMENSION( ims:ime , jms:jme )                   ,           &
135           INTENT(IN   ) ::                                             &
136                                                      xlat,             &
137                                                      xlong
138    REAL,  DIMENSION( ims:ime, jms:jme ),                                & 
139           OPTIONAL, INTENT(IN ) :: o3_gfs_du
141    TYPE(grid_config_rec_type),  INTENT(IN   )    :: config_flags
143    LOGICAL, INTENT(IN)  :: haveaer
144    integer, INTENT(IN ) :: ivgtyp(ims:ime,jms:jme)
145    character(len=132)   :: dbg_msg
146 !         
147 !                                                    
148 ! LOCAL  VAR
151 !-----------------------------------------------------------------
153    IF (config_flags%phot_opt .eq. 0) return
155    write(dbg_msg,*) 'photolysis_driver: called for domain ',id
156    CALL wrf_message( trim(dbg_msg) )
158 ! select photolysis option
160    chem_phot_select: SELECT CASE(config_flags%phot_opt)
162      CASE (PHOTMAD)
163        CALL wrf_debug(15,'calling madronich1_driver')
164        call madronich1_driver(id,curr_secs,ktau,config_flags,haveaer,  &
165                gmt,julday,t_phy,moist,aerwrf,p8w,t8w,p_phy,            &
166                chem,rho_phy,dz8w,xlat,xlong,z_at_w,gd_cloud,gd_cloud2, &
167                ph_macr,ph_o31d,ph_o33p,ph_no2,                  &
168 !liqy
169                 ph_cl2,ph_hocl,ph_clno2,ph_fmcl,        &
170 !liqy-20140911 
171                 ph_no3o2,ph_no3o,ph_hno2,&
172                ph_hno3,ph_hno4,ph_h2o2,ph_ch2or,ph_ch2om,ph_ch3cho,    &
173                ph_ch3coch3,ph_ch3coc2h5,ph_hcocho,ph_ch3cocho,         &
174                ph_hcochest,ph_ch3o2h,ph_ch3coo2h,ph_ch3ono2,ph_hcochob,&
175                pm2_5_dry,pm2_5_water,uvrad,                            &
176                ids,ide, jds,jde, kds,kde,                              &
177                ims,ime, jms,jme, kms,kme,                              &
178                its,ite, jts,jte, kts,kte                               )
179      CASE (PHOTFASTJ)
180        call wrf_debug(15,'calling fastj_driver')
181        call fastj_driver(id,curr_secs,dtstep,config_flags,             &
182                gmt,julday,t_phy,moist,p8w,p_phy,                       &
183                chem,rho_phy,dz8w,xlat,xlong,z_at_w,                    &
184                ph_o2,ph_o31d,ph_o33p,ph_no2,ph_no3o2,ph_no3o,ph_hno2,  &
185                ph_hno3,ph_hno4,ph_h2o2,ph_ch2or,ph_ch2om,ph_ch3cho,    &
186                ph_ch3coch3,ph_ch3coc2h5,ph_hcocho,ph_ch3cocho,         &
187                ph_hcochest,ph_ch3o2h,ph_ch3coo2h,ph_ch3ono2,ph_hcochob,&
188                ph_n2o5,                                                &
189                tauaer1,tauaer2,tauaer3,tauaer4,                        &
190                gaer1,gaer2,gaer3,gaer4,                                &
191                waer1,waer2,waer3,waer4,                                &
192                bscoef1,bscoef2,bscoef3,bscoef4,                        &
193                l2aer,l3aer,l4aer,l5aer,l6aer,l7aer,                    &
194                ids,ide, jds,jde, kds,kde,                              &
195                ims,ime, jms,jme, kms,kme,                              &
196                its,ite, jts,jte, kts,kte                               )
197      CASE (FTUV)
198        call wrf_debug(15,'calling ftuv_driver')
199        call ftuv_driver(      id, curr_secs, dtstep, config_flags,     &
200                               gmt, julday,                             &
201                               p_phy, t_phy, rho_phy, p8w, t8w,         &
202                               xlat, xlong,    z_at_w,                  &
203                               moist, chem, gd_cloud,gd_cloud2,         &
204                               ph_no2,ph_o31d,ph_o33p,ph_hno2,          &
205                               ph_hno3,ph_hno4,ph_no3o2,ph_no3o,        &
206                               ph_h2o2,ph_ch2om,ph_ch2or,ph_ch3cho,     &
207                               ph_ch3o2h,ph_o2,ph_ch3coo2h,ph_ch3coch3,ph_hcocho, &
208                               ph_hcochob,ph_ch3cocho,ph_hcochest,ph_ch3ono2,     &
209                               ph_macr,ph_ch3coc2h5,ph_n2o,             &
210                               ph_pan,ph_mpan,ph_acetol,ph_gly,         &
211                               ph_bigald,ph_mek,ph_c2h5ooh,ph_c3h7ooh,  &
212                               ph_pooh,ph_rooh,ph_xooh,ph_isopooh,      &
213                               ph_alkooh,ph_mekooh,ph_tolooh,ph_terpooh,&
214                               ph_n2o5,ph_mvk,ph_glyald,ph_hyac,        &
215                               ph_cl2,ph_hocl,ph_fmcl,                  &
216                               ivgtyp,                                  &
217                               nref0, nw0, tuv_jmax0,                   &
218                               ph_radfld, ph_adjcoe, ph_prate,          &
219                               wc,zref,                                 &
220                               tauaer1, tauaer2, tauaer3, tauaer4,      &    !rajesh
221                               waer1, waer2, waer3, waer4,              &    !rajesh
222                               gaer1, gaer2, gaer3, gaer4,              &    !rajesh
223                               ids,ide, jds,jde, kds,kde,               &
224                               ims,ime, jms,jme, kms,kme,               &
225                               its,ite, jts,jte, kts,kte                )
226      CASE (TUV)
227        CALL wrf_debug(15,'calling tuv driver')
228        call tuv_driver(                                                &
229                id, curr_secs, ktau, config_flags, haveaer,             &
230                gmt, julday, t_phy, moist, aerwrf,                      &
231                p8w, t8w, p_phy, chem, rho_phy,                         &
232                dz8w, xlat, xlong, z, z_at_w, gd_cloud, gd_cloud2,      &
233                bl_cld,bl_cld2,                                         &
234                tauaer1,tauaer2,tauaer3,tauaer4,                        &
235                gaer1,gaer2,gaer3,gaer4,                                &
236                waer1,waer2,waer3,waer4,                                &
237                ph_macr,ph_o31d,ph_o33p,ph_no2,ph_no3o2,ph_no3o,ph_hno2,&
238                ph_hno3,ph_hno4,ph_h2o2,ph_ch2or,ph_ch2om,ph_ch3cho,    &
239                ph_ch3coch3,ph_ch3coc2h5,ph_hcocho,ph_ch3cocho,         &
240                ph_hcochest,ph_ch3o2h,ph_ch3coo2h,ph_ch3ono2,ph_hcochob,&
241                ph_n2o5,ph_o2,ph_n2o,ph_pooh,ph_pan,ph_mvk,ph_hyac,     &
242                ph_glyald,ph_mek,ph_gly,                                &
243                pm2_5_dry, pm2_5_water, uvrad,                          &
244                dt_cld,af_dir,af_dn,af_up,par,erythema,                 &
245                o3_gfs_du,                                              &
246                ids,ide, jds,jde, kds,kde,                              &
247                ims,ime, jms,jme, kms,kme,                              &
248                its,ite, jts,jte, kts,kte                               )
249      CASE DEFAULT
251    END SELECT chem_phot_select
253 END SUBROUTINE photolysis_driver