source: trunk/LMDZ.TITAN/libf/phytitan/su_gases.F90 @ 1647

Last change on this file since 1647 was 1647, checked in by jvatant, 8 years ago

+ Major clean of the new LMDZ.TITAN from too-generic options and routines (water, co2, ocean, surface type ...)
+ From this revision LMDZ.TITAN begins to be really separated from LMDZ.GENERIC
+ Partial desactivation of aerosols, only the dummy case is still enabled to keep the code running ( new aerosol routines to come in followings commits )

JVO

  • Property svn:executable set to *
File size: 3.0 KB
Line 
1subroutine su_gases
2
3  use gases_h
4
5  implicit none
6
7  integer igas, ierr, count
8
9  !==================================================================
10  !     
11  !     Purpose
12  !     -------
13  !     Load atmospheric composition info
14  !     
15  !     Authors
16  !     -------
17  !     R. Wordsworth (2011)
18  !     Allocatable arrays by A. Spiga (2011)
19  !     
20  !==================================================================
21
22!$OMP MASTER
23  ! load gas names from file 'gases.def'
24  open(90,file='gases.def',status='old',form='formatted',iostat=ierr)
25  if (ierr.eq.0) then
26     write(*,*) "sugases.F90: reading file gases.def"
27     read(90,*)
28     read(90,*,iostat=ierr) ngasmx
29     if (ierr.ne.0) then
30        write(*,*) "sugases.F90: error reading number of gases"
31        write(*,*) "   (first line of gases.def) "
32        call abort
33     endif
34
35     print*,ngasmx, " gases found in gases.def. Allocating names and molar fractions..."
36
37     if (.not.allocated(gnom)) allocate(gnom(ngasmx))
38     do igas=1,ngasmx
39        read(90,*,iostat=ierr) gnom(igas)
40        if (ierr.ne.0) then
41           write(*,*) 'sugases.F90: error reading gas names in gases.def...'
42           call abort
43        endif
44     enddo                  !of do igas=1,ngasmx
45
46     vgas=0
47     if(.not.allocated(gfrac)) allocate(gfrac(ngasmx))
48     do igas=1,ngasmx
49        read(90,*,iostat=ierr) gfrac(igas)
50        if (ierr.ne.0) then
51           write(*,*) 'sugases.F90: error reading gas molar fractions in gases.def...'
52           call abort
53        endif
54
55        ! find variable gas (if any)
56        if(gfrac(igas).eq.-1.0)then
57           if(vgas.eq.0)then
58              vgas=igas
59           else
60              print*,'You seem to be choosing two variable gases'
61              print*,'Check that gases.def is correct'
62              call abort
63           endif
64        endif
65
66     enddo                  !of do igas=1,ngasmx
67
68
69     ! assign the 'igas_X' labels
70     count=0
71     do igas=1,ngasmx
72        if (trim(gnom(igas)).eq."H2_" .or. trim(gnom(igas)).eq."H2") then
73           igas_H2=igas
74           count=count+1
75        elseif (trim(gnom(igas)).eq."N2_" .or. trim(gnom(igas)).eq."N2") then
76           igas_N2=igas
77           count=count+1
78        elseif (trim(gnom(igas)).eq."CH4") then
79           igas_CH4=igas
80           count=count+1
81        elseif (trim(gnom(igas)).eq."C2H6") then
82           igas_C2H6=igas
83           count=count+1
84        elseif (trim(gnom(igas)).eq."C2H2") then
85           igas_C2H2=igas
86           count=count+1
87        endif
88     enddo
89
90     if(count.ne.ngasmx)then
91        print*,'Mismatch between ngas and number of recognised gases in sugas_corrk.F90.'
92        print*,'Either we haven`t managed to assign all the gases, or there are duplicates.'
93        print*,'Please try again.'
94     endif
95
96  else
97     write(*,*) 'Cannot find required file "gases.def"'
98     call abort
99  endif
100  close(90)
101!$OMP END MASTER
102!$OMP BARRIER
103
104end subroutine su_gases
Note: See TracBrowser for help on using the repository browser.