Changeset 78e62dc in flexpart.git for src


Ignore:
Timestamp:
May 12, 2015, 12:28:19 PM (9 years ago)
Author:
flexpart <>
Branches:
master, 10.4.1_pesei, GFS_025, bugfixes+enhancements, dev, release-10, release-10.4.1, scaling-bug, univie
Children:
0f20c31
Parents:
2f8635b
Message:

New OH parameter in SPECIES files (now 3 instead of 2). New path to OH binariy files.

Location:
src
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • src/FLEXPART.f90

    r8a65cb0 r78e62dc  
    6969
    7070  ! FLEXPART version string
    71   flexversion='Version 10.0pre  (2015-03-01)'
     71  flexversion='Version 10.0beta (2015-05-01)'
    7272  verbosity=0
    7373
  • src/FLEXPART_MPI.f90

    r2f8635b r78e62dc  
    7777
    7878  ! FLEXPART version string
    79   flexversion='Ver. 10.0pre MPI (2015-03-01)'
     79  flexversion='Ver. 10 Beta MPI (2015-05-01)'
    8080  verbosity=0
    8181
     
    336336  !******************************************************************
    337337
     338  if (mp_measure_time) call mpif_mtime('iotime',0)
     339  if (lroot) then ! MPI: this part root process only
     340
    338341  if (lnetcdfout.eq.1) then
    339342    call writeheader_netcdf(lnest=.false.)
     
    350353  endif
    351354
    352   if (lroot) then ! MPI: this part root process only
     355!
    353356    if (verbosity.gt.0) then
    354357      print*,'call writeheader'
     
    364367  end if ! (mpif_pid == 0)
    365368
     369  if (mp_measure_time) call mpif_mtime('iotime',0)
     370
    366371  !open(unitdates,file=path(2)(1:length(2))//'dates')
    367 
    368 !open(unitdates,file=path(2)(1:length(2))//'dates')
    369372
    370373  if (verbosity.gt.0 .and. lroot) then
  • src/com_mod.f90

    r5f9d14a r78e62dc  
    2626  integer :: length(numpath+2*maxnests)
    2727  character(len=256) :: pathfile, flexversion, arg1, arg2
     28  character(len=256) :: ohfields_path
    2829 
    2930  ! path                    path names needed for trajectory model
     
    3233  ! flexversion             version of flexpart
    3334  ! arg                     input arguments from launch at command line
     35  ! ohfields_path           path to binary files for OH fields
    3436
    3537  !********************************************************
     
    163165  real :: rgs(maxspec,5,numclass),rlu(maxspec,5,numclass)
    164166  real :: rm(maxspec),dryvel(maxspec),kao(maxspec)
    165   real :: ohcconst(maxspec),ohdconst(maxspec)
     167  real :: ohcconst(maxspec),ohdconst(maxspec),ohnconst(maxspec)
    166168  ! se  it is possible to associate a species with a second one to make transfer from gas to aerosol
    167169  integer :: spec_ass(maxspec)
  • src/getfields_mpi.f90

    r5f9d14a r78e62dc  
    4343!
    4444!  eso 2014:
    45 !    MPI version. 3 fields instead of 2, to allow reading the newest in
    46 !    the background.
    47 !    Only one process (lmpreader=.true.) does the actual reading, while the
    48 !    rest call this routine only to update memind, memstat etc.
     45!    MPI version.
     46!    If running with number of processes >= mpi_mod::read_grp_min,
     47!    only one process (mpi_mod::lmpreader=.true.) does the actual reading, while
     48!    the rest call this routine only to update memind, memstat etc.
     49!
     50!    If mpi_mod::lmp_sync=.true., uses 3 fields instead of 2, to allow reading
     51!    the newest in the background.
    4952!
    5053!    Return memstat, which is the sum of
     
    6164! indj                 indicates the number of the wind field to be read in  *
    6265! indmin               remembers the number of wind fields already treated   *
    63 ! memind(2)            pointer, on which place the wind fields are stored    *
    64 ! memtime(2) [s]       times of the wind fields, which are kept in memory    *
     66! memind(2[3])         pointer, on which place the wind fields are stored    *
     67! memtime(2[3]) [s]    times of the wind fields, which are kept in memory    *
    6568! itime [s]            current time since start date of trajectory calcu-    *
    6669!                      lation                                                *
  • src/gethourlyOH.f90

    r5f9d14a r78e62dc  
    120120    memOHtime(1)=0.
    121121
    122     jul2=bdate+real(1./24.,kind=dp)  ! date for next hour
     122    jul2=bdate+ldirect*real(1./24.,kind=dp)  ! date for next hour
    123123    call caldate(jul2,jjjjmmdd,hhmmss)
    124124    m2=(jjjjmmdd-(jjjjmmdd/10000)*10000)/100
  • src/mpi_mod.f90

    r5f9d14a r78e62dc  
    9090  integer :: tm1
    9191  integer, parameter :: nvar_async=27 !29 :DBG:
    92   !integer, dimension(:), allocatable :: tags
     92!integer, dimension(:), allocatable :: tags
    9393  integer, dimension(:), allocatable :: reqs
    9494
     
    117117  logical, parameter :: mp_dbg_out = .false.
    118118  logical, parameter :: mp_time_barrier=.true.
    119   logical, parameter :: mp_measure_time=.true.
     119  logical, parameter :: mp_measure_time=.false.
    120120
    121121! for measuring CPU/Wall time
     
    139139  real(dp) :: mp_conccalc_time_beg, mp_conccalc_time_end, mp_conccalc_time_total=0.
    140140  real(dp) :: mp_total_wtime_beg, mp_total_wtime_end, mp_total_wtime_total=0.
     141  real(dp) :: mp_vt_wtime_beg, mp_vt_wtime_end, mp_vt_wtime_total
     142  real(sp) :: mp_vt_time_beg, mp_vt_time_end, mp_vt_time_total
    141143
    142144! dat_lun           logical unit number for i/o
     
    418420
    419421
    420 
    421422! redefine numpart as 'numpart per process' throughout the code
    422423!**************************************************************
     
    438439
    439440    integer :: i
    440 
    441 
    442 !***********************************************************************
    443 
    444441
    445442! Time for MPI communications
     
    12431240
    12441241    do dest=0,mp_np-1 ! mp_np-2 will also work if last proc reserved for reading
    1245                       ! TODO: use mp_partgroup_np here
     1242! TODO: use mp_partgroup_np here
    12461243      if (dest.eq.id_read) cycle
    12471244      i=dest*nvar_async
     
    13391336             &MPI_COMM_WORLD,reqs(i),mp_ierr)
    13401337        if (mp_ierr /= 0) goto 600
    1341       ! else
    1342       !   i=i+2
     1338! else
     1339!   i=i+2
    13431340      end if
    13441341
     
    13891386
    13901387! :TODO: don't need these
    1391     ! d3s1=d3_size1
    1392     ! d3s2=d3_size2
    1393     ! d2s1=d2_size1
    1394     ! d2s2=d2_size2
     1388! d3s1=d3_size1
     1389! d3s2=d3_size2
     1390! d2s1=d2_size1
     1391! d2s2=d2_size2
    13951392
    13961393! At the time this immediate receive is posted, memstat is the state of
     
    15931590    call MPI_Waitall(n_req,reqs,MPI_STATUSES_IGNORE,mp_ierr)
    15941591!    endif
    1595     ! else
    1596     !   do i = 0, nvar_async*mp_np-1
    1597     !     if (mod(i,27).eq.0 .or. mod(i,28).eq.0) then
    1598     !       call MPI_Cancel(reqs(i),mp_ierr)
    1599     !       cycle
    1600     !     end if
    1601     !     call MPI_Wait(reqs(i),MPI_STATUS_IGNORE,mp_ierr)
    1602     !   end do
    1603     ! end if
     1592! else
     1593!   do i = 0, nvar_async*mp_np-1
     1594!     if (mod(i,27).eq.0 .or. mod(i,28).eq.0) then
     1595!       call MPI_Cancel(reqs(i),mp_ierr)
     1596!       cycle
     1597!     end if
     1598!     call MPI_Wait(reqs(i),MPI_STATUS_IGNORE,mp_ierr)
     1599!   end do
     1600! end if
    16041601
    16051602    if (mp_ierr /= 0) goto 600
     
    17331730           & mp_comm_used, mp_ierr)
    17341731    end if
    1735 
    17361732
    17371733    if ((WETDEP).and.(ldirect.gt.0)) then
     
    18541850      end if
    18551851
     1852    case ('verttransform')
     1853      if (imode.eq.0) then
     1854        mp_vt_wtime_beg = mpi_wtime()
     1855        call cpu_time(mp_vt_time_beg)
     1856      else
     1857        mp_vt_wtime_end = mpi_wtime()
     1858        call cpu_time(mp_vt_time_end)
     1859
     1860        mp_vt_wtime_total = mp_vt_wtime_total + (mp_vt_wtime_end - &
     1861             & mp_vt_wtime_beg)
     1862        mp_vt_time_total = mp_vt_time_total + (mp_vt_time_end - &
     1863             & mp_vt_time_beg)
     1864      end if
     1865
    18561866    case ('readwind')
    18571867      if (imode.eq.0) then
     
    19091919!***********************************************************************
    19101920
    1911     if (mp_measure_time) then
     1921    IF (mp_measure_time) THEN
    19121922      do ip=0, mp_np-1
    19131923        call MPI_BARRIER(MPI_COMM_WORLD, mp_ierr)
     
    19561966          write(*,FMT='(A60,TR1,F9.2)') 'TOTAL WALL TIME FOR CONCCALC:',&
    19571967               & mp_conccalc_time_total
     1968          ! write(*,FMT='(A60,TR1,F9.2)') 'TOTAL WALL TIME FOR VERTTRANSFORM:',&
     1969          !      & mp_vt_wtime_total
     1970          ! write(*,FMT='(A60,TR1,F9.2)') 'TOTAL CPU TIME FOR VERTTRANSFORM:',&
     1971          !      & mp_vt_time_total
    19581972! NB: the 'flush' function is possibly a gfortran-specific extension
    19591973          call flush()
     
    19621976    end if
    19631977
     1978! This call to barrier is for correctly formatting output
     1979    call MPI_BARRIER(MPI_COMM_WORLD, mp_ierr)
     1980
     1981    if (lroot) then
     1982      write(*,FMT='(72("#"))')
     1983      WRITE(*,*) "To turn off output of time measurements, set "
     1984      WRITE(*,*) "    mp_measure_time=.false."
     1985      WRITE(*,*) "in file mpi_mod.f90"
     1986      write(*,FMT='(72("#"))')
     1987    end if
     1988
    19641989! j=mp_pid*nvar_async
    19651990! In the implementation with 3 fields, the processes may have posted
    19661991! MPI_Irecv requests that should be cancelled here
    19671992!! TODO:
    1968     ! if (.not.lmp_sync) then
    1969     !   r=mp_pid*nvar_async
    1970     !   do j=r,r+nvar_async-1
    1971     !     call MPI_Cancel(j,mp_ierr)
    1972     !     if (mp_ierr /= 0) write(*,*) '#### mpif_finalize::MPI_Cancel> ERROR ####'
    1973     !   end do
    1974     ! end if
     1993! if (.not.lmp_sync) then
     1994!   r=mp_pid*nvar_async
     1995!   do j=r,r+nvar_async-1
     1996!     call MPI_Cancel(j,mp_ierr)
     1997!     if (mp_ierr /= 0) write(*,*) '#### mpif_finalize::MPI_Cancel> ERROR ####'
     1998!   end do
     1999! end if
    19752000
    19762001    call MPI_FINALIZE(mp_ierr)
     
    19812006
    19822007
    1983   end subroutine mpif_finalize
    1984 
    1985 
    1986   subroutine get_lun(my_lun)
     2008    end subroutine mpif_finalize
     2009
     2010
     2011    subroutine get_lun(my_lun)
    19872012!***********************************************************************
    19882013! get_lun:
     
    19902015!***********************************************************************
    19912016
    1992     implicit none
    1993 
    1994     integer, intent(inout) :: my_lun
    1995     integer, save :: free_lun=100
    1996     logical :: exists, iopen
    1997 
    1998 !***********************************************************************
    1999 
    2000     loop1: do
    2001       inquire(UNIT=free_lun, EXIST=exists, OPENED=iopen)
    2002       if (exists .and. .not.iopen) exit loop1
    2003       free_lun = free_lun+1
    2004     end do loop1
    2005     my_lun = free_lun
    2006 
    2007   end subroutine get_lun
    2008 
    2009 
    2010   subroutine write_data_dbg(array_in, array_name, tstep, ident)
    2011 !***********************************************************************
    2012 ! Write one-dimensional arrays to disk (for debugging purposes)
    2013 !***********************************************************************
    2014     implicit none
    2015 
    2016     real, intent(in), dimension(:) :: array_in
    2017     integer, intent(in) :: tstep
    2018     integer :: lios
    2019     character(LEN=*), intent(in) :: ident, array_name
    2020 
    2021     character(LEN=8) :: c_ts
    2022     character(LEN=40) :: fn_1, fn_2
    2023 
    2024 !***********************************************************************
    2025 
    2026     write(c_ts, FMT='(I8.8,BZ)') tstep
    2027     fn_1='-'//trim(adjustl(c_ts))//'-'//trim(ident)
    2028     write(c_ts, FMT='(I2.2,BZ)') mp_np
    2029     fn_2= trim(adjustl(array_name))//trim(adjustl(fn_1))//'-np'//trim(adjustl(c_ts))//'.dat'
    2030 
    2031     call get_lun(dat_lun)
    2032     open(UNIT=dat_lun, FILE=fn_2, IOSTAT=lios, ACTION='WRITE', &
    2033          FORM='UNFORMATTED', STATUS='REPLACE')
    2034     write(UNIT=dat_lun, IOSTAT=lios) array_in
    2035     close(UNIT=dat_lun)
    2036 
    2037   end subroutine write_data_dbg
     2017      implicit none
     2018
     2019      integer, intent(inout) :: my_lun
     2020      integer, save :: free_lun=100
     2021      logical :: exists, iopen
     2022
     2023!***********************************************************************
     2024
     2025      loop1: do
     2026        inquire(UNIT=free_lun, EXIST=exists, OPENED=iopen)
     2027        if (exists .and. .not.iopen) exit loop1
     2028        free_lun = free_lun+1
     2029      end do loop1
     2030      my_lun = free_lun
     2031
     2032    end subroutine get_lun
     2033
     2034
     2035    subroutine write_data_dbg(array_in, array_name, tstep, ident)
     2036!***********************************************************************
     2037! Write one-dimensional arrays to file (for debugging purposes)
     2038!***********************************************************************
     2039      implicit none
     2040
     2041      real, intent(in), dimension(:) :: array_in
     2042      integer, intent(in) :: tstep
     2043      integer :: lios
     2044      character(LEN=*), intent(in) :: ident, array_name
     2045
     2046      character(LEN=8) :: c_ts
     2047      character(LEN=40) :: fn_1, fn_2
     2048
     2049!***********************************************************************
     2050
     2051      write(c_ts, FMT='(I8.8,BZ)') tstep
     2052      fn_1='-'//trim(adjustl(c_ts))//'-'//trim(ident)
     2053      write(c_ts, FMT='(I2.2,BZ)') mp_np
     2054      fn_2= trim(adjustl(array_name))//trim(adjustl(fn_1))//'-np'//trim(adjustl(c_ts))//'.dat'
     2055
     2056      call get_lun(dat_lun)
     2057      open(UNIT=dat_lun, FILE=fn_2, IOSTAT=lios, ACTION='WRITE', &
     2058           FORM='UNFORMATTED', STATUS='REPLACE')
     2059      write(UNIT=dat_lun, IOSTAT=lios) array_in
     2060      close(UNIT=dat_lun)
     2061
     2062    end subroutine write_data_dbg
    20382063
    20392064
  • src/ohreaction.f90

    r8a65cb0 r78e62dc  
    153153      do k=1,nspec                               
    154154        if (ohcconst(k).gt.0.) then
    155           ohrate=ohcconst(k)*temp**2*exp(-ohdconst(k)/temp)*oh_average
     155          ohrate=ohcconst(k)*temp**ohnconst(k)*exp(-ohdconst(k)/temp)*oh_average
    156156          ! new particle mass
    157157          restmass = xmass1(jpart,k)*exp(-1*ohrate*abs(ltsample))
  • src/readOHfield.f90

    r8a65cb0 r78e62dc  
    4646  use com_mod
    4747
    48 
    4948  implicit none
    5049
     
    6968    ! open netcdf file
    7069    write(mm,fmt='(i2.2)') m
    71     thefile=trim(path(1))//'OH_FIELDS/'//'geos-chem.OH.2005'//mm//'01.nc'
     70!    thefile=trim(path(1))//'OH_FIELDS/'//'geos-chem.OH.2005'//mm//'01.nc'
     71    thefile=trim(ohfields_path)//'OH_FIELDS/'//'geos-chem.OH.2005'//mm//'01.nc'
    7272    ierr=nf_open(trim(thefile),NF_NOWRITE,nid)
    7373    if(ierr.ne.0) then
     
    163163
    164164  ! open netcdf file
    165   thefile=trim(path(1))//'OH_FIELDS/jrate_average.nc'
     165!  thefile=trim(path(1))//'OH_FIELDS/jrate_average.nc'
     166  thefile=trim(ohfields_path)//'OH_FIELDS/jrate_average.nc'
    166167  ierr=nf_open(trim(thefile),NF_NOWRITE,nid)
    167168  if(ierr.ne.0) then
  • src/readcommand.f90

    r8a65cb0 r78e62dc  
    111111  lnetcdfout, &
    112112  surf_only, &
    113   cblflag
     113  cblflag, &
     114  ohfields_path
    114115
    115116  ! Presetting namelist command
     
    143144  surf_only=0
    144145  cblflag=0
     146  ohfields_path="../../flexin/"
    145147
    146148  ! Open the command file and read user options
     
    232234    if (old) call skplin(3,unitcommand)  !added by mc
    233235    read(unitcommand,*) cblflag          !added by mc
     236
    234237    close(unitcommand)
    235238
  • src/readreleases.f90

    r5f9d14a r78e62dc  
    385385    if (ohcconst(i).gt.0.) then
    386386      OHREA=.true.
    387       write (*,*) 'OHreaction switched on: ',ohcconst(i),i
     387      if (lroot) write (*,*) 'OHreaction switched on: ',ohcconst(i),i
    388388    endif
    389389
  • src/readspecies.f90

    r5f9d14a r78e62dc  
    4747  ! ohcconst             OH reaction rate constant C                           *
    4848  ! ohdconst             OH reaction rate constant D                           *
     49  ! ohnconst             OH reaction rate constant n                           *
    4950  ! id_spec              SPECIES number as referenced in RELEASE file          *
    5051  ! id_pos               position where SPECIES data shall be stored           *
     
    6667  character(len=16) :: pspecies
    6768  real :: pdecay, pweta, pwetb, preldiff, phenry, pf0, pdensity, pdquer
    68   real :: pdsigma, pdryvel, pweightmolar, pohcconst, pohdconst, pspec_ass, pkao
     69  real :: pdsigma, pdryvel, pweightmolar, pohcconst, pohdconst, pohnconst, pspec_ass, pkao
    6970  real :: pweta_in, pwetb_in, pwetc_in, pwetd_in
    7071  integer :: readerror
     
    7576       pweta_in, pwetb_in, pwetc_in, pwetd_in, &
    7677       preldiff, phenry, pf0, pdensity, pdquer, &
    77        pdsigma, pdryvel, pweightmolar, pohcconst, pohdconst, pspec_ass, pkao
     78       pdsigma, pdryvel, pweightmolar, pohcconst, pohdconst, pohnconst, pspec_ass, pkao
    7879
    7980  pspecies=" "
     
    9495  pohcconst=-9.99
    9596  pohdconst=-9.9E-09
     97  pohnconst=2.0
    9698  pspec_ass=-9
    9799  pkao=-99.99
     
    160162    read(unitspecies,'(f8.2)',end=22) ohdconst(pos_spec)
    161163!  write(*,*) ohdconst(pos_spec)
     164    read(unitspecies,'(f8.2)',end=22) ohnconst(pos_spec)
     165!  write(*,*) ohnconst(pos_spec)
    162166    read(unitspecies,'(i18)',end=22) spec_ass(pos_spec)
    163167!  write(*,*) spec_ass(pos_spec)
     
    183187    pohcconst=ohcconst(pos_spec)
    184188    pohdconst=ohdconst(pos_spec)
     189    pohnconst=ohnconst(pos_spec)
    185190    pspec_ass=spec_ass(pos_spec)
    186191    pkao=kao(pos_spec)
     
    206211    ohcconst(pos_spec)=pohcconst
    207212    ohdconst(pos_spec)=pohdconst
     213    ohnconst(pos_spec)=pohnconst
    208214    spec_ass(pos_spec)=pspec_ass
    209215    kao(pos_spec)=pkao
  • src/timemanager.f90

    r8a65cb0 r78e62dc  
    657657  if (linit_cond.ge.1) call initial_cond_output(itime)   ! dump initial cond. field
    658658
    659   close(104)
     659  !close(104)
    660660
    661661  ! De-allocate memory and end
  • src/timemanager_mpi.f90

    r5f9d14a r78e62dc  
    208208    endif
    209209
     210! This time measure includes reading/MPI communication (for the reader process),
     211! or MPI communication time only (for other processes)
    210212    if (mp_measure_time) call mpif_mtime('getfields',0)
    211213
     
    213215
    214216    if (mp_measure_time) call mpif_mtime('getfields',1)
     217
     218
    215219
    216220! Broadcast fields to all MPI processes
    217221! Skip if all processes have called getfields or if no new fields
    218222!*****************************************************************
     223
     224    if (mp_measure_time.and..not.(lmpreader.and.lmp_use_reader)) call mpif_mtime('getfields',0)
    219225
    220226! Version 1 (lmp_sync=.true.) uses a read-ahead process where send/recv is done
     
    258264
    259265    end if
     266
     267    if (mp_measure_time.and..not.(lmpreader.and.lmp_use_reader)) call mpif_mtime('getfields',1)
     268
    260269
    261270!*******************************************************************************
     
    446455          call mpif_tm_reduce_grid
    447456
     457          if (mp_measure_time) call mpif_mtime('iotime',0)
    448458          if (surf_only.ne.1) then
    449459            if (lroot) then
     
    470480            endif
    471481          endif
     482          if (mp_measure_time) call mpif_mtime('iotime',1)
    472483
    473484! :TODO: Correct calling of conc_surf above?
     
    481492!*********************************************
    482493            call mpif_tm_reduce_grid_nest
     494 
     495           if (mp_measure_time) call mpif_mtime('iotime',0)
    483496
    484497            if (lnetcdfout.eq.0) then
     
    515528            end if
    516529          end if
     530         
    517531
    518532          outnum=0.
     
    520534        if ((iout.eq.4).or.(iout.eq.5)) call plumetraj(itime)
    521535        if (iflux.eq.1) call fluxoutput(itime)
     536        if (mp_measure_time) call mpif_mtime('iotime',1)
     537
    522538        if (lroot) write(*,45) itime,numpart*mp_partgroup_np,gridtotalunc,&
    523539             &wetgridtotalunc,drygridtotalunc
Note: See TracChangeset for help on using the changeset viewer.
hosted by ZAMG