Changeset 27 for trunk/src/readageclasses.f90
- Timestamp:
- Jul 3, 2014, 2:55:50 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/readageclasses.f90
r4 r27 28 28 ! * 29 29 ! Author: A. Stohl * 30 ! *31 30 ! 20 March 2000 * 31 ! HSO, 1 July 2014 * 32 ! Added optional namelist input * 32 33 ! * 33 34 !***************************************************************************** … … 46 47 integer :: i 47 48 49 ! namelist help variables 50 integer :: readerror 51 52 ! namelist declaration 53 namelist /ageclass/ & 54 nageclass, & 55 lage 56 57 nageclass=-1 ! preset to negative value to identify failed namelist input 48 58 49 59 ! If age spectra calculation is switched off, set number of age classes … … 57 67 endif 58 68 59 60 69 ! If age spectra claculation is switched on, 61 70 ! open the AGECLASSSES file and read user options 62 71 !************************************************ 63 72 64 open(unitageclasses,file=path(1)(1:length(1))//'AGECLASSES', & 65 status='old',err=999) 73 open(unitageclasses,file=path(1)(1:length(1))//'AGECLASSES',form='formatted',status='old',err=999) 66 74 67 do i=1,13 68 read(unitageclasses,*) 69 end do 70 read(unitageclasses,*) nageclass 75 ! try to read in as a namelist 76 read(unitageclasses,ageclass,iostat=readerror) 77 close(unitageclasses) 71 78 79 if ((nageclass.lt.0).or.(readerror.ne.0)) then 80 open(unitageclasses,file=path(1)(1:length(1))//'AGECLASSES',status='old',err=999) 81 do i=1,13 82 read(unitageclasses,*) 83 end do 84 read(unitageclasses,*) nageclass 85 read(unitageclasses,*) lage(1) 86 do i=2,nageclass 87 read(unitageclasses,*) lage(i) 88 end do 89 close(unitageclasses) 90 endif 91 92 ! write ageclasses file in namelist format to output directory if requested 93 if (nmlout.eqv..true.) then 94 open(unitageclasses,file=path(2)(1:length(2))//'AGECLASSES.namelist',err=1000) 95 write(unitageclasses,nml=ageclass) 96 close(unitageclasses) 97 endif 72 98 73 99 if (nageclass.gt.maxageclass) then … … 80 106 endif 81 107 82 read(unitageclasses,*) lage(1)83 108 if (lage(1).le.0) then 84 109 write(*,*) ' #### FLEXPART MODEL ERROR! AGE OF FIRST #### ' … … 89 114 90 115 do i=2,nageclass 91 read(unitageclasses,*) lage(i)92 116 if (lage(i).le.lage(i-1)) then 93 117 write(*,*) ' #### FLEXPART MODEL ERROR! AGE CLASSES #### ' … … 105 129 stop 106 130 131 1000 write(*,*) ' #### FLEXPART MODEL ERROR! FILE "AGECLASSES" #### ' 132 write(*,*) ' #### CANNOT BE OPENED IN THE DIRECTORY #### ' 133 write(*,'(a)') path(2)(1:length(2)) 134 stop 135 136 107 137 end subroutine readageclasses
Note: See TracChangeset
for help on using the changeset viewer.