Changes in src/concoutput_nest_mpi.f90 [92fab65:f3054ea] in flexpart.git


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/concoutput_nest_mpi.f90

    r92fab65 rf3054ea  
    1 ! SPDX-FileCopyrightText: FLEXPART 1998-2019, see flexpart_license.txt
    2 ! SPDX-License-Identifier: GPL-3.0-or-later
     1!**********************************************************************
     2! Copyright 1998,1999,2000,2001,2002,2005,2007,2008,2009,2010         *
     3! Andreas Stohl, Petra Seibert, A. Frank, Gerhard Wotawa,             *
     4! Caroline Forster, Sabine Eckhardt, John Burkhart, Harald Sodemann   *
     5!                                                                     *
     6! This file is part of FLEXPART.                                      *
     7!                                                                     *
     8! FLEXPART is free software: you can redistribute it and/or modify    *
     9! it under the terms of the GNU General Public License as published by*
     10! the Free Software Foundation, either version 3 of the License, or   *
     11! (at your option) any later version.                                 *
     12!                                                                     *
     13! FLEXPART is distributed in the hope that it will be useful,         *
     14! but WITHOUT ANY WARRANTY; without even the implied warranty of      *
     15! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the       *
     16! GNU General Public License for more details.                        *
     17!                                                                     *
     18! You should have received a copy of the GNU General Public License   *
     19! along with FLEXPART.  If not, see <http://www.gnu.org/licenses/>.   *
     20!**********************************************************************
    321
    422subroutine concoutput_nest(itime,outnum)
     
    3957  !                                                                            *
    4058  !*****************************************************************************
    41 
    4259
    4360  use unc_mod
     
    5673  real :: sp_fact
    5774  real :: outnum,densityoutrecept(maxreceptor),xl,yl
     75! RLT
     76  real :: densitydryrecept(maxreceptor)
     77  real :: factor_dryrecept(maxreceptor)
    5878
    5979  !real densityoutgrid(0:numxgrid-1,0:numygrid-1,numzgrid),
     
    82102  character :: adate*8,atime*6
    83103  character(len=3) :: anspec
     104  logical :: lexist
    84105  integer :: mind
    85106! mind        eso:added to ensure identical results between 2&3-fields versions
     
    158179        densityoutgrid(ix,jy,kz)=(rho(iix,jjy,kzz,mind)*dz1+ &
    159180             rho(iix,jjy,kzz-1,mind)*dz2)/dz
     181! RLT
     182        densitydrygrid(ix,jy,kz)=(rho_dry(iix,jjy,kzz,mind)*dz1+ &
     183             rho_dry(iix,jjy,kzz-1,mind)*dz2)/dz
    160184      end do
    161185    end do
     
    169193    !densityoutrecept(i)=rho(iix,jjy,1,2)
    170194    densityoutrecept(i)=rho(iix,jjy,1,mind)
     195! RLT
     196    densitydryrecept(i)=rho_dry(iix,jjy,1,mind)
    171197  end do
    172198
     199! RLT
     200! conversion factor for output relative to dry air
     201  factor_drygrid=densityoutgrid/densitydrygrid
     202  factor_dryrecept=densityoutrecept/densitydryrecept
    173203
    174204  ! Output is different for forward and backward simulations
     
    193223
    194224  write(anspec,'(i3.3)') ks
     225 
     226  if (DRYBKDEP.or.WETBKDEP) then !scavdep output
     227      if (DRYBKDEP) &
     228      open(unitoutgrid,file=path(2)(1:length(2))//'grid_drydep_nest_'//adate// &
     229           atime//'_'//anspec,form='unformatted')
     230      if (WETBKDEP) &
     231      open(unitoutgrid,file=path(2)(1:length(2))//'grid_wetdep_nest_'//adate// &
     232           atime//'_'//anspec,form='unformatted')
     233      write(unitoutgrid) itime
     234  else
    195235  if ((iout.eq.1).or.(iout.eq.3).or.(iout.eq.5)) then
    196236    if (ldirect.eq.1) then
     
    205245     write(unitoutgrid) itime
    206246   endif
     247  endif
    207248
    208249  if ((iout.eq.2).or.(iout.eq.3)) then      ! mixing ratio
     
    535576  end do
    536577
    537 
    538 
    539   ! Reinitialization of grid
    540   !*************************
    541 
    542   do ks=1,nspec
    543     do kp=1,maxpointspec_act
    544       do i=1,numreceptor
    545         creceptor(i,ks)=0.
    546       end do
    547       do jy=0,numygridn-1
    548         do ix=0,numxgridn-1
    549           do l=1,nclassunc
    550             do nage=1,nageclass
    551               do kz=1,numzgrid
    552                 griduncn(ix,jy,kz,ks,kp,l,nage)=0.
    553               end do
    554             end do
    555           end do
    556         end do
     578! RLT Aug 2017
     579! Write out conversion factor for dry air
     580  inquire(file=path(2)(1:length(2))//'factor_drygrid_nest',exist=lexist)
     581  if (lexist) then
     582    ! open and append
     583    open(unitoutfactor,file=path(2)(1:length(2))//'factor_drygrid_nest',form='unformatted',&
     584            status='old',action='write',access='append')
     585  else
     586    ! create new
     587    open(unitoutfactor,file=path(2)(1:length(2))//'factor_drygrid_nest',form='unformatted',&
     588            status='new',action='write')
     589  endif
     590  sp_count_i=0
     591  sp_count_r=0
     592  sp_fact=-1.
     593  sp_zer=.true.
     594  do kz=1,numzgrid
     595    do jy=0,numygridn-1
     596      do ix=0,numxgridn-1
     597        if (factor_drygrid(ix,jy,kz).gt.(1.+smallnum).or.factor_drygrid(ix,jy,kz).lt.(1.-smallnum)) then
     598          if (sp_zer.eqv..true.) then ! first value not equal to one
     599            sp_count_i=sp_count_i+1
     600            sparse_dump_i(sp_count_i)= &
     601                  ix+jy*numxgridn+kz*numxgridn*numygridn
     602            sp_zer=.false.
     603            sp_fact=sp_fact*(-1.)
     604          endif
     605          sp_count_r=sp_count_r+1
     606          sparse_dump_r(sp_count_r)= &
     607               sp_fact*factor_drygrid(ix,jy,kz)
     608        else ! factor is one
     609          sp_zer=.true.
     610        endif
    557611      end do
    558612    end do
    559613  end do
    560 
     614  write(unitoutfactor) sp_count_i
     615  write(unitoutfactor) (sparse_dump_i(i),i=1,sp_count_i)
     616  write(unitoutfactor) sp_count_r
     617  write(unitoutfactor) (sparse_dump_r(i),i=1,sp_count_r)
     618  close(unitoutfactor)
     619
     620  ! Reinitialization of grid
     621  !*************************
     622
     623  ! do ks=1,nspec
     624  !   do kp=1,maxpointspec_act
     625  !     do i=1,numreceptor
     626  !       creceptor(i,ks)=0.
     627  !     end do
     628  !     do jy=0,numygridn-1
     629  !       do ix=0,numxgridn-1
     630  !         do l=1,nclassunc
     631  !           do nage=1,nageclass
     632  !             do kz=1,numzgrid
     633  !               griduncn(ix,jy,kz,ks,kp,l,nage)=0.
     634  !             end do
     635  !           end do
     636  !         end do
     637  !       end do
     638  !     end do
     639  !   end do
     640  ! end do
     641  creceptor(:,:)=0.
     642  griduncn(:,:,:,:,:,:,:)=0.
     643 
    561644  if (mp_measure_time) call mpif_mtime('iotime',1)
    562645  ! if (mp_measure_time) then
Note: See TracChangeset for help on using the changeset viewer.
hosted by ZAMG