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 coordtrafo |
---|
23 | |
---|
24 | !********************************************************************** |
---|
25 | ! * |
---|
26 | ! FLEXPART MODEL SUBROUTINE COORDTRAFO * |
---|
27 | ! * |
---|
28 | !********************************************************************** |
---|
29 | ! * |
---|
30 | ! AUTHOR: G. WOTAWA * |
---|
31 | ! DATE: 1994-02-07 * |
---|
32 | ! LAST UPDATE: 1996-05-18 A. STOHL * |
---|
33 | ! * |
---|
34 | !********************************************************************** |
---|
35 | ! * |
---|
36 | ! DESCRIPTION: This subroutine transforms x and y coordinates of * |
---|
37 | ! particle release points to grid coordinates. * |
---|
38 | ! * |
---|
39 | !********************************************************************** |
---|
40 | |
---|
41 | use point_mod |
---|
42 | use par_mod |
---|
43 | use com_mod |
---|
44 | |
---|
45 | implicit none |
---|
46 | |
---|
47 | integer :: i,j,k |
---|
48 | real :: yrspc ! small real number relative to x |
---|
49 | |
---|
50 | if (numpoint.eq.0) goto 30 |
---|
51 | |
---|
52 | ! TRANSFORM X- AND Y- COORDINATES OF STARTING POINTS TO GRID COORDINATES |
---|
53 | !*********************************************************************** |
---|
54 | |
---|
55 | do i=1,numpoint |
---|
56 | xpoint1(i)=(xpoint1(i)-xlon0)/dx |
---|
57 | xpoint2(i)=(xpoint2(i)-xlon0)/dx |
---|
58 | ypoint1(i)=(ypoint1(i)-ylat0)/dy |
---|
59 | ypoint2(i)=(ypoint2(i)-ylat0)/dy |
---|
60 | end do |
---|
61 | |
---|
62 | 15 continue |
---|
63 | |
---|
64 | |
---|
65 | ! CHECK IF RELEASE POINTS ARE WITHIN DOMAIN |
---|
66 | !****************************************** |
---|
67 | |
---|
68 | yrspc = spacing(real(nymin1,kind=sp)) |
---|
69 | |
---|
70 | do i=1,numpoint |
---|
71 | if (sglobal.and.(ypoint1(i).lt.1.e-6)) ypoint1(i)=1.e-6 |
---|
72 | if (nglobal.and.(ypoint2(i).gt.real(nymin1,kind=dp)-1.e-5)) & |
---|
73 | ypoint2(i)=real(nymin1,kind=dp)-10*yrspc |
---|
74 | if ((ypoint1(i).lt.1.e-6).or.(ypoint1(i).ge.real(nymin1,kind=dp)-1.e-6) & |
---|
75 | .or.(ypoint2(i).lt.1.e-6).or.(ypoint2(i).ge.real(nymin1,kind=dp)-yrspc) & |
---|
76 | .or.((.not.xglobal).and.((xpoint1(i).lt.1.e-6).or. & |
---|
77 | (xpoint1(i).ge.real(nxmin1,kind=dp)-1.e-6).or.(xpoint2(i).lt.1.e-6).or. & |
---|
78 | (xpoint2(i).ge.real(nxmin1,kind=dp)-1.e-6)))) then |
---|
79 | write(*,*) ' NOTICE: RELEASE POINT OUT OF DOMAIN DETECTED.' |
---|
80 | write(*,*) ' IT IS REMOVED NOW ... ' |
---|
81 | if (i.le.1000) then |
---|
82 | write(*,*) ' COMMENT: ',compoint(i) |
---|
83 | else |
---|
84 | write(*,*) ' COMMENT: ',compoint(1001) |
---|
85 | endif |
---|
86 | if (i.lt.numpoint) then |
---|
87 | do j=i+1,numpoint |
---|
88 | xpoint1(j-1)=xpoint1(j) |
---|
89 | ypoint1(j-1)=ypoint1(j) |
---|
90 | xpoint2(j-1)=xpoint2(j) |
---|
91 | ypoint2(j-1)=ypoint2(j) |
---|
92 | zpoint1(j-1)=zpoint1(j) |
---|
93 | zpoint2(j-1)=zpoint2(j) |
---|
94 | npart(j-1)=npart(j) |
---|
95 | kindz(j-1)=kindz(j) |
---|
96 | ireleasestart(j-1)=ireleasestart(j) |
---|
97 | ireleaseend(j-1)=ireleaseend(j) |
---|
98 | if (j.le.1000) compoint(j-1)=compoint(j) |
---|
99 | do k=1,nspec |
---|
100 | xmass(j-1,k)=xmass(j,k) |
---|
101 | end do |
---|
102 | end do |
---|
103 | endif |
---|
104 | |
---|
105 | numpoint=numpoint-1 |
---|
106 | if (numpoint.gt.0) goto 15 |
---|
107 | endif |
---|
108 | end do |
---|
109 | |
---|
110 | 30 if(numpoint.eq.0) then |
---|
111 | write(*,*) ' FLEXPART MODEL SUBROUTINE COORDTRAFO: ERROR ! ' |
---|
112 | write(*,*) ' NO PARTICLE RELEASES ARE DEFINED!' |
---|
113 | write(*,*) ' CHECK FILE RELEASES...' |
---|
114 | stop |
---|
115 | endif |
---|
116 | |
---|
117 | end subroutine coordtrafo |
---|