[1796] | 1 | !*********************************************************************** |
---|
| 2 | |
---|
| 3 | subroutine read_phototable |
---|
| 4 | |
---|
| 5 | !*********************************************************************** |
---|
| 6 | ! |
---|
| 7 | ! subject: |
---|
| 8 | ! -------- |
---|
| 9 | ! |
---|
| 10 | ! read photolysis lookup table |
---|
| 11 | ! |
---|
| 12 | ! VERSION: 8/10/2014 |
---|
| 13 | ! |
---|
| 14 | ! Author: Franck Lefevre |
---|
[2542] | 15 | ! update 06/03/2021 dimension set in table + CH4 dimension + photoheat (Yassin Jaziri) |
---|
[1796] | 16 | ! |
---|
| 17 | ! Arguments: |
---|
| 18 | ! ---------- |
---|
| 19 | ! |
---|
[2542] | 20 | ! The output variable is jphot/ephot and is put in common chimiedata. |
---|
[1796] | 21 | ! |
---|
| 22 | !*********************************************************************** |
---|
| 23 | |
---|
| 24 | use ioipsl_getincom |
---|
| 25 | use ioipsl_getin_p_mod, only: getin_p |
---|
| 26 | use datafile_mod |
---|
[2542] | 27 | use callkeys_mod |
---|
| 28 | use chimiedata_h |
---|
[1796] | 29 | implicit none |
---|
| 30 | |
---|
[2542] | 31 | !#include "chimiedata.h" |
---|
[1796] | 32 | |
---|
| 33 | !ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc |
---|
| 34 | ! local: |
---|
| 35 | !ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc |
---|
| 36 | |
---|
[2542] | 37 | integer :: fic, ij, iozo, isza, itemp, iz, itau, ich4, ierr |
---|
| 38 | real :: xsza, dummy |
---|
[1796] | 39 | |
---|
| 40 | character(len = 128) :: phototable ! photolysis table file name |
---|
[2542] | 41 | character(len = 128) :: ephototable ! energie photolysis table file name |
---|
[1796] | 42 | |
---|
| 43 | !ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc |
---|
| 44 | ! set photolysis table input file name |
---|
| 45 | !ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc |
---|
| 46 | |
---|
| 47 | |
---|
| 48 | |
---|
| 49 | ! look for a " phototable= ..." option in def files |
---|
| 50 | write(*,*) "Directory where external input files are:" |
---|
| 51 | phototable = "jmars.20140930" ! default |
---|
| 52 | call getin_p("phototable",phototable) ! default path |
---|
| 53 | write(*,*) " phototable = ",trim(phototable) |
---|
| 54 | |
---|
| 55 | |
---|
| 56 | fic = 81 |
---|
| 57 | |
---|
| 58 | open(fic, form = 'formatted', status = 'old', & |
---|
| 59 | file =trim(datadir)//"/"//trim(phototable),iostat=ierr) |
---|
| 60 | |
---|
| 61 | if (ierr /= 0) THEN |
---|
| 62 | write(*,*)'Error : cannot open photolysis lookup table ', trim(phototable) |
---|
| 63 | write(*,*)'It should be in :',trim(datadir),'/' |
---|
| 64 | write(*,*)'1) You can change this directory in callphys.def' |
---|
| 65 | write(*,*)' with:' |
---|
| 66 | write(*,*)' datadir=/path/to/the/directory' |
---|
| 67 | write(*,*)'2) You can change the input phototable file name in' |
---|
| 68 | write(*,*)' callphys.def with:' |
---|
| 69 | write(*,*)' phototable=filename' |
---|
| 70 | stop |
---|
| 71 | end if |
---|
| 72 | |
---|
| 73 | !ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc |
---|
| 74 | ! read photolys table |
---|
| 75 | !ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc |
---|
| 76 | |
---|
| 77 | print*, 'read photolysis lookup table ',trim(phototable) |
---|
| 78 | |
---|
[2542] | 79 | read(fic,*) nz, nsza, nozo, dummy, ntemp, ntau, nch4, nd |
---|
| 80 | |
---|
| 81 | allocate(jphot(ntemp,nsza,nz,nozo,ntau,nch4,nd)) |
---|
| 82 | allocate(ephot(ntemp,nsza,nz,nozo,ntau,nch4,nd)) |
---|
| 83 | allocate(colairtab(nz)) |
---|
| 84 | allocate(szatab(nsza)) |
---|
| 85 | allocate(table_ozo(nozo)) |
---|
| 86 | allocate(tautab(ntau)) |
---|
| 87 | allocate(table_ch4(nch4)) |
---|
| 88 | |
---|
[1796] | 89 | do itau = 1,ntau |
---|
| 90 | do itemp = 1,ntemp |
---|
| 91 | do iozo = 1,nozo |
---|
[2542] | 92 | do ich4 =1,nch4 |
---|
| 93 | do isza = 1,nsza |
---|
| 94 | do iz = nz,1,-1 |
---|
| 95 | read(fic,*) colairtab(iz), szatab(isza),table_ozo(iozo), dummy, dummy, dummy, table_ch4(ich4) |
---|
| 96 | read(fic,'(7e11.4)') (jphot(itemp,isza,iz,iozo,itau,ich4,ij), ij= 1,nd) |
---|
| 97 | do ij = 1,nd |
---|
| 98 | if (jphot(itemp,isza,iz,iozo,itau,ich4,ij) == 1.e-30) then |
---|
| 99 | jphot(itemp,isza,iz,iozo,itau,ich4,ij) = 0. |
---|
| 100 | end if |
---|
| 101 | end do |
---|
[1796] | 102 | end do |
---|
| 103 | end do |
---|
| 104 | end do |
---|
| 105 | end do |
---|
| 106 | end do |
---|
| 107 | end do |
---|
| 108 | |
---|
| 109 | print*, 'lookup table...ok' |
---|
| 110 | close(fic) |
---|
| 111 | |
---|
[2542] | 112 | if (photoheat) then |
---|
| 113 | !ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc |
---|
| 114 | ! set energie photolysis table input file name |
---|
| 115 | !ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc |
---|
| 116 | |
---|
| 117 | |
---|
| 118 | |
---|
| 119 | ! look for a " ephototable= ..." option in def files |
---|
| 120 | write(*,*) "Directory where external input files are:" |
---|
| 121 | ephototable = "zdtearth_N+_CO2_0.0004_O2_0.21_G11" ! default |
---|
| 122 | call getin_p("ephototable",ephototable) ! default path |
---|
| 123 | write(*,*) " ephototable = ",trim(ephototable) |
---|
| 124 | |
---|
| 125 | |
---|
| 126 | fic = 81 |
---|
| 127 | |
---|
| 128 | open(fic, form = 'formatted', status = 'old', & |
---|
| 129 | file =trim(datadir)//"/"//trim(ephototable),iostat=ierr) |
---|
| 130 | |
---|
| 131 | if (ierr /= 0) THEN |
---|
| 132 | write(*,*)'Error : cannot open energie photolysis lookup table ', trim(ephototable) |
---|
| 133 | write(*,*)'It should be in :',trim(datadir),'/' |
---|
| 134 | write(*,*)'1) You can change this directory in callphys.def' |
---|
| 135 | write(*,*)' with:' |
---|
| 136 | write(*,*)' datadir=/path/to/the/directory' |
---|
| 137 | write(*,*)'2) You can change the input ephototable file name in' |
---|
| 138 | write(*,*)' callphys.def with:' |
---|
| 139 | write(*,*)' ephototable=filename' |
---|
| 140 | stop |
---|
| 141 | end if |
---|
| 142 | |
---|
| 143 | !ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc |
---|
| 144 | ! read energie photolys table |
---|
| 145 | !ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc |
---|
| 146 | |
---|
| 147 | print*, 'read energie photolysis lookup table ',trim(ephototable) |
---|
| 148 | |
---|
| 149 | do itau = 1,ntau |
---|
| 150 | do itemp = 1,ntemp |
---|
| 151 | do iozo = 1,nozo |
---|
| 152 | do ich4 =1,nch4 |
---|
| 153 | do isza = 1,nsza |
---|
| 154 | do iz = nz,1,-1 |
---|
| 155 | read(fic,*) colairtab(iz), xsza,table_ozo(iozo), dummy, dummy, dummy, table_ch4(ich4) |
---|
| 156 | read(fic,'(7e11.4)') (ephot(itemp,isza,iz,iozo,itau,ich4,ij), ij= 1,nd) |
---|
| 157 | do ij = 1,nd |
---|
| 158 | if (ephot(itemp,isza,iz,iozo,itau,ich4,ij) == 1.e-30) then |
---|
| 159 | ephot(itemp,isza,iz,iozo,itau,ich4,ij) = 0. |
---|
| 160 | end if |
---|
| 161 | end do |
---|
| 162 | end do |
---|
| 163 | end do |
---|
| 164 | end do |
---|
| 165 | end do |
---|
| 166 | end do |
---|
| 167 | end do |
---|
| 168 | |
---|
| 169 | print*, 'lookup etable...ok' |
---|
| 170 | close(fic) |
---|
| 171 | end if |
---|
| 172 | |
---|
[1796] | 173 | return |
---|
| 174 | end |
---|