Changes in / [aa939a9:4c52d0b] in flexpart.git


Ignore:
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • .gitignore

    rf976c5d r969c1fe  
     1log*
     2noh*
     3diff*
    14FP_ecmwf_gfortran*
    25*.o
     
    710FLEXPART
    811FLEXPART_MPI
     12FLEX*
  • src/calcfluxes.f90

    r92fab65 ra7167e4  
    6464       (jyave.le.numygrid-1)) then
    6565    do kz=1,numzgrid                ! determine height of cell
    66       if (outheighthalf(kz).gt.zold) goto 11
     66!      if (outheighthalf(kz).gt.zold) goto 11
     67      if (outheight(kz).gt.zold) goto 11 !sec, use upper layer instead of mid layer
    6768    end do
    686911   k1=min(numzgrid,kz)
    6970    do kz=1,numzgrid                ! determine height of cell
    70       if (outheighthalf(kz).gt.ztra1(jpart)) goto 21
     71!      if (outheighthalf(kz).gt.ztra1(jpart)) goto 21
     72      if (outheight(kz).gt.ztra1(jpart)) goto 21
    7173    end do
    727421   k2=min(numzgrid,kz)
     
    9698
    9799    if (abs(xold-xtra1(jpart)).lt.real(nx)/2.) then
    98       ix1=int((xold*dx+xoutshift)/dxout+0.5)
    99       ix2=int((xtra1(jpart)*dx+xoutshift)/dxout+0.5)
     100      ix1=int((xold*dx+xoutshift)/dxout)              ! flux throught the western boundary (sec)
     101      ix2=int((xtra1(jpart)*dx+xoutshift)/dxout)      ! flux throught the western boundary (sec)
     102!      ix1=int((xold*dx+xoutshift)/dxout+0.5)
     103!      ix2=int((xtra1(jpart)*dx+xoutshift)/dxout+0.5)
    100104      do k=1,nspec
    101105        do ix=ix1,ix2-1
     
    145149  if ((kzave.le.numzgrid).and.(ixave.ge.0).and. &
    146150       (ixave.le.numxgrid-1)) then
    147     jy1=int((yold*dy+youtshift)/dyout+0.5)
    148     jy2=int((ytra1(jpart)*dy+youtshift)/dyout+0.5)
     151    jy1=int((yold*dy+youtshift)/dyout)         ! flux throught the southern boundary (sec)
     152    jy2=int((ytra1(jpart)*dy+youtshift)/dyout) ! flux throught the southern boundary (sec)
     153!    jy1=int((yold*dy+youtshift)/dyout+0.5)
     154!    jy2=int((ytra1(jpart)*dy+youtshift)/dyout+0.5)
    149155
    150156    do k=1,nspec
  • src/init_domainfill.f90

    r92fab65 rffbe224  
    209209                   ztra1(numpart+jj)=height(nz)-0.5
    210210
    211 
    212211! Interpolate PV to the particle position
    213212!****************************************
     
    216215              ixp=ixm+1
    217216              jyp=jym+1
     217              if (jyp.gt.180) then
     218                 write (*,*) 'init_domainfill, over: ',jyp,jym,ytra1(numpart+jj),jy,ran1(idummy),ny
     219                 jyp=jym
     220              endif
    218221              ddx=xtra1(numpart+jj)-real(ixm)
    219222              ddy=ytra1(numpart+jj)-real(jym)
  • src/netcdf_output_mod.f90

    • Property mode changed from 100644 to 100755
    r759df5f r759df5f  
    3636  use outg_mod,  only: outheight,oroout,densityoutgrid,factor3d,volume,&
    3737                       wetgrid,wetgridsigma,drygrid,drygridsigma,grid,gridsigma,&
    38                        area,arean,volumen, orooutn, p0out, t0out
     38                       area,arean,volumen, orooutn, areaeast, areanorth, p0out, t0out
    3939  use par_mod,   only: dep_prec, sp, dp, maxspec, maxreceptor, nclassunc,&
    4040                       unitoutrecept,unitoutreceptppt, nxmax,unittmp, &
    4141                       write_p0t0
    42   use com_mod,   only: path,length,ldirect,ibdate,ibtime,iedate,ietime, &
     42  use com_mod,   only: path,length,ldirect,bdate,ibdate,ibtime,iedate,ietime, &
    4343                       loutstep,loutaver,loutsample,outlon0,outlat0,&
    4444                       numxgrid,numygrid,dxout,dyout,numzgrid, height, &
     
    6767
    6868  public :: writeheader_netcdf,concoutput_surf_nest_netcdf,concoutput_netcdf,&
    69        &concoutput_nest_netcdf,concoutput_surf_netcdf
     69       &concoutput_nest_netcdf,concoutput_surf_netcdf,fluxoutput_netcdf
    7070
    7171!  include 'netcdf.inc'
     
    15201520end subroutine concoutput_surf_nest_netcdf
    15211521
     1522subroutine fluxoutput_netcdf(itime)
     1523     
     1524  !                            i
     1525  !*****************************************************************************
     1526  !                                                                            *
     1527  !     Output of the gridded fluxes.                                          *
     1528  !     Eastward, westward, northward, southward, upward and downward gross    *
     1529  !     fluxes are written to output file in either sparse matrix or grid dump *
     1530  !     format, whichever is more efficient.                                   *
     1531  !                                                                            *
     1532  !     Author: A. Stohl                                                       *
     1533  !                                                                            *
     1534  !     04 April 2000                                                          *
     1535  !     netcdfoutput S. Eckhardt, 2020                                         *
     1536  !                                                                            *
     1537  !*****************************************************************************
     1538
     1539   use flux_mod
     1540
     1541  implicit none
     1542
     1543  real(kind=dp) :: jul
     1544  integer :: itime,ix,jy,kz,ks,nage,jjjjmmdd,ihmmss,kp,i
     1545 
     1546  character(len=255) :: ncfname
     1547  character :: adate*8,atime*6,timeunit*32,anspec*3
     1548
     1549  integer :: ncid
     1550  integer :: timeDimID, latDimID, lonDimID, levDimID
     1551  integer :: nspecDimID, npointDimID, nageclassDimID, ncharDimID, pointspecDimID
     1552  integer :: tID, lonID, latID, levID, lageID, fluxID
     1553  integer, dimension(6)       :: dIDs
     1554  integer :: cache_size
     1555  real, allocatable, dimension(:) :: coord
     1556
     1557
     1558  ! Determine current calendar date, needed for the file name
     1559  !**********************************************************
     1560
     1561  jul=bdate+real(itime,kind=dp)/86400._dp
     1562  call caldate(jul,jjjjmmdd,ihmmss)
     1563  write(adate,'(i8.8)') jjjjmmdd
     1564  write(atime,'(i6.6)') ihmmss
     1565
     1566  ncfname=path(2)(1:length(2))//'grid_flux_'//adate// &
     1567       atime//'.nc'
     1568
     1569  ! setting cache size in bytes. It is set to 4 times the largest data block that is written
     1570  !   size_type x nx x ny x nz
     1571  ! create file
     1572
     1573  cache_size = 16 * numxgrid * numygrid * numzgrid
     1574  call nf90_err(nf90_create(trim(ncfname), cmode = nf90_hdf5, ncid = ncid, &
     1575    cache_size = cache_size)) 
     1576
     1577  ! create dimensions:
     1578  !*************************
     1579  ! time
     1580  call nf90_err(nf90_def_dim(ncid, 'time', nf90_unlimited, timeDimID))
     1581  timeunit = 'seconds since '//adate(1:4)//'-'//adate(5:6)// &
     1582     '-'//adate(7:8)//' '//atime(1:2)//':'//atime(3:4)
     1583
     1584  call nf90_err(nf90_def_dim(ncid, 'longitude', numxgrid, lonDimID))
     1585  call nf90_err(nf90_def_dim(ncid, 'latitude', numygrid, latDimID))
     1586  call nf90_err(nf90_def_dim(ncid, 'height', numzgrid, levDimID))
     1587  call nf90_err(nf90_def_dim(ncid, 'numspec', nspec, nspecDimID))
     1588  call nf90_err(nf90_def_dim(ncid, 'pointspec', maxpointspec_act, pointspecDimID))
     1589  call nf90_err(nf90_def_dim(ncid, 'nageclass', nageclass, nageclassDimID))
     1590  call nf90_err(nf90_def_dim(ncid, 'nchar', 45, ncharDimID))
     1591  call nf90_err(nf90_def_dim(ncid, 'numpoint', numpoint, npointDimID))
     1592
     1593
     1594  ! create variables
     1595  !*************************
     1596
     1597  ! time
     1598  call nf90_err(nf90_def_var(ncid, 'time', nf90_int, (/ timeDimID /), tID))
     1599  call nf90_err(nf90_put_att(ncid, tID, 'units', timeunit))
     1600  call nf90_err(nf90_put_att(ncid, tID, 'calendar', 'proleptic_gregorian'))
     1601  timeID = tID
     1602
     1603  ! lon
     1604  call nf90_err(nf90_def_var(ncid, 'longitude', nf90_float, (/ lonDimID /), lonID))
     1605  call nf90_err(nf90_put_att(ncid, lonID, 'long_name', 'longitude in degree east'))
     1606  call nf90_err(nf90_put_att(ncid, lonID, 'axis', 'Lon'))
     1607  call nf90_err(nf90_put_att(ncid, lonID, 'units', 'degrees_east'))
     1608  call nf90_err(nf90_put_att(ncid, lonID, 'standard_name', 'grid_longitude'))
     1609  call nf90_err(nf90_put_att(ncid, lonID, 'description', 'grid cell centers'))
     1610
     1611  ! lat
     1612  call nf90_err(nf90_def_var(ncid, 'latitude', nf90_float, (/ latDimID /), latID))
     1613  call nf90_err(nf90_put_att(ncid, latID, 'long_name', 'latitude in degree north'))
     1614  call nf90_err(nf90_put_att(ncid, latID, 'axis', 'Lat'))
     1615  call nf90_err(nf90_put_att(ncid, latID, 'units', 'degrees_north'))
     1616  call nf90_err(nf90_put_att(ncid, latID, 'standard_name', 'grid_latitude'))
     1617  call nf90_err(nf90_put_att(ncid, latID, 'description', 'grid cell centers'))
     1618
     1619  ! height
     1620  call nf90_err(nf90_def_var(ncid, 'height', nf90_float, (/ levDimID /), levID))
     1621  call nf90_err(nf90_put_att(ncid, levID, 'units', 'meters'))
     1622  call nf90_err(nf90_put_att(ncid, levID, 'positive', 'up'))
     1623  call nf90_err(nf90_put_att(ncid, levID, 'standard_name', 'height'))
     1624
     1625  if (.not.allocated(coord)) allocate(coord(numxgrid))
     1626  do i = 1,numxgrid
     1627     coord(i) = outlon0 + (i-0.5)*dxout
     1628  enddo
     1629  call nf90_err(nf90_put_var(ncid, lonID, coord(1:numxgrid)))
     1630  deallocate(coord)
     1631  if (.not.allocated(coord)) allocate(coord(numygrid))
     1632  do i = 1,numygrid
     1633     coord(i) = outlat0 + (i-0.5)*dyout
     1634  enddo
     1635  call nf90_err(nf90_put_var(ncid, latID, coord(1:numygrid)))
     1636  deallocate(coord)
     1637  call nf90_err(nf90_put_var(ncid, levID, outheight(1:numzgrid)))
     1638
     1639  ! write time, one field per time - different to the others!
     1640  call nf90_err(nf90_put_var( ncid, timeID, itime, (/ 1 /)))
     1641 
     1642  dIDs = (/ londimid, latdimid, levdimid, timedimid, pointspecdimid, nageclassdimid /)
     1643
     1644  do ks=1,nspec
     1645    do kp=1,maxpointspec_act
     1646      do nage=1,nageclass
     1647 
     1648         write(anspec,'(i3.3)') ks
     1649
     1650 ! East Flux
     1651        call nf90_err(nf90_def_var(ncid,'flux_east_'//anspec, nf90_float, dIDs, &
     1652             fluxID))
     1653
     1654        do jy=0,numygrid-1
     1655          do ix=0,numxgrid-1
     1656            do kz=1, numzgrid
     1657               grid(ix,jy,kz)=flux(1,ix,jy,kz,ks,kp,nage)
     1658            end do
     1659          end do
     1660        end do
     1661
     1662        call nf90_err(nf90_put_var(ncid,fluxid,1.e12*grid(0:numxgrid-1,0:numygrid-1,1:numzgrid)&
     1663            /areaeast(0:numxgrid-1,0:numygrid-1,1:numzgrid)/loutstep,&
     1664           (/ 1,1,1,1,kp,nage /), (/ numxgrid,numygrid,numzgrid,1,1,1 /) ))
     1665
     1666 ! West Flux
     1667        call nf90_err(nf90_def_var(ncid,'flux_west_'//anspec, nf90_float, dIDs, &
     1668             fluxID))
     1669
     1670        do jy=0,numygrid-1
     1671          do ix=0,numxgrid-1
     1672            do kz=1, numzgrid
     1673               grid(ix,jy,kz)=flux(2,ix,jy,kz,ks,kp,nage)
     1674            end do
     1675          end do
     1676        end do
     1677
     1678        call nf90_err(nf90_put_var(ncid,fluxid,1.e12*grid(0:numxgrid-1,0:numygrid-1,1:numzgrid)&
     1679            /areaeast(0:numxgrid-1,0:numygrid-1,1:numzgrid)/loutstep,&
     1680           (/ 1,1,1,1,kp,nage /), (/ numxgrid,numygrid,numzgrid,1,1,1 /) ))
     1681
     1682 ! North Flux
     1683        call nf90_err(nf90_def_var(ncid,'flux_north_'//anspec, nf90_float, dIDs, &
     1684             fluxID))
     1685
     1686        do jy=0,numygrid-1
     1687          do ix=0,numxgrid-1
     1688            do kz=1, numzgrid
     1689               grid(ix,jy,kz)=flux(4,ix,jy,kz,ks,kp,nage)
     1690            end do
     1691          end do
     1692        end do
     1693
     1694        call nf90_err(nf90_put_var(ncid,fluxid,1.e12*grid(0:numxgrid-1,0:numygrid-1,1:numzgrid)&
     1695            /areanorth(0:numxgrid-1,0:numygrid-1,1:numzgrid)/loutstep,&
     1696           (/ 1,1,1,1,kp,nage /), (/ numxgrid,numygrid,numzgrid,1,1,1 /) ))
     1697
     1698 ! South Flux
     1699        call nf90_err(nf90_def_var(ncid,'flux_south_'//anspec, nf90_float, dIDs, &
     1700             fluxID))
     1701
     1702        do jy=0,numygrid-1
     1703          do ix=0,numxgrid-1
     1704            do kz=1, numzgrid
     1705               grid(ix,jy,kz)=flux(3,ix,jy,kz,ks,kp,nage)
     1706            end do
     1707          end do
     1708        end do
     1709
     1710        call nf90_err(nf90_put_var(ncid,fluxid,1.e12*grid(0:numxgrid-1,0:numygrid-1,1:numzgrid)&
     1711            /areanorth(0:numxgrid-1,0:numygrid-1,1:numzgrid)/loutstep,&
     1712           (/ 1,1,1,1,kp,nage /), (/ numxgrid,numygrid,numzgrid,1,1,1 /) ))
     1713
     1714 ! Up Flux
     1715        call nf90_err(nf90_def_var(ncid,'flux_up_'//anspec, nf90_float, dIDs, &
     1716             fluxID))
     1717
     1718        do jy=0,numygrid-1
     1719          do ix=0,numxgrid-1
     1720            do kz=1, numzgrid
     1721               grid(ix,jy,kz)=flux(5,ix,jy,kz,ks,kp,nage)/area(ix,jy)
     1722            end do
     1723          end do
     1724        end do
     1725
     1726        call nf90_err(nf90_put_var(ncid,fluxid,1.e12*grid(0:numxgrid-1,0:numygrid-1,1:numzgrid)&
     1727            /loutstep,&
     1728           (/ 1,1,1,1,kp,nage /), (/ numxgrid,numygrid,numzgrid,1,1,1 /) ))
     1729
     1730 ! Down Flux
     1731        call nf90_err(nf90_def_var(ncid,'flux_down_'//anspec, nf90_float, dIDs, &
     1732             fluxID))
     1733
     1734        do jy=0,numygrid-1
     1735          do ix=0,numxgrid-1
     1736            do kz=1, numzgrid
     1737               grid(ix,jy,kz)=flux(6,ix,jy,kz,ks,kp,nage)/area(ix,jy)
     1738            end do
     1739          end do
     1740        end do
     1741
     1742        call nf90_err(nf90_put_var(ncid,fluxid,1.e12*grid(0:numxgrid-1,0:numygrid-1,1:numzgrid)&
     1743            /loutstep,&
     1744           (/ 1,1,1,1,kp,nage /), (/ numxgrid,numygrid,numzgrid,1,1,1 /) ))
     1745
     1746      end do
     1747    end do
     1748  end do
     1749
     1750  ! Close netCDF file
     1751  call nf90_err(nf90_close(ncid))
     1752
     1753  ! Reinitialization of grid
     1754  !*************************
     1755
     1756  do ks=1,nspec
     1757    do kp=1,maxpointspec_act
     1758      do jy=0,numygrid-1
     1759        do ix=0,numxgrid-1
     1760          do kz=1,numzgrid
     1761            do nage=1,nageclass
     1762              do i=1,6
     1763                flux(i,ix,jy,kz,ks,kp,nage)=0.
     1764              end do
     1765            end do
     1766          end do
     1767        end do
     1768      end do
     1769    end do
     1770  end do
     1771
     1772
     1773end subroutine fluxoutput_netcdf
     1774
    15221775end module netcdf_output_mod
    15231776
  • src/readspecies.f90

    r92fab65 r03adec6  
    4242  implicit none
    4343
    44   integer :: i, pos_spec,j
     44  integer :: i, pos_spec,j,icheck_dow_hour
    4545  integer :: idow,ihour,id_spec
    4646  character(len=3) :: aspecnumb
     
    229229    ohnconst(pos_spec)=pohnconst
    230230
     231
     232    icheck_dow_hour=0
    231233    do j=1,24     ! 24 hours, starting with 0-1 local time
    232234      area_hour(pos_spec,j)=parea_hour(j)
    233235      point_hour(pos_spec,j)=ppoint_hour(j)
     236      if (parea_hour(j).ne.1 .or. ppoint_hour(j).ne.1) icheck_dow_hour=1
    234237    end do
    235238    do j=1,7      ! 7 days of the week, starting with Monday
    236239      area_dow(pos_spec,j)=parea_dow(j)
    237240      point_dow(pos_spec,j)=ppoint_dow(j)
     241      if (parea_dow(j).ne.1 .or. ppoint_dow(j).ne.1) icheck_dow_hour=1
    238242    end do
    239243
     
    35736120 continue
    358362
     363  if ((icheck_dow_hour.eq.1).and.(ldirect.lt.0)) then
     364    write(*,*) '#### FLEXPART MODEL WARNING                     ####'
     365    write(*,*) '#### The variation for an emission release      ####'
     366    write(*,*) '#### will have no effect in backward mode       ####' 
     367  endif
    359368
    36036922 close(unitspecies)
  • src/timemanager.f90

    rf3054ea rf3054ea  
    8585#ifdef USE_NCF
    8686  use netcdf_output_mod, only: concoutput_netcdf,concoutput_nest_netcdf,&
    87        &concoutput_surf_netcdf,concoutput_surf_nest_netcdf
     87       &concoutput_surf_netcdf,concoutput_surf_nest_netcdf,fluxoutput_netcdf
    8888#endif
    8989
     
    433433        endif
    434434        if ((iout.eq.4).or.(iout.eq.5)) call plumetraj(itime)
    435         if (iflux.eq.1) call fluxoutput(itime)
     435        if ((iflux.eq.1).and.(lnetcdfout.eq.0)) call fluxoutput(itime)
     436#ifdef USE_NCF
     437        if ((iflux.eq.1).and.(lnetcdfout.eq.1)) call fluxoutput_netcdf(itime)
     438#endif
    436439        write(*,45) itime,numpart,gridtotalunc,wetgridtotalunc,drygridtotalunc
    437440 
  • src/timemanager_mpi.f90

    rf06b72a rf06b72a  
    556556        endif
    557557        if ((iout.eq.4).or.(iout.eq.5)) call plumetraj(itime)
    558         if (iflux.eq.1) call fluxoutput(itime)
     558        if ((iflux.eq.1).and.(lnetcdfout.eq.0)) call fluxoutput(itime)
     559        if ((iflux.eq.1).and.(lnetcdfout.eq.1)) call fluxoutput_netcdf(itime)
    559560        if (mp_measure_time) call mpif_mtime('iotime',1)
    560561
Note: See TracChangeset for help on using the changeset viewer.
hosted by ZAMG