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

Last change on this file since 16 was 16, checked in by jebri, 10 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!***********************************************************************
23subroutine drydepokernel(nunc,deposit,x,y,itage,nage,kp)
24  !                          i      i    i i  i
25  !*****************************************************************************
26  !                                                                            *
27  !     Attribution of the deposition to the grid using a uniform kernel with  *
28  !     bandwidths dx and dy.                                                  *
29  !                                                                            *
30  !     Author: A. Stohl                                                       *
31  !                                                                            *
32  !     26 December 1996                                                       *
33  !
34  !     D. Arnold: modification to skip the kernel the first 3 hours.
35  !     then, modification to a regular lat-lon.
36  !
37  !                                                                            *
38  !*****************************************************************************
39  !                                                                            *
40  ! Variables:                                                                 *
41  !                                                                            *
42  ! nunc             uncertainty class of the respective particle              *
43  ! nage             age class of the respective particle                      *
44  ! deposit          amount (kg) to be deposited                               *
45  !                                                                            *
46  !*****************************************************************************
47
48  use unc_mod
49  use par_mod
50  use com_mod
51
52  implicit none
53
54  real :: x,y,deposit(maxspec),ddx,ddy,xl,yl,wx,wy,w
55  integer :: ix,jy,ixp,jyp,ks,nunc,nage,kp
56! CDA new declarations
57   real :: rhoprof(2),rhoi,xlon,ylat,xl2,yl2
58   integer :: itage
59! CDA
60
61!JB
62  if (outgrid_option.eq.0) then
63! CDA
64  xl=(x*dx+xoutshift)/dxout
65  yl=(y*dy+youtshift)/dyout
66  elseif (outgrid_option.eq.1) then
67! CDA new code:
68  xl2=x*dx+xmet0
69  yl2=y*dy+ymet0
70  call xymeter_to_ll_wrf(xl2,yl2,xlon,ylat)
71  xl=(xlon-outlon0)/dxoutl
72  yl=(ylat-outlat0)/dyoutl
73  endif
74
75
76  ix=int(xl)
77  jy=int(yl)
78
79! CDA skip kernel
80      if (itage.lt.7200) then ! no kernel, direct attribution to grid cell
81        do ks=1,nspec
82          if ((abs(deposit(ks)).gt.0).and.DRYDEPSPEC(ks)) then
83!$OMP CRITICAL
84            if ((ix.ge.0).and.(jy.ge.0).and.(ix.le.numxgrid-1).and. &
85                                      (jy.le.numygrid-1)) &
86        drygridunc2(ix,jy,ks,kp,nunc,nage)= &
87          drygridunc2(ix,jy,ks,kp,nunc,nage)+deposit(ks)
88!$OMP END CRITICAL
89          endif
90        enddo       
91 else ! attribution via uniform kernel
92
93  ddx=xl-real(ix)                   ! distance to left cell border
94  ddy=yl-real(jy)                   ! distance to lower cell border
95
96  if (ddx.gt.0.5) then
97    ixp=ix+1
98    wx=1.5-ddx
99  else
100    ixp=ix-1
101    wx=0.5+ddx
102  endif
103
104  if (ddy.gt.0.5) then
105    jyp=jy+1
106    wy=1.5-ddy
107  else
108    jyp=jy-1
109    wy=0.5+ddy
110  endif
111
112
113  ! Determine mass fractions for four grid points
114  !**********************************************
115    do ks=1,nspec
116
117    if ((abs(deposit(ks)).gt.0).and.DRYDEPSPEC(ks)) then
118
119   if ((ix.ge.0).and.(jy.ge.0).and.(ix.le.numxgrid-1).and.(jy.le.numygrid-1)) then
120    w=wx*wy
121!$OMP CRITICAL
122       drygridunc2(ix,jy,ks,kp,nunc,nage)= &
123            drygridunc2(ix,jy,ks,kp,nunc,nage)+deposit(ks)*w
124!$OMP END CRITICAL
125      continue
126  endif
127
128  if ((ixp.ge.0).and.(jyp.ge.0).and.(ixp.le.numxgrid-1).and. &
129       (jyp.le.numygrid-1)) then
130    w=(1.-wx)*(1.-wy)
131!$OMP CRITICAL
132      drygridunc2(ixp,jyp,ks,kp,nunc,nage)= &
133           drygridunc2(ixp,jyp,ks,kp,nunc,nage)+deposit(ks)*w
134!$OMP END CRITICAL
135  endif
136
137  if ((ixp.ge.0).and.(jy.ge.0).and.(ixp.le.numxgrid-1).and. &
138       (jy.le.numygrid-1)) then
139   w=(1.-wx)*wy
140!$OMP CRITICAL
141      drygridunc2(ixp,jy,ks,kp,nunc,nage)= &
142           drygridunc2(ixp,jy,ks,kp,nunc,nage)+deposit(ks)*w
143!$OMP END CRITICAL
144  endif
145
146  if ((ix.ge.0).and.(jyp.ge.0).and.(ix.le.numxgrid-1).and. &
147       (jyp.le.numygrid-1)) then
148     w=wx*(1.-wy)
149!$OMP CRITICAL
150      drygridunc2(ix,jyp,ks,kp,nunc,nage)= &
151            drygridunc2(ix,jyp,ks,kp,nunc,nage)+deposit(ks)*w
152!$OMP END CRITICAL
153  endif
154
155  endif
156
157    end do
158
159  endif !kernel
160end subroutine drydepokernel
Note: See TracBrowser for help on using the repository browser.
hosted by ZAMG