source: branches/jerome/src_flexwrf_v3.1/wetdepokernel_nest.f90 @ 16

Last change on this file since 16 was 16, checked in by jebri, 11 years ago

sources for flexwrf v3.1

File size: 5.9 KB
Line 
1!***********************************************************************
2!* Copyright 2012,2013                                                *
3!* Jerome Brioude, Delia Arnold, Andreas Stohl, Wayne Angevine,       *
4!* John Burkhart, Massimo Cassiani, Adam Dingwell, Richard C Easter, Sabine Eckhardt,*
5!* Stephanie Evan, Jerome D Fast, Don Morton, Ignacio Pisso,          *
6!* Petra Seibert, Gerard Wotawa, Caroline Forster, Harald Sodemann,   *
7!*                                                                     *
8!* This file is part of FLEXPART WRF         
9!                                                                     *
10! FLEXPART is free software: you can redistribute it and/or modify    *
11! it under the terms of the GNU General Public License as published by*
12! the Free Software Foundation, either version 3 of the License, or   *
13! (at your option) any later version.                                 *
14!                                                                     *
15! FLEXPART is distributed in the hope that it will be useful,         *
16! but WITHOUT ANY WARRANTY; without even the implied warranty of      *
17! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the       *
18! GNU General Public License for more details.                        *
19!                                                                     *
20! You should have received a copy of the GNU General Public License   *
21! along with FLEXPART.  If not, see <http://www.gnu.org/licenses/>.   *
22!**********************************************************************
23
24subroutine wetdepokernel_nest &
25       (nunc,deposit,x,y,itage,nage,kp)
26  !        i      i    i i  i    i
27  !*****************************************************************************
28  !                                                                            *
29  !     Attribution of the deposition from an individual particle to the       *
30  !     nested deposition fields using a uniform kernel with bandwidths        *
31  !     dxoutn and dyoutn.                                                     *
32  !                                                                            *
33  !     Author: A. Stohl                                                       *
34  !                                                                            *
35  !     26 December 1996                                                       *
36  !                                                                            *
37  !      2 September 2004: Adaptation from wetdepokernel.                      *
38  !                                                                            *
39  !     Dec 2012: modifications following wetdepokernel.f90                   *
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
58! CDA new declarations
59   real :: rhoprof(2),rhoi,xlon,ylat,xl2,yl2
60   integer :: itage
61! CDA
62
63
64!JB
65  if (outgrid_option.eq.0) then
66! CDA
67  xl=(x*dx+xoutshiftn)/dxoutn
68  yl=(y*dy+youtshiftn)/dyoutn
69  elseif (outgrid_option.eq.1) then
70! CDA new code:
71  xl2=x*dx+xmet0
72  yl2=y*dy+ymet0
73  call xymeter_to_ll_wrf(xl2,yl2,xlon,ylat)
74  xl=(xlon-outlon0n)/dxoutln
75  yl=(ylat-outlat0n)/dyoutln
76  endif
77
78  ix=int(xl)
79  jy=int(yl)
80
81! CDA skip kernelfor some hours to prevent smoothing close to source
82      if (itage.lt.7200) then ! no kernel, direct attribution to grid cell
83        do ks=1,nspec
84          if ((abs(deposit(ks)).gt.0).and.DRYDEPSPEC(ks)) then
85!        print*,ix,jy,ks,kp,nunc,nage
86            if ((ix.ge.0).and.(jy.ge.0).and.(ix.le.numxgridn-1).and. &
87                                      (jy.le.numygridn-1)) &
88        wetgriduncn(ix,jy,ks,kp,nunc,nage)= &
89          wetgriduncn(ix,jy,ks,kp,nunc,nage)+deposit(ks)
90          endif
91        enddo
92 else ! attribution via uniform kernel
93
94  ddx=xl-real(ix)                   ! distance to left cell border
95  ddy=yl-real(jy)                   ! distance to lower cell border
96
97  if (ddx.gt.0.5) then
98    ixp=ix+1
99    wx=1.5-ddx
100  else
101    ixp=ix-1
102    wx=0.5+ddx
103  endif
104
105  if (ddy.gt.0.5) then
106    jyp=jy+1
107    wy=1.5-ddy
108  else
109    jyp=jy-1
110    wy=0.5+ddy
111  endif
112
113
114  ! Determine mass fractions for four grid points
115  !**********************************************
116
117  do ks=1,nspec
118
119  if ((ix.ge.0).and.(jy.ge.0).and.(ix.le.numxgridn-1).and. &
120       (jy.le.numygridn-1)) then
121    w=wx*wy
122      wetgriduncn(ix,jy,ks,kp,nunc,nage)= &
123           wetgriduncn(ix,jy,ks,kp,nunc,nage)+deposit(ks)*w
124  endif
125
126  if ((ixp.ge.0).and.(jyp.ge.0).and.(ixp.le.numxgridn-1).and. &
127       (jyp.le.numygridn-1)) then
128    w=(1.-wx)*(1.-wy)
129      wetgriduncn(ixp,jyp,ks,kp,nunc,nage)= &
130           wetgriduncn(ixp,jyp,ks,kp,nunc,nage)+deposit(ks)*w
131  endif
132
133  if ((ixp.ge.0).and.(jy.ge.0).and.(ixp.le.numxgridn-1).and. &
134       (jy.le.numygridn-1)) then
135    w=(1.-wx)*wy
136      wetgriduncn(ixp,jy,ks,kp,nunc,nage)= &
137           wetgriduncn(ixp,jy,ks,kp,nunc,nage)+deposit(ks)*w
138  endif
139
140  if ((ix.ge.0).and.(jyp.ge.0).and.(ix.le.numxgridn-1).and. &
141       (jyp.le.numygridn-1)) then
142    w=wx*(1.-wy)
143      wetgriduncn(ix,jyp,ks,kp,nunc,nage)= &
144           wetgriduncn(ix,jyp,ks,kp,nunc,nage)+deposit(ks)*w
145  endif
146
147  end do
148  endif !kernel
149
150end subroutine wetdepokernel_nest
Note: See TracBrowser for help on using the repository browser.
hosted by ZAMG