| 1 | subroutine su_gases |
|---|
| 2 | |
|---|
| 3 | use gases_h |
|---|
| 4 | |
|---|
| 5 | implicit none |
|---|
| 6 | |
|---|
| 7 | integer 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) ngasmx |
|---|
| 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 | |
|---|
| 33 | PRINT *, "OK I HAVE ",ngasmx, " GASES. NOW I ALLOCATE ARRAYS AND READ NAMES AND FRAC." |
|---|
| 34 | |
|---|
| 35 | IF ( .NOT. ALLOCATED( gnom ) ) ALLOCATE( gnom( ngasmx ) ) |
|---|
| 36 | do igas=1,ngasmx |
|---|
| 37 | read(90,*,iostat=ierr) gnom(igas) |
|---|
| 38 | if (ierr.ne.0) then |
|---|
| 39 | write(*,*) 'sugases.F90: error reading gas names in gases.def...' |
|---|
| 40 | call abort |
|---|
| 41 | endif |
|---|
| 42 | enddo !of do igas=1,ngasmx |
|---|
| 43 | |
|---|
| 44 | vgas=0 |
|---|
| 45 | IF ( .NOT. ALLOCATED( gfrac ) ) ALLOCATE( gfrac( ngasmx ) ) |
|---|
| 46 | do igas=1,ngasmx |
|---|
| 47 | read(90,*,iostat=ierr) gfrac(igas) |
|---|
| 48 | if (ierr.ne.0) then |
|---|
| 49 | write(*,*) 'sugases.F90: error reading gas molar fractions in gases.def...' |
|---|
| 50 | call abort |
|---|
| 51 | endif |
|---|
| 52 | |
|---|
| 53 | ! find variable gas (if any) |
|---|
| 54 | if(gfrac(igas).eq.-1.0)then |
|---|
| 55 | if(vgas.eq.0)then |
|---|
| 56 | vgas=igas |
|---|
| 57 | else |
|---|
| 58 | print*,'You seem to be choosing two variable gases' |
|---|
| 59 | print*,'Check that gases.def is correct' |
|---|
| 60 | call abort |
|---|
| 61 | endif |
|---|
| 62 | endif |
|---|
| 63 | |
|---|
| 64 | enddo !of do igas=1,ngasmx |
|---|
| 65 | |
|---|
| 66 | else |
|---|
| 67 | write(*,*) 'Cannot find required file "gases.def"' |
|---|
| 68 | call abort |
|---|
| 69 | endif |
|---|
| 70 | close(90) |
|---|
| 71 | |
|---|
| 72 | end subroutine su_gases |
|---|