source: trunk/LMDZ.MARS/libf/aeronomars/read_phototable.F90 @ 2325

Last change on this file since 2325 was 2311, checked in by emillour, 5 years ago

Mars GCM:
Code tidying: use getin_p() instead of getin() and use "call abort_physic"
instead of "stop" or "call abort".
EM

File size: 2.9 KB
Line 
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
15!
16!   Arguments:
17!   ----------
18!
19!   The output variable is jphot and is put in common chimiedata.
20!
21!***********************************************************************
22
23      use ioipsl_getin_p_mod, only: getin_p
24      use datafile_mod, only: datadir
25
26      implicit none
27
28      include "chimiedata.h"
29
30!ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
31!     local:
32!ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
33
34      integer :: fic, ij, iozo, isza, itemp, iz, itau, ierr
35      real    :: xsza
36
37      character(len = 128) :: phototable ! photolysis table file name
38
39!ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
40! set photolysis table input file name
41!ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
42
43      phototable = "jmars.20140930" ! default
44
45! look for a " phototable= ..." option in def files
46
47      call getin_p("phototable",phototable)
48
49      fic = 81
50
51      open(fic, form = 'formatted', status = 'old',                &
52           file =trim(datadir)//"/"//trim(phototable),iostat=ierr)
53
54      if (ierr /= 0) THEN
55        write(*,*)'Error : cannot open photolysis lookup table ', trim(phototable)
56        write(*,*)'It should be in :',trim(datadir),'/'
57        write(*,*)'1) You can change this directory in callphys.def'
58        write(*,*)'   with:'
59        write(*,*)'   datadir=/path/to/the/directory'
60        write(*,*)'2) You can change the input phototable file name in'
61        write(*,*)'   callphys.def with:'
62        write(*,*)'   phototable=filename'
63        call abort_physic("read_phototable","missing "//trim(phototable)//"file",1)
64      end if
65
66!ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
67! read photolys table
68!ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
69
70      print*, 'read photolysis lookup table ',trim(phototable)
71
72      do itau = 1,ntau
73         do itemp = 1,ntemp
74            do iozo = 1,nozo
75               do isza = 1,nsza
76                  do iz = nz,1,-1
77                     read(fic,*) colairtab(iz), xsza, table_ozo(iozo)
78                     read(fic,'(7e11.4)') (jphot(itemp,isza,iz,iozo,itau,ij), ij= 1,nd)
79                     do ij = 1,nd
80                        if (jphot(itemp,isza,iz,iozo,itau,ij) == 1.e-30) then
81                           jphot(itemp,isza,iz,iozo,itau,ij) = 0.
82                        end if
83                     end do
84                  end do
85               end do
86            end do
87         end do
88      end do
89
90      print*, 'lookup table...ok'
91      close(fic)
92
93      return
94      end
Note: See TracBrowser for help on using the repository browser.