CTBTO FLEXPART WO4 (2015-10-15)
 All Classes Files Functions Variables
readreceptors.F90
Go to the documentation of this file.
1 !**********************************************************************
2 ! Copyright 1998,1999,2000,2001,2002,2005,2007,2008,2009,2010 *
3 ! Andreas Stohl, Petra Seibert, A. Frank, Gerhard Wotawa, *
4 ! Caroline Forster, Sabine Eckhardt, John Burkhart, Harald Sodemann *
5 ! *
6 ! This file is part of FLEXPART. *
7 ! *
8 ! FLEXPART is free software: you can redistribute it and/or modify *
9 ! it under the terms of the GNU General Public License as published by*
10 ! the Free Software Foundation, either version 3 of the License, or *
11 ! (at your option) any later version. *
12 ! *
13 ! FLEXPART is distributed in the hope that it will be useful, *
14 ! but WITHOUT ANY WARRANTY; without even the implied warranty of *
15 ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16 ! GNU General Public License for more details. *
17 ! *
18 ! You should have received a copy of the GNU General Public License *
19 ! along with FLEXPART. If not, see <http://www.gnu.org/licenses/>. *
20 !**********************************************************************
21 
22 subroutine readreceptors
23 
24  !*****************************************************************************
25  ! *
26  ! This routine reads the user specifications for the receptor points. *
27  ! *
28  ! Author: A. Stohl *
29  ! *
30  ! 1 August 1996 *
31  ! *
32  !*****************************************************************************
33  ! *
34  ! Variables: *
35  ! receptorarea(maxreceptor) area of dx*dy at location of receptor *
36  ! receptorname(maxreceptor) names of receptors *
37  ! xreceptor,yreceptor coordinates of receptor points *
38  ! *
39  ! Constants: *
40  ! unitreceptor unit connected to file RECEPTORS *
41  ! *
42  !*****************************************************************************
43 
44  use par_mod
45  use com_mod
46 
47  implicit none
48 
49  integer :: j
50  real :: x,y,xm,ym
51  character(len=16) :: receptor
52 
53 
54  ! For backward runs, do not allow receptor output. Thus, set number of receptors to zero
55  !*****************************************************************************
56 
57 #if defined WITH_CTBTO_PATCHES
58 ! if (ldirect.lt.0) then
59 ! numreceptor=0
60 ! return
61 ! endif
62 #else
63  if (ldirect.lt.0) then
64  numreceptor=0
65  return
66  endif
67 #endif
68 
69 
70  ! Open the RECEPTORS file and read output grid specifications
71  !************************************************************
72 
73  open(unitreceptor,file=path(1)(1:length(1))//'RECEPTORS', &
74  status='old',err=999)
75 
76  call skplin(5,unitreceptor)
77 
78 
79  ! Read the names and coordinates of the receptors
80  !************************************************
81 
82  j=0
83 100 j=j+1
84  read(unitreceptor,*,end=99)
85  read(unitreceptor,*,end=99)
86  read(unitreceptor,*,end=99)
87  read(unitreceptor,'(4x,a16)',end=99) receptor
88  call skplin(3,unitreceptor)
89  read(unitreceptor,'(4x,f11.4)',end=99) x
90  call skplin(3,unitreceptor)
91  read(unitreceptor,'(4x,f11.4)',end=99) y
92  if ((x.eq.0.).and.(y.eq.0.).and. &
93  (receptor.eq.' ')) then
94  j=j-1
95  goto 100
96  endif
97  if (j.gt.maxreceptor) then
98  write(*,*) ' #### FLEXPART MODEL ERROR! TOO MANY RECEPTOR #### '
99  write(*,*) ' #### POINTS ARE GIVEN. #### '
100  write(*,*) ' #### MAXIMUM NUMBER IS ',maxreceptor,' #### '
101  write(*,*) ' #### PLEASE MAKE CHANGES IN FILE RECEPTORS #### '
102  endif
103  receptorname(j)=receptor
104  xreceptor(j)=(x-xlon0)/dx ! transform to grid coordinates
105  yreceptor(j)=(y-ylat0)/dy
106  xm=r_earth*cos(y*pi/180.)*dx/180.*pi
107  ym=r_earth*dy/180.*pi
108  receptorarea(j)=xm*ym
109  goto 100
110 
111 99 numreceptor=j-1
112  close(unitreceptor)
113  return
114 
115 
116 999 write(*,*) ' #### FLEXPART MODEL ERROR! FILE "RECEPTORS" #### '
117  write(*,*) ' #### CANNOT BE OPENED IN THE DIRECTORY #### '
118  write(*,'(a)') path(1)(1:length(1))
119  stop
120 
121 end subroutine readreceptors
subroutine readreceptors
subroutine skplin(nlines, iunit)
Definition: skplin.f90:22