source: trunk/LMDZ.MARS/libf/aeronomars/hrtherm.F @ 1621

Last change on this file since 1621 was 1266, checked in by aslmd, 11 years ago

LMDZ.MARS
IMPORTANT CHANGE

  • Remove all reference/use of nlayermx and dimphys.h
  • Made use of automatic arrays whenever arrays are needed with dimension nlayer
  • Remove lots of obsolete reference to dimensions.h
  • Converted iono.h and param_v4.h into corresponding modules

(with embedded subroutine to allocate arrays)
(no arrays allocated if thermosphere not used)

  • Deleted param.h and put contents into module param_v4_h
  • Adapted testphys1d, newstart, etc...
  • Made DATA arrays in param_read to be initialized by subroutine

fill_data_thermos in module param_v4_h

  • Optimized computations in paramfoto_compact (twice less dlog10 calculations)
  • Checked consistency before/after modification in debug mode
  • Checked performance is not impacted (same as before)
File size: 3.5 KB
RevLine 
[38]1c**********************************************************************
2
[1266]3      subroutine hrtherm(ig,nlayer,
4     .      euvmod,rm,nespeuv,tx,iz,zenit,zday,jtot)
[38]5
6
7c     feb 2002        fgg           first version
8c     nov 2002        fgg           second version
9
10c**********************************************************************
11
[1266]12      use param_v4_h, only: ninter,nabs,jfotsout,fluxtop,freccen
13
[38]14      implicit none
15
16c     common variables and constants
[705]17      include "callkeys.h"
[38]18
19
20c    local parameters and variables
21
[1266]22      real       xabsi(nabs,nlayer)                     !densities
23      real       jergs(ninter,nabs,nlayer)
[38]24     
25      integer    i,j,k,indexint          !indexes
26      character  dn
27
28
29c     input and output variables
30
[1266]31      integer    ig  ,euvmod,nlayer
[635]32      integer    nespeuv
[1266]33      real       rm(nlayer,nespeuv)              !density matrix (cm^-3)
34      real       jtot(nlayer)                    !output: heating rate(erg/s)
35      real       tx(nlayer)                      !temperature
[38]36      real       zenit
[1266]37      real       iz(nlayer)
[705]38      real       zday
[38]39
[635]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
[38]56
57c*************************PROGRAM STARTS*******************************
58
[635]59      !If nighttime, photoabsorption coefficient set to 0
60      if(zenit.gt.140.) then
[38]61         dn='n'
62         else
63         dn='d'
64      end if
65      if(dn.eq.'n') then
[1266]66        do i=1,nlayer                                   
[38]67              jtot(i)=0.
68        enddo       
69        return
70      endif
[635]71
72      !initializations
73      jergs(:,:,:)=0.
74      xabsi(:,:)=0.
75      jtot(:)=0.
76      !All number densities to a single array, xabsi(species,layer)
[1266]77      do i=1,nlayer
[635]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)
[38]97      end do
98
[635]99      !Calculation of photoabsortion coefficient
[705]100      if(solvarmod.eq.0) then
[1266]101         call jthermcalc(ig,nlayer,euvmod,rm,nespeuv,tx,iz,zenit)
[705]102      else if (solvarmod.eq.1) then
[1266]103         call jthermcalc_e107(ig,nlayer,euvmod,
104     .           rm,nespeuv,tx,iz,zenit,zday)
[705]105      endif
[38]106
[635]107      !Total photoabsorption coefficient
[1266]108      do i=1,nlayer
[635]109         jtot(i)=0.
[38]110        do j=1,nabs
[635]111          do indexint=1,ninter
[38]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
[1119]120
[38]121      return
122
123      end
124
Note: See TracBrowser for help on using the repository browser.