Changeset 3405994 in flexpart.git
- Timestamp:
- May 28, 2020, 6:10:55 PM (4 years ago)
- Branches:
- 10.4.1_pesei, bugfixes+enhancements, release-10.4.1, scaling-bug
- Children:
- 477a094
- Parents:
- 5cbd51b
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/readreceptors.f90
r92fab65 r3405994 10 10 ! Author: A. Stohl * 11 11 ! 1 August 1996 * 12 ! HSO, 14 August 2013 13 ! Added optional namelist input12 ! HSO, 14 August 2013: Added optional namelist input * 13 ! PS, 2020-05-28: correct bug in nml input, code cosmetics * 14 14 ! * 15 15 !***************************************************************************** … … 34 34 character(len=16) :: receptor 35 35 36 integer :: readerror36 integer :: ierr 37 37 real :: lon,lat ! for namelist input, lon/lat are used instead of x,y 38 integer,parameter :: unitreceptorout=238 integer,parameter :: iunitreceptorout=2 39 39 40 40 ! declare namelist 41 namelist /receptors/ & 42 receptor, lon, lat 43 44 lon=-999.9 41 namelist /receptors/ receptor, lon, lat 45 42 46 43 ! For backward runs, do not allow receptor output. Thus, set number of receptors to zero … … 52 49 endif 53 50 51 ! prepare namelist output if requested 52 if (nmlout .and. lroot) & 53 open(iunitreceptorout,file=path(2)(1:length(2))//'RECEPTORS.namelist', & 54 status='replace',err=1000) 54 55 55 ! Open the RECEPTORS file and read output grid specifications 56 !************************************************************ 56 ! Open the RECEPTORS file and read output grid specifications 57 !************************************************************ 58 ! try namelist input 59 open(unitreceptor,file=path(1)(1:length(1))//'RECEPTORS',status='old',err=999) 60 read(unitreceptor,receptors,iostat=ierr) 61 close(unitreceptor) 57 62 58 open(unitreceptor,file=path(1)(1:length(1))//'RECEPTORS' ,form='formatted',status='old',err=999)63 open(unitreceptor,file=path(1)(1:length(1))//'RECEPTORS') 59 64 60 ! try namelist input 61 read(unitreceptor,receptors,iostat=readerror) 62 63 ! prepare namelist output if requested 64 if (nmlout.and.lroot) then 65 open(unitreceptorout,file=path(2)(1:length(2))//'RECEPTORS.namelist',& 66 &access='append',status='replace',err=1000) 67 endif 68 69 if ((lon.lt.-900).or.(readerror.ne.0)) then 70 71 close(unitreceptor) 72 open(unitreceptor,file=path(1)(1:length(1))//'RECEPTORS',status='old',err=999) 65 if (ierr.ne.0) then ! not namelist 66 73 67 call skplin(5,unitreceptor) 74 68 … … 78 72 j=0 79 73 100 j=j+1 80 read(unitreceptor,*,end=99) 81 read(unitreceptor,*,end=99) 82 read(unitreceptor,*,end=99) 83 read(unitreceptor,'(4x,a16)',end=99) receptor 84 call skplin(3,unitreceptor) 85 read(unitreceptor,'(4x,f11.4)',end=99) x 86 call skplin(3,unitreceptor) 87 read(unitreceptor,'(4x,f11.4)',end=99) y 88 if ((x.eq.0.).and.(y.eq.0.).and. & 89 (receptor.eq.' ')) then 90 j=j-1 91 goto 100 92 endif 93 if (j.gt.maxreceptor) then 94 write(*,*) ' #### FLEXPART MODEL ERROR! TOO MANY RECEPTOR #### ' 95 write(*,*) ' #### POINTS ARE GIVEN. #### ' 96 write(*,*) ' #### MAXIMUM NUMBER IS ',maxreceptor,' #### ' 97 write(*,*) ' #### PLEASE MAKE CHANGES IN FILE RECEPTORS #### ' 98 endif 99 receptorname(j)=receptor 100 xreceptor(j)=(x-xlon0)/dx ! transform to grid coordinates 101 yreceptor(j)=(y-ylat0)/dy 102 xm=r_earth*cos(y*pi/180.)*dx/180.*pi 103 ym=r_earth*dy/180.*pi 104 receptorarea(j)=xm*ym 74 read(unitreceptor,*,end=99) 75 read(unitreceptor,*,end=99) 76 read(unitreceptor,*,end=99) 77 read(unitreceptor,'(4x,a16)',end=99) receptor 78 call skplin(3,unitreceptor) 79 read(unitreceptor,'(4x,f11.4)',end=99) x 80 call skplin(3,unitreceptor) 81 read(unitreceptor,'(4x,f11.4)',end=99) y 82 if (x.eq.0. .and. y.eq.0. .and. receptor.eq.' ') then 83 j=j-1 84 goto 100 85 endif 86 if (j.gt.maxreceptor) goto 998 ! ERROR - STOP 87 receptorname(j)=receptor 88 xreceptor(j)=(x-xlon0)/dx ! transform to grid coordinates 89 yreceptor(j)=(y-ylat0)/dy 90 xm=r_earth*cos(y*pi/180.)*dx/180.*pi 91 ym=r_earth*dy/180.*pi 92 receptorarea(j)=xm*ym 105 93 106 ! write receptors file in namelist format to output directory if requested107 if (nmlout.and.lroot) then108 lon=x109 lat=y110 write(unitreceptorout,nml=receptors)111 endif94 ! write receptors file in namelist format to output directory if requested 95 if (nmlout .and. lroot) then 96 lon=x 97 lat=y 98 write(iunitreceptorout,nml=receptors) 99 endif 112 100 113 goto 100 101 goto 100 ! read next 114 102 115 99 numreceptor=j-1 103 99 numreceptor=j-1 ! read all 116 104 117 105 else ! continue with namelist input 118 106 119 107 j=0 120 do while ( readerror.eq.0)108 do while (ierr.eq.0) 121 109 j=j+1 122 lon=-999.9 123 read(unitreceptor,receptors,iostat=readerror) 124 if ((lon.lt.-900).or.(readerror.ne.0)) then 125 readerror=1 126 else 127 if (j.gt.maxreceptor) then 128 write(*,*) ' #### FLEXPART MODEL ERROR! TOO MANY RECEPTOR #### ' 129 write(*,*) ' #### POINTS ARE GIVEN. #### ' 130 write(*,*) ' #### MAXIMUM NUMBER IS ',maxreceptor,' #### ' 131 write(*,*) ' #### PLEASE MAKE CHANGES IN FILE RECEPTORS #### ' 132 endif 110 read(unitreceptor,receptors,iostat=ierr) 111 if (ierr.eq.0) then 112 if (j.gt.maxreceptor) goto 998 ! ERROR - STOP 133 113 receptorname(j)=receptor 134 114 xreceptor(j)=(lon-xlon0)/dx ! transform to grid coordinates … … 137 117 ym=r_earth*dy/180.*pi 138 118 receptorarea(j)=xm*ym 119 ! write receptors file in namelist format to output directory if requested 120 if (nmlout.and.lroot) & 121 write(iunitreceptorout,nml=receptors) 139 122 endif 140 141 ! write receptors file in namelist format to output directory if requested142 if (nmlout.and.lroot) then143 write(unitreceptorout,nml=receptors)144 endif145 146 123 end do 147 124 numreceptor=j-1 148 125 close(unitreceptor) 149 126 150 endif 127 endif ! end reading nml input 151 128 152 if (nmlout.and.lroot) then 153 close(unitreceptorout) 154 endif 129 if (nmlout.and.lroot) & 130 close(iunitreceptorout) 155 131 156 132 return 157 133 134 998 continue 135 write(*,*) ' #### FLEXPART MODEL ERROR! TOO MANY RECEPTOR #### ' 136 write(*,*) ' #### POINTS ARE GIVEN. #### ' 137 write(*,*) ' #### MAXIMUM NUMBER IS ',maxreceptor,' #### ' 138 write(*,*) ' #### PLEASE MAKE CHANGES IN FILE RECEPTORS #### ' 139 stop 158 140 159 999 write(*,*) ' #### FLEXPART MODEL ERROR! FILE "RECEPTORS" #### ' 141 999 continue 142 write(*,*) ' #### FLEXPART MODEL ERROR! FILE "RECEPTORS" #### ' 160 143 write(*,*) ' #### CANNOT BE OPENED IN THE DIRECTORY #### ' 161 144 write(*,'(a)') path(1)(1:length(1)) 162 145 stop 163 146 164 1000 write(*,*) ' #### FLEXPART MODEL ERROR! FILE "RECEPTORS" #### ' 147 1000 continue 148 write(*,*) ' #### FLEXPART MODEL ERROR! FILE "RECEPTORS" #### ' 165 149 write(*,*) ' #### CANNOT BE OPENED IN THE DIRECTORY #### ' 166 150 write(*,'(a)') path(2)(1:length(2))
Note: See TracChangeset
for help on using the changeset viewer.