source: branches/petra/src/wetdepokernel_nest.f90 @ 37

Last change on this file since 37 was 37, checked in by pesei, 9 years ago

Wet dep quick fix and other small changes. Wet depo quick fix not final yet.

File size: 5.4 KB
Line 
1!**********************************************************************
2! Copyright 1998-2015                                                 *
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
22subroutine wetdepokernel_nest (nunc,deposit,x,y,itage,nage,kp)
23  !                             i      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  !  PS, 2/2015: do not use kernel for itage < 3 h
38  !   same as for concentration in conccalc.f90
39  !                                                                            *
40  !*****************************************************************************
41  !                                                                            *
42  ! Variables:                                                                 *
43  !                                                                            *
44  ! nunc             uncertainty class of the respective particle              *
45  ! nage             age class of the respective particle                      *
46  ! deposit          amount (kg) to be deposited                               *
47  !                                                                            *
48  !*****************************************************************************
49
50  use unc_mod
51  use par_mod
52  use com_mod
53
54  implicit none
55
56  real :: x,y,deposit(maxspec),ddx,ddy,xl,yl,wx,wy,w
57  integer :: ix,jy,ixp,jyp,ks,kp,nunc,nage,itage
58
59
60
61  xl=(x*dx+xoutshiftn)/dxoutn
62  yl=(y*dy+youtshiftn)/dyoutn
63  ix=int(xl)
64  jy=int(yl)
65  ddx=xl-real(ix)                   ! distance to left cell border
66  ddy=yl-real(jy)                   ! distance to lower cell border
67
68  if (ddx.gt.0.5) then
69    ixp=ix+1
70    wx=1.5-ddx
71  else
72    ixp=ix-1
73    wx=0.5+ddx
74  endif
75
76  if (ddy.gt.0.5) then
77    jyp=jy+1
78    wy=1.5-ddy
79  else
80    jyp=jy-1
81    wy=0.5+ddy
82  endif
83
84  if (itage .lt. itagekernmin) then 
85   ! no kernel, direct attribution to grid cell
86   
87    do ks=1,nspec
88      if (ix.ge.0 .and. jy.ge.0 .and. &
89          ix.le.numxgridn-1 .and. jy.le.numygridn-1) &
90        wetgriduncn(ix,jy,ks,kp,nunc,nage)= &
91          wetgriduncn(ix,jy,ks,kp,nunc,nage)+deposit(ks)
92    enddo
93       
94  else
95    ! Determine mass fractions for four grid points & distribute
96
97    do ks=1,nspec
98
99      if ((ix.ge.0).and.(jy.ge.0).and.(ix.le.numxgridn-1).and. &
100           (jy.le.numygridn-1)) then
101        w=wx*wy
102        wetgriduncn(ix,jy,ks,kp,nunc,nage)= &
103          wetgriduncn(ix,jy,ks,kp,nunc,nage)+deposit(ks)*w
104      endif
105
106      if ((ixp.ge.0).and.(jyp.ge.0).and.(ixp.le.numxgridn-1).and. &
107           (jyp.le.numygridn-1)) then
108        w=(1.-wx)*(1.-wy)
109        wetgriduncn(ixp,jyp,ks,kp,nunc,nage)= &
110          wetgriduncn(ixp,jyp,ks,kp,nunc,nage)+deposit(ks)*w
111      endif
112
113      if ((ixp.ge.0).and.(jy.ge.0).and.(ixp.le.numxgridn-1).and. &
114           (jy.le.numygridn-1)) then
115        w=(1.-wx)*wy
116        wetgriduncn(ixp,jy,ks,kp,nunc,nage)= &
117          wetgriduncn(ixp,jy,ks,kp,nunc,nage)+deposit(ks)*w
118      endif
119
120      if ((ix.ge.0).and.(jyp.ge.0).and.(ix.le.numxgridn-1).and. &
121           (jyp.le.numygridn-1)) then
122        w=wx*(1.-wy)
123        wetgriduncn(ix,jyp,ks,kp,nunc,nage)= &
124          wetgriduncn(ix,jyp,ks,kp,nunc,nage)+deposit(ks)*w
125      endif
126
127    end do
128
129  endif
130end subroutine wetdepokernel_nest
Note: See TracBrowser for help on using the repository browser.
hosted by ZAMG