[16] | 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 | subroutine plumetraj(itime) |
---|
| 24 | ! i |
---|
| 25 | !******************************************************************************* |
---|
| 26 | ! * |
---|
| 27 | ! Note: This is the FLEXPART_WRF version of subroutine plumetraj. * |
---|
| 28 | ! The computational grid is the WRF x-y grid rather than lat-lon. * |
---|
| 29 | ! * |
---|
| 30 | ! Determines a plume centroid trajectory for each release site, and manages * |
---|
| 31 | ! clustering of particle locations. Certain parameters (average PV, * |
---|
| 32 | ! tropopause height, etc., are provided along the plume trajectories. * |
---|
| 33 | ! At the end, output is written to file 'trajectories.txt'. * |
---|
| 34 | ! * |
---|
| 35 | ! Author: A. Stohl * |
---|
| 36 | ! * |
---|
| 37 | ! 24 January 2002 * |
---|
| 38 | ! * |
---|
| 39 | ! 26 Oct 2005, R. Easter - changes associated with WRF horizontal grid. * |
---|
| 40 | ! Calculate the distance between 2 points directly * |
---|
| 41 | ! instead of using the distance function. * |
---|
| 42 | ! Dec 2005, R. Easter - changed names of "*lon0*" & "*lat0*" variables * |
---|
| 43 | ! 2011 - J brioude: modified to have better output format * |
---|
| 44 | !******************************************************************************* |
---|
| 45 | ! * |
---|
| 46 | ! Variables: * |
---|
| 47 | ! fclust fraction of particles belonging to each cluster * |
---|
| 48 | ! hmixcenter mean mixing height for all particles * |
---|
| 49 | ! ncluster number of clusters to be used * |
---|
| 50 | ! pvcenter mean PV for all particles * |
---|
| 51 | ! pvfract fraction of particles with PV<2pvu * |
---|
| 52 | ! rms total horizontal rms distance after clustering * |
---|
| 53 | ! rmsdist total horizontal rms distance before clustering * |
---|
| 54 | ! rmsclust horizontal rms distance for each individual cluster * |
---|
| 55 | ! topocenter mean topography underlying all particles * |
---|
| 56 | ! tropocenter mean tropopause height at the positions of particles * |
---|
| 57 | ! tropofract fraction of particles within the troposphere * |
---|
| 58 | ! zrms total vertical rms distance after clustering * |
---|
| 59 | ! zrmsdist total vertical rms distance before clustering * |
---|
| 60 | ! xclust,yclust, Cluster centroid positions * |
---|
| 61 | ! zclust * |
---|
| 62 | ! * |
---|
| 63 | !******************************************************************************* |
---|
| 64 | |
---|
| 65 | use point_mod |
---|
| 66 | use par_mod |
---|
| 67 | use com_mod |
---|
| 68 | |
---|
| 69 | |
---|
| 70 | integer :: itime,ix,jy,ixp,jyp,indexh,i,j,k,m,n,il,ind,indz,indzp |
---|
| 71 | real :: xl(maxpart),yl(maxpart),zl(maxpart) |
---|
| 72 | real :: xcenter,ycenter,zcenter,dist,distance,rmsdist,zrmsdist |
---|
| 73 | |
---|
| 74 | real :: xclust(ncluster),yclust(ncluster),zclust(ncluster) |
---|
| 75 | real :: fclust(ncluster),rms,rmsclust(ncluster),zrms |
---|
| 76 | |
---|
| 77 | real :: dt1,dt2,dtt,ddx,ddy,rddx,rddy,p1,p2,p3,p4,dz1,dz2,dz |
---|
| 78 | real :: topo,topocenter,hm(2),hmixi,hmixfract,hmixcenter |
---|
| 79 | real :: pv1(2),pvprof(2),pvi,pvcenter,pvfract,tr(2),tri,tropofract |
---|
| 80 | real :: tropocenter |
---|
| 81 | |
---|
| 82 | real :: xlon,ylat,xtmp,ytmp |
---|
| 83 | |
---|
| 84 | dt1=real(itime-memtime(1)) |
---|
| 85 | dt2=real(memtime(2)-itime) |
---|
| 86 | dtt=1./(dt1+dt2) |
---|
| 87 | |
---|
| 88 | |
---|
| 89 | ! Loop about all release points |
---|
| 90 | !****************************** |
---|
| 91 | |
---|
| 92 | do j=1,numpoint |
---|
| 93 | if (abs(ireleasestart(j)-itime).gt.lage(nageclass)) goto 10 |
---|
| 94 | topocenter=0. |
---|
| 95 | hmixcenter=0. |
---|
| 96 | hmixfract=0. |
---|
| 97 | tropocenter=0. |
---|
| 98 | tropofract=0. |
---|
| 99 | pvfract=0. |
---|
| 100 | pvcenter=0. |
---|
| 101 | rmsdist=0. |
---|
| 102 | zrmsdist=0. |
---|
| 103 | |
---|
| 104 | n=0 |
---|
| 105 | do i=1,numpart |
---|
| 106 | if (itra1(i).ne.itime) goto 20 |
---|
| 107 | if (npoint(i).ne.j) goto 20 |
---|
| 108 | n=n+1 |
---|
| 109 | xl(n)=xmet0+xtra1(i)*dx |
---|
| 110 | yl(n)=ymet0+ytra1(i)*dy |
---|
| 111 | zl(n)=ztra1(i) |
---|
| 112 | |
---|
| 113 | |
---|
| 114 | ! Interpolate PBL height, PV, and tropopause height to each |
---|
| 115 | ! particle position in order to determine fraction of particles |
---|
| 116 | ! within the PBL, above tropopause height, and average PV. |
---|
| 117 | ! Interpolate topography, too, and convert to altitude asl |
---|
| 118 | !************************************************************** |
---|
| 119 | |
---|
| 120 | ix=int(xtra1(i)) |
---|
| 121 | jy=int(ytra1(i)) |
---|
| 122 | ixp=ix+1 |
---|
| 123 | jyp=jy+1 |
---|
| 124 | ddx=xtra1(i)-real(ix) |
---|
| 125 | ddy=ytra1(i)-real(jy) |
---|
| 126 | rddx=1.-ddx |
---|
| 127 | rddy=1.-ddy |
---|
| 128 | p1=rddx*rddy |
---|
| 129 | p2=ddx*rddy |
---|
| 130 | p3=rddx*ddy |
---|
| 131 | p4=ddx*ddy |
---|
| 132 | |
---|
| 133 | ! Topography |
---|
| 134 | !*********** |
---|
| 135 | topo=p1*oro(ix ,jy) & |
---|
| 136 | + p2*oro(ixp,jy) & |
---|
| 137 | + p3*oro(ix ,jyp) & |
---|
| 138 | + p4*oro(ixp,jyp) |
---|
| 139 | topocenter=topocenter+topo |
---|
| 140 | |
---|
| 141 | ! Potential vorticity |
---|
| 142 | !******************** |
---|
| 143 | |
---|
| 144 | do il=2,nz |
---|
| 145 | if (height(il).gt.zl(n)) then |
---|
| 146 | indz=il-1 |
---|
| 147 | indzp=il |
---|
| 148 | goto 6 |
---|
| 149 | endif |
---|
| 150 | end do |
---|
| 151 | 6 continue |
---|
| 152 | |
---|
| 153 | dz1=zl(n)-height(indz) |
---|
| 154 | dz2=height(indzp)-zl(n) |
---|
| 155 | dz=1./(dz1+dz2) |
---|
| 156 | |
---|
| 157 | do ind=indz,indzp |
---|
| 158 | do m=1,2 |
---|
| 159 | indexh=memind(m) |
---|
| 160 | pv1(m)=p1*pv(ix ,jy ,ind,indexh) & |
---|
| 161 | +p2*pv(ixp,jy ,ind,indexh) & |
---|
| 162 | +p3*pv(ix ,jyp,ind,indexh) & |
---|
| 163 | +p4*pv(ixp,jyp,ind,indexh) |
---|
| 164 | end do |
---|
| 165 | pvprof(ind-indz+1)=(pv1(1)*dt2+pv1(2)*dt1)*dtt |
---|
| 166 | end do |
---|
| 167 | pvi=(dz1*pvprof(2)+dz2*pvprof(1))*dz |
---|
| 168 | pvcenter=pvcenter+pvi |
---|
| 169 | if (yl(n).gt.0.) then |
---|
| 170 | if (pvi.lt.2.) pvfract=pvfract+1. |
---|
| 171 | else |
---|
| 172 | if (pvi.gt.-2.) pvfract=pvfract+1. |
---|
| 173 | endif |
---|
| 174 | |
---|
| 175 | ! Tropopause and PBL height |
---|
| 176 | !************************** |
---|
| 177 | |
---|
| 178 | do m=1,2 |
---|
| 179 | indexh=memind(m) |
---|
| 180 | |
---|
| 181 | tr(m)=p1*tropopause(ix ,jy ,1,indexh) & |
---|
| 182 | + p2*tropopause(ixp,jy ,1,indexh) & |
---|
| 183 | + p3*tropopause(ix ,jyp,1,indexh) & |
---|
| 184 | + p4*tropopause(ixp,jyp,1,indexh) |
---|
| 185 | |
---|
| 186 | hm(m)=p1*hmix(ix ,jy ,1,indexh) & |
---|
| 187 | + p2*hmix(ixp,jy ,1,indexh) & |
---|
| 188 | + p3*hmix(ix ,jyp,1,indexh) & |
---|
| 189 | + p4*hmix(ixp,jyp,1,indexh) |
---|
| 190 | end do |
---|
| 191 | |
---|
| 192 | hmixi=(hm(1)*dt2+hm(2)*dt1)*dtt |
---|
| 193 | tri=(tr(1)*dt2+tr(2)*dt1)*dtt |
---|
| 194 | if (zl(n).lt.tri) tropofract=tropofract+1. |
---|
| 195 | tropocenter=tropocenter+tri+topo |
---|
| 196 | if (zl(n).lt.hmixi) hmixfract=hmixfract+1. |
---|
| 197 | zl(n)=zl(n)+topo ! convert to height asl |
---|
| 198 | hmixcenter=hmixcenter+hmixi |
---|
| 199 | |
---|
| 200 | |
---|
| 201 | 20 continue |
---|
| 202 | end do |
---|
| 203 | |
---|
| 204 | |
---|
| 205 | ! Make statistics for all plumes with n>0 particles |
---|
| 206 | !************************************************** |
---|
| 207 | |
---|
| 208 | if (n.gt.0) then |
---|
| 209 | topocenter=topocenter/real(n) |
---|
| 210 | hmixcenter=hmixcenter/real(n) |
---|
| 211 | pvcenter=pvcenter/real(n) |
---|
| 212 | tropocenter=tropocenter/real(n) |
---|
| 213 | hmixfract=100.*hmixfract/real(n) |
---|
| 214 | pvfract=100.*pvfract/real(n) |
---|
| 215 | tropofract=100.*tropofract/real(n) |
---|
| 216 | |
---|
| 217 | ! Cluster the particle positions |
---|
| 218 | !******************************* |
---|
| 219 | |
---|
| 220 | call clustering(xl,yl,zl,n,xclust,yclust,zclust,fclust,rms, & |
---|
| 221 | rmsclust,zrms) |
---|
| 222 | |
---|
| 223 | |
---|
| 224 | ! Determine center of mass position on earth and average height |
---|
| 225 | !************************************************************** |
---|
| 226 | |
---|
| 227 | call centerofmass(xl,yl,n,xcenter,ycenter) |
---|
| 228 | call mean(zl,zcenter,zrmsdist,n) |
---|
| 229 | |
---|
| 230 | ! Root mean square distance from center of mass |
---|
| 231 | !********************************************** |
---|
| 232 | |
---|
| 233 | do k=1,n |
---|
| 234 | ! for FLEXPART_WRF, x,y coords are in meters, so xl,yl are in meters |
---|
| 235 | ! dist=distance(yl(k),xl(k),ycenter,xcenter) |
---|
| 236 | !jdf |
---|
| 237 | ! if (outgrid_option .eq. 1) then |
---|
| 238 | dist=sqrt( (yl(k)-ycenter)**2 + (xl(k)-xcenter)**2 ) |
---|
| 239 | rmsdist=rmsdist+dist*dist |
---|
| 240 | ! endif |
---|
| 241 | enddo |
---|
| 242 | ! if (outgrid_option .eq. 0) then |
---|
| 243 | xtmp = xcenter |
---|
| 244 | ytmp = ycenter |
---|
| 245 | call xymeter_to_ll_wrf( xtmp, ytmp, xlon, ylat ) |
---|
| 246 | xcenter = xlon |
---|
| 247 | ycenter = ylat |
---|
| 248 | |
---|
| 249 | ! xtmp = xl(k) |
---|
| 250 | ! ytmp = yl(k) |
---|
| 251 | ! call xymeter_to_ll_wrf( xtmp, ytmp, xlon, ylat ) |
---|
| 252 | ! dist=sqrt( (ylat-ycenter)**2 + (xlon-xcenter)**2 ) |
---|
| 253 | ! rmsdist=rmsdist+dist*dist |
---|
| 254 | ! endif |
---|
| 255 | !jdf |
---|
| 256 | |
---|
| 257 | ! end do |
---|
| 258 | do k=1,ncluster |
---|
| 259 | ! if (outgrid_option .eq. 0) then |
---|
| 260 | xtmp = xclust(k) |
---|
| 261 | ytmp = yclust(k) |
---|
| 262 | call xymeter_to_ll_wrf( xtmp, ytmp, xlon, ylat ) |
---|
| 263 | xclust(k) = xlon |
---|
| 264 | yclust(k) = ylat |
---|
| 265 | ! endif |
---|
| 266 | ! print*,xclust(k),yclust(k) |
---|
| 267 | enddo |
---|
| 268 | if (rmsdist.gt.0.) rmsdist=sqrt(rmsdist/real(n)) |
---|
| 269 | rmsdist=max(rmsdist,0.) |
---|
| 270 | |
---|
| 271 | ! Write out results in trajectory data file |
---|
| 272 | !****************************************** |
---|
| 273 | |
---|
| 274 | write(unitouttraj,'(i5,1x,i8,1x,2f9.4,1x,4f8.1,1x,f8.2,1x,4f8.1,1x,3f6.1,& |
---|
| 275 | &5(1x,2f9.3,1x,f7.0,1x,f6.1,1x,f8.1))')& |
---|
| 276 | &j,itime-(ireleasestart(j)+ireleaseend(j))/2, & |
---|
| 277 | xcenter,ycenter,zcenter,topocenter,hmixcenter,tropocenter, & |
---|
| 278 | pvcenter,rmsdist,rms,zrmsdist,zrms,hmixfract,pvfract, & |
---|
| 279 | tropofract, & |
---|
| 280 | (xclust(k),yclust(k),zclust(k),fclust(k),rmsclust(k), & |
---|
| 281 | k=1,ncluster) |
---|
| 282 | endif |
---|
| 283 | |
---|
| 284 | |
---|
| 285 | |
---|
| 286 | 10 continue |
---|
| 287 | enddo |
---|
| 288 | |
---|
| 289 | end subroutine plumetraj |
---|
| 290 | |
---|