Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/readreceptors.f90

    r27 r4  
    2727  !                                                                            *
    2828  !     Author: A. Stohl                                                       *
     29  !                                                                            *
    2930  !     1 August 1996                                                          *
    30   !     HSO, 14 August 2013
    31   !     Added optional namelist input
    3231  !                                                                            *
    3332  !*****************************************************************************
     
    5251  character(len=16) :: receptor
    5352
    54   integer :: readerror
    55   real :: lon,lat   ! for namelist input, lon/lat are used instead of x,y
    56   integer,parameter :: unitreceptorout=2
    57 
    58   ! declare namelist
    59   namelist /receptors/ &
    60     receptor, lon, lat
    61 
    62   lon=-999.9
    6353
    6454  ! For backward runs, do not allow receptor output. Thus, set number of receptors to zero
     
    7464  !************************************************************
    7565
    76   open(unitreceptor,file=path(1)(1:length(1))//'RECEPTORS',form='formatted',status='old',err=999)
     66  open(unitreceptor,file=path(1)(1:length(1))//'RECEPTORS', &
     67       status='old',err=999)
    7768
    78   ! try namelist input
    79   read(unitreceptor,receptors,iostat=readerror)
     69  call skplin(5,unitreceptor)
    8070
    81   ! prepare namelist output if requested
    82   if (nmlout.eqv..true.) then
    83     open(unitreceptorout,file=path(2)(1:length(2))//'RECEPTORS.namelist',access='append',status='new',err=1000)
    84   endif
    8571
    86   if ((lon.lt.-900).or.(readerror.ne.0)) then
     72  ! Read the names and coordinates of the receptors
     73  !************************************************
    8774
    88     close(unitreceptor)
    89     open(unitreceptor,file=path(1)(1:length(1))//'RECEPTORS',status='old',err=999)
    90     call skplin(5,unitreceptor)
    91 
    92     ! Read the names and coordinates of the receptors
    93     !************************************************
    94 
    95     j=0
    96 100 j=j+1
     75  j=0
     76100   j=j+1
    9777    read(unitreceptor,*,end=99)
    9878    read(unitreceptor,*,end=99)
     
    10989    endif
    11090    if (j.gt.maxreceptor) then
    111       write(*,*) ' #### FLEXPART MODEL ERROR! TOO MANY RECEPTOR #### '
    112       write(*,*) ' #### POINTS ARE GIVEN.                       #### '
    113       write(*,*) ' #### MAXIMUM NUMBER IS ',maxreceptor,'       #### '
    114       write(*,*) ' #### PLEASE MAKE CHANGES IN FILE RECEPTORS   #### '
     91    write(*,*) ' #### FLEXPART MODEL ERROR! TOO MANY RECEPTOR #### '
     92    write(*,*) ' #### POINTS ARE GIVEN.                       #### '
     93    write(*,*) ' #### MAXIMUM NUMBER IS ',maxreceptor,'       #### '
     94    write(*,*) ' #### PLEASE MAKE CHANGES IN FILE RECEPTORS   #### '
    11595    endif
    11696    receptorname(j)=receptor
     
    120100    ym=r_earth*dy/180.*pi
    121101    receptorarea(j)=xm*ym
    122 
    123     ! write receptors file in namelist format to output directory if requested
    124     if (nmlout.eqv..true.) then
    125       lon=x
    126       lat=y
    127       write(unitreceptorout,nml=receptors)
    128     endif
    129 
    130102    goto 100
    131103
    132 99  numreceptor=j-1
    133 
    134   else ! continue with namelist input
    135 
    136     j=0
    137     do while (readerror.eq.0)
    138       j=j+1
    139       lon=-999.9
    140       read(unitreceptor,receptors,iostat=readerror)
    141       if ((lon.lt.-900).or.(readerror.ne.0)) then
    142         readerror=1
    143       else
    144         if (j.gt.maxreceptor) then
    145           write(*,*) ' #### FLEXPART MODEL ERROR! TOO MANY RECEPTOR #### '
    146           write(*,*) ' #### POINTS ARE GIVEN.                       #### '
    147           write(*,*) ' #### MAXIMUM NUMBER IS ',maxreceptor,'       #### '
    148           write(*,*) ' #### PLEASE MAKE CHANGES IN FILE RECEPTORS   #### '
    149         endif
    150         receptorname(j)=receptor
    151         xreceptor(j)=(lon-xlon0)/dx       ! transform to grid coordinates
    152         yreceptor(j)=(lat-ylat0)/dy
    153         xm=r_earth*cos(lat*pi/180.)*dx/180.*pi
    154         ym=r_earth*dy/180.*pi
    155         receptorarea(j)=xm*ym
    156       endif
    157 
    158       ! write receptors file in namelist format to output directory if requested
    159       if (nmlout.eqv..true.) then
    160         write(unitreceptorout,nml=receptors)
    161       endif
    162 
    163     end do
    164     numreceptor=j-1
    165     close(unitreceptor)
    166 
    167   endif
    168 
    169   if (nmlout.eqv..true.) then
    170     close(unitreceptorout)
    171   endif
    172 
     10499   numreceptor=j-1
     105  close(unitreceptor)
    173106  return
    174107
    175108
    176 999 write(*,*) ' #### FLEXPART MODEL ERROR! FILE "RECEPTORS"  #### '
     109999   write(*,*) ' #### FLEXPART MODEL ERROR! FILE "RECEPTORS"  #### '
    177110  write(*,*) ' #### CANNOT BE OPENED IN THE DIRECTORY       #### '
    178111  write(*,'(a)') path(1)(1:length(1))
    179112  stop
    180113
    181 1000 write(*,*) ' #### FLEXPART MODEL ERROR! FILE "RECEPTORS"    #### '
    182   write(*,*) ' #### CANNOT BE OPENED IN THE DIRECTORY       #### '
    183   write(*,'(a)') path(2)(1:length(2))
    184   stop
    185 
    186114end subroutine readreceptors
Note: See TracChangeset for help on using the changeset viewer.
hosted by ZAMG