1 | subroutine su_gases |
---|
2 | |
---|
3 | implicit none |
---|
4 | |
---|
5 | #include "gases.h" |
---|
6 | |
---|
7 | integer ngas, igas, ierr |
---|
8 | |
---|
9 | !================================================================== |
---|
10 | ! |
---|
11 | ! Purpose |
---|
12 | ! ------- |
---|
13 | ! Load atmospheric composition info |
---|
14 | ! |
---|
15 | ! Authors |
---|
16 | ! ------- |
---|
17 | ! R. Wordsworth (2011) |
---|
18 | ! |
---|
19 | !================================================================== |
---|
20 | |
---|
21 | ! load gas names from file 'gases.def' |
---|
22 | open(90,file='gases.def',status='old',form='formatted',iostat=ierr) |
---|
23 | if (ierr.eq.0) then |
---|
24 | write(*,*) "sugases.F90: reading file gases.def" |
---|
25 | read(90,*) |
---|
26 | read(90,*,iostat=ierr) ngas |
---|
27 | if (ierr.ne.0) then |
---|
28 | write(*,*) "sugases.F90: error reading number of gases" |
---|
29 | write(*,*) " (first line of gases.def) " |
---|
30 | call abort |
---|
31 | endif |
---|
32 | ! check that the number of gases is indeed ngasmx |
---|
33 | if (ngas.ne.ngasmx) then |
---|
34 | write(*,*) "sugases.F90: error, wrong number of gases:" |
---|
35 | write(*,*) "ngas=",ngas," whereas ngasmx=",ngasmx |
---|
36 | write(*,*) "Check that the values in gases.def and gases.h match..." |
---|
37 | call abort |
---|
38 | endif |
---|
39 | |
---|
40 | do igas=1,ngas |
---|
41 | read(90,*,iostat=ierr) gnom(igas) |
---|
42 | if (ierr.ne.0) then |
---|
43 | write(*,*) 'sugases.F90: error reading gas names in gases.def...' |
---|
44 | call abort |
---|
45 | endif |
---|
46 | enddo !of do igas=1,ngas |
---|
47 | |
---|
48 | vgas=0 |
---|
49 | do igas=1,ngas |
---|
50 | read(90,*,iostat=ierr) gfrac(igas) |
---|
51 | if (ierr.ne.0) then |
---|
52 | write(*,*) 'sugases.F90: error reading gas molar fractions in gases.def...' |
---|
53 | call abort |
---|
54 | endif |
---|
55 | |
---|
56 | ! find variable gas (if any) |
---|
57 | if(gfrac(igas).eq.-1.0)then |
---|
58 | if(vgas.eq.0)then |
---|
59 | vgas=igas |
---|
60 | else |
---|
61 | print*,'You seem to be choosing two variable gases' |
---|
62 | print*,'Check that gases.def is correct' |
---|
63 | call abort |
---|
64 | endif |
---|
65 | endif |
---|
66 | |
---|
67 | enddo !of do igas=1,ngas |
---|
68 | |
---|
69 | else |
---|
70 | write(*,*) 'Cannot find required file "gases.def"' |
---|
71 | call abort |
---|
72 | endif |
---|
73 | close(90) |
---|
74 | |
---|
75 | end subroutine su_gases |
---|