subroutine su_gases implicit none #include "gases.h" integer ngas, 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) ngas if (ierr.ne.0) then write(*,*) "sugases.F90: error reading number of gases" write(*,*) " (first line of gases.def) " call abort endif ! check that the number of gases is indeed ngasmx if (ngas.ne.ngasmx) then write(*,*) "sugases.F90: error, wrong number of gases:" write(*,*) "ngas=",ngas," whereas ngasmx=",ngasmx write(*,*) "Check that the values in gases.def and gases.h match..." call abort endif do igas=1,ngas 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,ngas vgas=0 do igas=1,ngas 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,ngas else write(*,*) 'Cannot find required file "gases.def"' call abort endif close(90) end subroutine su_gases