- Timestamp:
- Dec 14, 2015, 3:10:04 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:
- f75967d
- Parents:
- 88d8c3d
- Location:
- src
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
src/FLEXPART_MPI.f90
rdf967a99 rd6a0977 165 165 write(*,FMT='(80("#"))') 166 166 write(*,*) '#### FLEXPART_MPI> ERROR: ', & 167 & 'MPI version not (yet) working with backward runs. ' ,&168 & 'Use the serial version instead.'167 & 'MPI version not (yet) working with backward runs. ' 168 write(*,*) '#### Use the serial version instead.' 169 169 write(*,FMT='(80("#"))') 170 stop 170 ! call mpif_finalize 171 ! stop 171 172 end if 172 173 -
src/com_mod.f90
r6b22af9 rd6a0977 130 130 ! gdomainfill .T., if domain-filling is global, .F. if not 131 131 132 ! hg132 !ZHG SEP 2015 wheather or not to read clouds from GRIB 133 133 logical :: readclouds 134 134 … … 347 347 real :: tt(0:nxmax-1,0:nymax-1,nzmax,numwfmem) 348 348 real :: qv(0:nxmax-1,0:nymax-1,nzmax,numwfmem) 349 !hg adding cloud water 350 real :: clwc(0:nxmax-1,0:nymax-1,nzmax,numwfmem) 351 real :: ciwc(0:nxmax-1,0:nymax-1,nzmax,numwfmem) 349 !ZHG adding cloud water 350 real :: clwc(0:nxmax-1,0:nymax-1,nzmax,numwfmem) !liquid [kg/kg] 351 real :: ciwc(0:nxmax-1,0:nymax-1,nzmax,numwfmem) !ice [kg/kg] 352 real :: clw(0:nxmax-1,0:nymax-1,nzmax,numwfmem) !combined [m3/m3] 353 352 354 real :: pv(0:nxmax-1,0:nymax-1,nzmax,numwfmem) 353 355 real :: rho(0:nxmax-1,0:nymax-1,nzmax,numwfmem) … … 362 364 integer(kind=1) :: clouds(0:nxmax-1,0:nymax-1,nzmax,numwfmem) 363 365 integer :: cloudsh(0:nxmax-1,0:nymax-1,numwfmem) 364 ! integer :: icloudbot(0:nxmax-1,0:nymax-1,numwfmem) 365 ! integer :: icloudthck(0:nxmax-1,0:nymax-1,numwfmem) 366 367 !ZHG Sep 2015 368 real :: icloud_stats(0:nxmax-1,0:nymax-1,5,numwfmem) 369 real :: clh(0:nxmax-1,0:nymax-1,nuvzmax,numwfmem) 366 370 367 371 … … 405 409 real :: tropopause(0:nxmax-1,0:nymax-1,1,numwfmem) 406 410 real :: oli(0:nxmax-1,0:nymax-1,1,numwfmem) 407 ! real :: diffk(0:nxmax-1,0:nymax-1,1,numwfmem) this is not in use?408 411 ! real :: diffk(0:nxmax-1,0:nymax-1,1,numwfmem) ESO: this is not in use? 412 ! logical :: beneath_cloud=.true. 409 413 ! ps surface pressure 410 414 ! sd snow depth … … 667 671 668 672 673 !CGZ-lifetime 674 real, allocatable, dimension(:,:) ::checklifetime, species_lifetime 675 !CGZ-lifetime 676 669 677 ! numpart actual number of particles in memory 670 678 ! itra1 (maxpart) [s] temporal positions of the particles … … 759 767 & idt(nmpart),itramem(nmpart),itrasplit(nmpart),& 760 768 & xtra1(nmpart),ytra1(nmpart),ztra1(nmpart),& 761 & xmass1(nmpart, maxspec)) 769 & xmass1(nmpart, maxspec),& 770 & checklifetime(nmpart,maxspec), species_lifetime(maxspec,2))!CGZ-lifetime 771 762 772 763 773 allocate(uap(nmpart),ucp(nmpart),uzp(nmpart),us(nmpart),& -
src/gridcheck.f90
r5f9d14a rd6a0977 195 195 elseif ((parCat.eq.1).and.(parNum.eq.0).and.(typSurf.eq.105)) then ! Q 196 196 isec1(6)=133 ! indicatorOfParameter 197 ! hg197 !ZHG FOR CLOUDS FROM GRIB 198 198 elseif ((parCat.eq.1).and.(parNum.eq.83).and.(typSurf.eq.105)) then ! clwc 199 199 isec1(6)=246 ! indicatorOfParameter 200 200 elseif ((parCat.eq.1).and.(parNum.eq.84).and.(typSurf.eq.105)) then ! ciwc 201 201 isec1(6)=247 ! indicatorOfParameter 202 ! hgend202 !ZHG end 203 203 elseif ((parCat.eq.3).and.(parNum.eq.0).and.(typSurf.eq.1)) then !SP 204 204 isec1(6)=134 ! indicatorOfParameter -
src/mpi_mod.f90
ra1f4dd6 rd6a0977 89 89 ! MPI tags/requests for send/receive operation 90 90 integer :: tm1 91 integer, parameter :: nvar_async=2 7 !29 :DBG:91 integer, parameter :: nvar_async=26 !27 !29 :DBG: 92 92 !integer, dimension(:), allocatable :: tags 93 93 integer, dimension(:), allocatable :: reqs … … 119 119 logical, parameter :: mp_dbg_out = .false. 120 120 logical, parameter :: mp_time_barrier=.true. 121 logical, parameter :: mp_measure_time=. true.121 logical, parameter :: mp_measure_time=.false. 122 122 logical, parameter :: mp_exact_numpart=.true. 123 123 … … 207 207 write(*,FMT='(80("#"))') 208 208 ! Force "syncronized" version if all processes will call getfields 209 else if ( .not.lmp_sync.and.mp_np.lt.read_grp_min) then209 else if ((.not.lmp_sync.and.mp_np.lt.read_grp_min).or.(mp_np.eq.1)) then 210 210 if (lroot) then 211 211 write(*,FMT='(80("#"))') … … 963 963 ! cloud water/ice: 964 964 if (readclouds) then 965 call MPI_Bcast(clwc(:,:,:,li:ui),d3s1,mp_pp,id_read,MPI_COMM_WORLD,mp_ierr) 966 if (mp_ierr /= 0) goto 600 967 call MPI_Bcast(ciwc(:,:,:,li:ui),d3s1,mp_pp,id_read,MPI_COMM_WORLD,mp_ierr) 968 if (mp_ierr /= 0) goto 600 965 call MPI_Bcast(icloud_stats(:,:,:,li:ui),d2_size1*5,mp_pp,id_read,MPI_COMM_WORLD,mp_ierr) 966 if (mp_ierr /= 0) goto 600 967 968 ! call MPI_Bcast(clwc(:,:,:,li:ui),d3s1,mp_pp,id_read,MPI_COMM_WORLD,mp_ierr) 969 ! if (mp_ierr /= 0) goto 600 970 ! call MPI_Bcast(ciwc(:,:,:,li:ui),d3s1,mp_pp,id_read,MPI_COMM_WORLD,mp_ierr) 971 ! if (mp_ierr /= 0) goto 600 969 972 end if 970 973 … … 1189 1192 ! 1190 1193 ! TODO 1191 ! Transfer cloud water/ice1192 1194 ! 1193 1195 !******************************************************************************* … … 1334 1336 if (readclouds) then 1335 1337 i=i+1 1336 call MPI_Isend( clwc(:,:,:,mind),d3s1,mp_pp,dest,tm1,&1338 call MPI_Isend(icloud_stats(:,:,:,mind),d2s1*5,mp_pp,dest,tm1,& 1337 1339 &MPI_COMM_WORLD,reqs(i),mp_ierr) 1338 1340 if (mp_ierr /= 0) goto 600 1339 i=i+1 1340 1341 call MPI_Isend(ciwc(:,:,:,mind),d3s1,mp_pp,dest,tm1,& 1342 &MPI_COMM_WORLD,reqs(i),mp_ierr) 1343 if (mp_ierr /= 0) goto 600 1344 ! else 1345 ! i=i+2 1341 1342 ! call MPI_Isend(clwc(:,:,:,mind),d3s1,mp_pp,dest,tm1,& 1343 ! &MPI_COMM_WORLD,reqs(i),mp_ierr) 1344 ! if (mp_ierr /= 0) goto 600 1345 ! i=i+1 1346 1347 ! call MPI_Isend(ciwc(:,:,:,mind),d3s1,mp_pp,dest,tm1,& 1348 ! &MPI_COMM_WORLD,reqs(i),mp_ierr) 1349 ! if (mp_ierr /= 0) goto 600 1350 1346 1351 end if 1347 1348 1352 end do 1349 1353 … … 1371 1375 ! 1372 1376 ! TODO 1373 ! Transfer cloud water/ice1374 1377 ! 1375 1378 !******************************************************************************* … … 1390 1393 ! integer :: d3s1,d3s2,d2s1,d2s2 1391 1394 !******************************************************************************* 1392 1393 ! :TODO: don't need these1394 ! d3s1=d3_size11395 ! d3s2=d3_size21396 ! d2s1=d2_size11397 ! d2s2=d2_size21398 1395 1399 1396 ! At the time this immediate receive is posted, memstat is the state of … … 1545 1542 if (readclouds) then 1546 1543 j=j+1 1547 call MPI_Irecv(clwc(:,:,:,mind),d3s1,mp_pp,id_read,MPI_ANY_TAG,& 1548 &MPI_COMM_WORLD,reqs(j),mp_ierr) 1549 if (mp_ierr /= 0) goto 600 1550 j=j+1 1551 call MPI_Irecv(ciwc(:,:,:,mind),d3s1,mp_pp,id_read,MPI_ANY_TAG,& 1552 &MPI_COMM_WORLD,reqs(j),mp_ierr) 1553 if (mp_ierr /= 0) goto 600 1544 1545 call MPI_Irecv(icloud_stats(:,:,:,mind),d2s1*5,mp_pp,id_read,MPI_ANY_TAG,& 1546 &MPI_COMM_WORLD,reqs(j),mp_ierr) 1547 if (mp_ierr /= 0) goto 600 1548 1549 ! call MPI_Irecv(clwc(:,:,:,mind),d3s1,mp_pp,id_read,MPI_ANY_TAG,& 1550 ! &MPI_COMM_WORLD,reqs(j),mp_ierr) 1551 ! if (mp_ierr /= 0) goto 600 1552 ! j=j+1 1553 ! call MPI_Irecv(ciwc(:,:,:,mind),d3s1,mp_pp,id_read,MPI_ANY_TAG,& 1554 ! &MPI_COMM_WORLD,reqs(j),mp_ierr) 1555 ! if (mp_ierr /= 0) goto 600 1556 1554 1557 end if 1555 1558 … … 2089 2092 implicit none 2090 2093 2091 integer, parameter :: li=1, ui=3 ! wfmem indices (i.e, operate on entire field) 2094 integer :: li=1, ui=2 ! wfmem indices (i.e, operate on entire field) 2095 2096 if (.not.lmp_sync) ui=3 2092 2097 2093 2098 -
src/par_mod.f90
r4c4261c rd6a0977 76 76 real,parameter :: hmixmin=100., hmixmax=4500., turbmesoscale=0.16 77 77 real,parameter :: d_trop=50., d_strat=0.1 78 78 real,parameter :: rho_water=1000 !ZHG 2015 [kg/m3] 79 79 ! karman Karman's constant 80 80 ! href [m] Reference height for dry deposition … … 226 226 ! --------- 227 227 integer,parameter :: maxwf=50000, maxtable=1000, numclass=13, ni=11 228 !integer,parameter :: numwfmem=2 ! Serial version/MPI with 2 fields229 integer,parameter :: numwfmem=3 ! MPI with 3 fields228 integer,parameter :: numwfmem=2 ! Serial version/MPI with 2 fields 229 !integer,parameter :: numwfmem=3 ! MPI with 3 fields 230 230 231 231 ! maxwf maximum number of wind fields to be used for simulation -
src/pathnames
rde7afbd rd6a0977 2 2 ../output/ 3 3 / 4 /xnilu_wrk/flex_wrk/WIND_FIELDS/AVAILABLE_ECMWF_OPER_fields_global /4 /xnilu_wrk/flex_wrk/WIND_FIELDS/AVAILABLE_ECMWF_OPER_fields_global 5 5 ============================================ 6 7 /xnilu_wrk/flex_wrk/zhg/ECMWF_CLWC/Availables 6 8 7 9 -
src/readwind.f90
r5f9d14a rd6a0977 106 106 hflswitch=.false. 107 107 strswitch=.false. 108 ! hg108 !ZHG test the grib fields that have lcwc without using them 109 109 ! readcloud=.false. 110 !hg end 110 111 111 levdiff2=nlev_ec-nwz+1 112 112 iumax=0 … … 190 190 elseif ((parCat.eq.1).and.(parNum.eq.0).and.(typSurf.eq.105)) then ! Q 191 191 isec1(6)=133 ! indicatorOfParameter 192 ! hg192 !ZHG ! READ CLOUD FIELD : assume these to be added together to one variable 193 193 elseif ((parCat.eq.1).and.(parNum.eq.83).and.(typSurf.eq.105)) then ! clwc 194 194 isec1(6)=246 ! indicatorOfParameter 195 elseif ((parCat.eq.1).and.(parNum.eq.84).and.(typSurf.eq.105)) then ! ciwc 196 isec1(6)=247 ! indicatorOfParameter 197 !hg end 195 ! ICE AND WATER IS ADDED TOGETHER IN NEW WINDFIELDS 196 ! elseif ((parCat.eq.1).and.(parNum.eq.84).and.(typSurf.eq.105)) then ! ciwc 197 ! isec1(6)=247 ! indicatorOfParameter 198 !ZHG end 198 199 elseif ((parCat.eq.3).and.(parNum.eq.0).and.(typSurf.eq.1)) then !SP 199 200 isec1(6)=134 ! indicatorOfParameter … … 226 227 elseif ((parCat.eq.4).and.(parNum.eq.9).and.(typSurf.eq.1)) then ! SR 227 228 isec1(6)=176 ! indicatorOfParameter 228 elseif ((parCat.eq.2).and.(parNum.eq.17) .or. parId .eq. 180) then ! EWSS 229 ! elseif ((parCat.eq.2).and.(parNum.eq.17) .or. parId .eq. 180) then ! EWSS --wrong 230 elseif ((parCat.eq.2).and.(parNum.eq.38) .or. parId .eq. 180) then ! EWSS --correct 229 231 isec1(6)=180 ! indicatorOfParameter 230 elseif ((parCat.eq.2).and.(parNum.eq.18) .or. parId .eq. 181) then ! NSSS 232 ! elseif ((parCat.eq.2).and.(parNum.eq.18) .or. parId .eq. 181) then ! NSSS --wrong 233 elseif ((parCat.eq.2).and.(parNum.eq.37) .or. parId .eq. 181) then ! NSSS --correct 231 234 isec1(6)=181 ! indicatorOfParameter 232 235 elseif ((parCat.eq.3).and.(parNum.eq.4)) then ! ORO … … 356 359 if(isec1(6).eq.131) iumax=max(iumax,nlev_ec-k+1) 357 360 if(isec1(6).eq.135) iwmax=max(iwmax,nlev_ec-k+1) 358 ! hgREADING CLOUD FIELDS ASWELL359 if(isec1(6).eq.246) then !! CLWC Cloud liquid water content 361 !ZHG READING CLOUD FIELDS ASWELL 362 if(isec1(6).eq.246) then !! CLWC Cloud liquid water content [kg/kg] 360 363 clwch(i,j,nlev_ec-k+2,n)=zsec4(nxfield*(ny-j-1)+i+1) 361 364 readclouds = .true. 362 !write(*,*) 'found water!' 365 !if (clwch(i,j,nlev_ec-k+2,n) .gt. 0) write(*,*) 'readwind: found water!', clwch(i,j,nlev_ec-k+2,n) 363 366 endif 364 if(isec1(6).eq.247) then !! CIWC Cloud ice water content365 ciwch(i,j,nlev_ec-k+2,n)=zsec4(nxfield*(ny-j-1)+i+1)367 ! if(isec1(6).eq.247) then !! CIWC Cloud ice water content 368 ! ciwch(i,j,nlev_ec-k+2,n)=zsec4(nxfield*(ny-j-1)+i+1) 366 369 !write(*,*) 'found ice!' 367 endif368 ! hgend370 ! endif 371 !ZHG end 369 372 370 373 end do … … 422 425 call shift_field(vvh,nxfield,ny,nuvzmax,nuvz,1,1) 423 426 call shift_field(wwh,nxfield,ny,nwzmax,nwz,1,1) 424 ! hg427 !ZHG 425 428 call shift_field(clwch,nxfield,ny,nuvzmax,nuvz,2,n) 426 429 call shift_field(ciwch,nxfield,ny,nuvzmax,nuvz,2,n) 427 ! hgend430 !ZHG end 428 431 429 432 endif -
src/readwind_mpi.f90
r5f9d14a rd6a0977 200 200 elseif ((parCat.eq.1).and.(parNum.eq.0).and.(typSurf.eq.105)) then ! Q 201 201 isec1(6)=133 ! indicatorOfParameter 202 ! hg202 !ZHG ! READ CLOUD FIELD : assume these to be added together to one variable 203 203 elseif ((parCat.eq.1).and.(parNum.eq.83).and.(typSurf.eq.105)) then ! clwc 204 204 isec1(6)=246 ! indicatorOfParameter 205 elseif ((parCat.eq.1).and.(parNum.eq.84).and.(typSurf.eq.105)) then ! ciwc 206 isec1(6)=247 ! indicatorOfParameter 207 !hg end 205 ! ICE AND WATER IS ADDED TOGETHER IN NEW WINDFIELDS 206 ! elseif ((parCat.eq.1).and.(parNum.eq.84).and.(typSurf.eq.105)) then ! ciwc 207 ! isec1(6)=247 ! indicatorOfParameter 208 !ZHG end 208 209 elseif ((parCat.eq.3).and.(parNum.eq.0).and.(typSurf.eq.1)) then !SP 209 210 isec1(6)=134 ! indicatorOfParameter … … 368 369 if(isec1(6).eq.131) iumax=max(iumax,nlev_ec-k+1) 369 370 if(isec1(6).eq.135) iwmax=max(iwmax,nlev_ec-k+1) 370 ! hgREADING CLOUD FIELDS ASWELL371 if(isec1(6).eq.246) then !! CLWC Cloud liquid water content 371 !ZHG READING CLOUD FIELDS ASWELL 372 if(isec1(6).eq.246) then !! CLWC Cloud liquid water content [kg/kg] 372 373 clwch(i,j,nlev_ec-k+2,n)=zsec4(nxfield*(ny-j-1)+i+1) 373 374 readclouds = .true. 374 !write(*,*) 'found water!' 375 !if (clwch(i,j,nlev_ec-k+2,n) .gt. 0) write(*,*) 'readwind: found water!', clwch(i,j,nlev_ec-k+2,n) 375 376 endif 376 377 if(isec1(6).eq.247) then !! CIWC Cloud ice water content 378 ciwch(i,j,nlev_ec-k+2,n)=zsec4(nxfield*(ny-j-1)+i+1) 377 ! if(isec1(6).eq.247) then !! CIWC Cloud ice water content 378 ! ciwch(i,j,nlev_ec-k+2,n)=zsec4(nxfield*(ny-j-1)+i+1) 379 379 !write(*,*) 'found ice!' 380 endif381 ! hgend380 ! endif 381 !ZHG end 382 382 383 383 end do -
src/timemanager.f90
r78e62dc rd6a0977 136 136 !********************************************************************** 137 137 138 !ZHG 2015 139 !CGZ-lifetime: set lifetime to 0 140 checklifetime(:,:)=0 141 species_lifetime(:,:)=0 142 print*, 'Initialized lifetime' 143 !CGZ-lifetime: set lifetime to 0 144 145 138 146 139 147 if (verbosity.gt.0) then … … 411 419 if (iflux.eq.1) call fluxoutput(itime) 412 420 write(*,45) itime,numpart,gridtotalunc,wetgridtotalunc,drygridtotalunc 421 422 !CGZ-lifetime: output species lifetime 423 !ZHG 424 write(*,*) 'Overview species lifetime in days', & 425 real((species_lifetime(:,1)/species_lifetime(:,2))/real(3600.0*24.0)) 426 write(*,*) 'all info:',species_lifetime 427 !ZHG 428 !CGZ-lifetime: output species lifetime 429 413 430 !write(*,46) float(itime)/3600,itime,numpart 414 431 45 format(i9,' SECONDS SIMULATED: ',i8, ' PARTICLES: Uncertainty: ',3f7.3) … … 575 592 xmassfract=max(xmassfract,real(npart(npoint(j)))* & 576 593 xmass1(j,ks)/xmass(npoint(j),ks)) 594 !ZHG 2015 595 !CGZ-lifetime: Check mass fraction left/save lifetime 596 if(real(npart(npoint(j)))*xmass1(j,ks)/xmass(npoint(j),ks).lt.0.01.and.checklifetime(j,ks).eq.0.)then 597 !Mass below 1% of initial >register lifetime 598 checklifetime(j,ks)=abs(itra1(j)-itramem(j)) 599 species_lifetime(ks,1)=species_lifetime(ks,1)+abs(itra1(j)-itramem(j)) 600 species_lifetime(ks,2)= species_lifetime(ks,2)+1 601 endif 602 !CGZ-lifetime: Check mass fraction left/save lifetime 603 !ZHG 2015 577 604 else 578 605 xmassfract=1. -
src/timemanager_mpi.f90
ra1f4dd6 rd6a0977 139 139 !********************************************************************** 140 140 141 142 ! itime=0 143 if (lroot) then 144 ! write(*,45) itime,numpart*mp_partgroup_np,gridtotalunc,wetgridtotalunc,drygridtotalunc 145 write(*,46) float(itime)/3600,itime,numpart*mp_partgroup_np 146 147 if (verbosity.gt.0) then 148 write (*,*) 'timemanager> starting simulation' 149 end if 150 end if ! (lroot) 151 152 !CGZ-lifetime: set lifetime to 0 153 checklifetime(:,:)=0 154 species_lifetime(:,:)=0 155 print*, 'Initialized lifetime' 156 !CGZ-lifetime: set lifetime to 0 157 158 159 141 160 do itime=0,ideltas,lsynctime 142 161 … … 544 563 endif 545 564 546 if (lroot) then 565 !CGZ-lifetime: output species lifetime 566 ! if (lroot) then 567 ! write(*,*) 'Overview species lifetime in days', & 568 ! real((species_lifetime(:,1)/species_lifetime(:,2))/real(3600.0*24.0)) 569 ! write(*,*) 'all info:',species_lifetime 547 570 write(*,45) itime,numpart_tot_mpi,gridtotalunc,& 548 571 &wetgridtotalunc,drygridtotalunc 549 if (verbosity.gt.0) then550 write (*,*) 'timemanager> starting simulation'551 end if552 end if572 ! if (verbosity.gt.0) then 573 ! write (*,*) 'timemanager> starting simulation' 574 ! end if 575 ! end if 553 576 554 577 45 format(i13,' SECONDS SIMULATED: ',i13, ' PARTICLES: Uncertainty: ',3f7.3) … … 729 752 730 753 if (mdomainfill.eq.0) then 731 if (xmass(npoint(j),ks).gt.0.) &754 if (xmass(npoint(j),ks).gt.0.)then 732 755 xmassfract=max(xmassfract,real(npart(npoint(j)))* & 733 756 xmass1(j,ks)/xmass(npoint(j),ks)) 757 758 !CGZ-lifetime: Check mass fraction left/save lifetime 759 if(lroot.and.real(npart(npoint(j)))*xmass1(j,ks)/xmass(npoint(j),ks).lt.0.01.and.checklifetime(j,ks).eq.0.)then 760 !Mass below 1% of initial >register lifetime 761 checklifetime(j,ks)=abs(itra1(j)-itramem(j)) 762 763 species_lifetime(ks,1)=species_lifetime(ks,1)+abs(itra1(j)-itramem(j)) 764 species_lifetime(ks,2)= species_lifetime(ks,2)+1 765 endif 766 !CGZ-lifetime: Check mass fraction left/save lifetime 767 768 endif 734 769 else 735 770 xmassfract=1. … … 737 772 end do 738 773 739 if (xmassfract.lt.0.0001) then ! terminate all particles carrying less mass 774 if (xmassfract.lt.0.00005 .and. sum(real(npart(npoint(j)))*xmass1(j,:)).lt.1.0) then ! terminate all particles carrying less mass 775 ! print*,'terminated particle ',j,' for small mass (', sum(real(npart(npoint(j)))* & 776 ! xmass1(j,:)), ' of ', sum(xmass(npoint(j),:)),')' 740 777 itra1(j)=-999999999 741 778 endif … … 758 795 call initial_cond_calc(itime+lsynctime,j) 759 796 itra1(j)=-999999999 797 !print*, 'terminated particle ',j,'for age' 760 798 endif 761 799 endif … … 828 866 endif 829 867 deallocate(gridunc) 830 deallocate(xpoint1,xpoint2,ypoint1,ypoint2,zpoint1,zpoint2,xmass )868 deallocate(xpoint1,xpoint2,ypoint1,ypoint2,zpoint1,zpoint2,xmass, checklifetime) 831 869 deallocate(ireleasestart,ireleaseend,npart,kindz) 832 870 deallocate(xmasssave) -
src/verttransform.f90
r4d45639 rd6a0977 97 97 logical :: init = .true. 98 98 99 !hg99 !ZHG SEP 2014 tests 100 100 integer :: cloud_ver,cloud_min, cloud_max 101 integer ::teller(5), convpteller=0, lspteller=0 101 102 real :: cloud_col_wat, cloud_water 102 !hgtemporary variables for testing103 !ZHG 2015 temporary variables for testing 103 104 real :: rcw(0:nxmax-1,0:nymax-1) 104 105 real :: rpc(0:nxmax-1,0:nymax-1) 105 !hg 106 character(len=60) :: zhgpath='/xnilu_wrk/flex_wrk/zhg/' 107 character(len=60) :: fnameA,fnameB,fnameC,fnameD,fnameE,fnameF,fnameG,fnameH 108 CHARACTER(LEN=3) :: aspec 109 integer :: virr=0 110 real :: tot_cloud_h 111 !ZHG 106 112 107 113 !************************************************************************* … … 561 567 562 568 569 !*********************************************************************************** 570 if (readclouds) then !HG METHOD 571 ! The method is loops all grids vertically and constructs the 3D matrix for clouds 572 ! Cloud top and cloud bottom gid cells are assigned as well as the total column 573 ! cloud water. For precipitating grids, the type and whether it is in or below 574 ! cloud scavenging are assigned with numbers 2-5 (following the old metod). 575 ! Distinction is done for lsp and convp though they are treated the same in regards 576 ! to scavenging. Also clouds that are not precipitating are defined which may be 577 ! to include future cloud processing by non-precipitating-clouds. 578 !*********************************************************************************** 563 579 if (readclouds) write(*,*) 'using cloud water from ECMWF' 564 ! if (.not.readclouds) write(*,*) 'using cloud water from parameterization' 565 566 rcw(:,:)=0 567 rpc(:,:)=0 568 580 clw(:,:,:,n)=0 581 icloud_stats(:,:,:,n)=0 582 clouds(:,:,:,n)=0 583 do jy=0,nymin1 584 do ix=0,nxmin1 585 lsp=lsprec(ix,jy,1,n) 586 convp=convprec(ix,jy,1,n) 587 prec=lsp+convp 588 tot_cloud_h=0 589 ! Find clouds in the vertical 590 do kz=1, nz-1 !go from top to bottom 591 if (clwc(ix,jy,kz,n).gt.0) then 592 ! assuming rho is in kg/m3 and hz in m gives: kg/kg * kg/m3 *m3/kg /m = m2/m3 593 clw(ix,jy,kz,n)=(clwc(ix,jy,kz,n)*rho(ix,jy,kz,n))*(height(kz+1)-height(kz)) 594 tot_cloud_h=tot_cloud_h+(height(kz+1)-height(kz)) 595 icloud_stats(ix,jy,4,n)= icloud_stats(ix,jy,4,n)+clw(ix,jy,kz,n) ! Column cloud water [m3/m3] 596 icloud_stats(ix,jy,3,n)= min(height(kz+1),height(kz)) ! Cloud BOT height stats [m] 597 !ZHG 2015 extra for testing 598 clh(ix,jy,kz,n)=height(kz+1)-height(kz) 599 icloud_stats(ix,jy,1,n)=icloud_stats(ix,jy,1,n)+(height(kz+1)-height(kz)) ! Cloud total vertical extent [m] 600 icloud_stats(ix,jy,2,n)= max(icloud_stats(ix,jy,2,n),height(kz)) ! Cloud TOP height [m] 601 !ZHG 602 endif 603 end do 604 605 ! If Precipitation. Define removal type in the vertical 606 if ((lsp.gt.0.01).or.(convp.gt.0.01)) then ! cloud and precipitation 607 608 do kz=nz,1,-1 !go Bottom up! 609 if (clw(ix,jy,kz,n).gt. 0) then ! is in cloud 610 cloudsh(ix,jy,n)=cloudsh(ix,jy,n)+height(kz)-height(kz-1) 611 clouds(ix,jy,kz,n)=1 ! is a cloud 612 if (lsp.ge.convp) then 613 clouds(ix,jy,kz,n)=3 ! lsp in-cloud 614 else 615 clouds(ix,jy,kz,n)=2 ! convp in-cloud 616 endif ! convective or large scale 617 elseif((clw(ix,jy,kz,n).le.0) .and. (icloud_stats(ix,jy,3,n).ge.height(kz)) ) then ! is below cloud 618 if (lsp.ge.convp) then 619 clouds(ix,jy,kz,n)=5 ! lsp dominated washout 620 else 621 clouds(ix,jy,kz,n)=4 ! convp dominated washout 622 endif ! convective or large scale 623 endif 624 625 if (height(kz).ge. 19000) then ! set a max height for removal 626 clouds(ix,jy,kz,n)=0 627 endif !clw>0 628 end do !nz 629 endif ! precipitation 630 end do 631 end do 632 !************************************************************************** 633 else ! use old definitions 634 !************************************************************************** 635 ! create a cloud and rainout/washout field, clouds occur where rh>80% 636 ! total cloudheight is stored at level 0 637 if (.not.readclouds) write(*,*) 'using cloud water from Parameterization' 569 638 do jy=0,nymin1 570 639 do ix=0,nxmin1 … … 603 672 end do 604 673 !END OLD METHOD 674 end do 675 end do 676 endif !readclouds 677 678 !********* TEST *************** 679 ! WRITE OUT SOME TEST VARIABLES 680 !********* TEST ************'** 681 !teller(:)=0 682 !virr=virr+1 683 !WRITE(aspec, '(i3.3)'), virr 684 685 !if (readclouds) then 686 !fnameH=trim(zhgpath)//trim(aspec)//'Vertical_placement.txt' 687 !else 688 !fnameH=trim(zhgpath)//trim(aspec)//'Vertical_placement_old.txt' 689 !endif 690 ! 691 !OPEN(UNIT=118, FILE=fnameH,FORM='FORMATTED',STATUS = 'UNKNOWN') 692 !do kz_inv=1,nz-1 693 ! kz=nz-kz_inv+1 694 ! !kz=91 695 ! do jy=0,nymin1 696 ! do ix=0,nxmin1 697 ! if (clouds(ix,jy,kz,n).eq.1) teller(1)=teller(1)+1 ! no precipitation cloud 698 ! if (clouds(ix,jy,kz,n).eq.2) teller(2)=teller(2)+1 ! convp dominated rainout 699 ! if (clouds(ix,jy,kz,n).eq.3) teller(3)=teller(3)+1 ! lsp dominated rainout 700 ! if (clouds(ix,jy,kz,n).eq.4) teller(4)=teller(4)+1 ! convp dominated washout 701 ! if (clouds(ix,jy,kz,n).eq.5) teller(5)=teller(5)+1 ! lsp dominated washout 702 ! 703 ! ! write(*,*) height(kz),teller 704 ! end do 705 ! end do 706 ! write(118,*) height(kz),teller 707 ! teller(:)=0 708 !end do 709 !teller(:)=0 710 !write(*,*) teller 711 !write(*,*) aspec 712 ! 713 !fnameA=trim(zhgpath)//trim(aspec)//'cloudV.txt' 714 !fnameB=trim(zhgpath)//trim(aspec)//'cloudT.txt' 715 !fnameC=trim(zhgpath)//trim(aspec)//'cloudB.txt' 716 !fnameD=trim(zhgpath)//trim(aspec)//'cloudW.txt' 717 !fnameE=trim(zhgpath)//trim(aspec)//'old_cloudV.txt' 718 !fnameF=trim(zhgpath)//trim(aspec)//'lsp.txt' 719 !fnameG=trim(zhgpath)//trim(aspec)//'convp.txt' 720 !if (readclouds) then 721 !OPEN(UNIT=111, FILE=fnameA,FORM='FORMATTED',STATUS = 'UNKNOWN') 722 !OPEN(UNIT=112, FILE=fnameB,FORM='FORMATTED',STATUS = 'UNKNOWN') 723 !OPEN(UNIT=113, FILE=fnameC,FORM='FORMATTED',STATUS = 'UNKNOWN') 724 !OPEN(UNIT=114, FILE=fnameD,FORM='FORMATTED',STATUS = 'UNKNOWN') 725 !else 726 !OPEN(UNIT=115, FILE=fnameE,FORM='FORMATTED',STATUS = 'UNKNOWN') 727 !OPEN(UNIT=116, FILE=fnameF,FORM='FORMATTED',STATUS = 'UNKNOWN') 728 !OPEN(UNIT=117, FILE=fnameG,FORM='FORMATTED',STATUS = 'UNKNOWN') 729 !endif 730 ! 731 !do ix=0,nxmin1 732 !if (readclouds) then 733 !write(111,*) (icloud_stats(ix,jy,1,n),jy=0,nymin1) 734 !write(112,*) (icloud_stats(ix,jy,2,n),jy=0,nymin1) 735 !write(113,*) (icloud_stats(ix,jy,3,n),jy=0,nymin1) 736 !write(114,*) (icloud_stats(ix,jy,4,n),jy=0,nymin1) 737 !else 738 !write(115,*) (cloudsh(ix,jy,n),jy=0,nymin1) !integer 739 !write(116,*) (lsprec(ix,jy,1,n),jy=0,nymin1) !7.83691406E-02 740 !write(117,*) (convprec(ix,jy,1,n),jy=0,nymin1) !5.38330078E-02 741 !endif 742 !end do 743 ! 744 !if (readclouds) then 745 !CLOSE(111) 746 !CLOSE(112) 747 !CLOSE(113) 748 !CLOSE(114) 749 !else 750 !CLOSE(115) 751 !CLOSE(116) 752 !CLOSE(117) 753 !endif 754 ! 755 !END ********* TEST *************** END 756 ! WRITE OUT SOME TEST VARIABLES 757 !END ********* TEST *************** END 758 605 759 606 760 ! PS 2012 … … 613 767 ! lconvectprec = .true. 614 768 ! endif 615 !HG METHOD616 !readclouds =.true.617 ! if (readclouds) then618 !hg added APR 2014 Cloud Water=clwc(ix,jy,kz,n) Cloud Ice=ciwc(ix,jy,kz,n)619 !hg Use the cloud water variables to determine existence of clouds. This makes the PS code obsolete620 ! cloud_min=99999621 ! cloud_max=-1622 ! cloud_col_wat=0623 624 ! do kz=1, nz625 ! !clw & ciw are given in kg/kg626 ! cloud_water=clwc(ix,jy,kz,n)+ciwc(ix,jy,kz,n)627 ! if (cloud_water .gt. 0) then628 ! cloud_min=min(nint(height(kz)),cloud_min) !hg needs reset each grid629 ! cloud_max=max(nint(height(kz)),cloud_max) !hg needs reset each grid630 ! cloud_col_wat=cloud_col_wat+cloud_water !hg needs reset each grid631 ! endif632 ! cloud_ver=max(0,cloud_max-cloud_min)633 634 ! icloudbot(ix,jy,n)=cloud_min635 ! icloudthck(ix,jy,n)=cloud_ver636 ! rcw(ix,jy)=cloud_col_wat637 ! rpc(ix,jy)=prec638 !write(*,*) 'Using clouds from ECMWF' !hg END Henrik Code639 !END HG METHOD640 641 642 643 769 ! else ! windfields does not contain cloud data 644 770 ! rhmin = 0.90 ! standard condition for presence of clouds … … 698 824 ! endif !hg read clouds 699 825 700 end do 701 end do 702 703 !do 102 kz=1,nuvz 704 !write(an,'(i02)') kz+10 705 !write(*,*) nuvz,nymin1,nxmin1,'--',an,'--' 706 !open(4,file='/nilu_wrk2/sec/cloudtest/cloud'//an,form='formatted') 707 !do 101 jy=0,nymin1 708 ! write(4,*) (clouds(ix,jy,kz,n),ix=1,nxmin1) 709 !101 continue 710 ! close(4) 711 !102 continue 712 713 ! open(4,file='/nilu_wrk2/sec/cloudtest/height',form='formatted') 714 ! do 103 jy=0,nymin1 715 ! write (4,*) 716 !+ (height(kz),kz=1,nuvz) 717 !103 continue 718 ! close(4) 719 720 !open(4,file='/nilu_wrk2/sec/cloudtest/p',form='formatted') 721 ! do 104 jy=0,nymin1 722 ! write (4,*) 723 !+ (r_air*tt(ix,jy,1,n)*rho(ix,jy,1,n),ix=1,nxmin1) 724 !104 continue 725 ! close(4) 826 827 726 828 727 829 !eso measure CPU time -
src/wetdepo.f90
r0f20c31 rd6a0977 90 90 91 91 integer :: blc_count, inc_count 92 real :: Si_dummy, wetscav_dummy 92 93 93 94 … … 190 191 clouds_h=cloudsh(ix,jy,n) 191 192 else 193 ! new removal not implemented for nests yet 192 194 clouds_v=cloudsn(ix,jy,hz,n,ngrid) 193 195 clouds_h=cloudsnh(ix,jy,n,ngrid) … … 231 233 232 234 233 !ZHG calculated for 1) both 2) lsp 3) convp 235 !ZHG oct 2014 : Calculated for 1) both 2) lsp 3) convp 236 ! Tentatively differentiate the grfraction for lsp and convp for treating differently the two forms 237 ! for now they are treated the same 234 238 grfraction(1)=max(0.05,cc*(lsp*lfr(i)+convp*cfr(j))/(lsp+convp)) 235 239 grfraction(2)=max(0.05,cc*(lfr(i))) … … 252 256 wetscav=0. 253 257 258 !ZHG test if it nested? 254 259 if (ngrid.gt.0) then 255 260 act_temp=ttn(ix,jy,hz,n,ngrid) … … 259 264 260 265 261 !**** i*******************266 !*********************** 262 267 ! BELOW CLOUD SCAVENGING 263 268 !*********************** … … 267 272 blc_count=blc_count+1 268 273 269 270 274 !GAS 271 275 if (dquer(ks) .le. 0.) then !is gas 272 ! Gas scavenging coefficient based on Hertel et al 1995 using the below-cloud scavenging parameters A (=weta) and B (=wetb) from SPECIES file 273 wetscav=weta(ks)*prec(1)**wetb(ks) 274 275 !AEROSOL 276 wetscav=weta(ks)*prec(1)**wetb(ks) 277 278 !AEROSOL 276 279 else !is particle 277 !NIK 17.02.2015 278 ! For the calculation here particle size needs to be in meter and not um as dquer is changed to in readreleases 279 dquer_m=dquer(ks)/1000000. !conversion from um to m 280 281 !ZHG snow or rain removal is applied based on the temperature. 280 !NIK 17.02.2015 281 ! For the calculation here particle size needs to be in meter and not um as dquer is changed to in readreleases 282 ! for particles larger than 10 um use the largest size defined in the parameterizations (10um) 283 dquer_m=min(10.,dquer(ks))/1000000. !conversion from um to m 282 284 if (act_temp .ge. 273 .and. weta(ks).gt.0.) then !Rain 283 284 !Particle RAIN scavenging coefficient based on Laakso et al 2003, the below-cloud scavenging (rain efficienty) parameter A (=weta) from SPECIES file 285 ! ZHG 2014 : Particle RAIN scavenging coefficient based on Laakso et al 2003, 286 ! the below-cloud scavenging (rain efficienty) 287 ! parameter A (=weta) from SPECIES file 285 288 wetscav= weta(ks)*10**(bclr(1)+ (bclr(2)*(log10(dquer_m))**(-4))+(bclr(3)*(log10(dquer_m))**(-3))+ (bclr(4)* & 286 289 (log10(dquer_m))**(-2))+ (bclr(5)*(log10(dquer_m))**(-1))+ bclr(6)* (prec(1))**(0.5)) 287 290 288 elseif (act_temp .lt. 273 .and. wetb(ks).gt.0.) then !snow 289 290 !Particle SNOW scavenging coefficient based on Kyro et al 2009, the below-cloud scavenging (Snow efficiency) parameter B (=wetb) from SPECIES file 291 elseif (act_temp .lt. 273 .and. wetb(ks).gt.0.) then ! Snow 292 ! ZHG 2014 : Particle SNOW scavenging coefficient based on Kyro et al 2009, 293 ! the below-cloud scavenging (Snow efficiency) 294 ! parameter B (=wetb) from SPECIES file 291 295 wetscav= wetb(ks)*10**(bcls(1)+ (bcls(2)*(log10(dquer_m))**(-4))+(bcls(3)*(log10(dquer_m))**(-3))+ (bcls(4)* & 292 296 (log10(dquer_m))**(-2))+ (bcls(5)*(log10(dquer_m))**(-1))+ bcls(6)* (prec(1))**(0.5)) … … 298 302 endif !gas or particle 299 303 endif ! positive below-cloud scavenging parameters given in Species file 300 endif !end below-cloud304 endif !end BELOW 301 305 302 306 303 307 !******************** 304 308 ! IN CLOUD SCAVENGING 305 !******************** 306 if (clouds_v.lt.4) then !in-cloud 307 309 !****************************************************** 310 if (clouds_v.lt.4) then ! In-cloud 308 311 ! NIK 13 may 2015: only do incloud if positive in-cloud scavenging parameters are given in species file 309 if (weta_in(ks).gt.0. .or. wetb_in(ks).gt.0.) then !if positive in-cloud parameters given in SPECIES file (either Ai or Bi) 310 312 if (weta_in(ks).gt.0. .or. wetb_in(ks).gt.0.) then 311 313 ! if negative coefficients (turned off) set to zero for use in equation 312 314 if (weta_in(ks).lt.0.) weta_in(ks)=0. 313 315 if (wetb_in(ks).lt.0.) wetb_in(ks)=0. 314 316 315 inc_count=inc_count+1 316 317 !ZHG liquid water parameterization (CLWC+CIWC) 318 if (readclouds) then !get cloud water clwc & ciwc units Kg/Kg 319 cl=clwc(ix,jy,hz,n)+ciwc(ix,jy,hz,n) 320 else !parameterize cloudwater 321 cl=2E-7*prec(1)**0.36 317 !ZHG 2015 Cloud liquid & ice water (CLWC+CIWC) from ECMWF 318 if (readclouds) then !icloud_stats(ix,jy,4,n) has units kg/m2 319 cl =icloud_stats(ix,jy,4,n)*(grfraction(1)/cc) 320 else !parameterize cloudwater m2/m3 321 !ZHG updated parameterization of cloud water to better reproduce the values coming from ECMWF 322 cl=1.6E-6*prec(1)**0.36 322 323 endif 323 324 325 !ZHG: Calculate the partition between liquid and water phase water. 324 326 if (act_temp .le. 253) then 325 327 liq_frac=0 … … 329 331 liq_frac =((act_temp-273)/(273-253))**2 330 332 endif 331 332 ! ZHG calculate the activated fraction based on the In-cloud scavenging parameters Ai (=weta_in) and Bi (=wetb_in) from SPECIES file 333 ! frac_act is the combined IN and CCN efficiency 334 ! The default values are 0.9 for CCN and 0.1 IN 335 ! This parameterization is based on Verheggen et al. (2007) & Cozich et al. (2006) 333 ! ZHG: Calculate the aerosol partition based on cloud phase and Ai and Bi 336 334 frac_act = liq_frac*weta_in(ks) +(1-liq_frac)*wetb_in(ks) 337 335 … … 339 337 340 338 ! AEROSOL 339 !************************************************** 341 340 if (dquer(ks).gt. 0.) then ! is particle 342 341 343 342 S_i= frac_act/cl 344 343 344 !********************* 345 345 ! GAS 346 346 else ! is gas 347 347 348 348 cle=(1-cl)/(henry(ks)*(r_air/3500.)*act_temp)+cl 349 S_i=frac_act/cle 350 349 !REPLACE to switch old/ new scheme 350 ! S_i=frac_act/cle 351 S_i=1/cle 351 352 endif ! gas or particle 352 353 353 354 ! scavenging coefficient based on Hertel et al 1995 - using the S_i for either gas or aerosol 355 !OLD 356 if (readclouds) then 357 wetscav=S_i*(prec(1)/3.6E6) 358 else 354 359 wetscav=S_i*(prec(1)/3.6E6)/clouds_h 355 356 ! write(*,*) 'in-cloud, act_temp=',act_temp,',prec=',prec(1),',wetscav=',wetscav,',jpart=',jpart,',clouds_h=,', & 357 ! clouds_h,',cl=',cl, 'diff to old scheme=', cl-2E-7*prec(1)**0.36 360 endif 361 362 !ZHG 2015 TEST 363 ! Si_dummy=frac_act/2E-7*prec(1)**0.36 364 ! wetscav_dummy=Si_dummy*(prec(1)/3.6E6)/clouds_h 365 ! if (clouds_v.lt.4) then 366 ! talltest=talltest+1 367 !if(talltest .eq. 1) OPEN(UNIT=199, FILE=utfil,FORM='FORMATTED',STATUS = 'UNKNOWN') 368 !if(talltest .lt. 100001) write(199,*) prec(1)/3.6E6, cl, clouds_h*2E-7*prec(1)**0.36,clouds_v,ytra1(jpart)-90 369 !if(talltest .lt. 100001) write(199,*) wetscav, wetscav_dummy,prec(1),ytra1(jpart)-90,clouds_v,cl 370 !if(talltest .eq. 100001) CLOSE(199) 371 !if(talltest .eq. 100001) STOP 372 ! 373 !write(*,*) 'PREC kg/m2s CLOUD kg/m2', (prec(1)/3.6E6), cl !, '2E-7*prec(1)**0.36', 2E-7*prec(1)**0.36,'2E-7*prec(1)**0.36*clouds_h',2E-7*prec(1)**0.36*clouds_h 374 !write(*,*) 'PREC kg/m2s LSP+convp kg/m2', prec(1), convp+lsp 375 !write(*,*) wetscav, wetscav_dummy 376 !write(*,*) cc, grfraction(1), cc/grfraction(1) 377 378 !write(*,*) 'Lmbda_old', (prec(1)/3.6E6)/(clouds_h*2E-7*prec(1)**0.36) 379 380 381 !write(*,*) '**************************************************' 382 !write(*,*) 'clouds_h', clouds_h, 'clouds_v',clouds_v,'abs(ltsample)', abs(ltsample) 383 !write(*,*) 'readclouds', readclouds, 'wetscav',wetscav, 'wetscav_dummy', wetscav_dummy 384 !write(*,*) 'S_i', S_i , 'Si_dummy', Si_dummy, 'prec(1)', prec(1) 385 386 387 ! write(*,*) 'PRECIPITATION ,cl ECMWF , cl PARAMETIZED, clouds_v, lat' & 388 ! ,prec(1)/3.6E6, cl, clouds_h*2E-7*prec(1)**0.36,clouds_v,ytra1(jpart)-90 389 390 !endif 391 358 392 endif ! positive in-cloud scavenging parameters given in Species file 359 393 endif !incloud 394 !END ZHG TEST 360 395 361 396 !************************************************** … … 368 403 wetdeposit(ks)=xmass1(jpart,ks)* & 369 404 (1.-exp(-wetscav*abs(ltsample)))*grfraction(1) ! wet deposition 405 !write(*,*) 'MASS DEPOSITED: PREC, WETSCAV, WETSCAVP', prec(1), wetdeposit(ks), xmass1(jpart,ks)* & 406 ! (1.-exp(-wetscav_dummy*abs(ltsample)))*grfraction(1), clouds_v 407 408 370 409 else ! if no scavenging 371 410 wetdeposit(ks)=0.
Note: See TracChangeset
for help on using the changeset viewer.