source: trunk/LMDZ.GENERIC/libf/aeronostd/read_phototable.F90 @ 2537

Last change on this file since 2537 was 1796, checked in by bclmd, 7 years ago

Adding photochemistry to LMDZ Generic

  • Property svn:executable set to *
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_getincom
24      use ioipsl_getin_p_mod, only: getin_p
25      use datafile_mod
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
44
45! look for a " phototable= ..." option in def files
46     write(*,*) "Directory where external input files are:"
47      phototable = "jmars.20140930" ! default
48     call getin_p("phototable",phototable) ! default path
49     write(*,*) " phototable = ",trim(phototable)
50
51
52      fic = 81
53
54      open(fic, form = 'formatted', status = 'old',                &
55           file =trim(datadir)//"/"//trim(phototable),iostat=ierr)
56
57      if (ierr /= 0) THEN
58        write(*,*)'Error : cannot open photolysis lookup table ', trim(phototable)
59        write(*,*)'It should be in :',trim(datadir),'/'
60        write(*,*)'1) You can change this directory in callphys.def'
61        write(*,*)'   with:'
62        write(*,*)'   datadir=/path/to/the/directory'
63        write(*,*)'2) You can change the input phototable file name in'
64        write(*,*)'   callphys.def with:'
65        write(*,*)'   phototable=filename'
66        stop
67      end if
68
69!ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
70! read photolys table
71!ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
72
73      print*, 'read photolysis lookup table ',trim(phototable)
74
75      do itau = 1,ntau
76         do itemp = 1,ntemp
77            do iozo = 1,nozo
78               do isza = 1,nsza
79                  do iz = nz,1,-1
80                     read(fic,*) colairtab(iz), xsza, table_ozo(iozo)
81                     read(fic,'(7e11.4)') (jphot(itemp,isza,iz,iozo,itau,ij), ij= 1,nd)
82                     do ij = 1,nd
83                        if (jphot(itemp,isza,iz,iozo,itau,ij) == 1.e-30) then
84                           jphot(itemp,isza,iz,iozo,itau,ij) = 0.
85                        end if
86                     end do
87                  end do
88               end do
89            end do
90         end do
91      end do
92
93      print*, 'lookup table...ok'
94      close(fic)
95
96      return
97      end
Note: See TracBrowser for help on using the repository browser.