1 | c********************************************************************** |
---|
2 | |
---|
3 | subroutine hrtherm(ig,nlayer, |
---|
4 | . euvmod,rm,nespeuv,tx,iz,zenit,zday,jtot) |
---|
5 | |
---|
6 | |
---|
7 | c feb 2002 fgg first version |
---|
8 | c nov 2002 fgg second version |
---|
9 | |
---|
10 | c********************************************************************** |
---|
11 | |
---|
12 | use param_v4_h, only: ninter,nabs,jfotsout,fluxtop,freccen |
---|
13 | |
---|
14 | implicit none |
---|
15 | |
---|
16 | c common variables and constants |
---|
17 | include "callkeys.h" |
---|
18 | |
---|
19 | |
---|
20 | c local parameters and variables |
---|
21 | |
---|
22 | real xabsi(nabs,nlayer) !densities |
---|
23 | real jergs(ninter,nabs,nlayer) |
---|
24 | |
---|
25 | integer i,j,k,indexint !indexes |
---|
26 | character dn |
---|
27 | |
---|
28 | |
---|
29 | c input and output variables |
---|
30 | |
---|
31 | integer ig ,euvmod,nlayer |
---|
32 | integer nespeuv |
---|
33 | real rm(nlayer,nespeuv) !density matrix (cm^-3) |
---|
34 | real jtot(nlayer) !output: heating rate(erg/s) |
---|
35 | real tx(nlayer) !temperature |
---|
36 | real zenit |
---|
37 | real iz(nlayer) |
---|
38 | real zday |
---|
39 | |
---|
40 | ! tracer indexes for the EUV heating: |
---|
41 | !!! ATTENTION. These values have to be identical to those in chemthermos.F90 |
---|
42 | !!! If the values are changed there, the same has to be done here !!! |
---|
43 | integer,parameter :: i_co2 = 1 |
---|
44 | integer,parameter :: i_co = 2 |
---|
45 | integer,parameter :: i_o = 3 |
---|
46 | integer,parameter :: i_o1d = 4 |
---|
47 | integer,parameter :: i_o2 = 5 |
---|
48 | integer,parameter :: i_o3 = 6 |
---|
49 | integer,parameter :: i_h = 7 |
---|
50 | integer,parameter :: i_h2 = 8 |
---|
51 | integer,parameter :: i_oh = 9 |
---|
52 | integer,parameter :: i_ho2 = 10 |
---|
53 | integer,parameter :: i_h2o2 = 11 |
---|
54 | integer,parameter :: i_h2o = 12 |
---|
55 | integer,parameter :: i_n = 13 |
---|
56 | integer,parameter :: i_n2d = 14 |
---|
57 | integer,parameter :: i_no = 15 |
---|
58 | integer,parameter :: i_no2 = 16 |
---|
59 | integer,parameter :: i_n2 = 17 |
---|
60 | ! integer,parameter :: i_co2=1 |
---|
61 | ! integer,parameter :: i_o2=2 |
---|
62 | ! integer,parameter :: i_o=3 |
---|
63 | ! integer,parameter :: i_co=4 |
---|
64 | ! integer,parameter :: i_h=5 |
---|
65 | ! integer,parameter :: i_h2=8 |
---|
66 | ! integer,parameter :: i_h2o=9 |
---|
67 | ! integer,parameter :: i_h2o2=10 |
---|
68 | ! integer,parameter :: i_o3=12 |
---|
69 | ! integer,parameter :: i_n2=13 |
---|
70 | ! integer,parameter :: i_n=14 |
---|
71 | ! integer,parameter :: i_no=15 |
---|
72 | ! integer,parameter :: i_no2=17 |
---|
73 | |
---|
74 | c*************************PROGRAM STARTS******************************* |
---|
75 | |
---|
76 | !If nighttime, photoabsorption coefficient set to 0 |
---|
77 | if(zenit.gt.140.) then |
---|
78 | dn='n' |
---|
79 | else |
---|
80 | dn='d' |
---|
81 | end if |
---|
82 | if(dn.eq.'n') then |
---|
83 | do i=1,nlayer |
---|
84 | jtot(i)=0. |
---|
85 | enddo |
---|
86 | return |
---|
87 | endif |
---|
88 | |
---|
89 | !initializations |
---|
90 | jergs(:,:,:)=0. |
---|
91 | xabsi(:,:)=0. |
---|
92 | jtot(:)=0. |
---|
93 | !All number densities to a single array, xabsi(species,layer) |
---|
94 | do i=1,nlayer |
---|
95 | xabsi(1,i) = rm(i,i_co2) |
---|
96 | xabsi(2,i) = rm(i,i_o2) |
---|
97 | xabsi(3,i) = rm(i,i_o) |
---|
98 | xabsi(4,i) = rm(i,i_h2o) |
---|
99 | xabsi(5,i) = rm(i,i_h2) |
---|
100 | xabsi(6,i) = rm(i,i_h2o2) |
---|
101 | !Only if O3, N or ion chemistry requested |
---|
102 | if(euvmod.ge.1) then |
---|
103 | xabsi(7,i) = rm(i,i_o3) |
---|
104 | endif |
---|
105 | !Only if N or ion chemistry requested |
---|
106 | if(euvmod.ge.2) then |
---|
107 | xabsi(8,i) = rm(i,i_n2) |
---|
108 | xabsi(9,i) = rm(i,i_n) |
---|
109 | xabsi(10,i) = rm(i,i_no) |
---|
110 | xabsi(13,i) = rm(i,i_no2) |
---|
111 | endif |
---|
112 | xabsi(11,i) = rm(i,i_co) |
---|
113 | xabsi(12,i) = rm(i,i_h) |
---|
114 | end do |
---|
115 | |
---|
116 | !Calculation of photoabsortion coefficient |
---|
117 | call jthermcalc_e107(ig,nlayer,euvmod, |
---|
118 | . rm,nespeuv,tx,iz,zenit,zday) |
---|
119 | |
---|
120 | !Total photoabsorption coefficient |
---|
121 | do i=1,nlayer |
---|
122 | jtot(i)=0. |
---|
123 | do j=1,nabs |
---|
124 | do indexint=1,ninter |
---|
125 | jergs(indexint,j,i) = jfotsout(indexint,j,i) |
---|
126 | $ * xabsi (j,i) * fluxtop(indexint) |
---|
127 | $ / (0.5e9 * freccen(indexint)) |
---|
128 | jtot(i)=jtot(i)+jergs(indexint,j,i) |
---|
129 | end do |
---|
130 | end do |
---|
131 | end do |
---|
132 | |
---|
133 | end |
---|
134 | |
---|