! module input implicit none character(len=240) :: source,output,guydat_ncfile integer :: | ndays, ! number of days for time loop | nutpday, ! number of ut's for each day (inner time loop) | start_day=9999, ! starting calendar day (ddd) | start_year, ! starting calendar year (yyyy) | hist, ! interval to write histories (every nth nutpday's) | iaurora, ! aurora flag (see solheat.F) | isolproton ! solar protons flag (see solheat.F) real :: | f107, ! solar flux | f107a, ! 80-day average solar flux | ap, ! solar index | rzur ! sunspot number namelist/glbmean_input/ | source,output,ndays,nutpday,hist,start_day,start_year,f107, | f107a,ap,rzur,iaurora,isolproton,guydat_ncfile ! integer :: istep,nstep contains !----------------------------------------------------------------------- subroutine read_namelist ! ! Local: integer :: luin=7,ios,ier character(len=80) :: rec80 ! iaurora = 1 ! default is to include aurora isolproton = 0 ! default is to NOT include solar protons write(6,"(/,'Reading namelist input data...',/)") call rmcomments(5,luin,';',1) read(luin, nml=glbmean_input,err=900) close(luin) write(6,"('Completed read of namelist inputs.',/)") return 900 continue ! ! Error in namelist read: ! (on the Crays, ios=1324 means unrecognized keyword in namelist input) ! write(6,"(/,72('>'),/,'ERROR in namelist read of user inputs: ', | ' lu=',i2,' ios=',i5/)") luin,ios backspace(luin) read(luin,"(a)") rec80 write(6,"('This might be the result of an unrecognized ', | 'or misspelled keyword in the input file.')") write(6,"('Please check your input file in the vicinity ', | 'of the following line:')") write(6,"(/,a,/)") rec80 write(6,"(72('<'),/)") close(luin) stop 'input' end subroutine read_namelist !------------------------------------------------------------------- subroutine rmcomments(luin,luout,comcharin,echo) implicit none ! ! Read input lines from unit lu. If current line contains the comment ! character comcharin, strip the line from position of comchar to end, ! and write any remaining line to a new unit. If no comment in current ! line, write entire line to new unit. ! Return new unit, rewound (e.g., ready to be read by namelist). ! If echo > 0, echo output lines to stdout. ! If comcharin is ' ', then default comment char is ';' ! ! Args: integer,intent(in) :: luin,luout,echo character(len=1),intent(in) :: comcharin ! ! Local: character(len=1) :: comchar logical isopen integer :: i,lens,ios,compos,nline,nlcfields character(len=6400) :: line character(len=64) :: newcfields(30) ! if (luin <= 0) then write(6,"('>>> rmcomments: bad input luin=',i5)") luin stop 'rmcomments' endif if (luout <= 0) then write(6,"('>>> rmcomments: bad input luout=',i5)") luout stop 'rmcomments' endif if (len_trim(comcharin) > 0) then comchar = comcharin else comchar = ';' write(6,"('rmcomments: using default semicolon as ', + 'comment character.')") endif inquire(unit=luin,opened=isopen) if (.not.isopen) then open(unit=luin,iostat=ios) if (ios /= 0) then write(6,"('>>> WARNING rmcomments: error opening input', + ' file with unit luin=',i2,' ios=',i5)") luin,ios stop 'rmcomments' endif endif nline = 0 read_loop: do line = ' ' read(luin,"(a)",iostat=ios) line if (ios > 0) then write(6,"('>>> rmcomments: error reading from input', + ' unit luin=',i3,' at line ',i5)") luin,nline return endif if (ios < 0) exit read_loop ! eof nline = nline+1 ! ! Remove line if it has only "E" in column 1 (this was an ! old "Echo" directive from f77/cray namelist): ! if (line(1:1)=='E'.and.trim(line)=='E') cycle read_loop ! ! Use only non-commented part of line: ! compos = index(line,comchar) if (compos == 1) cycle read_loop if (compos > 0) line = line(1:compos-1) if (len_trim(adjustl(line))==0) cycle read_loop ! ! Write to new unit: write(luout,"(a)") trim(line) if (echo > 0) write(6,"(a)") line(1:len_trim(line)) enddo read_loop ! ! 8/3/04 btf: close luout (rather than just rewinding) to insure ! that the file fort.7 is complete before barrier is passed and all ! tasks do the namelist read. ! rewind luout close(luout) return end subroutine rmcomments end module input