source: branches/jerome/src_flexwrf_v3.1/wetdepokernel.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.7 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(nunc,deposit,x,y,itage,nage,kp)
25  !                          i      i    i i  i
26  !*****************************************************************************
27  !                                                                            *
28  !     Attribution of the deposition from an individual particle to the       *
29  !     deposition fields using a uniform kernel with bandwidths dxout and dyout.*
30  !                                                                            *
31  !     Author: A. Stohl                                                       *
32  !                                                                            *
33  !     26 December 1996                                                       *
34  !
35  !     D. Arnold: modification to skip the kernel the first 3 hours.
36  !     then, modification to a regular lat-lon.
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,nunc,nage,ks,kp
55! CDA new declarations
56   real :: rhoprof(2),rhoi,xlon,ylat,xl2,yl2
57   integer :: itage
58!JB
59  if (outgrid_option.eq.0) then
60! CDA
61  xl=(x*dx+xoutshift)/dxout
62  yl=(y*dy+youtshift)/dyout
63  elseif (outgrid_option.eq.1) then
64! CDA new code:
65  xl2=x*dx+xmet0
66  yl2=y*dy+ymet0
67  call xymeter_to_ll_wrf(xl2,yl2,xlon,ylat)
68  xl=(xlon-outlon0)/dxoutl
69  yl=(ylat-outlat0)/dyoutl
70  endif
71
72  ix=int(xl)
73  jy=int(yl)
74!JB I don't know what this thing is suppose to do, but I put it here in case it is necessary
75! see for instance conccalc_reg.f90
76!      ix=int(xl)
77!      if (xl.lt.0.) ix=ix-1
78!      jy=int(yl)
79!      if (yl.lt.0.) jy=jy-1
80!
81
82! CDA skip kernelfor some hours to prevent smoothing close to source
83   if (itage.lt.7200) then ! no kernel, direct attribution to grid cell
84    do ks=1,nspec
85      if ((ix.ge.0).and.(jy.ge.0).and.(ix.le.numxgrid-1).and. &
86                                   (jy.le.numygrid-1)) &
87                    wetgridunc(ix,jy,ks,kp,nunc,nage)= &
88              wetgridunc(ix,jy,ks,kp,nunc,nage)+deposit(ks)
89    enddo   
90   else ! attribution via  uniform kernel
91
92  ddx=xl-real(ix)                   ! distance to left cell border
93  ddy=yl-real(jy)                   ! distance to lower cell border
94
95  if (ddx.gt.0.5) then
96    ixp=ix+1
97    wx=1.5-ddx
98  else
99    ixp=ix-1
100    wx=0.5+ddx
101  endif
102
103  if (ddy.gt.0.5) then
104    jyp=jy+1
105    wy=1.5-ddy
106  else
107    jyp=jy-1
108    wy=0.5+ddy
109  endif
110
111
112  ! Determine mass fractions for four grid points
113  !**********************************************
114
115  do ks=1,nspec
116
117  if ((ix.ge.0).and.(jy.ge.0).and.(ix.le.numxgrid-1).and. &
118       (jy.le.numygrid-1)) then
119    w=wx*wy
120      wetgridunc(ix,jy,ks,kp,nunc,nage)= &
121           wetgridunc(ix,jy,ks,kp,nunc,nage)+deposit(ks)*w
122  endif
123
124  if ((ixp.ge.0).and.(jyp.ge.0).and.(ixp.le.numxgrid-1).and. &
125       (jyp.le.numygrid-1)) then
126    w=(1.-wx)*(1.-wy)
127      wetgridunc(ixp,jyp,ks,kp,nunc,nage)= &
128           wetgridunc(ixp,jyp,ks,kp,nunc,nage)+deposit(ks)*w
129  endif
130
131  if ((ixp.ge.0).and.(jy.ge.0).and.(ixp.le.numxgrid-1).and. &
132       (jy.le.numygrid-1)) then
133    w=(1.-wx)*wy
134      wetgridunc(ixp,jy,ks,kp,nunc,nage)= &
135           wetgridunc(ixp,jy,ks,kp,nunc,nage)+deposit(ks)*w
136  endif
137
138  if ((ix.ge.0).and.(jyp.ge.0).and.(ix.le.numxgrid-1).and. &
139       (jyp.le.numygrid-1)) then
140    w=wx*(1.-wy)
141      wetgridunc(ix,jyp,ks,kp,nunc,nage)= &
142           wetgridunc(ix,jyp,ks,kp,nunc,nage)+deposit(ks)*w
143  endif
144  end do
145
146  endif ! Kernel
147end subroutine wetdepokernel
Note: See TracBrowser for help on using the repository browser.
hosted by ZAMG