Line data Source code
1 : module mo_chm_diags
2 :
3 : use shr_kind_mod, only : r8 => shr_kind_r8
4 : use chem_mods, only : gas_pcnst
5 : use mo_tracname, only : solsym
6 : use chem_mods, only : rxntot, nfs, gas_pcnst, indexm, adv_mass
7 : use ppgrid, only : pver
8 : use mo_constants, only : rgrav, rearth
9 : use mo_chem_utls, only : get_rxt_ndx, get_spc_ndx
10 : use cam_history, only : fieldname_len
11 : use mo_jeuv, only : neuv
12 : use gas_wetdep_opts,only : gas_wetdep_method
13 : use mo_drydep, only : has_drydep
14 :
15 : implicit none
16 : private
17 :
18 : public :: chm_diags_inti
19 : public :: chm_diags
20 : public :: het_diags
21 : public :: chm_prod_ndep_flx
22 :
23 : integer :: id_n,id_no,id_no2,id_no3,id_n2o5,id_hno3,id_ho2no2,id_clono2,id_brono2
24 : integer :: id_isopfdn, id_isopfdnc, id_terpfdn !these are dinitrates
25 : integer :: id_cl,id_clo,id_hocl,id_cl2,id_cl2o2,id_oclo,id_hcl,id_brcl
26 : integer :: id_ccl4,id_cfc11,id_cfc113,id_ch3ccl3,id_cfc12,id_ch3cl,id_hcfc22,id_cf3br,id_cf2clbr
27 : integer :: id_cfc114,id_cfc115,id_hcfc141b,id_hcfc142b,id_h1202,id_h2402,id_ch2br2,id_chbr3
28 : integer :: id_hf,id_f,id_cof2,id_cofcl,id_ch3br
29 : integer :: id_br,id_bro,id_hbr,id_hobr,id_ch4,id_h2o,id_h2
30 : integer :: id_o,id_o2,id_h, id_h2o2, id_n2o
31 : integer :: id_co2,id_o3,id_oh,id_ho2,id_so4_a1,id_so4_a2,id_so4_a3
32 : integer :: id_num_a2,id_num_a3,id_dst_a3,id_ncl_a3
33 : integer :: id_ndep,id_nhdep
34 :
35 : integer, parameter :: NJEUV = neuv
36 : integer :: rid_jeuv(NJEUV), rid_jno_i, rid_jno
37 :
38 : logical :: has_jeuvs, has_jno_i, has_jno
39 :
40 : integer :: nox_species(3), noy_species(56)
41 : integer :: clox_species(6), cloy_species(9), tcly_species(21)
42 : integer :: brox_species(4), broy_species(6), tbry_species(13)
43 : integer :: foy_species(4), tfy_species(16)
44 : integer :: hox_species(4)
45 : integer :: toth_species(3)
46 : integer :: sox_species(3)
47 : integer :: nhx_species(2)
48 : integer :: aer_species(gas_pcnst)
49 :
50 : character(len=fieldname_len) :: dtchem_name(gas_pcnst)
51 : character(len=fieldname_len) :: depvel_name(gas_pcnst)
52 : character(len=fieldname_len) :: depflx_name(gas_pcnst)
53 : character(len=fieldname_len) :: wetdep_name(gas_pcnst)
54 : character(len=fieldname_len) :: wtrate_name(gas_pcnst)
55 :
56 : real(r8), parameter :: N_molwgt = 14.00674_r8
57 : real(r8), parameter :: S_molwgt = 32.066_r8
58 :
59 : logical, protected :: chm_prod_ndep_flx =.false.
60 :
61 : contains
62 :
63 74496 : subroutine chm_diags_inti
64 : !--------------------------------------------------------------------
65 : ! ... initialize utility routine
66 : !--------------------------------------------------------------------
67 :
68 : use cam_history, only : addfld, add_default, horiz_only
69 : use constituents, only : cnst_get_ind, cnst_longname
70 : use phys_control, only : phys_getopts
71 : use species_sums_diags, only : species_sums_init
72 :
73 : integer :: j, k, m, n
74 : character(len=16) :: jname, spc_name, attr
75 : character(len=2) :: jchar
76 : character(len=2) :: unit_basename ! Units 'kg' or '1'
77 :
78 : integer :: id_pan, id_onit, id_mpan, id_isopno3, id_onitr, id_nh4no3
79 : integer :: id_so2, id_so4, id_h2so4
80 : integer :: id_nh3, id_nh4
81 : integer :: id_honitr
82 : integer :: id_alknit
83 : integer :: id_isopnita
84 : integer :: id_isopnitb
85 : integer :: id_isopnooh
86 : integer :: id_nc4ch2oh
87 : integer :: id_nc4cho
88 : integer :: id_noa
89 : integer :: id_nterpooh
90 : integer :: id_pbznit
91 : integer :: id_terpnit
92 : integer :: id_dst01, id_dst02, id_dst03, id_dst04, id_sslt01, id_sslt02, id_sslt03, id_sslt04
93 : integer :: id_soa, id_oc1, id_oc2, id_cb1, id_cb2
94 : integer :: id_soam,id_soai,id_soat,id_soab,id_soax
95 : integer :: id_bry, id_cly
96 : integer :: id_isopn2b, id_isopn3b, id_isopn1d, id_isopn4d, id_isopnbno3
97 : integer :: id_isopfnp, id_isopnoohb, id_isopnoohd, id_inheb, id_inhed
98 : integer :: id_no3ch2cho, id_macrn, id_mvkn, id_isopfnc, id_terpns
99 : integer :: id_terpnt, id_terpnt1, id_terpns1, id_terpnpt, id_terpnps
100 : integer :: id_terpnpt1, id_terpnps1, id_sqtn, id_terphfn
101 : integer :: id_terpapan, id_terpa2pan, id_terpa3pan
102 :
103 : logical :: history_aerosol ! Output the MAM aerosol tendencies
104 : logical :: history_chemistry
105 : logical :: history_cesm_forcing
106 : logical :: history_scwaccm_forcing
107 : logical :: history_chemspecies_srf ! output the chemistry constituents species in the surface layer
108 : logical :: history_dust
109 : integer :: bulkaero_species(20)
110 :
111 : !-----------------------------------------------------------------------
112 :
113 : call phys_getopts( history_aerosol_out = history_aerosol, &
114 : history_chemistry_out = history_chemistry, &
115 : history_chemspecies_srf_out = history_chemspecies_srf, &
116 : history_cesm_forcing_out = history_cesm_forcing, &
117 : history_scwaccm_forcing_out = history_scwaccm_forcing, &
118 1536 : history_dust_out = history_dust )
119 :
120 1536 : id_bry = get_spc_ndx( 'BRY' )
121 1536 : id_cly = get_spc_ndx( 'CLY' )
122 :
123 1536 : id_n = get_spc_ndx( 'N' )
124 1536 : id_no = get_spc_ndx( 'NO' )
125 1536 : id_no2 = get_spc_ndx( 'NO2' )
126 1536 : id_no3 = get_spc_ndx( 'NO3' )
127 1536 : id_n2o5 = get_spc_ndx( 'N2O5' )
128 1536 : id_n2o = get_spc_ndx( 'N2O' )
129 1536 : id_hno3 = get_spc_ndx( 'HNO3' )
130 1536 : id_ho2no2 = get_spc_ndx( 'HO2NO2' )
131 1536 : id_clono2 = get_spc_ndx( 'CLONO2' )
132 1536 : id_brono2 = get_spc_ndx( 'BRONO2' )
133 1536 : id_cl = get_spc_ndx( 'CL' )
134 1536 : id_clo = get_spc_ndx( 'CLO' )
135 1536 : id_hocl = get_spc_ndx( 'HOCL' )
136 1536 : id_cl2 = get_spc_ndx( 'CL2' )
137 1536 : id_cl2o2 = get_spc_ndx( 'CL2O2' )
138 1536 : id_oclo = get_spc_ndx( 'OCLO' )
139 1536 : id_hcl = get_spc_ndx( 'HCL' )
140 1536 : id_brcl = get_spc_ndx( 'BRCL' )
141 :
142 1536 : id_co2 = get_spc_ndx( 'CO2' )
143 1536 : id_o3 = get_spc_ndx( 'O3' )
144 1536 : id_oh = get_spc_ndx( 'OH' )
145 1536 : id_ho2 = get_spc_ndx( 'HO2' )
146 1536 : id_h2o2 = get_spc_ndx( 'H2O2' )
147 1536 : id_so4_a1 = get_spc_ndx( 'so4_a1' )
148 1536 : id_so4_a2 = get_spc_ndx( 'so4_a2' )
149 1536 : id_so4_a3 = get_spc_ndx( 'so4_a3' )
150 1536 : id_num_a2 = get_spc_ndx( 'num_a2' )
151 1536 : id_num_a3 = get_spc_ndx( 'num_a3' )
152 1536 : id_dst_a3 = get_spc_ndx( 'dst_a3' )
153 1536 : id_ncl_a3 = get_spc_ndx( 'ncl_a3' )
154 :
155 1536 : id_f = get_spc_ndx( 'F' )
156 1536 : id_hf = get_spc_ndx( 'HF' )
157 1536 : id_cofcl = get_spc_ndx( 'COFCL' )
158 1536 : id_cof2 = get_spc_ndx( 'COF2' )
159 :
160 1536 : id_ccl4 = get_spc_ndx( 'CCL4' )
161 1536 : id_cfc11 = get_spc_ndx( 'CFC11' )
162 :
163 1536 : id_cfc113 = get_spc_ndx( 'CFC113' )
164 1536 : id_cfc114 = get_spc_ndx( 'CFC114' )
165 1536 : id_cfc115 = get_spc_ndx( 'CFC115' )
166 :
167 1536 : id_ch3ccl3 = get_spc_ndx( 'CH3CCL3' )
168 1536 : id_cfc12 = get_spc_ndx( 'CFC12' )
169 1536 : id_ch3cl = get_spc_ndx( 'CH3CL' )
170 :
171 1536 : id_hcfc22 = get_spc_ndx( 'HCFC22' )
172 1536 : id_hcfc141b= get_spc_ndx( 'HCFC141B' )
173 1536 : id_hcfc142b= get_spc_ndx( 'HCFC142B' )
174 :
175 1536 : id_cf2clbr = get_spc_ndx( 'CF2CLBR' )
176 1536 : id_cf3br = get_spc_ndx( 'CF3BR' )
177 1536 : id_ch3br = get_spc_ndx( 'CH3BR' )
178 1536 : id_h1202 = get_spc_ndx( 'H1202' )
179 1536 : id_h2402 = get_spc_ndx( 'H2402' )
180 1536 : id_ch2br2 = get_spc_ndx( 'CH2BR2' )
181 1536 : id_chbr3 = get_spc_ndx( 'CHBR3' )
182 :
183 1536 : id_br = get_spc_ndx( 'BR' )
184 1536 : id_bro = get_spc_ndx( 'BRO' )
185 1536 : id_hbr = get_spc_ndx( 'HBR' )
186 1536 : id_hobr = get_spc_ndx( 'HOBR' )
187 1536 : id_ch4 = get_spc_ndx( 'CH4' )
188 1536 : id_h2o = get_spc_ndx( 'H2O' )
189 1536 : id_h2 = get_spc_ndx( 'H2' )
190 1536 : id_o = get_spc_ndx( 'O' )
191 1536 : id_o2 = get_spc_ndx( 'O2' )
192 1536 : id_h = get_spc_ndx( 'H' )
193 :
194 1536 : id_pan = get_spc_ndx( 'PAN' )
195 1536 : id_onit = get_spc_ndx( 'ONIT' )
196 1536 : id_mpan = get_spc_ndx( 'MPAN' )
197 1536 : id_isopno3 = get_spc_ndx( 'ISOPNO3' )
198 1536 : id_onitr = get_spc_ndx( 'ONITR' )
199 1536 : id_nh4no3 = get_spc_ndx( 'NH4NO3' )
200 :
201 1536 : id_honitr = get_spc_ndx( 'HONITR' )
202 1536 : id_alknit = get_spc_ndx( 'ALKNIT' )
203 1536 : id_isopnita = get_spc_ndx( 'ISOPNITA' )
204 1536 : id_isopnitb = get_spc_ndx( 'ISOPNITB' )
205 1536 : id_isopnooh = get_spc_ndx( 'ISOPNOOH' )
206 1536 : id_nc4ch2oh = get_spc_ndx( 'NC4CH2OH' )
207 1536 : id_nc4cho = get_spc_ndx( 'NC4CHO' )
208 1536 : id_noa = get_spc_ndx( 'NOA' )
209 1536 : id_nterpooh = get_spc_ndx( 'NTERPOOH' )
210 1536 : id_pbznit = get_spc_ndx( 'PBZNIT' )
211 1536 : id_terpnit = get_spc_ndx( 'TERPNIT' )
212 1536 : id_ndep = get_spc_ndx( 'NDEP' )
213 1536 : id_nhdep = get_spc_ndx( 'NHDEP' )
214 :
215 1536 : id_so2 = get_spc_ndx( 'SO2' )
216 1536 : id_so4 = get_spc_ndx( 'SO4' )
217 1536 : id_h2so4 = get_spc_ndx( 'H2SO4' )
218 :
219 1536 : id_nh3 = get_spc_ndx( 'NH3' )
220 1536 : id_nh4 = get_spc_ndx( 'NH4' )
221 1536 : id_nh4no3 = get_spc_ndx( 'NH4NO3' )
222 :
223 1536 : id_isopn2b = get_spc_ndx( 'ISOPN2B' )
224 1536 : id_isopn3b = get_spc_ndx( 'ISOPN3B' )
225 1536 : id_isopn1d = get_spc_ndx( 'ISOPN1D' )
226 1536 : id_isopn4d = get_spc_ndx( 'ISOPN4D' )
227 1536 : id_isopnbno3 = get_spc_ndx('ISOPNBNO3' )
228 1536 : id_isopfdn = get_spc_ndx( 'ISOPFDN' )
229 1536 : id_isopfdnc = get_spc_ndx( 'ISOPFDNC')
230 1536 : id_terpfdn = get_spc_ndx( 'TERPFDN' )
231 1536 : id_isopfnp = get_spc_ndx( 'ISOPFNP' )
232 1536 : id_isopnoohb = get_spc_ndx( 'ISOPNOOHB' )
233 1536 : id_isopnoohd = get_spc_ndx( 'ISOPNOOHD' )
234 1536 : id_inheb = get_spc_ndx( 'INHEB' )
235 1536 : id_inhed = get_spc_ndx( 'INHED' )
236 1536 : id_no3ch2cho = get_spc_ndx( 'NO3CH2CHO' )
237 1536 : id_macrn = get_spc_ndx( 'MACRN' )
238 1536 : id_mvkn = get_spc_ndx( 'MVKN' )
239 1536 : id_isopfnc = get_spc_ndx( 'ISOPFNC' )
240 1536 : id_terpns = get_spc_ndx( 'TERPNS' )
241 1536 : id_terpnt = get_spc_ndx( 'TERPNT' )
242 1536 : id_terpnt1 = get_spc_ndx( 'TERPNT1' )
243 1536 : id_terpns1 = get_spc_ndx( 'TERPNS1' )
244 1536 : id_terpnpt = get_spc_ndx( 'TERPNPT' )
245 1536 : id_terpnps = get_spc_ndx( 'TERPNPS' )
246 1536 : id_terpnpt1 = get_spc_ndx( 'TERPNPT1' )
247 1536 : id_terpnps1 = get_spc_ndx( 'TERPNPS1' )
248 1536 : id_sqtn = get_spc_ndx( 'SQTN' )
249 1536 : id_terphfn = get_spc_ndx( 'TERPHFN' )
250 1536 : id_terpapan = get_spc_ndx( 'TERPAPAN' )
251 1536 : id_terpa2pan = get_spc_ndx( 'TERPA2PAN' )
252 1536 : id_terpa3pan = get_spc_ndx( 'TERPA3PAN' )
253 :
254 1536 : id_dst01 = get_spc_ndx( 'DST01' )
255 1536 : id_dst02 = get_spc_ndx( 'DST02' )
256 1536 : id_dst03 = get_spc_ndx( 'DST03' )
257 1536 : id_dst04 = get_spc_ndx( 'DST04' )
258 1536 : id_sslt01 = get_spc_ndx( 'SSLT01' )
259 1536 : id_sslt02 = get_spc_ndx( 'SSLT02' )
260 1536 : id_sslt03 = get_spc_ndx( 'SSLT03' )
261 1536 : id_sslt04 = get_spc_ndx( 'SSLT04' )
262 1536 : id_soa = get_spc_ndx( 'SOA' )
263 1536 : id_so4 = get_spc_ndx( 'SO4' )
264 1536 : id_oc1 = get_spc_ndx( 'OC1' )
265 1536 : id_oc2 = get_spc_ndx( 'OC2' )
266 1536 : id_cb1 = get_spc_ndx( 'CB1' )
267 1536 : id_cb2 = get_spc_ndx( 'CB2' )
268 :
269 1536 : rid_jno = get_rxt_ndx( 'jno' )
270 1536 : rid_jno_i = get_rxt_ndx( 'jno_i' )
271 :
272 1536 : id_soam = get_spc_ndx( 'SOAM' )
273 1536 : id_soai = get_spc_ndx( 'SOAI' )
274 1536 : id_soat = get_spc_ndx( 'SOAT' )
275 1536 : id_soab = get_spc_ndx( 'SOAB' )
276 1536 : id_soax = get_spc_ndx( 'SOAX' )
277 :
278 :
279 : !... NOY species
280 6144 : nox_species = (/ id_n, id_no, id_no2 /)
281 : noy_species = (/ id_n, id_no, id_no2, id_no3, id_n2o5, id_hno3, id_ho2no2, id_clono2, &
282 : id_brono2, id_pan, id_onit, id_mpan, id_isopno3, id_onitr, id_nh4no3, &
283 : id_honitr, id_alknit, id_isopnita, id_isopnitb, id_isopnooh, id_nc4ch2oh, &
284 : id_nc4cho, id_noa, id_nterpooh, id_pbznit, id_terpnit, &
285 : id_isopn2b, id_isopn3b, id_isopn1d, id_isopn4d, id_isopnbno3, &
286 : id_isopfdn, id_isopfdnc, id_terpfdn, &
287 : id_isopfnp, id_isopnoohb, id_isopnoohd, id_inheb, id_inhed, &
288 : id_no3ch2cho, id_macrn, id_mvkn, id_isopfnc, id_terpns, &
289 : id_terpnt, id_terpnt1, id_terpns1, id_terpnpt, id_terpnps, &
290 : id_terpnpt1, id_terpnps1, id_sqtn, id_terphfn, &
291 87552 : id_terpapan, id_terpa2pan, id_terpa3pan /)
292 : !... HOX species
293 7680 : hox_species = (/ id_h, id_oh, id_ho2, id_h2o2 /)
294 :
295 : !... CLOY species
296 10752 : clox_species = (/ id_cl, id_clo, id_hocl, id_cl2, id_cl2o2, id_oclo /)
297 15360 : cloy_species = (/ id_cl, id_clo, id_hocl, id_cl2, id_cl2o2, id_oclo, id_hcl, id_clono2, id_brcl /)
298 : tcly_species = (/ id_cl, id_clo, id_hocl, id_cl2, id_cl2o2, id_oclo, id_hcl, id_clono2, id_brcl, &
299 : id_ccl4, id_cfc11, id_cfc113, id_cfc114, id_cfc115, id_ch3ccl3, id_cfc12, id_ch3cl, &
300 33792 : id_hcfc22, id_hcfc141b, id_hcfc142b, id_cf2clbr /)
301 :
302 : !... FOY species
303 7680 : foy_species = (/ id_F, id_hf, id_cofcl, id_cof2 /)
304 : tfy_species = (/ id_f, id_hf, id_cofcl, id_cof2, id_cfc11, id_cfc12, id_cfc113, id_cfc114, id_cfc115, &
305 26112 : id_hcfc22, id_hcfc141b, id_hcfc142b, id_cf2clbr, id_cf3br, id_h1202, id_h2402 /)
306 :
307 : !... BROY species
308 7680 : brox_species = (/ id_br, id_bro, id_brcl, id_hobr /)
309 10752 : broy_species = (/ id_br, id_bro, id_hbr, id_brono2, id_brcl, id_hobr /)
310 : tbry_species = (/ id_br, id_bro, id_hbr, id_brono2, id_brcl, id_hobr, id_cf2clbr, id_cf3br, id_ch3br, id_h1202, &
311 21504 : id_h2402, id_ch2br2, id_chbr3 /)
312 :
313 6144 : sox_species = (/ id_so2, id_so4, id_h2so4 /)
314 4608 : nhx_species = (/ id_nh3, id_nh4 /)
315 32256 : bulkaero_species(:) = -1
316 : bulkaero_species(1:20) = (/ id_dst01, id_dst02, id_dst03, id_dst04, &
317 : id_sslt01, id_sslt02, id_sslt03, id_sslt04, &
318 : id_soa, id_so4, id_oc1, id_oc2, id_cb1, id_cb2, id_nh4no3, &
319 32256 : id_soam,id_soai,id_soat,id_soab,id_soax /)
320 :
321 405504 : aer_species(:) = -1
322 1536 : n = 1
323 405504 : do m = 1,gas_pcnst
324 8483328 : k=0
325 8483328 : if ( any(bulkaero_species(:)==m) ) k=1
326 403968 : if ( k==0 ) k = index(trim(solsym(m)), '_a')
327 403968 : if ( k==0 ) k = index(trim(solsym(m)), '_c')
328 405504 : if ( k>0 ) then ! must be aerosol species
329 78336 : aer_species(n) = m
330 78336 : n = n+1
331 : endif
332 : enddo
333 :
334 6144 : toth_species = (/ id_ch4, id_h2o, id_h2 /)
335 :
336 3072 : chm_prod_ndep_flx = any(noy_species>0) .or. any(nhx_species>0)
337 :
338 3072 : call addfld( 'NOX', (/ 'lev' /), 'A', 'mol/mol', 'nox (N+NO+NO2)' )
339 : call addfld( 'NOY', (/ 'lev' /), 'A', 'mol/mol', &
340 3072 : 'noy = total nitrogen (N+NO+NO2+NO3+2N2O5+HNO3+HO2NO2+ORGNOY+NH4NO3)' )
341 1536 : call addfld( 'NOY_SRF', horiz_only, 'A', 'mol/mol', 'surface noy volume mixing ratio' )
342 3072 : call addfld( 'HOX', (/ 'lev' /), 'A', 'mol/mol', 'HOx (H+OH+HO2+2H2O2)' )
343 :
344 3072 : call addfld( 'BROX', (/ 'lev' /), 'A', 'mol/mol', 'brox (Br+BrO+BRCl+HOBr)' )
345 3072 : call addfld( 'BROY', (/ 'lev' /), 'A', 'mol/mol', 'total inorganic bromine (Br+BrO+HOBr+BrONO2+HBr+BrCl)' )
346 3072 : call addfld( 'TBRY', (/ 'lev' /), 'A', 'mol/mol', 'total Br (ORG+INORG) volume mixing ratio' )
347 :
348 3072 : call addfld( 'CLOX', (/ 'lev' /), 'A', 'mol/mol', 'clox (Cl+CLO+HOCl+2Cl2+2Cl2O2+OClO)' )
349 3072 : call addfld( 'CLOY', (/ 'lev' /), 'A', 'mol/mol', 'total inorganic chlorine (Cl+ClO+2Cl2+2Cl2O2+OClO+HOCl+ClONO2+HCl+BrCl)' )
350 3072 : call addfld( 'TCLY', (/ 'lev' /), 'A', 'mol/mol', 'total Cl (ORG+INORG) volume mixing ratio' )
351 :
352 3072 : call addfld( 'FOY', (/ 'lev' /), 'A', 'mol/mol', 'total inorganic fluorine (F+HF+COFCL+2COF2)' )
353 3072 : call addfld( 'TFY', (/ 'lev' /), 'A', 'mol/mol', 'total F (ORG+INORG) volume mixing ratio' )
354 :
355 3072 : call addfld( 'TOTH', (/ 'lev' /), 'A', 'mol/mol', 'total H2 volume mixing ratio' )
356 :
357 3072 : call addfld( 'NOY_mmr', (/ 'lev' /), 'A', 'kg/kg', 'NOy mass mixing ratio' )
358 3072 : call addfld( 'SOX_mmr', (/ 'lev' /), 'A', 'kg/kg', 'SOx mass mixing ratio' )
359 3072 : call addfld( 'NHX_mmr', (/ 'lev' /), 'A', 'kg/kg', 'NHx mass mixing ratio' )
360 :
361 41472 : do j = 1,NJEUV
362 39936 : write( jchar, '(I2)' ) j
363 39936 : jname = 'jeuv_'//trim(adjustl(jchar))
364 41472 : rid_jeuv(j) = get_rxt_ndx( trim(jname) )
365 : enddo
366 :
367 1536 : has_jeuvs = all( rid_jeuv(:) > 0 )
368 1536 : has_jno_i = rid_jno_i>0
369 1536 : has_jno = rid_jno>0
370 :
371 1536 : if ( has_jeuvs ) then
372 0 : call addfld( 'PION_EUV', (/ 'lev' /), 'I', '/cm^3/s', 'total euv ionization rate' )
373 0 : call addfld( 'PEUV1', (/ 'lev' /), 'I', '/cm^3/s', '(j1+j2+j3)*o' )
374 0 : call addfld( 'PEUV1e', (/ 'lev' /), 'I', '/cm^3/s', '(j14+j15+j16)*o' )
375 0 : call addfld( 'PEUV2', (/ 'lev' /), 'I', '/cm^3/s', 'j4*n' )
376 0 : call addfld( 'PEUV3', (/ 'lev' /), 'I', '/cm^3/s', '(j5+j7+j8+j9)*o2' )
377 0 : call addfld( 'PEUV3e', (/ 'lev' /), 'I', '/cm^3/s', '(j17+j19+j20+j21)*o2' )
378 0 : call addfld( 'PEUV4', (/ 'lev' /), 'I', '/cm^3/s', '(j10+j11)*n2' )
379 0 : call addfld( 'PEUV4e', (/ 'lev' /), 'I', '/cm^3/s', '(j22+j23)*n2' )
380 0 : call addfld( 'PEUVN2D', (/ 'lev' /), 'I', '/cm^3/s', '(j11+j13)*n2' )
381 0 : call addfld( 'PEUVN2De', (/ 'lev' /), 'I', '/cm^3/s', '(j23+j25)*n2' )
382 : endif
383 1536 : if ( has_jno ) then
384 3072 : call addfld( 'PJNO', (/ 'lev' /), 'I', '/cm^3/s', 'jno*no' )
385 : endif
386 1536 : if ( has_jno_i ) then
387 0 : call addfld( 'PJNO_I', (/ 'lev' /), 'I', '/cm^3/s', 'jno_i*no' )
388 : endif
389 : !
390 : ! CCMI
391 : !
392 : call addfld( 'DO3CHM_TRP', horiz_only, 'A', 'kg/s', 'integrated net tendency from chem in troposphere', &
393 1536 : flag_xyfill=.True. )
394 : call addfld( 'DO3CHM_LMS', horiz_only, 'A', 'kg/s', 'integrated net tendency from chem in lowermost stratosphere', &
395 1536 : flag_xyfill=.True. )
396 : !
397 405504 : do m = 1,gas_pcnst
398 :
399 403968 : spc_name = trim(solsym(m))
400 :
401 403968 : call cnst_get_ind(spc_name, n, abort=.false. )
402 403968 : if ( n > 0 ) then
403 350208 : attr = cnst_longname(n)
404 53760 : elseif ( trim(spc_name) == 'H2O' ) then
405 1536 : attr = 'water vapor'
406 : else
407 52224 : attr = spc_name
408 : endif
409 :
410 403968 : dtchem_name(m) = 'D'//trim(spc_name)//'CHM'
411 807936 : call addfld( dtchem_name(m), (/ 'lev' /), 'A', 'kg/s', 'net tendency from chem' )
412 :
413 403968 : depvel_name(m) = 'DV_'//trim(spc_name)
414 403968 : depflx_name(m) = 'DF_'//trim(spc_name)
415 403968 : if (has_drydep(spc_name)) then
416 : call addfld( depvel_name(m), horiz_only, 'A', 'cm/s', 'deposition velocity ' )
417 : call addfld( depflx_name(m), horiz_only, 'A', 'kg/m2/s', 'dry deposition flux ' )
418 173568 : if (history_chemistry) then
419 0 : call add_default( depflx_name(m), 1, ' ' )
420 : endif
421 : endif
422 :
423 403968 : if (gas_wetdep_method=='MOZ') then
424 0 : wetdep_name(m) = 'WD_'//trim(spc_name)
425 0 : wtrate_name(m) = 'WDR_'//trim(spc_name)
426 :
427 0 : call addfld( wetdep_name(m), horiz_only, 'A', 'kg/s', spc_name//' wet deposition' )
428 0 : call addfld( wtrate_name(m), (/ 'lev' /), 'A', '/s', spc_name//' wet deposition rate' )
429 : endif
430 :
431 403968 : if (spc_name(1:3) == 'num') then
432 7680 : unit_basename = ' 1'
433 : else
434 396288 : unit_basename = 'kg'
435 : endif
436 :
437 88003584 : if ( any( aer_species == m ) ) then
438 156672 : call addfld( spc_name, (/ 'lev' /), 'A', unit_basename//'/kg ', trim(attr)//' concentration')
439 78336 : call addfld( trim(spc_name)//'_SRF', horiz_only, 'A', unit_basename//'/kg', trim(attr)//" in bottom layer")
440 : else
441 651264 : call addfld( spc_name, (/ 'lev' /), 'A', 'mol/mol', trim(attr)//' concentration')
442 325632 : call addfld( trim(spc_name)//'_SRF', horiz_only, 'A', 'mol/mol', trim(attr)//" in bottom layer")
443 : endif
444 :
445 403968 : if ((m /= id_cly) .and. (m /= id_bry)) then
446 400896 : if (history_aerosol.or.history_chemistry) then
447 0 : call add_default( spc_name, 1, ' ' )
448 : endif
449 400896 : if (history_chemspecies_srf) then
450 0 : call add_default( trim(spc_name)//'_SRF', 1, ' ' )
451 : endif
452 : endif
453 :
454 403968 : if ( history_cesm_forcing ) then
455 0 : if (m==id_o3) call add_default( spc_name, 1, ' ')
456 0 : if (m==id_oh) call add_default( spc_name, 1, ' ')
457 0 : if (m==id_no3) call add_default( spc_name, 1, ' ')
458 0 : if (m==id_ho2) call add_default( spc_name, 1, ' ')
459 :
460 0 : if (m==id_o3) call add_default( spc_name, 8, ' ')
461 0 : if (m==id_so4_a1) call add_default( spc_name, 8, ' ')
462 0 : if (m==id_so4_a2) call add_default( spc_name, 8, ' ')
463 0 : if (m==id_so4_a3) call add_default( spc_name, 8, ' ')
464 :
465 0 : if (m==id_num_a2) call add_default( spc_name, 8, ' ')
466 0 : if (m==id_num_a3) call add_default( spc_name, 8, ' ')
467 0 : if (m==id_dst_a3) call add_default( spc_name, 8, ' ')
468 0 : if (m==id_ncl_a3) call add_default( spc_name, 8, ' ')
469 :
470 : endif
471 403968 : if ( history_scwaccm_forcing ) then
472 0 : if (m==id_co2) call add_default( spc_name, 8, ' ')
473 0 : if (m==id_h) call add_default( spc_name, 8, ' ')
474 0 : if (m==id_no) call add_default( spc_name, 8, ' ')
475 0 : if (m==id_o) call add_default( spc_name, 8, ' ')
476 0 : if (m==id_o2) call add_default( spc_name, 8, ' ')
477 0 : if (m==id_o3) call add_default( spc_name, 8, ' ')
478 0 : if (m==id_h2o) call add_default( spc_name, 1, ' ')
479 0 : if (m==id_ch4 ) call add_default( spc_name, 1, ' ')
480 0 : if (m==id_n2o ) call add_default( spc_name, 1, ' ')
481 0 : if (m==id_cfc11 ) call add_default( spc_name, 1, ' ')
482 0 : if (m==id_cfc12 ) call add_default( spc_name, 1, ' ')
483 : endif
484 :
485 405504 : if (history_dust .and. (index(spc_name,'dst_') > 0)) call add_default( spc_name, 1, ' ')
486 :
487 : enddo
488 :
489 3072 : call addfld( 'MASS', (/ 'lev' /), 'A', 'kg', 'mass of grid box' )
490 1536 : call addfld( 'AREA', horiz_only, 'A', 'm2', 'area of grid box' )
491 :
492 1536 : call addfld( 'dry_deposition_NOy_as_N', horiz_only, 'I', 'kg/m2/s', 'NOy dry deposition flux ' )
493 1536 : call addfld( 'DF_SOX', horiz_only, 'I', 'kg/m2/s', 'SOx dry deposition flux ' )
494 1536 : call addfld( 'dry_deposition_NHx_as_N', horiz_only, 'I', 'kg/m2/s', 'NHx dry deposition flux ' )
495 1536 : if (gas_wetdep_method=='NEU') then
496 1536 : call addfld( 'wet_deposition_NOy_as_N', horiz_only, 'A', 'kg/m2/s', 'NOy wet deposition' )
497 1536 : call addfld( 'wet_deposition_NHx_as_N', horiz_only, 'A', 'kg/m2/s', 'NHx wet deposition' )
498 0 : elseif (gas_wetdep_method=='MOZ') then
499 0 : call addfld( 'wet_deposition_NOy_as_N', horiz_only, 'A', 'kg/s', 'NOy wet deposition' )
500 0 : call addfld( 'WD_SOX', horiz_only, 'A', 'kg/s', 'SOx wet deposition' )
501 0 : call addfld( 'wet_deposition_NHx_as_N', horiz_only, 'A', 'kg/s', 'NHx wet deposition' )
502 : endif
503 1536 : if ( history_cesm_forcing ) then
504 0 : call add_default('dry_deposition_NOy_as_N', 1, ' ')
505 0 : call add_default('dry_deposition_NHx_as_N', 1, ' ')
506 0 : call add_default('wet_deposition_NOy_as_N', 1, ' ')
507 0 : call add_default('wet_deposition_NHx_as_N', 1, ' ')
508 : endif
509 :
510 1536 : call species_sums_init()
511 :
512 1536 : end subroutine chm_diags_inti
513 :
514 145920 : subroutine chm_diags( lchnk, ncol, vmr, mmr, rxt_rates, invariants, depvel, depflx, mmr_tend, pdel, pmid, ltrop, &
515 72960 : wetdepflx, nhx_nitrogen_flx, noy_nitrogen_flx )
516 : !--------------------------------------------------------------------
517 : ! ... utility routine to output chemistry diagnostic variables
518 : !--------------------------------------------------------------------
519 :
520 1536 : use cam_history, only : outfld
521 : use phys_grid, only : get_area_all_p
522 : use species_sums_diags, only : species_sums_output
523 : !
524 : ! CCMI
525 : !
526 : use cam_history_support, only : fillvalue
527 :
528 : !--------------------------------------------------------------------
529 : ! ... dummy arguments
530 : !--------------------------------------------------------------------
531 : integer, intent(in) :: lchnk
532 : integer, intent(in) :: ncol
533 : real(r8), intent(in) :: vmr(ncol,pver,gas_pcnst)
534 : real(r8), intent(in) :: mmr(ncol,pver,gas_pcnst)
535 : real(r8), intent(in) :: rxt_rates(ncol,pver,rxntot)
536 : real(r8), intent(in) :: invariants(ncol,pver,max(1,nfs))
537 : real(r8), intent(in) :: depvel(ncol, gas_pcnst)
538 : real(r8), intent(in) :: depflx(ncol, gas_pcnst)
539 : real(r8), intent(in) :: mmr_tend(ncol,pver,gas_pcnst)
540 : real(r8), intent(in) :: pdel(ncol,pver)
541 : real(r8), intent(in) :: pmid(ncol,pver)
542 : integer, intent(in) :: ltrop(ncol)
543 : real(r8), intent(in) :: wetdepflx(ncol, gas_pcnst)
544 : real(r8), intent(out) :: nhx_nitrogen_flx(ncol) ! kgN/m2/sec
545 : real(r8), intent(out) :: noy_nitrogen_flx(ncol) ! kgN/m2/sec
546 :
547 : !--------------------------------------------------------------------
548 : ! ... local variables
549 : !--------------------------------------------------------------------
550 : integer :: i, k, m
551 145920 : real(r8) :: wrk(ncol,pver)
552 : ! real(r8) :: tmp(ncol,pver)
553 : ! real(r8) :: m(ncol,pver)
554 145920 : real(r8) :: un2(ncol)
555 :
556 145920 : real(r8), dimension(ncol,pver) :: vmr_nox, vmr_noy, vmr_clox, vmr_cloy, vmr_tcly, vmr_brox, vmr_broy, vmr_toth
557 145920 : real(r8), dimension(ncol,pver) :: vmr_tbry, vmr_foy, vmr_tfy
558 145920 : real(r8), dimension(ncol,pver) :: mmr_noy, mmr_sox, mmr_nhx, net_chem
559 145920 : real(r8), dimension(ncol) :: df_noy, df_sox, df_nhx, do3chm_trp, do3chm_lms
560 145920 : real(r8), dimension(ncol) :: wd_noy, wd_nhx
561 145920 : real(r8), dimension(ncol,pver) :: vmr_hox
562 :
563 72960 : real(r8) :: area(ncol), mass(ncol,pver)
564 : real(r8) :: wgt
565 :
566 : !--------------------------------------------------------------------
567 : ! ... "diagnostic" groups
568 : !--------------------------------------------------------------------
569 36027648 : vmr_nox(:ncol,:) = 0._r8
570 36027648 : vmr_noy(:ncol,:) = 0._r8
571 36027648 : vmr_hox(:ncol,:) = 0._r8
572 36027648 : vmr_clox(:ncol,:) = 0._r8
573 36027648 : vmr_cloy(:ncol,:) = 0._r8
574 36027648 : vmr_tcly(:ncol,:) = 0._r8
575 36027648 : vmr_brox(:ncol,:) = 0._r8
576 36027648 : vmr_broy(:ncol,:) = 0._r8
577 36027648 : vmr_tbry(:ncol,:) = 0._r8
578 36027648 : vmr_foy(:ncol,:) = 0._r8
579 36027648 : vmr_tfy(:ncol,:) = 0._r8
580 36027648 : vmr_toth(:ncol,:) = 0._r8
581 36027648 : mmr_noy(:ncol,:) = 0._r8
582 36027648 : mmr_sox(:ncol,:) = 0._r8
583 36027648 : mmr_nhx(:ncol,:) = 0._r8
584 1123584 : df_noy(:ncol) = 0._r8
585 1123584 : df_sox(:ncol) = 0._r8
586 1123584 : df_nhx(:ncol) = 0._r8
587 :
588 1123584 : wd_noy(:ncol) = 0._r8
589 1123584 : wd_nhx(:ncol) = 0._r8
590 :
591 72960 : call get_area_all_p(lchnk, ncol, area)
592 1123584 : area = area * rearth**2
593 :
594 2407680 : do k = 1,pver
595 36027648 : mass(:ncol,k) = pdel(:ncol,k) * area(:ncol) * rgrav
596 : enddo
597 :
598 72960 : call outfld( 'AREA', area(:ncol), ncol, lchnk )
599 72960 : call outfld( 'MASS', mass(:ncol,:), ncol, lchnk )
600 :
601 19261440 : do m = 1,gas_pcnst
602 :
603 : !...FOY (counting Fluorines, not chlorines or bromines)
604 : if ( m == id_cfc12 .or. m == id_hcfc22 .or. m == id_cf2clbr .or. m == id_h1202 .or. m == id_hcfc142b &
605 19188480 : .or. m == id_cof2 ) then
606 : wgt = 2._r8
607 18823680 : elseif ( m == id_cfc113 .or. m == id_cf3br ) then
608 : wgt = 3._r8
609 18677760 : elseif ( m == id_cfc114 .or. m == id_h2402 ) then
610 : wgt = 4._r8
611 18531840 : elseif ( m == id_cfc115 ) then
612 : wgt = 5._r8
613 : else
614 18458880 : wgt = 1._r8
615 : endif
616 95212800 : if ( any( foy_species == m ) ) then
617 144110592 : vmr_foy(:ncol,:) = vmr_foy(:ncol,:) + wgt * vmr(:ncol,:,m)
618 : endif
619 316427520 : if ( any( tfy_species == m ) ) then
620 540414720 : vmr_tfy(:ncol,:) = vmr_tfy(:ncol,:) + wgt * vmr(:ncol,:,m)
621 : endif
622 :
623 : !... counting chlorine and bromines, etc... (and total H2 species)
624 19188480 : if ( m == id_ch4 .or. m == id_n2o5 .or. m == id_cfc12 .or. m == id_cl2 .or. m == id_cl2o2 .or. m==id_h2o2 ) then
625 : wgt = 2._r8
626 18750720 : elseif (m == id_cfc114 .or. m == id_hcfc141b .or. m == id_h1202 .or. m == id_h2402 .or. m == id_ch2br2 ) then
627 : wgt = 2._r8
628 18458880 : elseif (m == id_isopfdn .or. m == id_isopfdnc .or. m == id_terpfdn ) then
629 : wgt = 2._r8
630 18458880 : elseif ( m == id_cfc11 .or. m == id_cfc113 .or. m == id_ch3ccl3 .or. m == id_chbr3 ) then
631 : wgt = 3._r8
632 18167040 : elseif ( m == id_ccl4 ) then
633 : wgt = 4._r8
634 : else
635 18094080 : wgt = 1._r8
636 : endif
637 : !...NOY
638 76316160 : if ( any( nox_species == m ) ) then
639 108082944 : vmr_nox(:ncol,:) = vmr_nox(:ncol,:) + wgt * vmr(:ncol,:,m)
640 : endif
641 1017646080 : if ( any( noy_species == m ) ) then
642 864663552 : vmr_noy(:ncol,:) = vmr_noy(:ncol,:) + wgt * vmr(:ncol,:,m)
643 : endif
644 : !...NOY, SOX, NHX
645 1017646080 : if ( any( noy_species == m ) ) then
646 864663552 : mmr_noy(:ncol,:) = mmr_noy(:ncol,:) + wgt * mmr(:ncol,:,m)
647 : endif
648 76462080 : if ( any( sox_species == m ) ) then
649 72055296 : mmr_sox(:ncol,:) = mmr_sox(:ncol,:) + wgt * mmr(:ncol,:,m)
650 : endif
651 57346560 : if ( any( nhx_species == m ) ) then
652 72055296 : mmr_nhx(:ncol,:) = mmr_nhx(:ncol,:) + wgt * mmr(:ncol,:,m)
653 : endif
654 : !...CLOY
655 132787200 : if ( any( clox_species == m ) ) then
656 216165888 : vmr_clox(:ncol,:) = vmr_clox(:ncol,:) + wgt * vmr(:ncol,:,m)
657 : endif
658 188601600 : if ( any( cloy_species == m ) ) then
659 324248832 : vmr_cloy(:ncol,:) = vmr_cloy(:ncol,:) + wgt * vmr(:ncol,:,m)
660 : endif
661 405292800 : if ( any( tcly_species == m ) ) then
662 756580608 : vmr_tcly(:ncol,:) = vmr_tcly(:ncol,:) + wgt * vmr(:ncol,:,m)
663 : endif
664 : !...BROY
665 95212800 : if ( any( brox_species == m ) ) then
666 144110592 : vmr_brox(:ncol,:) = vmr_brox(:ncol,:) + wgt * vmr(:ncol,:,m)
667 : endif
668 132787200 : if ( any( broy_species == m ) ) then
669 216165888 : vmr_broy(:ncol,:) = vmr_broy(:ncol,:) + wgt * vmr(:ncol,:,m)
670 : endif
671 262291200 : if ( any( tbry_species == m ) ) then
672 432331776 : vmr_tbry(:ncol,:) = vmr_tbry(:ncol,:) + wgt * vmr(:ncol,:,m)
673 : endif
674 : !...HOY
675 76316160 : if ( any ( toth_species == m ) ) then
676 108082944 : vmr_toth(:ncol,:) = vmr_toth(:ncol,:) + wgt * vmr(:ncol,:,m)
677 : endif
678 : !...HOx
679 95212800 : if ( any( hox_species == m ) ) then
680 144110592 : vmr_hox(:ncol,:) = vmr_hox(:ncol,:) + wgt * vmr(:ncol,:,m)
681 : endif
682 :
683 4180170240 : if ( any( aer_species == m ) ) then
684 3720960 : call outfld( solsym(m), mmr(:ncol,:,m), ncol ,lchnk )
685 3720960 : call outfld( trim(solsym(m))//'_SRF', mmr(:ncol,pver,m), ncol ,lchnk )
686 : else
687 15467520 : call outfld( solsym(m), vmr(:ncol,:,m), ncol ,lchnk )
688 15467520 : call outfld( trim(solsym(m))//'_SRF', vmr(:ncol,pver,m), ncol ,lchnk )
689 : endif
690 :
691 19188480 : if (has_drydep(solsym(m))) then
692 8244480 : call outfld( depvel_name(m), depvel(:ncol,m), ncol ,lchnk )
693 8244480 : call outfld( depflx_name(m), depflx(:ncol,m), ncol ,lchnk )
694 : endif
695 :
696 1017646080 : if ( any( noy_species == m ) ) then
697 26966016 : df_noy(:ncol) = df_noy(:ncol) + wgt * depflx(:ncol,m)*N_molwgt/adv_mass(m)
698 : endif
699 76462080 : if ( any( sox_species == m ) ) then
700 2247168 : df_sox(:ncol) = df_sox(:ncol) + wgt * depflx(:ncol,m)*S_molwgt/adv_mass(m)
701 : endif
702 57346560 : if ( any( nhx_species == m ) ) then
703 2247168 : df_nhx(:ncol) = df_nhx(:ncol) + wgt * depflx(:ncol,m)*N_molwgt/adv_mass(m)
704 : endif
705 :
706 1017646080 : if ( any( noy_species == m ) ) then
707 26966016 : wd_noy(:ncol) = wd_noy(:ncol) + wgt * wetdepflx(:ncol,m)*N_molwgt/adv_mass(m)
708 : endif
709 57346560 : if ( any( nhx_species == m ) ) then
710 2247168 : wd_nhx(:ncol) = wd_nhx(:ncol) + wgt * wetdepflx(:ncol,m)*N_molwgt/adv_mass(m)
711 : endif
712 : !
713 : ! add contribution from non-conservation tracers
714 : !
715 19188480 : if ( id_ndep == m ) then
716 1123584 : wd_noy(:ncol) = wd_noy(:ncol) + wgt * wetdepflx(:ncol,m)*N_molwgt/adv_mass(m)
717 : end if
718 19188480 : if ( id_nhdep == m ) then
719 1123584 : wd_nhx(:ncol) = wd_nhx(:ncol) + wgt * wetdepflx(:ncol,m)*N_molwgt/adv_mass(m)
720 : end if
721 :
722 633219840 : do k=1,pver
723 9475271424 : do i=1,ncol
724 9456082944 : net_chem(i,k) = mmr_tend(i,k,m) * mass(i,k)
725 : end do
726 : end do
727 : call outfld( dtchem_name(m), net_chem(:ncol,:), ncol, lchnk )
728 : !
729 : ! CCMI
730 : !
731 19261440 : if ( trim(dtchem_name(m)) == 'DO3CHM' ) then
732 1123584 : do3chm_trp(:) = 0._r8
733 1123584 : do i=1,ncol
734 20472195 : do k=ltrop(i),pver
735 20399235 : do3chm_trp(i) = do3chm_trp(i) + net_chem(i,k)
736 : end do
737 : end do
738 1123584 : where ( do3chm_trp == 0._r8 )
739 : do3chm_trp = fillvalue
740 : end where
741 72960 : call outfld('DO3CHM_TRP',do3chm_trp(:ncol), ncol, lchnk )
742 1123584 : do3chm_lms(:) = 0._r8
743 1123584 : do i=1,ncol
744 34743552 : do k=1,pver
745 34670592 : if ( pmid(i,k) > 100.e2_r8 .and. k < ltrop(i) ) then
746 3808762 : do3chm_lms(i) = do3chm_lms(i) + net_chem(i,k)
747 : end if
748 : end do
749 : end do
750 1123584 : where ( do3chm_lms == 0._r8 )
751 : do3chm_lms = fillvalue
752 : end where
753 72960 : call outfld('DO3CHM_LMS',do3chm_lms(:ncol), ncol, lchnk )
754 : end if
755 : !
756 : enddo
757 :
758 :
759 72960 : call outfld( 'NOX', vmr_nox (:ncol,:), ncol, lchnk )
760 72960 : call outfld( 'NOY', vmr_noy (:ncol,:), ncol, lchnk )
761 72960 : call outfld( 'HOX', vmr_hox (:ncol,:), ncol, lchnk )
762 72960 : call outfld( 'NOY_SRF', vmr_noy(:ncol,pver), ncol, lchnk )
763 72960 : call outfld( 'CLOX', vmr_clox (:ncol,:), ncol, lchnk )
764 72960 : call outfld( 'CLOY', vmr_cloy (:ncol,:), ncol, lchnk )
765 72960 : call outfld( 'BROX', vmr_brox (:ncol,:), ncol, lchnk )
766 72960 : call outfld( 'BROY', vmr_broy (:ncol,:), ncol, lchnk )
767 72960 : call outfld( 'TCLY', vmr_tcly (:ncol,:), ncol, lchnk )
768 72960 : call outfld( 'TBRY', vmr_tbry (:ncol,:), ncol, lchnk )
769 72960 : call outfld( 'FOY', vmr_foy (:ncol,:), ncol, lchnk )
770 72960 : call outfld( 'TFY', vmr_tfy (:ncol,:), ncol, lchnk )
771 72960 : call outfld( 'TOTH', vmr_toth (:ncol,:), ncol, lchnk )
772 :
773 72960 : call outfld( 'NOY_mmr', mmr_noy(:ncol,:), ncol ,lchnk )
774 72960 : call outfld( 'SOX_mmr', mmr_sox(:ncol,:), ncol ,lchnk )
775 72960 : call outfld( 'NHX_mmr', mmr_nhx(:ncol,:), ncol ,lchnk )
776 72960 : call outfld( 'dry_deposition_NOy_as_N', df_noy(:ncol), ncol ,lchnk )
777 72960 : call outfld( 'DF_SOX', df_sox(:ncol), ncol ,lchnk )
778 72960 : call outfld( 'dry_deposition_NHx_as_N', df_nhx(:ncol), ncol ,lchnk )
779 72960 : if (gas_wetdep_method=='NEU') then
780 1123584 : wd_noy(:ncol) = -wd_noy(:ncol) ! downward is possitive
781 1123584 : wd_nhx(:ncol) = -wd_nhx(:ncol)
782 72960 : call outfld( 'wet_deposition_NOy_as_N', wd_noy(:ncol), ncol, lchnk )
783 72960 : call outfld( 'wet_deposition_NHx_as_N', wd_nhx(:ncol), ncol, lchnk )
784 : end if
785 :
786 1123584 : nhx_nitrogen_flx = df_nhx + wd_nhx
787 1123584 : noy_nitrogen_flx = df_noy + wd_noy
788 :
789 : !--------------------------------------------------------------------
790 : ! ... euv ion production
791 : !--------------------------------------------------------------------
792 :
793 72960 : jeuvs: if ( has_jeuvs ) then
794 0 : do k = 1,pver
795 0 : un2(:) = 1._r8 - (vmr(:,k,id_o) + vmr(:,k,id_o2) + vmr(:,k,id_h))
796 0 : wrk(:,k) = vmr(:,k,id_o)*(rxt_rates(:,k,rid_jeuv(1)) + rxt_rates(:,k,rid_jeuv(2)) &
797 0 : + rxt_rates(:,k,rid_jeuv(3)) + rxt_rates(:,k,rid_jeuv(14)) &
798 0 : + rxt_rates(:,k,rid_jeuv(15)) + rxt_rates(:,k,rid_jeuv(16))) &
799 0 : + vmr(:,k,id_n)*rxt_rates(:,k,rid_jeuv(4)) &
800 0 : + vmr(:,k,id_o2)*(rxt_rates(:,k,rid_jeuv(5)) + rxt_rates(:,k,rid_jeuv(7)) &
801 0 : + rxt_rates(:,k,rid_jeuv(8)) + rxt_rates(:,k,rid_jeuv(9)) &
802 0 : + rxt_rates(:,k,rid_jeuv(17)) + rxt_rates(:,k,rid_jeuv(19)) &
803 0 : + rxt_rates(:,k,rid_jeuv(20)) + rxt_rates(:,k,rid_jeuv(21))) &
804 0 : + un2(:)*(rxt_rates(:,k,rid_jeuv(6)) + rxt_rates(:,k,rid_jeuv(10)) &
805 0 : + rxt_rates(:,k,rid_jeuv(11)) + rxt_rates(:,k,rid_jeuv(18)) &
806 0 : + rxt_rates(:,k,rid_jeuv(22)) + rxt_rates(:,k,rid_jeuv(23)))
807 0 : wrk(:,k) = wrk(:,k) * invariants(:,k,indexm)
808 : end do
809 0 : call outfld( 'PION_EUV', wrk, ncol, lchnk )
810 :
811 0 : do k = 1,pver
812 0 : wrk(:,k) = vmr(:,k,id_o)*(rxt_rates(:,k,rid_jeuv(1)) + rxt_rates(:,k,rid_jeuv(2)) &
813 0 : + rxt_rates(:,k,rid_jeuv(3)))
814 0 : wrk(:,k) = wrk(:,k) * invariants(:,k,indexm)
815 : end do
816 0 : call outfld( 'PEUV1', wrk, ncol, lchnk )
817 0 : do k = 1,pver
818 0 : wrk(:,k) = vmr(:,k,id_o)*(rxt_rates(:,k,rid_jeuv(14)) + rxt_rates(:,k,rid_jeuv(15)) &
819 0 : + rxt_rates(:,k,rid_jeuv(16)))
820 0 : wrk(:,k) = wrk(:,k) * invariants(:,k,indexm)
821 : end do
822 0 : call outfld( 'PEUV1e', wrk, ncol, lchnk )
823 0 : do k = 1,pver
824 0 : wrk(:,k) = vmr(:,k,id_n)*rxt_rates(:,k,rid_jeuv(4))
825 0 : wrk(:,k) = wrk(:,k) * invariants(:,k,indexm)
826 : end do
827 0 : call outfld( 'PEUV2', wrk, ncol, lchnk )
828 0 : do k = 1,pver
829 0 : wrk(:,k) = vmr(:,k,id_o2)*(rxt_rates(:,k,rid_jeuv(5)) + rxt_rates(:,k,rid_jeuv(7)) &
830 0 : + rxt_rates(:,k,rid_jeuv(8)) + rxt_rates(:,k,rid_jeuv(9)))
831 0 : wrk(:,k) = wrk(:,k) * invariants(:,k,indexm)
832 : end do
833 0 : call outfld( 'PEUV3', wrk, ncol, lchnk )
834 0 : do k = 1,pver
835 0 : wrk(:,k) = vmr(:,k,id_o2)*(rxt_rates(:,k,rid_jeuv(17)) + rxt_rates(:,k,rid_jeuv(19)) &
836 0 : + rxt_rates(:,k,rid_jeuv(20)) + rxt_rates(:,k,rid_jeuv(21)))
837 0 : wrk(:,k) = wrk(:,k) * invariants(:,k,indexm)
838 : end do
839 0 : call outfld( 'PEUV3e', wrk, ncol, lchnk )
840 0 : do k = 1,pver
841 0 : un2(:) = 1._r8 - (vmr(:,k,id_o) + vmr(:,k,id_o2) + vmr(:,k,id_h))
842 0 : wrk(:,k) = un2(:)*(rxt_rates(:,k,rid_jeuv(6)) + rxt_rates(:,k,rid_jeuv(10)) + rxt_rates(:,k,rid_jeuv(11)))
843 0 : wrk(:,k) = wrk(:,k) * invariants(:,k,indexm)
844 : end do
845 0 : call outfld( 'PEUV4', wrk, ncol, lchnk )
846 0 : do k = 1,pver
847 0 : un2(:) = 1._r8 - (vmr(:,k,id_o) + vmr(:,k,id_o2) + vmr(:,k,id_h))
848 0 : wrk(:,k) = un2(:)*(rxt_rates(:,k,rid_jeuv(18)) + rxt_rates(:,k,rid_jeuv(22)) + rxt_rates(:,k,rid_jeuv(23)))
849 0 : wrk(:,k) = wrk(:,k) * invariants(:,k,indexm)
850 : end do
851 0 : call outfld( 'PEUV4e', wrk, ncol, lchnk )
852 0 : do k = 1,pver
853 0 : un2(:) = 1._r8 - (vmr(:,k,id_o) + vmr(:,k,id_o2) + vmr(:,k,id_h))
854 0 : wrk(:,k) = un2(:)*(rxt_rates(:,k,rid_jeuv(11)) + rxt_rates(:,k,rid_jeuv(13)))
855 0 : wrk(:,k) = wrk(:,k) * invariants(:,k,indexm)
856 : end do
857 0 : call outfld( 'PEUVN2D', wrk, ncol, lchnk )
858 0 : do k = 1,pver
859 0 : un2(:) = 1._r8 - (vmr(:,k,id_o) + vmr(:,k,id_o2) + vmr(:,k,id_h))
860 0 : wrk(:,k) = un2(:)*(rxt_rates(:,k,rid_jeuv(23)) + rxt_rates(:,k,rid_jeuv(25)))
861 0 : wrk(:,k) = wrk(:,k) * invariants(:,k,indexm)
862 : end do
863 0 : call outfld( 'PEUVN2De', wrk, ncol, lchnk )
864 : endif jeuvs
865 :
866 72960 : if ( has_jno_i ) then
867 0 : do k = 1,pver
868 0 : wrk(:,k) = vmr(:,k,id_no)*rxt_rates(:,k,rid_jno_i)
869 0 : wrk(:,k) = wrk(:,k) * invariants(:,k,indexm)
870 : end do
871 0 : call outfld( 'PJNO_I', wrk, ncol, lchnk )
872 : endif
873 72960 : if ( has_jno ) then
874 2407680 : do k = 1,pver
875 35954688 : wrk(:,k) = vmr(:,k,id_no)*rxt_rates(:,k,rid_jno)
876 36027648 : wrk(:,k) = wrk(:,k) * invariants(:,k,indexm)
877 : end do
878 72960 : call outfld( 'PJNO', wrk, ncol, lchnk )
879 : endif
880 :
881 72960 : call species_sums_output(vmr, mmr, ncol, lchnk)
882 :
883 72960 : end subroutine chm_diags
884 :
885 72960 : subroutine het_diags( het_rates, mmr, pdel, lchnk, ncol )
886 :
887 72960 : use cam_history, only : outfld
888 : use phys_grid, only : get_wght_all_p
889 :
890 : integer, intent(in) :: lchnk
891 : integer, intent(in) :: ncol
892 : real(r8), intent(in) :: het_rates(ncol,pver,max(1,gas_pcnst))
893 : real(r8), intent(in) :: mmr(ncol,pver,gas_pcnst)
894 : real(r8), intent(in) :: pdel(ncol,pver)
895 :
896 145920 : real(r8), dimension(ncol) :: noy_wk, sox_wk, nhx_wk, wrk_wd
897 : integer :: m, k
898 72960 : real(r8) :: wght(ncol)
899 : !
900 : ! output integrated wet deposition field
901 : !
902 1123584 : noy_wk(:) = 0._r8
903 1123584 : sox_wk(:) = 0._r8
904 1123584 : nhx_wk(:) = 0._r8
905 :
906 72960 : call get_wght_all_p(lchnk, ncol, wght)
907 :
908 19261440 : do m = 1,gas_pcnst
909 : !
910 : ! compute vertical integral
911 : !
912 295502592 : wrk_wd(:ncol) = 0._r8
913 633219840 : do k = 1,pver
914 9475271424 : wrk_wd(:ncol) = wrk_wd(:ncol) + het_rates(:ncol,k,m) * mmr(:ncol,k,m) * pdel(:ncol,k)
915 : end do
916 : !
917 295502592 : wrk_wd(:ncol) = wrk_wd(:ncol) * rgrav * wght(:ncol) * rearth**2
918 : !
919 19261440 : if (gas_wetdep_method=='MOZ') then
920 0 : call outfld( wetdep_name(m), wrk_wd(:ncol), ncol, lchnk )
921 0 : call outfld( wtrate_name(m), het_rates(:ncol,:,m), ncol, lchnk )
922 :
923 0 : if ( any(noy_species == m ) ) then
924 0 : noy_wk(:ncol) = noy_wk(:ncol) + wrk_wd(:ncol)*N_molwgt/adv_mass(m)
925 : endif
926 0 : if ( m == id_n2o5 ) then ! 2 NOy molecules in N2O5
927 0 : noy_wk(:ncol) = noy_wk(:ncol) + wrk_wd(:ncol)*N_molwgt/adv_mass(m)
928 : endif
929 0 : if ( any(sox_species == m ) ) then
930 0 : sox_wk(:ncol) = sox_wk(:ncol) + wrk_wd(:ncol)*S_molwgt/adv_mass(m)
931 : endif
932 0 : if ( any(nhx_species == m ) ) then
933 0 : nhx_wk(:ncol) = nhx_wk(:ncol) + wrk_wd(:ncol)*N_molwgt/adv_mass(m)
934 : endif
935 : endif
936 : end do
937 72960 : if (gas_wetdep_method=='MOZ') then
938 0 : call outfld( 'wet_deposition_NOy_as_N', noy_wk(:ncol), ncol, lchnk )
939 0 : call outfld( 'WD_SOX', sox_wk(:ncol), ncol, lchnk )
940 0 : call outfld( 'wet_deposition_NHx_as_N', nhx_wk(:ncol), ncol, lchnk )
941 : endif
942 :
943 72960 : end subroutine het_diags
944 :
945 : end module mo_chm_diags
|