Changeset 8a65cb0 in flexpart.git for src/timemanager.f90
- Timestamp:
- Mar 2, 2015, 3:11:55 PM (9 years ago)
- Branches:
- master, 10.4.1_pesei, GFS_025, bugfixes+enhancements, dev, release-10, release-10.4.1, scaling-bug, univie
- Children:
- 1d207bb
- Parents:
- 60403cd
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/timemanager.f90
r1a08571 r8a65cb0 43 43 ! call convection BEFORE new fields are read in BWD mode * 44 44 ! Changes Caroline Forster, Feb 2005 * 45 !new interface between flexpart and convection scheme * 46 !Emanuel's latest subroutine convect43c.f is used * 45 ! new interface between flexpart and convection scheme * 46 ! Emanuel's latest subroutine convect43c.f is used * 47 ! Changes Stefan Henne, Harald Sodemann, 2013-2014 * 48 ! added netcdf output code * 49 ! Changes Espen Sollum 2014 * 50 ! For compatibility with MPI version, * 51 ! variables uap,ucp,uzp,us,vs,ws,cbt now in module com_mod * 47 52 !***************************************************************************** 48 53 ! * … … 92 97 use par_mod 93 98 use com_mod 99 use netcdf_output_mod, only: concoutput_netcdf,concoutput_nest_netcdf,& 100 &concoutput_surf_netcdf,concoutput_surf_nest_netcdf 94 101 95 102 implicit none … … 99 106 integer :: loutnext,loutstart,loutend 100 107 integer :: ix,jy,ldeltat,itage,nage 101 real :: outnum,weight,prob(maxspec) 102 real :: uap(maxpart),ucp(maxpart),uzp(maxpart),decfact 103 real :: us(maxpart),vs(maxpart),ws(maxpart) 104 integer(kind=2) :: cbt(maxpart) 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),decfact 110 ! real :: uap(maxpart),ucp(maxpart),uzp(maxpart) 111 ! real :: us(maxpart),vs(maxpart),ws(maxpart) 112 ! integer(kind=2) :: cbt(maxpart) 105 113 real :: drydeposit(maxspec),gridtotalunc,wetgridtotalunc 106 114 real :: drygridtotalunc,xold,yold,zold,xmassfract … … 129 137 130 138 131 !write(*,45) itime,numpart,gridtotalunc,wetgridtotalunc,drygridtotalunc132 itime=0 ! initialise to avoid random numbers on output IP 2015-03-02133 write(*,46) float(itime)/3600,itime,numpart134 139 if (verbosity.gt.0) then 135 140 write (*,*) 'timemanager> starting simulation' … … 141 146 142 147 do itime=0,ideltas,lsynctime 143 if (verbosity.gt.0) then144 write (*,*) 'timemanager> itime=', itime145 endif146 147 148 148 149 ! Computation of wet deposition, OH reaction and mass transfer … … 198 199 if (nstop1.gt.1) stop 'NO METEO FIELDS AVAILABLE' 199 200 201 ! Get hourly OH fields if not available 202 !**************************************************** 203 if (OHREA) then 204 if (verbosity.gt.0) then 205 write (*,*) 'timemanager> call gethourlyOH' 206 endif 207 call gethourlyOH(itime) 208 if (verbosity.gt.1) then 209 CALL SYSTEM_CLOCK(count_clock) 210 WRITE(*,*) 'timemanager> SYSTEM CLOCK',(count_clock - count_clock0)/real(count_rate) 211 endif 212 endif 213 200 214 ! Release particles 201 215 !****************** 202 216 203 !if (verbosity.gt.0) then204 !write (*,*) 'timemanager> Release particles'205 !endif217 if (verbosity.gt.0) then 218 write (*,*) 'timemanager> Release particles' 219 endif 206 220 207 221 if (mdomainfill.ge.1) then … … 219 233 else 220 234 if (verbosity.gt.0) then 221 print*,' timemanager>call releaseparticles'235 print*,'call releaseparticles' 222 236 endif 223 237 call releaseparticles(itime) … … 354 368 if ((iout.le.3.).or.(iout.eq.5)) then 355 369 if (surf_only.ne.1) then 356 call concoutput(itime,outnum,gridtotalunc, & 357 wetgridtotalunc,drygridtotalunc) 370 if (lnetcdfout.eq.1) then 371 call concoutput_netcdf(itime,outnum,gridtotalunc,wetgridtotalunc,drygridtotalunc) 372 else 373 call concoutput(itime,outnum,gridtotalunc,wetgridtotalunc,drygridtotalunc) 374 endif 358 375 else 359 if (verbosity.eq.1) then 360 print*,'call concoutput_surf ' 361 CALL SYSTEM_CLOCK(count_clock) 362 WRITE(*,*) 'SYSTEM_CLOCK',count_clock - count_clock0 363 endif 364 call concoutput_surf(itime,outnum,gridtotalunc, & 365 wetgridtotalunc,drygridtotalunc) 366 if (verbosity.eq.1) then 367 print*,'called concoutput_surf ' 368 CALL SYSTEM_CLOCK(count_clock) 369 WRITE(*,*) 'SYSTEM_CLOCK',count_clock - count_clock0 370 endif 376 if (verbosity.eq.1) then 377 print*,'call concoutput_surf ' 378 call system_clock(count_clock) 379 write(*,*) 'system clock',count_clock - count_clock0 380 endif 381 if (lnetcdfout.eq.1) then 382 call concoutput_surf_netcdf(itime,outnum,gridtotalunc,wetgridtotalunc,drygridtotalunc) 383 else 384 call concoutput_surf(itime,outnum,gridtotalunc,wetgridtotalunc,drygridtotalunc) 385 if (verbosity.eq.1) then 386 print*,'called concoutput_surf ' 387 call system_clock(count_clock) 388 write(*,*) 'system clock',count_clock - count_clock0 389 endif 390 endif 371 391 endif 372 392 373 if ((nested_output.eq.1).and.(surf_only.ne.1)) call concoutput_nest(itime,outnum) 374 if ((nested_output.eq.1).and.(surf_only.eq.1)) call concoutput_surf_nest(itime,outnum) 393 if (nested_output .eq. 1) then 394 if (lnetcdfout.eq.0) then 395 if (surf_only.ne.1) then 396 call concoutput_nest(itime,outnum) 397 else 398 call concoutput_surf_nest(itime,outnum) 399 endif 400 else 401 if (surf_only.ne.1) then 402 call concoutput_nest_netcdf(itime,outnum) 403 else 404 call concoutput_surf_nest_netcdf(itime,outnum) 405 endif 406 endif 407 endif 375 408 outnum=0. 376 409 endif 377 410 if ((iout.eq.4).or.(iout.eq.5)) call plumetraj(itime) 378 411 if (iflux.eq.1) call fluxoutput(itime) 379 !write(*,45) itime,numpart,gridtotalunc,wetgridtotalunc,drygridtotalunc380 write(*,46) float(itime)/3600,itime,numpart412 write(*,45) itime,numpart,gridtotalunc,wetgridtotalunc,drygridtotalunc 413 !write(*,46) float(itime)/3600,itime,numpart 381 414 45 format(i9,' SECONDS SIMULATED: ',i8, ' PARTICLES: Uncertainty: ',3f7.3) 382 415 46 format(' Simulated ',f7.1,' hours (',i9,' s), ',i8, ' particles') … … 448 481 ! Loop over all particles 449 482 !************************ 450 483 ! Various variables for testing reason of CBL scheme, by mc 484 well_mixed_vector=0. !erase vector to test well mixed condition: modified by mc 485 well_mixed_norm=0. !erase normalization to test well mixed condition: modified by mc 486 avg_ol=0. 487 avg_wst=0. 488 avg_h=0. 489 avg_air_dens=0. !erase vector to obtain air density at particle positions: modified by mc 490 !----------------------------------------------------------------------------- 451 491 do j=1,numpart 452 492 … … 542 582 if (xmassfract.lt.0.0001) then ! terminate all particles carrying less mass 543 583 itra1(j)=-999999999 584 if (verbosity.gt.0) then 585 print*,'terminated particle ',j,' for small mass' 586 endif 544 587 endif 545 588 … … 558 601 559 602 if (abs(itra1(j)-itramem(j)).ge.lage(nageclass)) then 560 if (linit_cond.ge.1) & 561 call initial_cond_calc(itime+lsynctime,j) 603 if (linit_cond.ge.1) call initial_cond_calc(itime+lsynctime,j) 562 604 itra1(j)=-999999999 605 if (verbosity.gt.0) then 606 print*,'terminated particle ',j,' for age' 607 endif 563 608 endif 564 609 endif … … 566 611 endif 567 612 568 end do 613 end do !loop over particles 614 615 ! Counter of "unstable" particle velocity during a time scale of 616 ! maximumtl=20 minutes (defined in com_mod) 617 !*************************************************************** 618 619 total_nan_intl=0 620 i_nan=i_nan+1 ! added by mc to count nan during a time of maxtl (i.e. maximum tl fixed here to 20 minutes, see com_mod) 621 sum_nan_count(i_nan)=nan_count 622 if (i_nan > maxtl/lsynctime) i_nan=1 !lsynctime must be <= maxtl 623 do ii_nan=1, (maxtl/lsynctime) 624 total_nan_intl=total_nan_intl+sum_nan_count(ii_nan) 625 end do 626 ! Output to keep track of the numerical instabilities in CBL simulation and if 627 ! they are compromising the final result (or not) 628 if (cblflag.eq.1) print *,j,itime,'nan_synctime',nan_count,'nan_tl',total_nan_intl 629 630 !!------------------------------------------------------------------------------ 631 ! these lines below to test the well-mixed condition, modified by mc, not to be 632 ! included in final release: 633 ! if (itime.eq.0) then 634 ! open(551,file='/home/mc/test_cbl/out/WELLMIXEDTEST_CBL_lonlat_9_33_100_3hours_3htp_cd.DAT') 635 ! open(552,file='/home/mc/test_cbl/out/avg_ol_h_wst_lonlat_9_33_100_3hours_3htp_cd.DAT') 636 ! end if 637 ! write(552,'(5F16.7)')itime*1./3600.,avg_wst/well_mixed_norm,avg_ol/well_mixed_norm,avg_h/well_mixed_norm 638 ! do j=1,25 639 ! !write(551,*))itime*1.,h_well/50.*j,well_mixed_vector(j)/well_mixed_norm*50. 640 ! avg_air_dens(j)=avg_air_dens(j)/well_mixed_vector(j) 641 ! write(551,'(5F16.7)')itime*1.,h_well/25.*j,well_mixed_vector(j)/well_mixed_norm*25.,avg_air_dens(j),0.04*j 642 ! end do 643 !!------------------------------------------------------------------------------ 569 644 570 645 end do … … 590 665 deallocate(flux) 591 666 endif 592 if (OHREA .eqv..TRUE.) then593 deallocate(OH_field,OH_ field_height)667 if (OHREA) then 668 deallocate(OH_field,OH_hourly,lonOH,latOH,altOH) 594 669 endif 595 670 if (ldirect.gt.0) then
Note: See TracChangeset
for help on using the changeset viewer.