Changeset d7935de in flexpart.git for src/readageclasses.f90
- Timestamp:
- Sep 11, 2018, 6:06:31 PM (6 years ago)
- Branches:
- univie
- Children:
- 93786a1
- Parents:
- 34f1452
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/readageclasses.f90
r5f9d14a rd7935de 29 29 ! Author: A. Stohl * 30 30 ! 20 March 2000 * 31 ! 31 32 ! HSO, 1 July 2014 * 32 33 ! Added optional namelist input * 34 ! * 35 ! PS, 6/2015-9/2018 some variable names changed as in readreleases.f90 * 36 ! catch nageclass>maxage properly * 33 37 ! * 34 38 !***************************************************************************** … … 47 51 integer :: i 48 52 49 ! namelist helpvariables50 integer :: readerror53 ! namelist aux variables 54 integer :: ios 51 55 52 56 ! namelist declaration 53 namelist / ageclass/ &57 namelist /nml_ageclass/ & 54 58 nageclass, & 55 59 lage … … 71 75 !************************************************ 72 76 73 open(unitageclasses,file=path(1)(1:length(1))//'AGECLASSES',form='formatted',status='old',err=999) 77 open(unitageclasses,file=path(1)(1:length(1))//'AGECLASSES', & 78 form='formatted',status='old',err=999) 74 79 75 80 ! try to read in as a namelist 76 read(unitageclasses, ageclass,iostat=readerror)81 read(unitageclasses, nml_ageclass, iostat=ios) 77 82 close(unitageclasses) 78 83 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) 84 if (ios .ne. 0) then ! failed to read nml, assume simple text 85 open(unitageclasses,file=path(1)(1:length(1))// & 86 'AGECLASSES',status='old',err=999) 87 call skplin(13,unitageclasses) 88 read(unitageclasses,*) nageclass ! number of classes 89 if (nageclass.gt.maxageclass) goto 1001 90 do i=1,nageclass 91 read(unitageclasses,*) lage(i) ! max age per classes 88 92 end do 89 93 close(unitageclasses) 90 94 endif 91 95 96 if (nageclass.lt.1) goto 1002 97 92 98 ! write ageclasses file in namelist format to output directory if requested 93 99 if (nmlout.and.lroot) then 94 open(unitageclasses,file=path(2)(1:length(2))//'AGECLASSES.namelist',err=1000) 95 write(unitageclasses,nml=ageclass) 100 open(unitageclasses,file=path(2)(1:length(2))//'AGECLASSES.namelist', & 101 err=1000) 102 write(unitageclasses,nml=nml_ageclass) 96 103 close(unitageclasses) 97 endif98 99 if (nageclass.gt.maxageclass) then100 write(*,*) ' #### FLEXPART MODEL ERROR! NUMBER OF AGE #### '101 write(*,*) ' #### CLASSES GREATER THAN MAXIMUM ALLOWED. #### '102 write(*,*) ' #### CHANGE SETTINGS IN FILE AGECLASSES OR #### '103 write(*,*) ' #### RECOMPILE WITH LARGER MAXAGECLASS IN #### '104 write(*,*) ' #### FILE PAR_MOD. #### '105 stop106 104 endif 107 105 … … 126 124 999 write(*,*) ' #### FLEXPART MODEL ERROR! FILE "AGECLASSES" #### ' 127 125 write(*,*) ' #### CANNOT BE OPENED IN THE DIRECTORY #### ' 128 write(*,'(a)') path(1)(1:length(1))126 write(*,'(a)') trim(path(1)) 129 127 stop 130 128 … … 134 132 stop 135 133 134 1001 continue 135 write(*,*) ' #### FLEXPART MODEL ERROR! NUMBER OF AGE #### ' 136 write(*,*) ' #### CLASSES GREATER THAN MAXIMUM ALLOWED. #### ' 137 write(*,*) ' #### CHANGE SETTINGS IN FILE AGECLASSES OR #### ' 138 write(*,*) ' #### RECOMPILE WITH LARGER MAXAGECLASS IN #### ' 139 write(*,*) ' #### FILE PAR_MOD. #### ' 140 stop 141 142 1002 continue 143 write(*,*) ' #### FLEXPART MODEL ERROR! NUMBER OF AGE #### ' 144 write(*,*) ' #### CLASSES < 1 #### ' 145 write(*,*) ' #### CHANGE SETTINGS IN FILE AGECLASSES #### ' 146 stop 136 147 137 148 end subroutine readageclasses
Note: See TracChangeset
for help on using the changeset viewer.