[e200b7a] | 1 | subroutine drydepokernel(nunc,deposit,x,y,nage,kp) |
---|
| 2 | ! i i i i i |
---|
| 3 | !***************************************************************************** |
---|
| 4 | ! * |
---|
| 5 | ! Attribution of the deposition to the grid using a uniform kernel with * |
---|
| 6 | ! bandwidths dx and dy. * |
---|
| 7 | ! * |
---|
| 8 | ! Author: A. Stohl * |
---|
| 9 | ! * |
---|
| 10 | ! 26 December 1996 * |
---|
| 11 | ! * |
---|
| 12 | !***************************************************************************** |
---|
| 13 | ! * |
---|
| 14 | ! Variables: * |
---|
| 15 | ! * |
---|
| 16 | ! nunc uncertainty class of the respective particle * |
---|
| 17 | ! nage age class of the respective particle * |
---|
| 18 | ! deposit amount (kg) to be deposited * |
---|
| 19 | ! * |
---|
| 20 | !***************************************************************************** |
---|
[4c64400] | 21 | ! Changes: |
---|
| 22 | ! eso 10/2016: Added option to disregard kernel |
---|
| 23 | ! |
---|
| 24 | !***************************************************************************** |
---|
| 25 | |
---|
[e200b7a] | 26 | |
---|
| 27 | use unc_mod |
---|
| 28 | use par_mod |
---|
| 29 | use com_mod |
---|
| 30 | |
---|
| 31 | implicit none |
---|
| 32 | |
---|
[4c64400] | 33 | real(dep_prec), dimension(maxspec) :: deposit |
---|
| 34 | real :: x,y,ddx,ddy,xl,yl,wx,wy,w |
---|
[e200b7a] | 35 | integer :: ix,jy,ixp,jyp,ks,nunc,nage,kp |
---|
| 36 | |
---|
| 37 | |
---|
| 38 | xl=(x*dx+xoutshift)/dxout |
---|
| 39 | yl=(y*dy+youtshift)/dyout |
---|
| 40 | ix=int(xl) |
---|
| 41 | jy=int(yl) |
---|
| 42 | ddx=xl-real(ix) ! distance to left cell border |
---|
| 43 | ddy=yl-real(jy) ! distance to lower cell border |
---|
| 44 | |
---|
| 45 | if (ddx.gt.0.5) then |
---|
| 46 | ixp=ix+1 |
---|
| 47 | wx=1.5-ddx |
---|
| 48 | else |
---|
| 49 | ixp=ix-1 |
---|
| 50 | wx=0.5+ddx |
---|
| 51 | endif |
---|
| 52 | |
---|
| 53 | if (ddy.gt.0.5) then |
---|
| 54 | jyp=jy+1 |
---|
| 55 | wy=1.5-ddy |
---|
| 56 | else |
---|
| 57 | jyp=jy-1 |
---|
| 58 | wy=0.5+ddy |
---|
| 59 | endif |
---|
| 60 | |
---|
[4c64400] | 61 | ! If no kernel is used, direct attribution to grid cell |
---|
| 62 | !****************************************************** |
---|
| 63 | |
---|
[fe32dca] | 64 | if (.not.lusekerneloutput) then |
---|
[4c64400] | 65 | do ks=1,nspec |
---|
| 66 | if ((abs(deposit(ks)).gt.0).and.DRYDEPSPEC(ks)) then |
---|
| 67 | if ((ix.ge.0).and.(jy.ge.0).and.(ix.le.numxgrid-1).and. & |
---|
| 68 | (jy.le.numygrid-1)) then |
---|
| 69 | drygridunc(ix,jy,ks,kp,nunc,nage)= & |
---|
| 70 | drygridunc(ix,jy,ks,kp,nunc,nage)+deposit(ks) |
---|
| 71 | end if |
---|
| 72 | end if |
---|
| 73 | end do |
---|
| 74 | else ! use kernel |
---|
| 75 | |
---|
[e200b7a] | 76 | |
---|
| 77 | ! Determine mass fractions for four grid points |
---|
| 78 | !********************************************** |
---|
[4c64400] | 79 | do ks=1,nspec |
---|
[e200b7a] | 80 | |
---|
[4c64400] | 81 | if ((abs(deposit(ks)).gt.0).and.DRYDEPSPEC(ks)) then |
---|
[e200b7a] | 82 | |
---|
[1c0d5e6] | 83 | if ((ix.ge.0).and.(jy.ge.0).and.(ix.le.numxgrid-1).and. & |
---|
[e200b7a] | 84 | (jy.le.numygrid-1)) then |
---|
[6985a98] | 85 | w=wx*wy |
---|
| 86 | drygridunc(ix,jy,ks,kp,nunc,nage)= & |
---|
[e200b7a] | 87 | drygridunc(ix,jy,ks,kp,nunc,nage)+deposit(ks)*w |
---|
[1c0d5e6] | 88 | endif |
---|
[e200b7a] | 89 | |
---|
[1c0d5e6] | 90 | if ((ixp.ge.0).and.(jyp.ge.0).and.(ixp.le.numxgrid-1).and. & |
---|
[e200b7a] | 91 | (jyp.le.numygrid-1)) then |
---|
| 92 | w=(1.-wx)*(1.-wy) |
---|
| 93 | drygridunc(ixp,jyp,ks,kp,nunc,nage)= & |
---|
| 94 | drygridunc(ixp,jyp,ks,kp,nunc,nage)+deposit(ks)*w |
---|
[1c0d5e6] | 95 | endif |
---|
[e200b7a] | 96 | |
---|
[1c0d5e6] | 97 | if ((ixp.ge.0).and.(jy.ge.0).and.(ixp.le.numxgrid-1).and. & |
---|
[e200b7a] | 98 | (jy.le.numygrid-1)) then |
---|
[1c0d5e6] | 99 | w=(1.-wx)*wy |
---|
[e200b7a] | 100 | drygridunc(ixp,jy,ks,kp,nunc,nage)= & |
---|
| 101 | drygridunc(ixp,jy,ks,kp,nunc,nage)+deposit(ks)*w |
---|
[1c0d5e6] | 102 | endif |
---|
[e200b7a] | 103 | |
---|
[1c0d5e6] | 104 | if ((ix.ge.0).and.(jyp.ge.0).and.(ix.le.numxgrid-1).and. & |
---|
[e200b7a] | 105 | (jyp.le.numygrid-1)) then |
---|
[1c0d5e6] | 106 | w=wx*(1.-wy) |
---|
[e200b7a] | 107 | drygridunc(ix,jyp,ks,kp,nunc,nage)= & |
---|
| 108 | drygridunc(ix,jyp,ks,kp,nunc,nage)+deposit(ks)*w |
---|
[1c0d5e6] | 109 | endif |
---|
[e200b7a] | 110 | |
---|
[1c0d5e6] | 111 | endif ! deposit>0 |
---|
[4c64400] | 112 | end do |
---|
| 113 | end if |
---|
[e200b7a] | 114 | |
---|
| 115 | end subroutine drydepokernel |
---|