[92fab65] | 1 | ! SPDX-FileCopyrightText: FLEXPART 1998-2019, see flexpart_license.txt |
---|
| 2 | ! SPDX-License-Identifier: GPL-3.0-or-later |
---|
[332fbbd] | 3 | |
---|
[db712a8] | 4 | subroutine wetdepokernel_nest(nunc,deposit,x,y,nage,kp) |
---|
| 5 | ! i i i i i i |
---|
[e200b7a] | 6 | !***************************************************************************** |
---|
| 7 | ! * |
---|
| 8 | ! Attribution of the deposition from an individual particle to the * |
---|
| 9 | ! nested deposition fields using a uniform kernel with bandwidths * |
---|
| 10 | ! dxoutn and dyoutn. * |
---|
| 11 | ! * |
---|
| 12 | ! Author: A. Stohl * |
---|
| 13 | ! * |
---|
| 14 | ! 26 December 1996 * |
---|
| 15 | ! * |
---|
| 16 | ! 2 September 2004: Adaptation from wetdepokernel. * |
---|
| 17 | ! * |
---|
| 18 | ! * |
---|
| 19 | !***************************************************************************** |
---|
| 20 | ! * |
---|
| 21 | ! Variables: * |
---|
| 22 | ! * |
---|
| 23 | ! nunc uncertainty class of the respective particle * |
---|
| 24 | ! nage age class of the respective particle * |
---|
| 25 | ! deposit amount (kg) to be deposited * |
---|
| 26 | ! * |
---|
| 27 | !***************************************************************************** |
---|
| 28 | |
---|
| 29 | use unc_mod |
---|
| 30 | use par_mod |
---|
| 31 | use com_mod |
---|
| 32 | |
---|
| 33 | implicit none |
---|
| 34 | |
---|
| 35 | real :: x,y,deposit(maxspec),ddx,ddy,xl,yl,wx,wy,w |
---|
| 36 | integer :: ix,jy,ixp,jyp,ks,kp,nunc,nage |
---|
| 37 | |
---|
| 38 | xl=(x*dx+xoutshiftn)/dxoutn |
---|
| 39 | yl=(y*dy+youtshiftn)/dyoutn |
---|
[db712a8] | 40 | |
---|
| 41 | ! old: |
---|
| 42 | ! ix=int(xl) |
---|
| 43 | ! jy=int(yl) |
---|
| 44 | |
---|
| 45 | ! ESO: for xl,yl in range <-.5,-1> we get ix,jy=0 and thus negative |
---|
| 46 | ! wx,wy as the int function rounds upwards for negative numbers. |
---|
| 47 | ! Either use the floor function, or (perhaps more correctly?) use "(xl.gt.-0.5)" |
---|
| 48 | ! in place of "(ix.ge.0)" and similar for the upper boundary. |
---|
| 49 | |
---|
| 50 | ! new: |
---|
| 51 | ix=floor(xl) |
---|
| 52 | jy=floor(yl) |
---|
| 53 | |
---|
[e200b7a] | 54 | ddx=xl-real(ix) ! distance to left cell border |
---|
| 55 | ddy=yl-real(jy) ! distance to lower cell border |
---|
| 56 | |
---|
[db712a8] | 57 | |
---|
[e200b7a] | 58 | if (ddx.gt.0.5) then |
---|
| 59 | ixp=ix+1 |
---|
| 60 | wx=1.5-ddx |
---|
| 61 | else |
---|
| 62 | ixp=ix-1 |
---|
| 63 | wx=0.5+ddx |
---|
| 64 | endif |
---|
| 65 | |
---|
| 66 | if (ddy.gt.0.5) then |
---|
| 67 | jyp=jy+1 |
---|
| 68 | wy=1.5-ddy |
---|
| 69 | else |
---|
| 70 | jyp=jy-1 |
---|
| 71 | wy=0.5+ddy |
---|
| 72 | endif |
---|
| 73 | |
---|
[db712a8] | 74 | ! Determine mass fractions for four grid points |
---|
| 75 | !********************************************** |
---|
[e200b7a] | 76 | |
---|
| 77 | do ks=1,nspec |
---|
[db712a8] | 78 | if ((ix.ge.0).and.(jy.ge.0).and.(ix.le.numxgridn-1).and. & |
---|
| 79 | (jy.le.numygridn-1)) then |
---|
| 80 | w=wx*wy |
---|
[e200b7a] | 81 | wetgriduncn(ix,jy,ks,kp,nunc,nage)= & |
---|
| 82 | wetgriduncn(ix,jy,ks,kp,nunc,nage)+deposit(ks)*w |
---|
[db712a8] | 83 | endif |
---|
[e200b7a] | 84 | |
---|
[db712a8] | 85 | if ((ixp.ge.0).and.(jyp.ge.0).and.(ixp.le.numxgridn-1).and. & |
---|
| 86 | (jyp.le.numygridn-1)) then |
---|
| 87 | w=(1.-wx)*(1.-wy) |
---|
[e200b7a] | 88 | wetgriduncn(ixp,jyp,ks,kp,nunc,nage)= & |
---|
| 89 | wetgriduncn(ixp,jyp,ks,kp,nunc,nage)+deposit(ks)*w |
---|
[db712a8] | 90 | endif |
---|
[e200b7a] | 91 | |
---|
[db712a8] | 92 | if ((ixp.ge.0).and.(jy.ge.0).and.(ixp.le.numxgridn-1).and. & |
---|
| 93 | (jy.le.numygridn-1)) then |
---|
| 94 | w=(1.-wx)*wy |
---|
[e200b7a] | 95 | wetgriduncn(ixp,jy,ks,kp,nunc,nage)= & |
---|
| 96 | wetgriduncn(ixp,jy,ks,kp,nunc,nage)+deposit(ks)*w |
---|
[db712a8] | 97 | endif |
---|
[e200b7a] | 98 | |
---|
[db712a8] | 99 | if ((ix.ge.0).and.(jyp.ge.0).and.(ix.le.numxgridn-1).and. & |
---|
| 100 | (jyp.le.numygridn-1)) then |
---|
| 101 | w=wx*(1.-wy) |
---|
[e200b7a] | 102 | wetgriduncn(ix,jyp,ks,kp,nunc,nage)= & |
---|
| 103 | wetgriduncn(ix,jyp,ks,kp,nunc,nage)+deposit(ks)*w |
---|
[db712a8] | 104 | endif |
---|
[e200b7a] | 105 | |
---|
| 106 | end do |
---|
| 107 | end subroutine wetdepokernel_nest |
---|