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 wetdepokernel_nest(nunc,deposit,x,y,nage,kp) |
---|
23 | ! i i i i i i |
---|
24 | !***************************************************************************** |
---|
25 | ! * |
---|
26 | ! Attribution of the deposition from an individual particle to the * |
---|
27 | ! nested deposition fields using a uniform kernel with bandwidths * |
---|
28 | ! dxoutn and dyoutn. * |
---|
29 | ! * |
---|
30 | ! Author: A. Stohl * |
---|
31 | ! * |
---|
32 | ! 26 December 1996 * |
---|
33 | ! * |
---|
34 | ! 2 September 2004: Adaptation from wetdepokernel. * |
---|
35 | ! * |
---|
36 | ! * |
---|
37 | !***************************************************************************** |
---|
38 | ! * |
---|
39 | ! Variables: * |
---|
40 | ! * |
---|
41 | ! nunc uncertainty class of the respective particle * |
---|
42 | ! nage age class of the respective particle * |
---|
43 | ! deposit amount (kg) to be deposited * |
---|
44 | ! * |
---|
45 | !***************************************************************************** |
---|
46 | |
---|
47 | use unc_mod |
---|
48 | use par_mod |
---|
49 | use com_mod |
---|
50 | |
---|
51 | implicit none |
---|
52 | |
---|
53 | real :: x,y,deposit(maxspec),ddx,ddy,xl,yl,wx,wy,w |
---|
54 | integer :: ix,jy,ixp,jyp,ks,kp,nunc,nage |
---|
55 | |
---|
56 | xl=(x*dx+xoutshiftn)/dxoutn |
---|
57 | yl=(y*dy+youtshiftn)/dyoutn |
---|
58 | |
---|
59 | ! old: |
---|
60 | ! ix=int(xl) |
---|
61 | ! jy=int(yl) |
---|
62 | |
---|
63 | ! ESO: for xl,yl in range <-.5,-1> we get ix,jy=0 and thus negative |
---|
64 | ! wx,wy as the int function rounds upwards for negative numbers. |
---|
65 | ! Either use the floor function, or (perhaps more correctly?) use "(xl.gt.-0.5)" |
---|
66 | ! in place of "(ix.ge.0)" and similar for the upper boundary. |
---|
67 | |
---|
68 | ! new: |
---|
69 | ix=floor(xl) |
---|
70 | jy=floor(yl) |
---|
71 | |
---|
72 | ddx=xl-real(ix) ! distance to left cell border |
---|
73 | ddy=yl-real(jy) ! distance to lower cell border |
---|
74 | |
---|
75 | |
---|
76 | if (ddx.gt.0.5) then |
---|
77 | ixp=ix+1 |
---|
78 | wx=1.5-ddx |
---|
79 | else |
---|
80 | ixp=ix-1 |
---|
81 | wx=0.5+ddx |
---|
82 | endif |
---|
83 | |
---|
84 | if (ddy.gt.0.5) then |
---|
85 | jyp=jy+1 |
---|
86 | wy=1.5-ddy |
---|
87 | else |
---|
88 | jyp=jy-1 |
---|
89 | wy=0.5+ddy |
---|
90 | endif |
---|
91 | |
---|
92 | ! Determine mass fractions for four grid points |
---|
93 | !********************************************** |
---|
94 | |
---|
95 | do ks=1,nspec |
---|
96 | if ((ix.ge.0).and.(jy.ge.0).and.(ix.le.numxgridn-1).and. & |
---|
97 | (jy.le.numygridn-1)) then |
---|
98 | w=wx*wy |
---|
99 | wetgriduncn(ix,jy,ks,kp,nunc,nage)= & |
---|
100 | wetgriduncn(ix,jy,ks,kp,nunc,nage)+deposit(ks)*w |
---|
101 | endif |
---|
102 | |
---|
103 | if ((ixp.ge.0).and.(jyp.ge.0).and.(ixp.le.numxgridn-1).and. & |
---|
104 | (jyp.le.numygridn-1)) then |
---|
105 | w=(1.-wx)*(1.-wy) |
---|
106 | wetgriduncn(ixp,jyp,ks,kp,nunc,nage)= & |
---|
107 | wetgriduncn(ixp,jyp,ks,kp,nunc,nage)+deposit(ks)*w |
---|
108 | endif |
---|
109 | |
---|
110 | if ((ixp.ge.0).and.(jy.ge.0).and.(ixp.le.numxgridn-1).and. & |
---|
111 | (jy.le.numygridn-1)) then |
---|
112 | w=(1.-wx)*wy |
---|
113 | wetgriduncn(ixp,jy,ks,kp,nunc,nage)= & |
---|
114 | wetgriduncn(ixp,jy,ks,kp,nunc,nage)+deposit(ks)*w |
---|
115 | endif |
---|
116 | |
---|
117 | if ((ix.ge.0).and.(jyp.ge.0).and.(ix.le.numxgridn-1).and. & |
---|
118 | (jyp.le.numygridn-1)) then |
---|
119 | w=wx*(1.-wy) |
---|
120 | wetgriduncn(ix,jyp,ks,kp,nunc,nage)= & |
---|
121 | wetgriduncn(ix,jyp,ks,kp,nunc,nage)+deposit(ks)*w |
---|
122 | endif |
---|
123 | |
---|
124 | end do |
---|
125 | end subroutine wetdepokernel_nest |
---|