subroutine su_gases use gases_h implicit none integer igas, ierr !================================================================== ! ! Purpose ! ------- ! Load atmospheric composition info ! ! Authors ! ------- ! R. Wordsworth (2011) ! !================================================================== ! load gas names from file 'gases.def' open(90,file='gases.def',status='old',form='formatted',iostat=ierr) if (ierr.eq.0) then write(*,*) "sugases.F90: reading file gases.def" read(90,*) read(90,*,iostat=ierr) ngasmx if (ierr.ne.0) then write(*,*) "sugases.F90: error reading number of gases" write(*,*) " (first line of gases.def) " call abort endif PRINT *, "OK I HAVE ",ngasmx, " GASES. NOW I ALLOCATE ARRAYS AND READ NAMES AND FRAC." IF ( .NOT. ALLOCATED( gnom ) ) ALLOCATE( gnom( ngasmx ) ) do igas=1,ngasmx read(90,*,iostat=ierr) gnom(igas) if (ierr.ne.0) then write(*,*) 'sugases.F90: error reading gas names in gases.def...' call abort endif enddo !of do igas=1,ngasmx vgas=0 IF ( .NOT. ALLOCATED( gfrac ) ) ALLOCATE( gfrac( ngasmx ) ) do igas=1,ngasmx read(90,*,iostat=ierr) gfrac(igas) if (ierr.ne.0) then write(*,*) 'sugases.F90: error reading gas molar fractions in gases.def...' call abort endif ! find variable gas (if any) if(gfrac(igas).eq.-1.0)then if(vgas.eq.0)then vgas=igas else print*,'You seem to be choosing two variable gases' print*,'Check that gases.def is correct' call abort endif endif enddo !of do igas=1,ngasmx else write(*,*) 'Cannot find required file "gases.def"' call abort endif close(90) end subroutine su_gases