source: trunk/LMDZ.MARS/libf/aeronomars/photochemistry_asis.F90 @ 1944

Last change on this file since 1944 was 1825, checked in by flefevre, 8 years ago

ajustement cinetique de H + O2 + CO2 -> HO2 + CO2

File size: 55.9 KB
RevLine 
[1495]1!*****************************************************************
2!
3!     Photochemical routine
4!
5!     Author: Franck Lefevre
6!     ------
7!
[1708]8!     Version: 27/04/2017
[1495]9!
[1708]10!     ASIS scheme : for details on the method see
11!     Cariolle et al., Geosci. Model Dev., 10, 1467-1485, 2017.
12!
[1495]13!*****************************************************************
14
15subroutine photochemistry_asis(nlayer, nq,                            &
16                          ig, lswitch, zycol, sza, ptimestep, press,  &
17                          temp, dens, zmmean, dist_sol, surfdust1d,   &
18                          surfice1d, jo3, tau, iter)
19
20implicit none
21
22#include "chimiedata.h"
23#include "callkeys.h"
24
25!===================================================================
26!     inputs:
27!===================================================================
28
29integer, intent(in) :: nlayer ! number of atmospheric layers
30integer, intent(in) :: nq     ! number of tracers
31integer :: ig                 ! grid point index
32     
33real :: sza                   ! solar zenith angle (deg)
34real :: ptimestep             ! physics timestep (s)
35real :: press(nlayer)         ! pressure (hpa)
36real :: temp(nlayer)          ! temperature (k)
37real :: dens(nlayer)          ! density (cm-3)
38real :: zmmean(nlayer)        ! mean molar mass (g/mole)
39real :: dist_sol              ! sun distance (au)
40real :: surfdust1d(nlayer)    ! dust surface area (cm2/cm3)
41real :: surfice1d(nlayer)     ! ice surface area (cm2/cm3)
42real :: tau                   ! optical depth at 7 hpa
43
44!===================================================================
45!     input/output:
46!===================================================================
47     
48real :: zycol(nlayer,nq)       ! chemical species volume mixing ratio
49
50!===================================================================
51!     output:
52!===================================================================
53     
54integer :: iter(nlayer)        ! iteration counter
55real    :: jo3(nlayer)         ! photodissociation rate o3 -> o1d
56
57!===================================================================
58!     local:
59!===================================================================
60
61integer :: phychemrat         ! (physical timestep)/(nominal chemical timestep)
62integer :: j_o3_o1d, ilev
63integer :: iesp, nesp
64integer :: lswitch
65
66logical, save :: firstcall = .true.
67
68parameter (nesp = 17)         ! number of species in the chemistry
69
70! tracer indexes in the chemistry:
71
72integer,parameter :: i_co2  =  1
73integer,parameter :: i_co   =  2
74integer,parameter :: i_o    =  3
75integer,parameter :: i_o1d  =  4
76integer,parameter :: i_o2   =  5
77integer,parameter :: i_o3   =  6
78integer,parameter :: i_h    =  7
79integer,parameter :: i_h2   =  8
80integer,parameter :: i_oh   =  9
81integer,parameter :: i_ho2  = 10
82integer,parameter :: i_h2o2 = 11
83integer,parameter :: i_h2o  = 12
84integer,parameter :: i_n    = 13
85integer,parameter :: i_n2d  = 14
86integer,parameter :: i_no   = 15
87integer,parameter :: i_no2  = 16
88integer,parameter :: i_n2   = 17
89
[1569]90real :: ctimestep           ! standard timestep for the chemistry (s)
[1495]91real :: dt_guess            ! first-guess timestep (s)
92real :: dt_corrected        ! corrected timestep (s)
93real :: j(nlayer,nd)        ! interpolated photolysis rates (s-1)
94real :: time                ! internal time (between 0 and ptimestep, in s)
95
96real, dimension(nlayer,nesp)            :: rm   ! mixing ratios
97real (kind = 8), dimension(nesp)        :: cold ! number densities at previous timestep (molecule.cm-3)
98real (kind = 8), dimension(nlayer,nesp) :: c    ! number densities at current timestep (molecule.cm-3)
99real (kind = 8), dimension(nesp)        :: cnew ! number densities at next timestep (molecule.cm-3)
100 
101! reaction rates
102 
103real (kind = 8), dimension(nlayer,      nb_phot_max) :: v_phot
104real (kind = 8), dimension(nlayer,nb_reaction_3_max) :: v_3
105real (kind = 8), dimension(nlayer,nb_reaction_4_max) :: v_4
106logical :: hetero_dust, hetero_ice
107
108! matrix
109
[1496]110real (kind = 8), dimension(nesp,nesp) :: mat, mat1
[1495]111integer, dimension(nesp)              :: indx
112integer                               :: code
113
[1496]114! production and loss terms (for first-guess solution only)
115
116real (kind = 8), dimension(nesp) :: prod, loss
117
[1495]118!===================================================================
119!     initialisation of the reaction indexes
120!===================================================================
121
122if (firstcall) then
123   print*,'photochemistry: initialize indexes'
124   call indice(i_co2, i_co, i_o, i_o1d, i_o2, i_o3, i_h,       &
125               i_h2, i_oh, i_ho2, i_h2o2, i_h2o,               &
126               i_n, i_n2d, i_no, i_no2, i_n2)
127   firstcall = .false.
128end if
129
130!===================================================================
131!     initialisation of mixing ratios and densities       
132!===================================================================
133
134call gcmtochim(nlayer, nq, zycol, lswitch, nesp,               &
135               i_co2, i_co, i_o, i_o1d, i_o2, i_o3, i_h,       &
136               i_h2, i_oh, i_ho2, i_h2o2, i_h2o,               &
137               i_n, i_n2d, i_no, i_no2, i_n2, dens, rm, c)
138
139!===================================================================
140!     interpolation of photolysis rates in the lookup table     
141!===================================================================
142
143call photolysis_asis(nlayer, lswitch, press, temp, sza, tau, zmmean, dist_sol, &
144                     rm(:,i_co2), rm(:,i_o3), v_phot)
145
146! save o3 photolysis for output
147
148j_o3_o1d = 5
149jo3(:) = v_phot(:,j_o3_o1d)
150
151!===================================================================
152!     reaction rates                                     
153!===================================================================
154!     switches for heterogeneous chemistry
155!     hetero_ice  : reactions on ice clouds
156!     hetero_dust : reactions on dust   
157!===================================================================
158
159hetero_dust = .false.
160hetero_ice  = .true.
161
162call reactionrates(nlayer, lswitch, dens, c(:,i_co2), c(:,i_o2), &
163                   press, temp, hetero_dust, hetero_ice,         &
164                   surfdust1d, surfice1d, v_phot, v_3, v_4)
165
166!===================================================================
[1569]167!     ctimestep : standard chemical timestep (s), defined as
168!                 the fraction phychemrat of the physical timestep                           
[1495]169!===================================================================
170
[1503]171phychemrat = 1
[1495]172
173ctimestep = ptimestep/real(phychemrat)
174
175!print*, "ptimestep  = ", ptimestep
176!print*, "phychemrat = ", phychemrat
177!print*, "ctimestep  = ", ctimestep
178!stop
179
180!===================================================================
181!     loop over levels         
182!===================================================================
183
184do ilev = 1,lswitch - 1
185
186!  initializations
187
188   time = 0.
189   iter(ilev) = 0
190   dt_guess = ctimestep
191   cold(:) = c(ilev,:)
192
193!  internal loop for the chemistry
194
195   do while (time < ptimestep)
196
[1496]197   iter(ilev) = iter(ilev) + 1    ! iteration counter
[1495]198 
199!  first-guess: fill matrix
200
[1496]201   call fill_matrix(ilev, mat1, prod, loss, c, nesp, nlayer, v_phot, v_3, v_4)
[1495]202
[1569]203!  adaptative evaluation of the sub time step
[1496]204
[1569]205   call define_dt(nesp, dt_corrected, dt_guess, ctimestep, cold(:), c(ilev,:),  &
[1571]206                  mat1, prod, loss, dens(ilev))
[1569]207
208   if (time + dt_corrected > ptimestep) then
209      dt_corrected = ptimestep - time
210   end if
211
212!  if (dt_corrected /= dt_guess) then  ! the timestep has been modified
213
214!  form the matrix identity + mat*dt_corrected
215
216   mat(:,:) = mat1(:,:)*dt_corrected
[1496]217   do iesp = 1,nesp
218      mat(iesp,iesp) = 1. + mat(iesp,iesp)
219   end do
220
[1569]221!  solve the linear system  M*Cn+1 = Cn (RHS in cnew, then replaced by solution)
[1495]222     
223   cnew(:) = c(ilev,:)
224
[1499]225#ifdef LAPACK
[1495]226   call dgesv(nesp,1,mat,nesp,indx,cnew,nesp,code)
[1499]227#else
228   write(*,*) "photochemistry_asis error, missing LAPACK routine dgesv"
229   stop
230#endif
[1569]231
232!  end if
233
[1495]234!  eliminate small values
235
236   where (cnew(:)/dens(ilev) < 1.e-30)
237      cnew(:) = 0.
238   end where
239
[1569]240!  update concentrations
[1495]241
[1569]242   cold(:)   = c(ilev,:)
243   c(ilev,:) = cnew(:)
244   cnew(:)   = 0.
[1495]245
[1569]246!  increment internal time
[1495]247
[1569]248   time = time + dt_corrected
249   dt_guess = dt_corrected     ! first-guess timestep for next iteration
[1495]250
[1569]251   end do ! while (time < ptimestep)
[1495]252
[1569]253end do ! ilev
[1495]254
[1569]255!===================================================================
256!     save chemical species for the gcm       
257!===================================================================
[1495]258
[1569]259call chimtogcm(nlayer, nq, zycol, lswitch, nesp,              &
260               i_co2, i_co, i_o, i_o1d, i_o2, i_o3, i_h,      &
261               i_h2, i_oh, i_ho2, i_h2o2, i_h2o,              &
262               i_n, i_n2d, i_no, i_no2, i_n2, dens, c)
[1495]263
[1569]264contains
[1495]265
[1569]266!================================================================
[1495]267
[1571]268 subroutine define_dt(nesp, dtnew, dtold, ctimestep, cold, ccur, mat1, &
269                      prod, loss, dens)
[1495]270
[1569]271!================================================================
272! iterative evaluation of the appropriate time step dtnew
273! according to curvature criterion based on
274! e = 2 Rtol [r Cn+1 -(1-r) Cn + Cn-1 ]/[(1+r) Cn]
275! with r = (tn - tn-1)/(tn+1 - tn)
276!================================================================
[1495]277
[1569]278implicit none
[1495]279
[1569]280! input
[1495]281
[1569]282integer :: nesp  ! number of species in the chemistry
[1495]283
[1569]284real :: dtold, ctimestep
285real (kind = 8), dimension(nesp)      :: cold, ccur
286real (kind = 8), dimension(nesp,nesp) :: mat1
287real (kind = 8), dimension(nesp)      :: prod, loss
[1574]288real                                  :: dens
[1569]289
290! output
291
292real :: dtnew
293
294! local
295
296real (kind = 8), dimension(nesp)      :: cnew
297real (kind = 8), dimension(nesp,nesp) :: mat
[1571]298real (kind = 8) :: atol, ratio, e, es, coef
[1569]299
300integer                  :: code, iesp, iter
301integer, dimension(nesp) :: indx
302
303real :: dttest
304
305! parameters
306
307real (kind = 8), parameter :: dtmin   = 10.      ! minimum time step (s)
[1571]308real (kind = 8), parameter :: vmrtol  = 1.e-11   ! absolute tolerance on vmr
[1708]309real (kind = 8), parameter :: rtol    = 1./0.05   ! 1/rtol recommended value : 0.1-0.02
[1569]310integer,         parameter :: niter   = 3        ! number of iterations
311real (kind = 8), parameter :: coefmax = 2.
312real (kind = 8), parameter :: coefmin = 0.1
313logical                    :: fast_guess = .true.
314
315dttest = dtold   ! dttest = dtold = dt_guess
316
[1571]317atol = vmrtol*dens ! absolute tolerance in molecule.cm-3
318
[1569]319do iter = 1,niter
320
321if (fast_guess) then
322
[1571]323! first guess : fast semi-implicit method
[1569]324
325   do iesp = 1, nesp
326      cnew(iesp) = (ccur(iesp) + prod(iesp)*dttest)/(1. + loss(iesp)*dttest)
327   end do
328
329else
330
331! first guess : form the matrix identity + mat*dt_guess
332
333   mat(:,:) = mat1(:,:)*dttest
334   do iesp = 1,nesp
335      mat(iesp,iesp) = 1. + mat(iesp,iesp)
336   end do
337
338! form right-hand side (RHS) of the system
339
340   cnew(:) = ccur(:)
341
342! solve the linear system  M*Cn+1 = Cn (RHS in cnew, then replaced by solution)
343
[1499]344#ifdef LAPACK
[1495]345      call dgesv(nesp,1,mat,nesp,indx,cnew,nesp,code)
[1499]346#else
347   write(*,*) "photochemistry_asis error, missing LAPACK routine dgesv"
348   stop
349#endif
[1495]350
[1569]351end if
[1495]352
[1569]353! ratio old/new subtimestep
[1495]354
[1569]355ratio = dtold/dttest
[1495]356
[1569]357! e : local error indicatocitr
[1495]358
[1569]359e = 0.
[1495]360
[1569]361do iesp = 1,nesp
362   es = 2.*abs((ratio*cnew(iesp) - (1. + ratio)*ccur(iesp) + cold(iesp))   &
363         /(1. + ratio)/max(ccur(iesp),atol))
[1495]364
[1569]365   if (es > e) then
366      e = es
367   end if
368end do
369e = rtol*e
[1495]370
[1569]371! timestep correction
[1495]372
[1569]373coef = max(coefmin, min(coefmax,0.8/sqrt(e)))
[1495]374
[1569]375dttest = max(dtmin,dttest*coef)
376dttest = min(ctimestep,dttest)
[1495]377
[1569]378end do ! iter
379
380! new timestep
381
382dtnew = dttest
383
384end subroutine define_dt
385
[1495]386!======================================================================
387
388 subroutine reactionrates(nlayer,                               &
389                          lswitch, dens, co2, o2, press, t,     &
390                          hetero_dust, hetero_ice,              &
391                          surfdust1d, surfice1d,                &
392                          v_phot, v_3, v_4)
393 
394!================================================================
395! compute reaction rates                                        !
396!----------------------------------------------------------------
397! reaction               type                array              !
398!----------------------------------------------------------------
399! A + B    --> C + D     bimolecular         v_4                !
400! A + A    --> B + C     quadratic           v_3                !
401! A + C    --> B + C     quenching           v_phot             !
402! A + ice  --> B + C     heterogeneous       v_phot             !
403!================================================================
404
405use comcstfi_h
406
407implicit none
408
409#include "chimiedata.h"
410
411!----------------------------------------------------------------------
412!     input
413!----------------------------------------------------------------------
414
415integer, intent(in)     :: nlayer            ! number of atmospheric layers
416integer                 :: lswitch           ! interface level between lower
417                                             ! atmosphere and thermosphere chemistries
418real, dimension(nlayer) :: dens              ! total number density (molecule.cm-3)
419real, dimension(nlayer) :: press             ! pressure (hPa)
420real, dimension(nlayer) :: t                 ! temperature (K)
421real, dimension(nlayer) :: surfdust1d        ! dust surface area (cm2.cm-3)
422real, dimension(nlayer) :: surfice1d         ! ice surface area (cm2.cm-3)
423real (kind = 8), dimension(nlayer) :: co2    ! co2 number density (molecule.cm-3)
424real (kind = 8), dimension(nlayer) :: o2     ! o2 number density (molecule.cm-3)
425logical :: hetero_dust, hetero_ice           ! switches for heterogeneous chemistry
426
427!----------------------------------------------------------------------
428!     output
429!----------------------------------------------------------------------
430
431real (kind = 8), dimension(nlayer,      nb_phot_max) :: v_phot
432real (kind = 8), dimension(nlayer,nb_reaction_3_max) :: v_3
433real (kind = 8), dimension(nlayer,nb_reaction_4_max) :: v_4
434
435!----------------------------------------------------------------------
436!     local
437!----------------------------------------------------------------------
438
439integer          :: ilev
440integer          :: nb_phot, nb_reaction_3, nb_reaction_4
441real :: ak0, ak1, xpo, rate
442real :: k1a0, k1b0, k1ainf, k1a, k1b, fc, fx, x, y, gam
443real, dimension(nlayer) :: deq
444real, dimension(nlayer) :: a001, a002, a003,                           &
445                             b001, b002, b003, b004, b005, b006, b007,   &
446                             b008, b009,                                 &
447                             c001, c002, c003, c004, c005, c006, c007,   &
448                             c008, c009, c010, c011, c012, c013, c014,   &
449                             c015, c016, c017, c018,                     &
450                             d001, d002, d003, d004, d005, d006, d007,   &
451                             d008, d009,                                 &
452                             e001, e002,                                 &
453                             h001, h002, h003, h004, h005
454
455!----------------------------------------------------------------------
456!     initialisation
457!----------------------------------------------------------------------
458
459      nb_phot       = 11       ! jmars.20140930 reduit de 13 a 11
460      nb_reaction_3 = 0
461      nb_reaction_4 = 0
462
463!----------------------------------------------------------------------
464!     oxygen reactions
465!----------------------------------------------------------------------
466
467!---  a001: o + o2 + co2 -> o3 + co2
468
469!     jpl 2003
470!
[1825]471!     co2/n2 efficiency as a third body = 2.075
[1495]472!     from sehested et al., j. geophys. res., 100, 1995.
473
474      a001(:) = 2.075*6.0e-34*(t(:)/300.)**(-2.4)*dens(:)
475
476      nb_reaction_4 = nb_reaction_4 + 1
477      v_4(:,nb_reaction_4) = a001(:)
478
479!---  a002: o + o + co2 -> o2 + co2
480
481!     Tsang and Hampson, J. Chem. Phys. Ref. Data, 15, 1087, 1986
482
483!     a002(:) = 2.5*5.2e-35*exp(900./t(:))*dens(:)
484
485!     Campbell and Gray, Chem. Phys. Lett., 18, 607, 1973
486
487!     a002(:) = 1.2e-32*(300./t(:))**(2.0)*dens(:)  ! yung expression
488      a002(:) = 2.5*9.46e-34*exp(485./t(:))*dens(:) ! nist expression
489
490      nb_reaction_3 = nb_reaction_3 + 1
491      v_3(:,nb_reaction_3) = a002(:)
492
493!---  a003: o + o3 -> o2 + o2
494
495!     jpl 2003
496
497      a003(:) = 8.0e-12*exp(-2060./t(:))
498
499      nb_reaction_4 = nb_reaction_4 + 1
500      v_4(:,nb_reaction_4) = a003(:)
501
502!----------------------------------------------------------------------
503!     o(1d) reactions
504!----------------------------------------------------------------------
505
506!---  b001: o(1d) + co2  -> o + co2
507
508!     jpl 2006
509
510      b001(:) = 7.5e-11*exp(115./t(:))
511   
512      nb_phot = nb_phot + 1
513      v_phot(:,nb_phot) = b001(:)*co2(:)
514
515!---  b002: o(1d) + h2o  -> oh + oh
516
517!     jpl 2006
518 
519      b002(:) = 1.63e-10*exp(60./t(:))
520
521      nb_reaction_4 = nb_reaction_4 + 1
522      v_4(:,nb_reaction_4) = b002(:)
523
524!---  b003: o(1d) + h2  -> oh + h
525
526!     jpl 2011
527
528      b003(:) = 1.2e-10
529
530      nb_reaction_4 = nb_reaction_4 + 1
531      v_4(:,nb_reaction_4) = b003(:)
532
533!---  b004: o(1d) + o2  -> o + o2
534
535!     jpl 2006
536
537      b004(:) = 3.3e-11*exp(55./t(:))
538
539      nb_phot = nb_phot + 1
540      v_phot(:,nb_phot) = b004(:)*o2(:)
541   
542!---  b005: o(1d) + o3  -> o2 + o2
543
544!     jpl 2003
545
546      b005(:) = 1.2e-10
547
548      nb_reaction_4 = nb_reaction_4 + 1
549      v_4(:,nb_reaction_4) = b005(:)
550   
551!---  b006: o(1d) + o3  -> o2 + o + o
552
553!     jpl 2003
554
555      b006(:) = 1.2e-10
556
557      nb_reaction_4 = nb_reaction_4 + 1
558      v_4(:,nb_reaction_4) = b006(:)
559   
560!---  b007: o(1d) + ch4 -> ch3 + oh
561
562!     jpl 2003
563
564      b007(:) = 1.5e-10*0.75
565
566!---  b008: o(1d) + ch4 -> ch3o + h
567
568!     jpl 2003
569
570      b008(:) = 1.5e-10*0.20
571!
572!---  b009: o(1d) + ch4 -> ch2o + h2
573
574!     jpl 2003
575
576      b009(:) = 1.5e-10*0.05
577
578!----------------------------------------------------------------------
579!     hydrogen reactions
580!----------------------------------------------------------------------
581
582!---  c001: o + ho2 -> oh + o2
583
584!     jpl 2003
585
586      c001(:) = 3.0e-11*exp(200./t(:))
587
588      nb_reaction_4 = nb_reaction_4 + 1
589      v_4(:,nb_reaction_4) = c001(:)
590
591!---  c002: o + oh -> o2 + h
592
593!     jpl 2011
594
595      c002(:) = 1.8e-11*exp(180./t(:))
596
597!     robertson and smith, j. chem. phys. a 110, 6673, 2006
598
599!     c002(:) = 11.2e-11*t(:)**(-0.32)*exp(177./t(:))
600
601      nb_reaction_4 = nb_reaction_4 + 1
602      v_4(:,nb_reaction_4) = c002(:)
603
604!---  c003: h + o3 -> oh + o2
605
606!     jpl 2003
607
608      c003(:) = 1.4e-10*exp(-470./t(:))
609
610      nb_reaction_4 = nb_reaction_4 + 1
611      v_4(:,nb_reaction_4) = c003(:)
612
613!---  c004: h + ho2 -> oh + oh
614
615!     jpl 2006
616
617      c004(:) = 7.2e-11
618
619      nb_reaction_4 = nb_reaction_4 + 1
620      v_4(:,nb_reaction_4) = c004(:)
621
622!---  c005: h + ho2 -> h2 + o2
623
624!     jpl 2006
625
626      c005(:) = 6.9e-12
627
628      nb_reaction_4 = nb_reaction_4 + 1
629      v_4(:,nb_reaction_4) = c005(:)
630
631!---  c006: h + ho2 -> h2o + o
632
633!     jpl 2006
634
635      c006(:) = 1.6e-12
636
637      nb_reaction_4 = nb_reaction_4 + 1
638      v_4(:,nb_reaction_4) = c006(:)
639
640!---  c007: oh + ho2 -> h2o + o2
641
642!     jpl 2003
643
644!     canty et al., grl, 2006 suggest to increase this rate
645!     by 20%. not done here.
646
647      c007(:) = 4.8e-11*exp(250./t(:))
648
649      nb_reaction_4 = nb_reaction_4 + 1
650      v_4(:,nb_reaction_4) = c007(:)
651
652!---  c008: ho2 + ho2 -> h2o2 + o2
653
654!     jpl 2006
655
656!     c008(:) = 3.5e-13*exp(430./t(:))
657
658!     christensen et al., grl, 13, 2002
659
660      c008(:) = 1.5e-12*exp(19./t(:))
661
662      nb_reaction_3 = nb_reaction_3 + 1
663      v_3(:,nb_reaction_3) = c008(:)
664
665!---  c009: oh + h2o2 -> h2o + ho2
666
667!     jpl 2006
668
669      c009(:) = 1.8e-12
670
671      nb_reaction_4 = nb_reaction_4 + 1
672      v_4(:,nb_reaction_4) = c009(:)
673
674!---  c010: oh + h2 -> h2o + h
675
676!     jpl 2006
677
678      c010(:) = 2.8e-12*exp(-1800./t(:))
679
680      nb_reaction_4 = nb_reaction_4 + 1
681      v_4(:,nb_reaction_4) = c010(:)
682
683!---  c011: h + o2 + co2 -> ho2 + co2
684
685!     jpl 2011
[1825]686!     co2/n2 efficiency as a third body = 2.4
687!     from ashman and haynes, 27th symposium on combustion, 1998.
[1495]688
689      do ilev = 1,lswitch-1
[1825]690         ak0 = 2.4*4.4e-32*(t(ilev)/300.)**(-1.3)
[1495]691         ak1 = 7.5e-11*(t(ilev)/300.)**(0.2)
692
693         rate = (ak0*dens(ilev))/(1. + ak0*dens(ilev)/ak1)
694         xpo = 1./(1. + alog10((ak0*dens(ilev))/ak1)**2)
695         c011(ilev) = rate*0.6**xpo
696      end do
697
698      nb_reaction_4 = nb_reaction_4 + 1
699      v_4(:,nb_reaction_4) = c011(:)
700
701!---  c012: o + h2o2 -> oh + ho2
702
703!     jpl 2003
704
705      c012(:) = 1.4e-12*exp(-2000./t(:))
706
707      nb_reaction_4 = nb_reaction_4 + 1
708      v_4(:,nb_reaction_4) = c012(:)
709
710!---  c013: oh + oh -> h2o + o
711
712!     jpl 2006
713
714      c013(:) = 1.8e-12
715
716      nb_reaction_3 = nb_reaction_3 + 1
717      v_3(:,nb_reaction_3) = c013(:)
718
719!---  c014: oh + o3 -> ho2 + o2
720
721!     jpl 2003
722
723      c014(:) = 1.7e-12*exp(-940./t(:))
724
725      nb_reaction_4 = nb_reaction_4 + 1
726      v_4(:,nb_reaction_4) = c014(:)
727
728!---  c015: ho2 + o3 -> oh + o2 + o2
729
730!     jpl 2003
731
732      c015(:) = 1.0e-14*exp(-490./t(:))
733
734      nb_reaction_4 = nb_reaction_4 + 1
735      v_4(:,nb_reaction_4) = c015(:)
736
737!---  c016: ho2 + ho2 + co2 -> h2o2 + o2 + co2
738
739!     jpl 2011
740
741      c016(:) = 2.5*2.1e-33*exp(920./t(:))*dens(:)
742
743      nb_reaction_3 = nb_reaction_3 + 1
744      v_3(:,nb_reaction_3) = c016(:)
745
746!---  c017: oh + oh + co2 -> h2o2 + co2
747
748!     jpl 2003
749
750      do ilev = 1,lswitch-1
751         ak0 = 2.5*6.9e-31*(t(ilev)/300.)**(-1.0)
752         ak1 = 2.6e-11*(t(ilev)/300.)**(0.0)
753
754         rate = (ak0*dens(ilev))/(1. + ak0*dens(ilev)/ak1)
755         xpo = 1./(1. + alog10((ak0*dens(ilev))/ak1)**2)
756         c017(ilev) = rate*0.6**xpo
757      end do
758
759      nb_reaction_3 = nb_reaction_3 + 1
760      v_3(:,nb_reaction_3) = c017(:)
761
762!---  c018: h + h + co2 -> h2 + co2
763
764!     baulch et al., 2005
765
766      c018(:) = 2.5*1.8e-30*(t(:)**(-1.0))*dens(:)
767
768      nb_reaction_3 = nb_reaction_3 + 1
769      v_3(:,nb_reaction_3) = c018(:)
770
771!----------------------------------------------------------------------
772!     nitrogen reactions
773!----------------------------------------------------------------------
774
775!---  d001: no2 + o -> no + o2
776
777!     jpl 2006
778
779      d001(:) = 5.1e-12*exp(210./t(:))
780
781      nb_reaction_4 = nb_reaction_4 + 1
782      v_4(:,nb_reaction_4) = d001(:)
783
784!---  d002: no + o3 -> no2 + o2
785
786!     jpl 2006
787
788      d002(:) = 3.0e-12*exp(-1500./t(:))
789
790      nb_reaction_4 = nb_reaction_4 + 1
791      v_4(:,nb_reaction_4) = d002(:)
792
793!---  d003: no + ho2 -> no2 + oh
794
795!     jpl 2011
796
797      d003(:) = 3.3e-12*exp(270./t(:))
798
799      nb_reaction_4 = nb_reaction_4 + 1
800      v_4(:,nb_reaction_4) = d003(:)
801
802!---  d004: n + no -> n2 + o
803
804!     jpl 2011
805
806      d004(:) = 2.1e-11*exp(100./t(:))
807
808      nb_reaction_4 = nb_reaction_4 + 1
809      v_4(:,nb_reaction_4) = d004(:)
810
811!---  d005: n + o2 -> no + o
812
813!     jpl 2011
814
815      d005(:) = 1.5e-11*exp(-3600./t(:))
816
817      nb_reaction_4 = nb_reaction_4 + 1
818      v_4(:,nb_reaction_4) = d005(:)
819
820!---  d006: no2 + h -> no + oh
821
822!     jpl 2011
823
824      d006(:) = 4.0e-10*exp(-340./t(:))
825
826      nb_reaction_4 = nb_reaction_4 + 1
827      v_4(:,nb_reaction_4) = d006(:)
828
829!---  d007: n + o -> no
830 
831      d007(:) = 2.8e-17*(300./t(:))**0.5
832
833      nb_reaction_4 = nb_reaction_4 + 1
834      v_4(:,nb_reaction_4) = d007(:)
835
836!---  d008: n + ho2 -> no + oh
837
838!     brune et al., j. chem. phys., 87, 1983
839
840      d008(:) = 2.19e-11
841
842      nb_reaction_4 = nb_reaction_4 + 1
843      v_4(:,nb_reaction_4) = d008(:)
844
845!---  d009: n + oh -> no + h
846
847!     atkinson et al., j. phys. chem. ref. data, 18, 881, 1989
848
849      d009(:) = 3.8e-11*exp(85./t(:))
850
851      nb_reaction_4 = nb_reaction_4 + 1
852      v_4(:,nb_reaction_4) = d009(:)
853
854!----------------------------------------------------------------------
855!     carbon reactions
856!----------------------------------------------------------------------
857
858!---  e001: oh + co -> co2 + h
859
860!     jpl 2003
861
862!     e001(:) = 1.5e-13*(1 + 0.6*press(:)/1013.)
863
864!     mccabe et al., grl, 28, 3135, 2001
865
866!     e001(:) = 1.57e-13 + 3.54e-33*dens(:)
867
868!     jpl 2006
869
870!     ak0 = 1.5e-13*(t(:)/300.)**(0.6)
871!     ak1 = 2.1e-9*(t(:)/300.)**(6.1)
872!     rate1 = ak0/(1. + ak0/(ak1/dens(:)))
873!     xpo1 = 1./(1. + alog10(ak0/(ak1/dens(:)))**2)
874
875!     ak0 = 5.9e-33*(t(:)/300.)**(-1.4)
876!     ak1 = 1.1e-12*(t(:)/300.)**(1.3)
877!     rate2 = (ak0*dens(:))/(1. + ak0*dens(:)/ak1)
878!     xpo2 = 1./(1. + alog10((ak0*dens(:))/ak1)**2)
879
880!     e001(:) = rate1*0.6**xpo1 + rate2*0.6**xpo2
881
882!     joshi et al., 2006
883
884      do ilev = 1,lswitch-1
885         k1a0 = 1.34*2.5*dens(ilev)                                  &
886               *1/(1/(3.62e-26*t(ilev)**(-2.739)*exp(-20./t(ilev)))  &
887               + 1/(6.48e-33*t(ilev)**(0.14)*exp(-57./t(ilev))))     ! typo in paper corrected
888         k1b0 = 1.17e-19*t(ilev)**(2.053)*exp(139./t(ilev))          &
889              + 9.56e-12*t(ilev)**(-0.664)*exp(-167./t(ilev))
890         k1ainf = 1.52e-17*t(ilev)**(1.858)*exp(28.8/t(ilev))        &
891                + 4.78e-8*t(ilev)**(-1.851)*exp(-318./t(ilev))
892         x = k1a0/(k1ainf - k1b0)
893         y = k1b0/(k1ainf - k1b0)
894         fc = 0.628*exp(-1223./t(ilev)) + (1. - 0.628)*exp(-39./t(ilev))  &
895            + exp(-t(ilev)/255.)
896         fx = fc**(1./(1. + (alog(x))**2))                           ! typo in paper corrected
897         k1a = k1a0*((1. + y)/(1. + x))*fx
898         k1b = k1b0*(1./(1.+x))*fx
899
900         e001(ilev) = k1a + k1b
901      end do
902
903      nb_reaction_4 = nb_reaction_4 + 1
904      v_4(:,nb_reaction_4) = e001(:)
905
906!---  e002: o + co + m -> co2 + m
907
908!     tsang and hampson, 1986.
909
910      e002(:) = 2.5*6.5e-33*exp(-2184./t(:))*dens(:)
911
912      nb_reaction_4 = nb_reaction_4 + 1
913      v_4(:,nb_reaction_4) = e002(:)
914
915!----------------------------------------------------------------------
916!     heterogeneous chemistry
917!----------------------------------------------------------------------
918
919      if (hetero_ice) then
920
921!        k = (surface*v*gamma)/4 (s-1)
922!        v = 100*sqrt(8rt/(pi*m))  (cm s-1)
923 
924!---     h001: ho2 + ice -> products
925 
926!        cooper and abbatt, 1996: gamma = 0.025
927     
928         gam = 0.025
929         h001(:) = surfice1d(:)       &
930                   *100.*sqrt(8.*8.31*t(:)/(33.e-3*pi))*gam/4.
931 
932!        h002: oh + ice -> products
933 
934!        cooper and abbatt, 1996: gamma = 0.03
935 
936         gam = 0.03
937         h002(:) = surfice1d(:)       &
938                   *100.*sqrt(8.*8.31*t(:)/(17.e-3*pi))*gam/4.
939
940!---     h003: h2o2 + ice -> products
941 
942!        gamma = 0.    test value
943 
944         gam = 0.
945         h003(:) = surfice1d(:)       &
946                   *100.*sqrt(8.*8.31*t(:)/(34.e-3*pi))*gam/4.
947      else
948         h001(:) = 0.
949         h002(:) = 0.
950         h003(:) = 0.
951      end if
952
953      nb_phot = nb_phot + 1
954      v_phot(:,nb_phot) = h001(:)
955
956      nb_phot = nb_phot + 1
957      v_phot(:,nb_phot) = h002(:)
958
959      nb_phot = nb_phot + 1
960      v_phot(:,nb_phot) = h003(:)
961
962      if (hetero_dust) then
963 
964!---     h004: ho2 + dust -> products
965 
966!        jacob, 2000: gamma = 0.2
967!        see dereus et al., atm. chem. phys., 2005
968 
969         gam = 0.2
970         h004(:) = surfdust1d(:)  &
971                   *100.*sqrt(8.*8.31*t(:)/(33.e-3*pi))*gam/4.
972 
973!---     h005: h2o2 + dust -> products
974 
975!        gamma = 5.e-4
976!        see dereus et al., atm. chem. phys., 2005
977 
978         gam = 5.e-4
979         h005(:) = surfdust1d(:)  &
980                   *100.*sqrt(8.*8.31*t(:)/(34.e-3*pi))*gam/4.
981      else
982         h004(:) = 0.
983         h005(:) = 0.
984      end if
985 
986      nb_phot = nb_phot + 1
987      v_phot(:,nb_phot) = h004(:)
988
989      nb_phot = nb_phot + 1
990      v_phot(:,nb_phot) = h005(:)
991
[1499]992end subroutine reactionrates
[1495]993
994!======================================================================
995
[1496]996 subroutine fill_matrix(ilev, mat, prod, loss, c, nesp, nlayer, v_phot, v_3, v_4)
[1495]997
998!======================================================================
999! filling of the jacobian matrix
1000!======================================================================
1001
1002use types_asis
1003
1004implicit none
1005
1006#include "chimiedata.h"
1007
1008! input
1009
1010integer             :: ilev    ! level index
1011integer             :: nesp    ! number of species in the chemistry
1012integer, intent(in) :: nlayer  ! number of atmospheric layers
1013
1014real (kind = 8), dimension(nlayer,nesp)              :: c    ! number densities
1015real (kind = 8), dimension(nlayer,      nb_phot_max) :: v_phot
1016real (kind = 8), dimension(nlayer,nb_reaction_3_max) :: v_3
1017real (kind = 8), dimension(nlayer,nb_reaction_4_max) :: v_4
1018
1019! output
1020
[1496]1021real (kind = 8), dimension(nesp,nesp), intent(out) :: mat  ! matrix
1022real (kind = 8), dimension(nesp), intent(out)      :: prod, loss
[1495]1023
1024! local
1025
1026integer :: iesp
1027integer :: ind_phot_2,ind_phot_4,ind_phot_6
1028integer :: ind_3_2,ind_3_4,ind_3_6
1029integer :: ind_4_2,ind_4_4,ind_4_6,ind_4_8
1030integer :: iphot,i3,i4
1031
[1569]1032real(kind = 8) :: eps, eps_4  ! implicit/explicit coefficient
[1495]1033
[1496]1034! initialisations
1035
[1495]1036mat(:,:) = 0.
[1496]1037prod(:)  = 0.
1038loss(:)  = 0.
[1495]1039
1040! photodissociations
1041! or reactions a + c -> b + c
1042! or reactions a + ice -> b + c
1043
1044do iphot = 1,nb_phot_max
1045
1046  ind_phot_2 = indice_phot(iphot)%z2
1047  ind_phot_4 = indice_phot(iphot)%z4
1048  ind_phot_6 = indice_phot(iphot)%z6
1049
[1496]1050  mat(ind_phot_2,ind_phot_2) = mat(ind_phot_2,ind_phot_2) + indice_phot(iphot)%z1*v_phot(ilev,iphot)
1051  mat(ind_phot_4,ind_phot_2) = mat(ind_phot_4,ind_phot_2) - indice_phot(iphot)%z3*v_phot(ilev,iphot)
1052  mat(ind_phot_6,ind_phot_2) = mat(ind_phot_6,ind_phot_2) - indice_phot(iphot)%z5*v_phot(ilev,iphot)
[1495]1053
[1496]1054  loss(ind_phot_2) = loss(ind_phot_2) + indice_phot(iphot)%z1*v_phot(ilev,iphot)
1055  prod(ind_phot_4) = prod(ind_phot_4) + indice_phot(iphot)%z3*v_phot(ilev,iphot)*c(ilev,ind_phot_2)
1056  prod(ind_phot_6) = prod(ind_phot_6) + indice_phot(iphot)%z5*v_phot(ilev,iphot)*c(ilev,ind_phot_2)
1057
[1495]1058end do
1059
1060! reactions a + a -> b + c
1061
1062do i3 = 1,nb_reaction_3_max
1063
1064  ind_3_2 = indice_3(i3)%z2
1065  ind_3_4 = indice_3(i3)%z4
1066  ind_3_6 = indice_3(i3)%z6
1067
[1496]1068  mat(ind_3_2,ind_3_2) = mat(ind_3_2,ind_3_2) + indice_3(i3)%z1*v_3(ilev,i3)*c(ilev,ind_3_2)
1069  mat(ind_3_4,ind_3_2) = mat(ind_3_4,ind_3_2) - indice_3(i3)%z3*v_3(ilev,i3)*c(ilev,ind_3_2)
1070  mat(ind_3_6,ind_3_2) = mat(ind_3_6,ind_3_2) - indice_3(i3)%z5*v_3(ilev,i3)*c(ilev,ind_3_2)
[1495]1071
[1496]1072  loss(ind_3_2) = loss(ind_3_2) + indice_3(i3)%z1*v_3(ilev,i3)*c(ilev,ind_3_2)
1073  prod(ind_3_4) = prod(ind_3_4) + indice_3(i3)%z3*v_3(ilev,i3)*c(ilev,ind_3_2)*c(ilev,ind_3_2)
1074  prod(ind_3_6) = prod(ind_3_6) + indice_3(i3)%z5*v_3(ilev,i3)*c(ilev,ind_3_2)*c(ilev,ind_3_2)
1075
[1495]1076end do
1077
1078! reactions a + b -> c + d
1079
1080eps = 1.d-10
1081
1082do i4 = 1,nb_reaction_4_max
1083
1084  ind_4_2 = indice_4(i4)%z2
1085  ind_4_4 = indice_4(i4)%z4
1086  ind_4_6 = indice_4(i4)%z6
1087  ind_4_8 = indice_4(i4)%z8
1088
1089  eps_4 = abs(c(ilev,ind_4_2))/(abs(c(ilev,ind_4_2)) + abs(c(ilev,ind_4_4)) + eps)
[1569]1090  eps_4 = min(eps_4,1.0)
[1495]1091
[1496]1092  mat(ind_4_2,ind_4_2) = mat(ind_4_2,ind_4_2) + indice_4(i4)%z1*v_4(ilev,i4)*(1. - eps_4)*c(ilev,ind_4_4)
1093  mat(ind_4_2,ind_4_4) = mat(ind_4_2,ind_4_4) + indice_4(i4)%z1*v_4(ilev,i4)*eps_4*c(ilev,ind_4_2)
1094  mat(ind_4_4,ind_4_2) = mat(ind_4_4,ind_4_2) + indice_4(i4)%z3*v_4(ilev,i4)*(1. - eps_4)*c(ilev,ind_4_4)
1095  mat(ind_4_4,ind_4_4) = mat(ind_4_4,ind_4_4) + indice_4(i4)%z3*v_4(ilev,i4)*eps_4*c(ilev,ind_4_2)   
1096  mat(ind_4_6,ind_4_2) = mat(ind_4_6,ind_4_2) - indice_4(i4)%z5*v_4(ilev,i4)*(1. - eps_4)*c(ilev,ind_4_4)
1097  mat(ind_4_6,ind_4_4) = mat(ind_4_6,ind_4_4) - indice_4(i4)%z5*v_4(ilev,i4)*eps_4*c(ilev,ind_4_2)
1098  mat(ind_4_8,ind_4_2) = mat(ind_4_8,ind_4_2) - indice_4(i4)%z7*v_4(ilev,i4)*(1. - eps_4)*c(ilev,ind_4_4)
1099  mat(ind_4_8,ind_4_4) = mat(ind_4_8,ind_4_4) - indice_4(i4)%z7*v_4(ilev,i4)*eps_4*c(ilev,ind_4_2)
[1495]1100
[1496]1101  loss(ind_4_2) = loss(ind_4_2) + indice_4(i4)%z1*v_4(ilev,i4)*c(ilev,ind_4_4)
1102  loss(ind_4_4) = loss(ind_4_4) + indice_4(i4)%z3*v_4(ilev,i4)*c(ilev,ind_4_2)
1103  prod(ind_4_6) = prod(ind_4_6) + indice_4(i4)%z5*v_4(ilev,i4)*c(ilev,ind_4_2)*c(ilev,ind_4_4)
1104  prod(ind_4_8) = prod(ind_4_8) + indice_4(i4)%z7*v_4(ilev,i4)*c(ilev,ind_4_2)*c(ilev,ind_4_4)
1105
[1495]1106end do
1107
[1499]1108end subroutine fill_matrix
[1495]1109
1110!================================================================
1111
1112 subroutine indice(i_co2, i_co, i_o, i_o1d, i_o2, i_o3, i_h,       &
1113                   i_h2, i_oh, i_ho2, i_h2o2, i_h2o,               &
1114                   i_n, i_n2d, i_no, i_no2, i_n2)
1115
1116!================================================================
1117! set the "indice" arrays used to fill the jacobian matrix      !
1118!----------------------------------------------------------------
1119! reaction                                   type               !
1120!----------------------------------------------------------------
1121! A + hv   --> B + C     photolysis          indice_phot        !
1122! A + B    --> C + D     bimolecular         indice_4           !
1123! A + A    --> B + C     quadratic           indice_3           !
1124! A + C    --> B + C     quenching           indice_phot        !
1125! A + ice  --> B + C     heterogeneous       indice_phot        !
1126!================================================================
1127
1128use types_asis
1129
1130implicit none
1131
1132#include "chimiedata.h"
1133
1134! input
1135
1136integer :: i_co2, i_co, i_o, i_o1d, i_o2, i_o3, i_h,       &
1137           i_h2, i_oh, i_ho2, i_h2o2, i_h2o,               &
1138           i_n, i_n2d, i_no, i_no2, i_n2
1139
1140! local
1141
1142integer :: nb_phot, nb_reaction_3, nb_reaction_4
1143integer :: i_dummy
1144
1145allocate (indice_phot(nb_phot_max))
1146allocate (indice_3(nb_reaction_3_max))
1147allocate (indice_4(nb_reaction_4_max))
1148
1149i_dummy = 1
1150
1151nb_phot       = 0
1152nb_reaction_3 = 0
1153nb_reaction_4 = 0
1154
1155!===========================================================
1156!      O2 + hv -> O + O
1157!===========================================================
1158
1159nb_phot = nb_phot + 1
1160
1161indice_phot(nb_phot) = z3spec(1.0, i_o2, 2.0, i_o, 0.0, i_dummy)
1162
1163!===========================================================
1164!      O2 + hv -> O + O(1D)
1165!===========================================================
1166
1167nb_phot = nb_phot + 1
1168
1169indice_phot(nb_phot) = z3spec(1.0, i_o2, 1.0, i_o, 1.0, i_o1d)
1170
1171!===========================================================
1172!      CO2 + hv -> CO + O
1173!===========================================================
1174
1175nb_phot = nb_phot + 1
1176
1177indice_phot(nb_phot) = z3spec(1.0, i_co2, 1.0, i_co, 1.0, i_o)
1178
1179!===========================================================
1180!      CO2 + hv -> CO + O(1D)
1181!===========================================================
1182
1183nb_phot = nb_phot + 1
1184
1185indice_phot(nb_phot) = z3spec(1.0, i_co2, 1.0, i_co, 1.0, i_o1d)
1186
1187!===========================================================
1188!      O3 + hv -> O2 + O(1D)
1189!===========================================================
1190
1191nb_phot = nb_phot + 1
1192
1193indice_phot(nb_phot) = z3spec(1.0, i_o3, 1.0, i_o2, 1.0, i_o1d)
1194
1195!===========================================================
1196!      O3 + hv -> O2 + O
1197!===========================================================
1198
1199nb_phot = nb_phot + 1
1200
1201indice_phot(nb_phot) = z3spec(1.0, i_o3, 1.0, i_o2, 1.0, i_o)
1202
1203!===========================================================
1204!      H2O + hv -> H + OH
1205!===========================================================
1206
1207nb_phot = nb_phot + 1
1208
1209indice_phot(nb_phot) = z3spec(1.0, i_h2o, 1.0, i_h, 1.0, i_oh)
1210
1211!===========================================================
1212!      H2O2 + hv -> OH + OH
1213!===========================================================
1214
1215nb_phot = nb_phot + 1
1216
1217indice_phot(nb_phot) = z3spec(1.0, i_h2o2, 2.0, i_oh, 0.0, i_dummy)
1218
1219!===========================================================
1220!      HO2 + hv -> OH + O
1221!===========================================================
1222
1223nb_phot = nb_phot + 1
1224
1225indice_phot(nb_phot) = z3spec(1.0, i_ho2, 1.0, i_oh, 1.0, i_o)
1226
1227!===========================================================
1228!      NO + hv -> N + O
1229!===========================================================
1230
1231nb_phot = nb_phot + 1
1232
1233indice_phot(nb_phot) = z3spec(1.0, i_no, 1.0, i_n, 1.0, i_o)
1234
1235!===========================================================
1236!      NO2 + hv -> NO + O
1237!===========================================================
1238
1239nb_phot = nb_phot + 1
1240
1241indice_phot(nb_phot) = z3spec(1.0, i_no2, 1.0, i_no, 1.0, i_o)
1242
1243!===========================================================
1244!      a001 : O + O2 + CO2 -> O3 + CO2
1245!===========================================================
1246
1247nb_reaction_4 = nb_reaction_4 + 1
1248
1249indice_4(nb_reaction_4) = z4spec(1.0, i_o, 1.0, i_o2, 1.0, i_o3, 0.0, i_dummy)
1250
1251!===========================================================
1252!      a002 : O + O + CO2 -> O2 + CO2
1253!===========================================================
1254
1255nb_reaction_3 = nb_reaction_3 + 1
1256
1257indice_3(nb_reaction_3) = z3spec(2.0, i_o, 1.0, i_o2, 0.0, i_dummy)
1258
1259!===========================================================
1260!      a003 : O + O3 -> O2 + O2
1261!===========================================================
1262
1263nb_reaction_4 = nb_reaction_4 + 1
1264
1265indice_4(nb_reaction_4) = z4spec(1.0, i_o, 1.0, i_o3, 2.0, i_o2, 0.0, i_dummy)
1266
1267!===========================================================
1268!      b001 : O(1D) + CO2 -> O + CO2
1269!===========================================================
1270
1271nb_phot = nb_phot + 1
1272
1273indice_phot(nb_phot) = z3spec(1.0, i_o1d, 1.0, i_o, 0.0, i_dummy)
1274
1275!===========================================================
1276!      b002 : O(1D) + H2O -> OH + OH
1277!===========================================================
1278
1279nb_reaction_4 = nb_reaction_4 + 1
1280
1281indice_4(nb_reaction_4) = z4spec(1.0, i_o1d, 1.0, i_h2o, 2.0, i_oh, 0.0, i_dummy)
1282
1283!===========================================================
1284!      b003 : O(1D) + H2 -> OH + H
1285!===========================================================
1286
1287nb_reaction_4 = nb_reaction_4 + 1
1288
1289indice_4(nb_reaction_4) = z4spec(1.0, i_o1d, 1.0, i_h2, 1.0, i_oh, 1.0, i_h)
1290
1291!===========================================================
1292!      b004 : O(1D) + O2 -> O + O2
1293!===========================================================
1294
1295nb_phot = nb_phot + 1
1296
1297indice_phot(nb_phot) = z3spec(1.0, i_o1d, 1.0, i_o, 0.0, i_dummy)
1298
1299!===========================================================
1300!      b005 : O(1D) + O3 -> O2 + O2
1301!===========================================================
1302
1303nb_reaction_4 = nb_reaction_4 + 1
1304
1305indice_4(nb_reaction_4) = z4spec(1.0, i_o1d, 1.0, i_o3, 2.0, i_o2, 0.0, i_dummy)
1306
1307!===========================================================
1308!      b006 : O(1D) + O3 -> O2 + O + O
1309!===========================================================
1310
1311nb_reaction_4 = nb_reaction_4 + 1
1312
1313indice_4(nb_reaction_4) = z4spec(1.0, i_o1d, 1.0, i_o3, 1.0, i_o2, 2.0, i_o)
1314
1315!===========================================================
1316!      c001 : O + HO2 -> OH + O2
1317!===========================================================
1318
1319nb_reaction_4 = nb_reaction_4 + 1
1320
1321indice_4(nb_reaction_4) = z4spec(1.0, i_o, 1.0, i_ho2, 1.0, i_oh, 1.0, i_o2)
1322
1323!===========================================================
1324!      c002 : O + OH -> O2 + H
1325!===========================================================
1326
1327nb_reaction_4 = nb_reaction_4 + 1
1328
1329indice_4(nb_reaction_4) = z4spec(1.0, i_o, 1.0, i_oh, 1.0, i_o2, 1.0, i_h)
1330
1331!===========================================================
1332!      c003 : H + O3 -> OH + O2
1333!===========================================================
1334
1335nb_reaction_4 = nb_reaction_4 + 1
1336
1337indice_4(nb_reaction_4) = z4spec(1.0, i_h, 1.0, i_o3, 1.0, i_oh, 1.0, i_o2)
1338
1339!===========================================================
1340!      c004 : H + HO2 -> OH + OH
1341!===========================================================
1342
1343nb_reaction_4 = nb_reaction_4 + 1
1344
1345indice_4(nb_reaction_4) = z4spec(1.0, i_h, 1.0, i_ho2, 2.0, i_oh, 0.0, i_dummy)
1346
1347!===========================================================
1348!      c005 : H + HO2 -> H2 + O2
1349!===========================================================
1350
1351nb_reaction_4 = nb_reaction_4 + 1
1352
1353indice_4(nb_reaction_4) = z4spec(1.0, i_h, 1.0, i_ho2, 1.0, i_h2, 1.0, i_o2)
1354
1355!===========================================================
1356!      c006 : H + HO2 -> H2O + O
1357!===========================================================
1358
1359nb_reaction_4 = nb_reaction_4 + 1
1360
1361indice_4(nb_reaction_4) = z4spec(1.0, i_h, 1.0, i_ho2, 1.0, i_h2o, 1.0, i_o)
1362
1363!===========================================================
1364!      c007 : OH + HO2 -> H2O + O2
1365!===========================================================
1366
1367nb_reaction_4 = nb_reaction_4 + 1
1368
1369indice_4(nb_reaction_4) = z4spec(1.0, i_oh, 1.0, i_ho2, 1.0, i_h2o, 1.0, i_o2)
1370
1371!===========================================================
1372!      c008 : HO2 + HO2 -> H2O2 + O2
1373!===========================================================
1374
1375nb_reaction_3 = nb_reaction_3 + 1
1376
1377indice_3(nb_reaction_3) = z3spec(2.0, i_ho2, 1.0, i_h2o2, 1.0, i_o2)
1378
1379!===========================================================
1380!      c009 : OH + H2O2 -> H2O + HO2
1381!===========================================================
1382
1383nb_reaction_4 = nb_reaction_4 + 1
1384
1385indice_4(nb_reaction_4) = z4spec(1.0, i_oh, 1.0, i_h2o2, 1.0, i_h2o, 1.0, i_ho2)
1386
1387!===========================================================
1388!      c010 : OH + H2 -> H2O + H
1389!===========================================================
1390
1391nb_reaction_4 = nb_reaction_4 + 1
1392
1393indice_4(nb_reaction_4) = z4spec(1.0, i_oh, 1.0, i_h2, 1.0, i_h2o, 1.0, i_h)
1394
1395!===========================================================
1396!      c011 : H + O2 + CO2 -> HO2 + CO2
1397!===========================================================
1398
1399nb_reaction_4 = nb_reaction_4 + 1
1400
1401indice_4(nb_reaction_4) = z4spec(1.0, i_h, 1.0, i_o2, 1.0, i_ho2, 0.0, i_dummy)
1402
1403!===========================================================
1404!      c012 : O + H2O2 -> OH + HO2
1405!===========================================================
1406
1407nb_reaction_4 = nb_reaction_4 + 1
1408
1409indice_4(nb_reaction_4) = z4spec(1.0, i_o, 1.0, i_h2o2, 1.0, i_oh, 1.0, i_ho2)
1410
1411!===========================================================
1412!      c013 : OH + OH -> H2O + O
1413!===========================================================
1414
1415nb_reaction_3 = nb_reaction_3 + 1
1416
1417indice_3(nb_reaction_3) = z3spec(2.0, i_oh, 1.0, i_h2o, 1.0, i_o)
1418
1419!===========================================================
1420!      c014 : OH + O3 -> HO2 + O2
1421!===========================================================
1422
1423nb_reaction_4 = nb_reaction_4 + 1
1424
1425indice_4(nb_reaction_4) = z4spec(1.0, i_oh, 1.0, i_o3, 1.0, i_ho2, 1.0, i_o2)
1426
1427!===========================================================
1428!      c015 : HO2 + O3 -> OH + O2 + O2
1429!===========================================================
1430
1431nb_reaction_4 = nb_reaction_4 + 1
1432
1433indice_4(nb_reaction_4) = z4spec(1.0, i_ho2, 1.0, i_o3, 1.0, i_oh, 2.0, i_o2)
1434
1435!===========================================================
1436!      c016 : HO2 + HO2 + CO2 -> H2O2 + O2 + CO2
1437!===========================================================
1438
1439nb_reaction_3 = nb_reaction_3 + 1
1440
1441indice_3(nb_reaction_3) = z3spec(2.0, i_ho2, 1.0, i_h2o2, 1.0, i_o2)
1442
1443!===========================================================
1444!      c017 : OH + OH + CO2 -> H2O2 + CO2
1445!===========================================================
1446
1447nb_reaction_3 = nb_reaction_3 + 1
1448
1449indice_3(nb_reaction_3) = z3spec(2.0, i_oh, 1.0, i_h2o2, 0.0, i_dummy)
1450
1451!===========================================================
1452!      c018 : H + H + CO2 -> H2 + CO2
1453!===========================================================
1454
1455nb_reaction_3 = nb_reaction_3 + 1
1456
1457indice_3(nb_reaction_3) = z3spec(2.0, i_h, 1.0, i_h2, 0.0, i_dummy)
1458
1459!===========================================================
1460!      d001 : NO2 + O -> NO + O2
1461!===========================================================
1462
1463nb_reaction_4 = nb_reaction_4 + 1
1464
1465indice_4(nb_reaction_4) = z4spec(1.0, i_no2, 1.0, i_o, 1.0, i_no, 1.0, i_o2)
1466
1467!===========================================================
1468!      d002 : NO + O3 -> NO2 + O2
1469!===========================================================
1470
1471nb_reaction_4 = nb_reaction_4 + 1
1472
1473indice_4(nb_reaction_4) = z4spec(1.0, i_no, 1.0, i_o3, 1.0, i_no2, 1.0, i_o2)
1474
1475!===========================================================
1476!      d003 : NO + HO2 -> NO2 + OH
1477!===========================================================
1478
1479nb_reaction_4 = nb_reaction_4 + 1
1480
1481indice_4(nb_reaction_4) = z4spec(1.0, i_no, 1.0, i_ho2, 1.0, i_no2, 1.0, i_oh)
1482
1483!===========================================================
1484!      d004 : N + NO -> N2 + O
1485!===========================================================
1486
1487nb_reaction_4 = nb_reaction_4 + 1
1488
1489indice_4(nb_reaction_4) = z4spec(1.0, i_n, 1.0, i_no, 1.0, i_n2, 1.0, i_o)
1490
1491!===========================================================
1492!      d005 : N + O2 -> NO + O
1493!===========================================================
1494
1495nb_reaction_4 = nb_reaction_4 + 1
1496
1497indice_4(nb_reaction_4) = z4spec(1.0, i_n, 1.0, i_o2, 1.0, i_no, 1.0, i_o)
1498
1499!===========================================================
1500!      d006 : NO2 + H -> NO + OH
1501!===========================================================
1502
1503nb_reaction_4 = nb_reaction_4 + 1
1504
1505indice_4(nb_reaction_4) = z4spec(1.0, i_no2, 1.0, i_h, 1.0, i_no, 1.0, i_oh)
1506
1507!===========================================================
1508!      d007 : N + O -> NO
1509!===========================================================
1510
1511nb_reaction_4 = nb_reaction_4 + 1
1512
1513indice_4(nb_reaction_4) = z4spec(1.0, i_n, 1.0, i_o, 1.0, i_no, 0.0, i_dummy)
1514
1515!===========================================================
1516!      d008 : N + HO2 -> NO + OH
1517!===========================================================
1518
1519nb_reaction_4 = nb_reaction_4 + 1
1520
1521indice_4(nb_reaction_4) = z4spec(1.0, i_n, 1.0, i_ho2, 1.0, i_no, 1.0, i_oh)
1522
1523!===========================================================
1524!      d009 : N + OH -> NO + H
1525!===========================================================
1526
1527nb_reaction_4 = nb_reaction_4 + 1
1528
1529indice_4(nb_reaction_4) = z4spec(1.0, i_n, 1.0, i_oh, 1.0, i_no, 1.0, i_h)
1530
1531!===========================================================
1532!      e001 : CO + OH -> CO2 + H
1533!===========================================================
1534
1535nb_reaction_4 = nb_reaction_4 + 1
1536
1537indice_4(nb_reaction_4) = z4spec(1.0, i_co, 1.0, i_oh, 1.0, i_co2, 1.0, i_h)
1538
1539!===========================================================
1540!      e002 : CO + O + M -> CO2 + M
1541!===========================================================
1542
1543nb_reaction_4 = nb_reaction_4 + 1
1544
1545indice_4(nb_reaction_4) = z4spec(1.0, i_co, 1.0, i_o, 1.0, i_co2, 0.0, i_dummy)
1546
1547!===========================================================
1548!      h001: HO2 + ice -> products
1549!            treated as
1550!            HO2 -> 0.5 H2O + 0.75 O2
1551!===========================================================
1552
1553nb_phot = nb_phot + 1
1554
1555indice_phot(nb_phot) = z3spec(1.0, i_ho2, 0.5, i_h2o, 0.75, i_o2)
1556
1557!===========================================================
1558!      h002: OH + ice -> products
1559!            treated as
1560!            OH -> 0.5 H2O + 0.25 O2
1561!===========================================================
1562
1563nb_phot = nb_phot + 1
1564
1565indice_phot(nb_phot) = z3spec(1.0, i_oh, 0.5, i_h2o, 0.25, i_o2)
1566
1567!===========================================================
1568!      h003: H2O2 + ice -> products
1569!            treated as
1570!            H2O2 -> H2O + 0.5 O2
1571!===========================================================
1572
1573nb_phot = nb_phot + 1
1574
1575indice_phot(nb_phot) = z3spec(1.0, i_h2o2, 1.0, i_h2o, 0.5, i_o2)
1576
1577!===========================================================
1578!      h004: HO2 + dust -> products
1579!            treated as
1580!            HO2 -> 0.5 H2O + 0.75 O2
1581!===========================================================
1582
1583nb_phot = nb_phot + 1
1584
1585indice_phot(nb_phot) = z3spec(1.0, i_ho2, 0.5, i_h2o, 0.75, i_o2)
1586
1587!===========================================================
1588!      h005: H2O2 + dust -> products
1589!            treated as
1590!            H2O2 -> H2O + 0.5 O2
1591!===========================================================
1592
1593nb_phot = nb_phot + 1
1594
1595indice_phot(nb_phot) = z3spec(1.0, i_h2o2, 1.0, i_h2o, 0.5, i_o2)
1596
1597!===========================================================
1598!  check dimensions
1599!===========================================================
1600
1601print*, 'nb_phot       = ', nb_phot
1602print*, 'nb_reaction_4 = ', nb_reaction_4
1603print*, 'nb_reaction_3 = ', nb_reaction_3
1604
1605if ((nb_phot /= nb_phot_max)             .or.  &
1606    (nb_reaction_3 /= nb_reaction_3_max) .or.  &
1607    (nb_reaction_4 /= nb_reaction_4_max)) then
1608   print*, 'wrong dimensions in indice'
1609   stop
1610end if 
1611
[1499]1612end subroutine indice
[1495]1613
1614!*****************************************************************
1615
1616      subroutine gcmtochim(nlayer, nq, zycol, lswitch, nesp,         &
1617                           i_co2, i_co, i_o, i_o1d, i_o2, i_o3, i_h, &
1618                           i_h2, i_oh, i_ho2, i_h2o2, i_h2o,         &
1619                           i_n, i_n2d, i_no, i_no2, i_n2,            &
1620                           dens, rm, c)
1621
1622!*****************************************************************
1623
1624      use tracer_mod, only: igcm_co2, igcm_co, igcm_o, igcm_o1d,         &
1625     &                      igcm_o2, igcm_o3, igcm_h, igcm_h2, igcm_oh,  &
1626     &                      igcm_ho2, igcm_h2o2, igcm_h2o_vap,           &
1627     &                      igcm_n, igcm_n2d, igcm_no, igcm_no2, igcm_n2
1628
1629      implicit none
1630
1631#include "callkeys.h"
1632
1633!ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
1634!     input:
1635!ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
1636     
1637      integer, intent(in) :: nlayer ! number of atmospheric layers
1638      integer, intent(in) :: nq     ! number of tracers in the gcm
1639      integer :: nesp               ! number of species in the chemistry
1640      integer :: lswitch            ! interface level between chemistries
1641
1642      integer :: i_co2, i_co, i_o, i_o1d, i_o2, i_o3, i_h,           &
1643                 i_h2, i_oh, i_ho2, i_h2o2, i_h2o,                   &
1644                 i_n, i_n2d, i_no, i_no2, i_n2
1645
1646      real :: zycol(nlayer,nq)      ! volume mixing ratios in the gcm
1647      real :: dens(nlayer)          ! total number density (molecule.cm-3)
1648
1649!ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
1650!     output:
1651!ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
1652
1653      real, dimension(nlayer,nesp)            :: rm ! volume mixing ratios
1654      real (kind = 8), dimension(nlayer,nesp) :: c  ! number densities (molecule.cm-3)
1655     
1656!ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
1657!     local:
1658!ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
1659
1660      integer      :: l, iesp
1661      logical,save :: firstcall = .true.
1662     
1663     
1664!     first call initializations
1665
1666      if (firstcall) then
1667
1668!       identify the indexes of the tracers we need
1669
1670         if (igcm_co2 == 0) then
1671            write(*,*) "gcmtochim: Error; no CO2 tracer !!!"
1672            stop
1673         endif
1674         if (igcm_co == 0) then
1675            write(*,*) "gcmtochim: Error; no CO tracer !!!"
1676            stop
1677         end if
1678         if (igcm_o == 0) then
1679            write(*,*) "gcmtochim: Error; no O tracer !!!"
1680            stop
1681         end if
1682         if (igcm_o1d == 0) then
1683            write(*,*) "gcmtochim: Error; no O1D tracer !!!"
1684            stop
1685         end if
1686         if (igcm_o2 == 0) then
1687            write(*,*) "gcmtochim: Error; no O2 tracer !!!"
1688            stop
1689         end if
1690         if (igcm_o3 == 0) then
1691            write(*,*) "gcmtochim: Error; no O3 tracer !!!"
1692            stop
1693         end if
1694         if (igcm_h == 0) then
1695            write(*,*) "gcmtochim: Error; no H tracer !!!"
1696            stop
1697         end if
1698         if (igcm_h2 == 0) then
1699            write(*,*) "gcmtochim: Error; no H2 tracer !!!"
1700            stop
1701         end if
1702         if (igcm_oh == 0) then
1703            write(*,*) "gcmtochim: Error; no OH tracer !!!"
1704            stop
1705         end if
1706         if (igcm_ho2 == 0) then
1707            write(*,*) "gcmtochim: Error; no HO2 tracer !!!"
1708            stop
1709         end if
1710         if (igcm_h2o2 == 0) then
1711            write(*,*) "gcmtochim: Error; no H2O2 tracer !!!"
1712            stop
1713         end if
1714         if (igcm_n == 0) then
1715            write(*,*) "gcmtochim: Error; no N tracer !!!"
1716            stop
1717         end if
1718         if (igcm_n2d == 0) then
1719            write(*,*) "gcmtochim: Error; no N2D tracer !!!"
1720            stop
1721         end if
1722         if (igcm_no == 0) then
1723            write(*,*) "gcmtochim: Error; no NO tracer !!!"
1724            stop
1725         end if
1726         if (igcm_no2 == 0) then
1727            write(*,*) "gcmtochim: Error; no NO2 tracer !!!"
1728            stop
1729         end if
1730         if (igcm_n2 == 0) then
1731            write(*,*) "gcmtochim: Error; no N2 tracer !!!"
1732            stop
1733         end if
1734         if (igcm_h2o_vap == 0) then
1735            write(*,*) "gcmtochim: Error; no water vapor tracer !!!"
1736            stop
1737         end if
1738         firstcall = .false.
1739      end if ! of if (firstcall)
1740
1741!ccccccccccccccccccccccccccccccccccccccccccccccccccccccc
1742!     initialise mixing ratios
1743!ccccccccccccccccccccccccccccccccccccccccccccccccccccccc
1744
1745      do l = 1,lswitch-1
1746         rm(l,i_co2)  = zycol(l, igcm_co2)
1747         rm(l,i_co)   = zycol(l, igcm_co)
1748         rm(l,i_o)    = zycol(l, igcm_o)
1749         rm(l,i_o1d)  = zycol(l, igcm_o1d)
1750         rm(l,i_o2)   = zycol(l, igcm_o2)
1751         rm(l,i_o3)   = zycol(l, igcm_o3)
1752         rm(l,i_h)    = zycol(l, igcm_h)
1753         rm(l,i_h2)   = zycol(l, igcm_h2)
1754         rm(l,i_oh)   = zycol(l, igcm_oh)
1755         rm(l,i_ho2)  = zycol(l, igcm_ho2)
1756         rm(l,i_h2o2) = zycol(l, igcm_h2o2)
1757         rm(l,i_h2o)  = zycol(l, igcm_h2o_vap)
1758         rm(l,i_n)    = zycol(l, igcm_n)
1759         rm(l,i_n2d)  = zycol(l, igcm_n2d)
1760         rm(l,i_no)   = zycol(l, igcm_no)
1761         rm(l,i_no2)  = zycol(l, igcm_no2)
1762         rm(l,i_n2)   = zycol(l, igcm_n2)
1763      end do
1764
1765      where (rm(:,:) < 1.e-30)
1766         rm(:,:) = 0.
1767      end where
1768
1769!ccccccccccccccccccccccccccccccccccccccccccccccccccccccc
1770!     initialise number densities
1771!ccccccccccccccccccccccccccccccccccccccccccccccccccccccc
1772
1773      do iesp = 1,nesp
1774         do l = 1,lswitch-1
1775            c(l,iesp) = rm(l,iesp)*dens(l)
1776         end do
1777      end do
1778
[1499]1779      end subroutine gcmtochim
[1495]1780
1781!*****************************************************************
1782 
1783      subroutine chimtogcm(nlayer, nq, zycol, lswitch, nesp,         &
1784                           i_co2, i_co, i_o, i_o1d, i_o2, i_o3, i_h, &
1785                           i_h2, i_oh, i_ho2, i_h2o2, i_h2o,         &
1786                           i_n, i_n2d, i_no, i_no2, i_n2, dens, c)
1787 
1788!*****************************************************************
1789 
1790      use tracer_mod, only: igcm_co2, igcm_co, igcm_o, igcm_o1d,          &
1791                            igcm_o2, igcm_o3, igcm_h, igcm_h2, igcm_oh,   &
1792                            igcm_ho2, igcm_h2o2, igcm_h2o_vap,            &
1793                            igcm_n, igcm_n2d, igcm_no, igcm_no2, igcm_n2
1794
1795      implicit none
1796
1797#include "callkeys.h"
1798
1799!ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
1800!     inputs:
1801!ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
1802 
1803      integer, intent(in) :: nlayer  ! number of atmospheric layers
1804      integer, intent(in) :: nq      ! number of tracers in the gcm
1805      integer :: nesp                ! number of species in the chemistry
1806      integer :: lswitch             ! interface level between chemistries
1807      integer :: i_co2, i_co, i_o, i_o1d, i_o2, i_o3, i_h,       &
1808                 i_h2, i_oh, i_ho2, i_h2o2, i_h2o,               &
1809                 i_n, i_n2d, i_no, i_no2, i_n2
1810
1811      real :: dens(nlayer)     ! total number density (molecule.cm-3)
1812      real (kind = 8), dimension(nlayer,nesp) :: c  ! number densities (molecule.cm-3)
1813
1814!ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
1815!     output:
1816!ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
1817       
1818      real zycol(nlayer,nq)  ! volume mixing ratios in the gcm
1819
1820!ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
1821!     local:
1822!ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
1823
1824      integer l
1825     
1826!ccccccccccccccccccccccccccccccccccccccccccccccccccccccc
1827!     save mixing ratios for the gcm
1828!ccccccccccccccccccccccccccccccccccccccccccccccccccccccc
1829
1830      do l = 1,lswitch-1
1831         zycol(l, igcm_co2)     = c(l,i_co2)/dens(l)
1832         zycol(l, igcm_co)      = c(l,i_co)/dens(l)
1833         zycol(l, igcm_o)       = c(l,i_o)/dens(l)
1834         zycol(l, igcm_o1d)     = c(l,i_o1d)/dens(l)
1835         zycol(l, igcm_o2)      = c(l,i_o2)/dens(l)
1836         zycol(l, igcm_o3)      = c(l,i_o3)/dens(l)
1837         zycol(l, igcm_h)       = c(l,i_h)/dens(l) 
1838         zycol(l, igcm_h2)      = c(l,i_h2)/dens(l)
1839         zycol(l, igcm_oh)      = c(l,i_oh)/dens(l)
1840         zycol(l, igcm_ho2)     = c(l,i_ho2)/dens(l)
1841         zycol(l, igcm_h2o2)    = c(l,i_h2o2)/dens(l)
1842         zycol(l, igcm_h2o_vap) = c(l,i_h2o)/dens(l)
1843         zycol(l, igcm_n)       = c(l,i_n)/dens(l)
1844         zycol(l, igcm_n2d)     = c(l,i_n2d)/dens(l)
1845         zycol(l, igcm_no)      = c(l,i_no)/dens(l)
1846         zycol(l, igcm_no2)     = c(l,i_no2)/dens(l)
1847         zycol(l, igcm_n2)      = c(l,i_n2)/dens(l)
1848      end do
1849
[1499]1850      end subroutine chimtogcm
1851
1852end subroutine photochemistry_asis
1853
Note: See TracBrowser for help on using the repository browser.