Changeset 5844866 in flexpart.git
- Timestamp:
- Oct 12, 2016, 1:14:19 PM (8 years ago)
- Branches:
- master, 10.4.1_pesei, GFS_025, bugfixes+enhancements, dev, release-10, release-10.4.1, scaling-bug, univie
- Children:
- df4a68e
- Parents:
- 0581cac
- Location:
- src
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
src/advance.f90
ra652cd5 r5844866 569 569 prob(ks)=1.+(prob(ks)-1.)* & 570 570 exp(-vdepo(ks)*abs(dt)/(2.*href)) 571 ! write(*,*) 'Prob calc: ',zt,href,prob(ks) 571 572 endif 572 573 end do -
src/advance_rec.f90
rdced13c r5844866 20 20 !********************************************************************** 21 21 22 subroutine advance_rec(itime,nrelpoint,ldt,up,vp,wp, & 23 usigold,vsigold,wsigold,nstop,xt,yt,zt,prob,icbt) 24 ! i i i/oi/oi/o 25 ! i/o i/o i/o o i/oi/oi/o i/o i/o 22 subroutine advance_rec(itime,xt,yt,zt,prob) 23 ! i i i i o 26 24 !***************************************************************************** 27 25 ! * … … 66 64 ! * 67 65 ! Variables: * 68 ! icbt 1 if particle not transferred to forbidden state, *69 ! else -1 *70 ! dawsave accumulated displacement in along-wind direction *71 ! dcwsave accumulated displacement in cross-wind direction *72 ! dxsave accumulated displacement in longitude *73 ! dysave accumulated displacement in latitude *74 ! h [m] Mixing height *75 ! lwindinterv [s] time interval between two wind fields *76 66 ! itime [s] time at which this subroutine is entered * 77 67 ! itimec [s] actual time, which is incremented in this subroutine * 78 68 ! href [m] height for which dry deposition velocity is calculated * 79 ! ladvance [s] Total integration time period *80 69 ! ldirect 1 forward, -1 backward * 81 70 ! ldt [s] Time step for the next integration * 82 71 ! lsynctime [s] Synchronisation interval of FLEXPART * 83 72 ! ngrid index which grid is to be used * 84 ! nrand index for a variable to be picked from rannumb *85 ! nstop if > 1 particle has left domain and must be stopped *86 73 ! prob probability of absorption due to dry deposition * 87 ! rannumb(maxrand) normally distributed random variables *88 ! rhoa air density *89 ! rhograd vertical gradient of the air density *90 ! up,vp,wp random velocities due to turbulence (along wind, cross *91 ! wind, vertical wind *92 ! usig,vsig,wsig mesoscale wind fluctuations *93 ! usigold,vsigold,wsigold like usig, etc., but for the last time step *94 74 ! vdepo Deposition velocities for all species * 95 75 ! xt,yt,zt Particle position * … … 101 81 use com_mod 102 82 use interpol_mod 103 use hanna_mod104 use cmapf_mod105 use random_mod, only: ran3106 83 107 84 implicit none 108 85 109 86 real(kind=dp) :: xt,yt 110 real :: zt,xts,yts,weight 111 integer :: itime,itimec,nstop,ldt,i,j,k,nrand,loop,memindnext,mind 112 integer :: ngr,nix,njy,ks,nsp,nrelpoint 113 real :: dz,dz1,dz2,xlon,ylat,xpol,ypol,gridsize 114 real :: ru,rv,rw,dt,ux,vy,cosfact,xtn,ytn,tropop 115 real :: prob(maxspec),up,vp,wp,dxsave,dysave,dawsave 116 real :: dcwsave 117 real :: usigold,vsigold,wsigold,r,rs 118 real :: uold,vold,wold,vdepo(maxspec) 119 !real uprof(nzmax),vprof(nzmax),wprof(nzmax) 120 !real usigprof(nzmax),vsigprof(nzmax),wsigprof(nzmax) 121 !real rhoprof(nzmax),rhogradprof(nzmax) 122 real :: rhoa,rhograd,delz,dtf,rhoaux,dtftlw,uxscale,wpscale 123 integer(kind=2) :: icbt 124 real,parameter :: eps=nxmax/3.e5,eps2=1.e-9 125 real :: ptot_lhh,Q_lhh,phi_lhh,ath,bth !modified by mc 126 real :: old_wp_buf,dcas,dcas1,del_test !added by mc 127 integer :: i_well,jj,flagrein !test well mixed: modified by mc 128 129 130 integer :: idummy = -7 131 real :: settling = 0. 132 133 134 nstop=0 135 do i=1,nmixz 136 indzindicator(i)=.true. 137 end do 138 87 real :: zt,xtn,ytn 88 integer :: itime,i,j,k,memindnext 89 integer :: nix,njy,ks 90 real :: prob(maxspec),vdepo(maxspec) 91 real,parameter :: eps=nxmax/3.e5 139 92 140 93 if (DRYDEP) then ! reset probability for deposition … … 144 97 end do 145 98 endif 146 147 dxsave=0. ! reset position displacements148 dysave=0. ! due to mean wind149 dawsave=0. ! and turbulent wind150 dcwsave=0.151 152 itimec=itime153 154 nrand=int(ran3(idummy)*real(maxrand-1))+1155 99 156 100 … … 207 151 208 152 209 ! Compute maximum mixing height around particle position210 !*******************************************************211 212 h=0.213 if (ngrid.le.0) then214 do k=1,2215 mind=memind(k) ! eso: compatibility with 3-field version216 do j=jy,jyp217 do i=ix,ixp218 if (hmix(i,j,1,mind).gt.h) h=hmix(i,j,1,mind)219 end do220 end do221 end do222 tropop=tropopause(nix,njy,1,1)223 else224 do k=1,2225 mind=memind(k)226 do j=jy,jyp227 do i=ix,ixp228 if (hmixn(i,j,1,mind,ngrid).gt.h) h=hmixn(i,j,1,mind,ngrid)229 end do230 end do231 end do232 tropop=tropopausen(nix,njy,1,1,ngrid)233 endif234 235 zeta=zt/h236 237 238 239 !*************************************************************240 ! If particle is in the PBL, interpolate once and then make a241 ! time loop until end of interval is reached242 !*************************************************************243 244 if (zeta.le.1.) then245 246 ! BEGIN TIME LOOP247 !================248 249 loop=0250 100 loop=loop+1251 if (method.eq.1) then252 ldt=min(ldt,abs(lsynctime-itimec+itime))253 itimec=itimec+ldt*ldirect254 else255 ldt=abs(lsynctime)256 itimec=itime+lsynctime257 endif258 dt=real(ldt)259 260 zeta=zt/h261 262 263 if (loop.eq.1) then264 if (ngrid.le.0) then265 xts=real(xt)266 yts=real(yt)267 call interpol_all(itime,xts,yts,zt)268 else269 call interpol_all_nests(itime,xtn,ytn,zt)270 endif271 272 else273 274 275 ! Determine the level below the current position for u,v,rho276 !***********************************************************277 278 do i=2,nz279 if (height(i).gt.zt) then280 indz=i-1281 indzp=i282 goto 6283 endif284 end do285 6 continue286 287 ! If one of the levels necessary is not yet available,288 ! calculate it289 !*****************************************************290 291 do i=indz,indzp292 if (indzindicator(i)) then293 if (ngrid.le.0) then294 call interpol_misslev(i)295 else296 call interpol_misslev_nests(i)297 endif298 endif299 end do300 endif301 302 303 ! Vertical interpolation of u,v,w,rho and drhodz304 !***********************************************305 306 ! Vertical distance to the level below and above current position307 ! both in terms of (u,v) and (w) fields308 !****************************************************************309 310 dz=1./(height(indzp)-height(indz))311 dz1=(zt-height(indz))*dz312 dz2=(height(indzp)-zt)*dz313 314 u=dz1*uprof(indzp)+dz2*uprof(indz)315 v=dz1*vprof(indzp)+dz2*vprof(indz)316 w=dz1*wprof(indzp)+dz2*wprof(indz)317 rhoa=dz1*rhoprof(indzp)+dz2*rhoprof(indz)318 rhograd=dz1*rhogradprof(indzp)+dz2*rhogradprof(indz)319 320 321 ! Compute the turbulent disturbances322 ! Determine the sigmas and the timescales323 !****************************************324 325 if (turbswitch) then326 call hanna(zt)327 else328 call hanna1(zt)329 endif330 331 332 !*****************************************333 ! Determine the new diffusivity velocities334 !*****************************************335 336 ! Horizontal components337 !**********************338 339 if (nrand+1.gt.maxrand) nrand=1340 if (dt/tlu.lt..5) then341 up=(1.-dt/tlu)*up+rannumb(nrand)*sigu*sqrt(2.*dt/tlu)342 else343 ru=exp(-dt/tlu)344 up=ru*up+rannumb(nrand)*sigu*sqrt(1.-ru**2)345 endif346 if (dt/tlv.lt..5) then347 vp=(1.-dt/tlv)*vp+rannumb(nrand+1)*sigv*sqrt(2.*dt/tlv)348 else349 rv=exp(-dt/tlv)350 vp=rv*vp+rannumb(nrand+1)*sigv*sqrt(1.-rv**2)351 endif352 nrand=nrand+2353 354 355 if (nrand+ifine.gt.maxrand) nrand=1356 rhoaux=rhograd/rhoa357 dtf=dt*fine358 359 dtftlw=dtf/tlw360 361 ! Loop over ifine short time steps for vertical component362 !********************************************************363 364 do i=1,ifine365 366 ! Determine the drift velocity and density correction velocity367 !*************************************************************368 369 if (turbswitch) then370 if (dtftlw.lt..5) then371 !*************************************************************372 !************** CBL options added by mc see routine cblf90 ***373 if (cblflag.eq.1) then !modified by mc374 if (-h/ol.gt.5) then !modified by mc375 !if (ol.lt.0.) then !modified by mc376 !if (ol.gt.0.) then !modified by mc : for test377 !print *,zt,wp,ath,bth,tlw,dtf,'prima'378 flagrein=0379 nrand=nrand+1380 old_wp_buf=wp381 call cbl(wp,zt,ust,wst,h,rhoa,rhograd,sigw,dsigwdz,tlw,ptot_lhh,Q_lhh,phi_lhh,ath,bth,ol,flagrein) !inside the routine for inverse time382 wp=(wp+ath*dtf+bth*rannumb(nrand)*sqrt(dtf))*real(icbt)383 ! wp=(wp+ath*dtf+bth*gasdev2(mydum)*sqrt(dtf))*real(icbt)384 delz=wp*dtf385 if (flagrein.eq.1) then386 call re_initialize_particle(zt,ust,wst,h,sigw,old_wp_buf,nrand,ol)387 wp=old_wp_buf388 delz=wp*dtf389 nan_count=nan_count+1390 end if391 !print *,zt,wp,ath,bth,tlw,dtf,rannumb(nrand+i),icbt392 !pause393 else394 nrand=nrand+1395 old_wp_buf=wp396 ath=-wp/tlw+sigw*dsigwdz+wp*wp/sigw*dsigwdz+sigw*sigw/rhoa*rhograd !1-note for inverse time should be -wp/tlw*ldirect+... calculated for wp=-wp397 !2-but since ldirect =-1 for inverse time and this must be calculated for (-wp) and398 !3-the gaussian pdf is symmetric (i.e. pdf(w)=pdf(-w) ldirect can be discarded399 bth=sigw*rannumb(nrand)*sqrt(2.*dtftlw)400 wp=(wp+ath*dtf+bth)*real(icbt)401 delz=wp*dtf402 del_test=(1.-wp)/wp !catch infinity value403 if (isnan(wp).or.isnan(del_test)) then404 nrand=nrand+1405 wp=sigw*rannumb(nrand)406 delz=wp*dtf407 nan_count2=nan_count2+1408 !print *,'NaN coutner equal to:', nan_count,'reduce ifine if this number became a non-negligible fraction of the particle number'409 end if410 end if411 !******************** END CBL option *******************************412 !*******************************************************************413 else414 wp=((1.-dtftlw)*wp+rannumb(nrand+i)*sqrt(2.*dtftlw) &415 +dtf*(dsigwdz+rhoaux*sigw))*real(icbt)416 delz=wp*sigw*dtf417 end if418 else419 rw=exp(-dtftlw)420 wp=(rw*wp+rannumb(nrand+i)*sqrt(1.-rw**2) &421 +tlw*(1.-rw)*(dsigwdz+rhoaux*sigw))*real(icbt)422 delz=wp*sigw*dtf423 endif424 425 else426 rw=exp(-dtftlw)427 wp=(rw*wp+rannumb(nrand+i)*sqrt(1.-rw**2)*sigw &428 +tlw*(1.-rw)*(dsigw2dz+rhoaux*sigw**2))*real(icbt)429 delz=wp*dtf430 endif431 432 !****************************************************433 ! Compute turbulent vertical displacement of particle434 !****************************************************435 436 if (abs(delz).gt.h) delz=mod(delz,h)437 438 ! Determine if particle transfers to a "forbidden state" below the ground439 ! or above the mixing height440 !************************************************************************441 442 if (delz.lt.-zt) then ! reflection at ground443 icbt=-1444 zt=-zt-delz445 else if (delz.gt.(h-zt)) then ! reflection at h446 icbt=-1447 zt=-zt-delz+2.*h448 else ! no reflection449 icbt=1450 zt=zt+delz451 endif452 453 if (i.ne.ifine) then454 zeta=zt/h455 call hanna_short(zt)456 endif457 458 end do459 if (cblflag.ne.1) nrand=nrand+i460 461 ! Determine time step for next integration462 !*****************************************463 464 if (turbswitch) then465 ldt=int(min(tlw,h/max(2.*abs(wp*sigw),1.e-5), &466 0.5/abs(dsigwdz))*ctl)467 else468 ldt=int(min(tlw,h/max(2.*abs(wp),1.e-5))*ctl)469 endif470 ldt=max(ldt,mintime)471 472 153 ! Determine probability of deposition 473 154 !************************************ … … 487 168 ! where f(n) is the exponential term 488 169 prob(ks)=1.+(prob(ks)-1.)* & 489 exp(-vdepo(ks)*abs( dt)/(2.*href))170 exp(-vdepo(ks)*abs(ideltas)/(2.*href)) 490 171 endif 491 172 end do 492 173 endif 493 174 494 endif495 175 496 176 end subroutine advance_rec -
src/interpol_vdep.f90
re200b7a r5844866 54 54 55 55 ! a) Bilinear horizontal interpolation 56 56 ! write(*,*) 'interpol: ',dt1,dt2,dtt,lsynctime,ix,jy 57 57 do m=1,2 58 58 indexh=memind(m) -
src/par_mod.f90
r842074e r5844866 186 186 !************************************************** 187 187 188 integer,parameter :: maxpart= 20000000188 integer,parameter :: maxpart=40000000 189 189 integer,parameter :: maxspec=2 190 190 real,parameter :: minmass=0.0001 -
src/releaseparticles.f90
r54cbd6c r5844866 209 209 210 210 ztra1(ipart)=zpoint1(i)+ran1(idummy)*zaux 211 212 211 ! Interpolation of topography and density 213 212 !**************************************** -
src/timemanager.f90
r0581cac r5844866 107 107 integer :: ix,jy,ldeltat,itage,nage 108 108 integer :: i_nan=0,ii_nan,total_nan_intl=0 !added by mc to check instability in CBL scheme 109 real :: outnum,weight,prob (maxspec),decfact109 real :: outnum,weight,prob_rec(maxspec),prob(maxspec),decfact 110 110 ! real :: uap(maxpart),ucp(maxpart),uzp(maxpart) 111 111 ! real :: us(maxpart),vs(maxpart),ws(maxpart) … … 552 552 do ks=1,nspec 553 553 if ((xscav_frac1(j,ks).lt.0)) then 554 call advance_rec(itime,npoint(j),idt(j),uap(j),ucp(j),uzp(j), & 555 us(j),vs(j),ws(j),nstop,xtra1(j),ytra1(j),ztra1(j),prob, & 556 cbt(j)) 554 call advance_rec(itime,xtra1(j),ytra1(j),ztra1(j),prob_rec) 557 555 if (decay(ks).gt.0.) then ! radioactive decay 558 556 decfact=exp(-real(abs(lsynctime))*decay(ks)) … … 561 559 endif 562 560 if (DRYDEPSPEC(ks)) then ! dry deposition 563 drydeposit(ks)=xmass1(j,ks)*prob (ks)*decfact561 drydeposit(ks)=xmass1(j,ks)*prob_rec(ks)*decfact 564 562 xscav_frac1(j,ks)=xscav_frac1(j,ks)*(-1.)* & 565 563 drydeposit(ks)/xmass1(j,ks) 564 ! write (*,*) 'notance: ',prob(ks),xmass1(j,ks),ztra1(j) 566 565 if (decay(ks).gt.0.) then ! correct for decay (see wetdepo) 567 566 drydeposit(ks)=drydeposit(ks)* & … … 572 571 xscav_frac1(j,ks)=0. 573 572 endif 573 ! write (*,*) 'xscav: ',j,ks,xscav_frac1(j,ks) 574 574 endif 575 575 enddo … … 600 600 us(j),vs(j),ws(j),nstop,xtra1(j),ytra1(j),ztra1(j),prob, & 601 601 cbt(j)) 602 ! write (*,*) 'advance: ',prob(1),xmass1(j,1),ztra1(j) 602 603 603 604 ! Calculate the gross fluxes across layer interfaces -
src/wetdepo.f90
r54cbd6c r5844866 20 20 !********************************************************************** 21 21 22 subroutine wetdepo(itime,ltsample,loutnext ,forreceptor)23 ! i i i i22 subroutine wetdepo(itime,ltsample,loutnext) 23 ! i i i 24 24 !***************************************************************************** 25 25 ! * … … 30 30 ! This fraction is parameterized from total cloud cover and rates of large * 31 31 ! scale and convective precipitation. * 32 ! SEC: if forrecptor is true then the wetdeposition fraction is only applied *33 ! on the xscav_frac and not on the xmass *34 32 ! * 35 33 ! Author: A. Stohl * … … 94 92 integer :: blc_count, inc_count 95 93 real :: Si_dummy, wetscav_dummy 96 logical :: readclouds_this_nest ,forreceptor94 logical :: readclouds_this_nest 97 95 98 96 … … 174 172 memtime(1),memtime(2),interp_time,lsp,convp,cc) 175 173 endif 174 175 ! If total precipitation is less than 0.01 mm/h - no scavenging occurs 176 ! sec this is just valid if release is over a point 177 if ((lsp.lt.0.01).and.(convp.lt.0.01)) then 178 if (WETBKDEP) then 179 do ks=1,nspec 180 if (xscav_frac1(jpart,ks).lt.0) then ! first timestep no scavenging 181 xmass1(jpart,ks)=0. 182 xscav_frac1(jpart,ks)=0. 183 ! write (*,*) 'paricle removed - no scavenging: ',jpart,ks 184 endif 185 end do 186 endif 187 goto 20 188 endif 189 176 190 177 191 ! get the level were the actual particle is in … … 399 413 kp=1 400 414 endif 401 if (forreceptor .eqv. .false.) then 402 if (restmass .gt. smallnum) then 403 xmass1(jpart,ks)=restmass 415 if (restmass .gt. smallnum) then 416 xmass1(jpart,ks)=restmass 404 417 ! depostatistic 405 418 ! wetdepo_sum(ks,kp)=wetdepo_sum(ks,kp)+wetdeposit(ks) 406 419 ! depostatistic 407 else 408 xmass1(jpart,ks)=0. 409 endif 410 else ! for the backward deposition calculation 411 if (wetdeposit(ks).gt.0) then ! deposition occured 412 xscav_frac1(jpart,ks)=xscav_frac1(jpart,ks)*(-1.)* & 413 wetdeposit(ks)/xmass1(jpart,ks) 414 ! write (*,*) 'paricle kept: ',jpart,ks,wetdeposit(ks),xscav_frac1(jpart,ks) 415 else 416 xmass1(jpart,ks)=0. 417 xscav_frac1(jpart,ks)=0. 418 endif 419 endif 420 else 421 xmass1(jpart,ks)=0. 422 endif 420 423 ! Correct deposited mass to the last time step when radioactive decay of 421 424 ! gridded deposited mass was calculated … … 423 426 wetdeposit(ks)=wetdeposit(ks)*exp(abs(ldeltat)*decay(ks)) 424 427 endif 428 429 if (WETBKDEP) then 430 ! the calculation of the scavenged mass shall only be done once after release 431 ! xscav_frac1 was initialised with a negative value 432 if (xscav_frac1(jpart,ks).lt.0) then 433 if (wetdeposit(ks).eq.0) then 434 ! terminate particle 435 xmass1(jpart,ks)=0. 436 xscav_frac1(jpart,ks)=0. 437 else 438 xscav_frac1(jpart,ks)=xscav_frac1(jpart,ks)*(-1.)* & 439 wetdeposit(ks)/xmass1(jpart,ks) 440 ! write (*,*) 'paricle kept: ',jpart,ks,wetdeposit(ks),xscav_frac1(jpart,ks) 441 endif 442 endif 443 endif 444 425 445 426 446 end do !all species
Note: See TracChangeset
for help on using the changeset viewer.