source: branches/jerome/src_flexwrf_v3.1/drydepokernel_nest.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: 6.0 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_nest(nunc,deposit,x,y,itage,nage,kp)
24  !                               i      i    i i  i
25  !*****************************************************************************
26  !                                                                            *
27  !     Attribution of the deposition from an individual particle to the       *
28  !     nested deposition fields using a uniform kernel with bandwidths        *
29  !     dxoutn and dyoutn.                                                     *
30  !                                                                            *
31  !     Author: A. Stohl                                                       *
32  !                                                                            *
33  !     26 December 1996                                                       *
34  !                                                                            *
35  !      2 September 2004: Adaptation from drydepokernel.                      *
36  !                                                                            *
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,ks,kp,nunc,nage
55! CDA new declarations
56   real :: rhoprof(2),rhoi,xlon,ylat,xl2,yl2
57   integer :: itage
58! CDA
59
60
61!JB
62  if (outgrid_option.eq.0) then
63! CDA
64  xl=(x*dx+xoutshiftn)/dxoutn
65  yl=(y*dy+youtshiftn)/dyoutn
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-outlon0n)/dxoutln
72  yl=(ylat-outlat0n)/dyoutln
73  endif
74
75  ix=int(xl)
76  jy=int(yl)
77
78! CDA skip kernel
79      if (itage.lt.7200) then ! no kernel, direct attribution to grid cell
80        do ks=1,nspec
81          if ((abs(deposit(ks)).gt.0).and.DRYDEPSPEC(ks)) then
82!$OMP CRITICAL
83            if ((ix.ge.0).and.(jy.ge.0).and.(ix.le.numxgridn-1).and. &
84                                      (jy.le.numygridn-1)) &
85        drygriduncn2(ix,jy,ks,kp,nunc,nage)= &
86          drygriduncn2(ix,jy,ks,kp,nunc,nage)+deposit(ks)
87!$OMP END CRITICAL
88          endif
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    do ks=1,nspec
115
116  if (DRYDEPSPEC(ks).and.(abs(deposit(ks)).gt.0)) then
117
118  if ((ix.ge.0).and.(jy.ge.0).and.(ix.le.numxgridn-1).and. &
119       (jy.le.numygridn-1)) then
120    w=wx*wy
121!$OMP CRITICAL
122      drygriduncn2(ix,jy,ks,kp,nunc,nage)= &
123           drygriduncn2(ix,jy,ks,kp,nunc,nage)+deposit(ks)*w
124!$OMP END CRITICAL
125  endif
126
127  if ((ixp.ge.0).and.(jyp.ge.0).and.(ixp.le.numxgridn-1).and. &
128       (jyp.le.numygridn-1)) then
129    w=(1.-wx)*(1.-wy)
130!$OMP CRITICAL
131      drygriduncn2(ixp,jyp,ks,kp,nunc,nage)= &
132           drygriduncn2(ixp,jyp,ks,kp,nunc,nage)+deposit(ks)*w
133!$OMP END CRITICAL
134  endif
135
136  if ((ixp.ge.0).and.(jy.ge.0).and.(ixp.le.numxgridn-1).and. &
137       (jy.le.numygridn-1)) then
138    w=(1.-wx)*wy
139!$OMP CRITICAL
140      drygriduncn2(ixp,jy,ks,kp,nunc,nage)= &
141           drygriduncn2(ixp,jy,ks,kp,nunc,nage)+deposit(ks)*w
142!$OMP END CRITICAL
143  endif
144
145  if ((ix.ge.0).and.(jyp.ge.0).and.(ix.le.numxgridn-1).and. &
146       (jyp.le.numygridn-1)) then
147    w=wx*(1.-wy)
148!$OMP CRITICAL
149      drygriduncn2(ix,jyp,ks,kp,nunc,nage)= &
150           drygriduncn2(ix,jyp,ks,kp,nunc,nage)+deposit(ks)*w
151!$OMP END CRITICAL
152  endif
153
154  endif
155
156    end do
157  endif !kernel
158
159end subroutine drydepokernel_nest
Note: See TracBrowser for help on using the repository browser.
hosted by ZAMG