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_o2=2 |
---|
45 | integer,parameter :: i_o=3 |
---|
46 | integer,parameter :: i_co=4 |
---|
47 | integer,parameter :: i_h=5 |
---|
48 | integer,parameter :: i_h2=8 |
---|
49 | integer,parameter :: i_h2o=9 |
---|
50 | integer,parameter :: i_h2o2=10 |
---|
51 | integer,parameter :: i_o3=12 |
---|
52 | integer,parameter :: i_n2=13 |
---|
53 | integer,parameter :: i_n=14 |
---|
54 | integer,parameter :: i_no=15 |
---|
55 | integer,parameter :: i_no2=17 |
---|
56 | |
---|
57 | c*************************PROGRAM STARTS******************************* |
---|
58 | |
---|
59 | !If nighttime, photoabsorption coefficient set to 0 |
---|
60 | if(zenit.gt.140.) then |
---|
61 | dn='n' |
---|
62 | else |
---|
63 | dn='d' |
---|
64 | end if |
---|
65 | if(dn.eq.'n') then |
---|
66 | do i=1,nlayer |
---|
67 | jtot(i)=0. |
---|
68 | enddo |
---|
69 | return |
---|
70 | endif |
---|
71 | |
---|
72 | !initializations |
---|
73 | jergs(:,:,:)=0. |
---|
74 | xabsi(:,:)=0. |
---|
75 | jtot(:)=0. |
---|
76 | !All number densities to a single array, xabsi(species,layer) |
---|
77 | do i=1,nlayer |
---|
78 | xabsi(1,i) = rm(i,i_co2) |
---|
79 | xabsi(2,i) = rm(i,i_o2) |
---|
80 | xabsi(3,i) = rm(i,i_o) |
---|
81 | xabsi(4,i) = rm(i,i_h2o) |
---|
82 | xabsi(5,i) = rm(i,i_h2) |
---|
83 | xabsi(6,i) = rm(i,i_h2o2) |
---|
84 | !Only if O3, N or ion chemistry requested |
---|
85 | if(euvmod.ge.1) then |
---|
86 | xabsi(7,i) = rm(i,i_o3) |
---|
87 | endif |
---|
88 | !Only if N or ion chemistry requested |
---|
89 | if(euvmod.ge.2) then |
---|
90 | xabsi(8,i) = rm(i,i_n2) |
---|
91 | xabsi(9,i) = rm(i,i_n) |
---|
92 | xabsi(10,i) = rm(i,i_no) |
---|
93 | xabsi(13,i) = rm(i,i_no2) |
---|
94 | endif |
---|
95 | xabsi(11,i) = rm(i,i_co) |
---|
96 | xabsi(12,i) = rm(i,i_h) |
---|
97 | end do |
---|
98 | |
---|
99 | !Calculation of photoabsortion coefficient |
---|
100 | if(solvarmod.eq.0) then |
---|
101 | call jthermcalc(ig,nlayer,euvmod,rm,nespeuv,tx,iz,zenit) |
---|
102 | else if (solvarmod.eq.1) then |
---|
103 | call jthermcalc_e107(ig,nlayer,euvmod, |
---|
104 | . rm,nespeuv,tx,iz,zenit,zday) |
---|
105 | endif |
---|
106 | |
---|
107 | !Total photoabsorption coefficient |
---|
108 | do i=1,nlayer |
---|
109 | jtot(i)=0. |
---|
110 | do j=1,nabs |
---|
111 | do indexint=1,ninter |
---|
112 | jergs(indexint,j,i) = jfotsout(indexint,j,i) |
---|
113 | $ * xabsi (j,i) * fluxtop(indexint) |
---|
114 | $ / (0.5e9 * freccen(indexint)) |
---|
115 | jtot(i)=jtot(i)+jergs(indexint,j,i) |
---|
116 | end do |
---|
117 | end do |
---|
118 | end do |
---|
119 | |
---|
120 | |
---|
121 | return |
---|
122 | |
---|
123 | end |
---|
124 | |
---|