Commit 4138764d authored by Sabine's avatar Sabine
Browse files

Merge remote-tracking branch 'refs/remotes/origin/dev' into dev

parents 03adec6e 759df5f2
! SPDX-FileCopyrightText: FLEXPART 1998-2019, see flexpart_license.txt
! SPDX-License-Identifier: GPL-3.0-or-later
subroutine interpol_vdep(level,vdepo)
! i o
!****************************************************************************
......
! SPDX-FileCopyrightText: FLEXPART 1998-2019, see flexpart_license.txt
! SPDX-License-Identifier: GPL-3.0-or-later
subroutine interpol_vdep_nests(level,vdepo)
! i o
!****************************************************************************
......
! SPDX-FileCopyrightText: FLEXPART 1998-2019, see flexpart_license.txt
! SPDX-License-Identifier: GPL-3.0-or-later
subroutine interpol_wind(itime,xt,yt,zt)
! i i i i
!*****************************************************************************
......
! SPDX-FileCopyrightText: FLEXPART 1998-2019, see flexpart_license.txt
! SPDX-License-Identifier: GPL-3.0-or-later
subroutine interpol_wind_nests(itime,xt,yt,zt)
! i i i i
!*****************************************************************************
......
! SPDX-FileCopyrightText: FLEXPART 1998-2019, see flexpart_license.txt
! SPDX-License-Identifier: GPL-3.0-or-later
subroutine interpol_wind_short(itime,xt,yt,zt)
! i i i i
!*****************************************************************************
......
! SPDX-FileCopyrightText: FLEXPART 1998-2019, see flexpart_license.txt
! SPDX-License-Identifier: GPL-3.0-or-later
subroutine interpol_wind_short_nests(itime,xt,yt,zt)
! i i i i
!*****************************************************************************
......
! SPDX-FileCopyrightText: FLEXPART 1998-2019, see flexpart_license.txt
! SPDX-License-Identifier: GPL-3.0-or-later
function juldate(yyyymmdd,hhmiss)
!*****************************************************************************
......
!**********************************************************************
! Copyright 1998,1999,2000,2001,2002,2005,2007,2008,2009,2010, 2013 *
! 2019 *
! Andreas Stohl, Petra Seibert, A. Frank, Gerhard Wotawa, *
! Caroline Forster, Sabine Eckhardt, John Burkhart, Harald Sodemann *
! Ignacio Pisso, Espen Sollum, Henrik Grythe, Nina I. Kristiansen, *
! Massimo Cassiani, Delia Arnold, Don Morton, Rona L. Thompson *
! Christine D. Groot Zwaaftink, Nikolaos Evangeliou, Leopold Haimberger
! Stephan Henne, Dominik Brunner, John F. Burkhart, Anne Fouilloux *
! Jerome Brioude, Anne Philipp *
! *
! This file is part of FLEXPART. *
! *
! FLEXPART is free software: you can redistribute it and/or modify *
! it under the terms of the GNU General Public License as published by*
! the Free Software Foundation, either version 3 of the License, or *
! (at your option) any later version. *
! *
! FLEXPART is distributed in the hope that it will be useful, *
! but WITHOUT ANY WARRANTY; without even the implied warranty of *
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
! GNU General Public License for more details. *
! *
! You should have received a copy of the GNU General Public License *
! along with FLEXPART. If not, see <http://www.gnu.org/licenses/>. *
!**********************************************************************
......@@ -61,15 +61,16 @@ ifeq ($(gcc), 4.9)
INCPATH2 = ${ROOT_DIR}/include
LIBPATH1 = ${ROOT_DIR}/lib
else
# Compiled libraries under user ~flexpart, gfortran v5.4
ROOT_DIR = /homevip/flexpart/
# Using system installed libraries at njord.nilu.no
F90 = /usr/bin/gfortran
MPIF90 = /usr/bin/mpifort
INCPATH1 = ${ROOT_DIR}/gcc-5.4.0/include
LIBPATH1 = /opt/eccodes/lib
INCPATH1 = /opt/eccodes/include
INCPATH2 = /usr/include
LIBPATH1 = ${ROOT_DIR}/gcc-5.4.0/lib
# INCPATH1 = /usr/include
# INCPATH2 = /usr/include
endif
......@@ -87,12 +88,11 @@ VPATH = gributils/
## OPTIMIZATION LEVEL
O_LEV = 0 # [0,1,2,3,g,s,fast]
O_LEV = 2 # [0,1,2,3,g,s,fast]
O_LEV_DBG = g # [0,g]
## LIBRARIES
#LIBS = -lgrib_api_f90 -lgrib_api -lm -ljasper -lnetcdff
LIBS = -lgrib_api_f90 -lgrib_api -lm -ljasper $(NCOPT)
LIBS = -leccodes -leccodes_f90 -lm $(NCOPT)
FFLAGS = -I$(INCPATH1) -I$(INCPATH2) -O$(O_LEV) -g -cpp -m64 -mcmodel=medium -fconvert=little-endian -frecord-marker=4 -fmessage-length=0 -flto=jobserver -O$(O_LEV) $(NCOPT) $(FUSER) #-Warray-bounds -fcheck=all # -march=native
......@@ -127,10 +127,10 @@ OBJECTS_SERIAL = \
boundcond_domainfill.o \
redist.o \
concoutput_surf.o concoutput_surf_nest.o \
concoutput_inversion_nest.o \
concoutput_inversion.o \
getfields.o \
readwind_ecmwf.o
readwind_ecmwf.o \
initial_cond_output.o \
initial_cond_output_inversion.o
## For MPI version
OBJECTS_MPI = releaseparticles_mpi.o partoutput_mpi.o \
......@@ -144,11 +144,14 @@ OBJECTS_MPI = releaseparticles_mpi.o partoutput_mpi.o \
redist_mpi.o \
concoutput_surf_mpi.o concoutput_surf_nest_mpi.o \
getfields_mpi.o \
readwind_ecmwf_mpi.o
readwind_ecmwf_mpi.o \
initial_cond_output_mpi.o \
initial_cond_output_inversion_mpi.o
OBJECTS_NCF = netcdf_output_mod.o
OBJECTS = \
initial_cond_calc.o \
advance.o initialize.o \
writeheader.o writeheader_txt.o \
partpos_average.o writeprecip.o \
......@@ -201,10 +204,12 @@ writeheader_nest.o writeheader_nest_surf.o \
wetdepokernel_nest.o \
drydepokernel_nest.o zenithangle.o \
ohreaction.o getvdep_nests.o \
initial_cond_calc.o initial_cond_output.o initial_cond_output_inversion.o \
dynamic_viscosity.o get_settling.o \
initialize_cbl_vel.o re_initialize_particle.o \
cbl.o
cbl.o \
concoutput_inversion_nest.o \
concoutput_inversion.o \
ifeq ($(ncf), yes)
OBJECTS := $(OBJECTS) $(OBJECTS_NCF)
......@@ -324,9 +329,13 @@ hanna_short.o: com_mod.o hanna_mod.o par_mod.o
init_domainfill.o: com_mod.o par_mod.o point_mod.o random_mod.o
init_domainfill_mpi.o: com_mod.o mpi_mod.o par_mod.o point_mod.o random_mod.o
initial_cond_calc.o: com_mod.o outg_mod.o par_mod.o unc_mod.o
initial_cond_calc_mpi.o: com_mod.o outg_mod.o par_mod.o unc_mod.o
initial_cond_output.o: com_mod.o outg_mod.o par_mod.o point_mod.o unc_mod.o
initial_cond_output_mpi.o: com_mod.o outg_mod.o par_mod.o point_mod.o unc_mod.o mpi_mod.o
initial_cond_output_inversion.o: com_mod.o outg_mod.o par_mod.o point_mod.o \
unc_mod.o
initial_cond_output_inversion_mpi.o: com_mod.o outg_mod.o par_mod.o point_mod.o \
unc_mod.o
initialize.o: com_mod.o hanna_mod.o interpol_mod.o par_mod.o random_mod.o
initialize_cbl_vel.o: com_mod.o par_mod.o random_mod.o
interpol_all.o: com_mod.o hanna_mod.o interpol_mod.o par_mod.o
......
! SPDX-FileCopyrightText: FLEXPART 1998-2019, see flexpart_license.txt
! SPDX-License-Identifier: GPL-3.0-or-later
module mean_mod
public
......
! SPDX-FileCopyrightText: FLEXPART 1998-2019, see flexpart_license.txt
! SPDX-License-Identifier: GPL-3.0-or-later
module mpi_mod
!*****************************************************************************
......@@ -2576,6 +2579,58 @@ contains
601 end subroutine mpif_tm_reduce_grid_nest
subroutine mpif_tm_reduce_initcond
!***********************************************************************
! Collect init_cond to PID 0, adding from all processes.
!
!
!***********************************************************************
use com_mod
use unc_mod
use par_mod
implicit none
integer :: grid_size
!**********************************************************************
grid_size=numxgrid*numygrid*numzgrid*maxspec* &
& maxpointspec_act
! Time for MPI communications
if (mp_measure_time) call mpif_mtime('commtime',0)
#ifdef USE_MPIINPLACE
! Using in-place reduction
if (lroot) then
call MPI_Reduce(MPI_IN_PLACE, init_cond, grid_size, mp_sp, MPI_SUM, id_root, &
& mp_comm_used, mp_ierr)
if (mp_ierr /= 0) goto 600
else
call MPI_Reduce(init_cond, 0, grid_size, mp_sp, MPI_SUM, id_root, &
& mp_comm_used, mp_ierr)
if (mp_ierr /= 0) goto 600
end if
#else
call MPI_Reduce(init_cond, init_cond0, grid_size, mp_sp, MPI_SUM, id_root, &
& mp_comm_used, mp_ierr)
if (mp_ierr /= 0) goto 600
! if (lroot) init_cond = init_cond0
#endif
if (mp_measure_time) call mpif_mtime('commtime',1)
goto 601
600 write(*,*) "mpi_mod> mp_ierr \= 0", mp_ierr
stop
601 end subroutine mpif_tm_reduce_initcond
subroutine mpif_mtime(ident,imode)
!***********************************************************************
! Measure CPU/Wall time in various parts of the code
......
! SPDX-FileCopyrightText: FLEXPART 1998-2019, see flexpart_license.txt
! SPDX-License-Identifier: GPL-3.0-or-later
!*****************************************************************************
! *
! This module handles all gridded netcdf output for concentration or *
......@@ -32,9 +35,10 @@ module netcdf_output_mod
xpoint1,ypoint1,xpoint2,ypoint2,zpoint1,zpoint2,npart,xmass
use outg_mod, only: outheight,oroout,densityoutgrid,factor3d,volume,&
wetgrid,wetgridsigma,drygrid,drygridsigma,grid,gridsigma,&
area,arean,volumen, orooutn, areaeast, areanorth
area,arean,volumen, orooutn, areaeast, areanorth, p0out, t0out
use par_mod, only: dep_prec, sp, dp, maxspec, maxreceptor, nclassunc,&
unitoutrecept,unitoutreceptppt, nxmax,unittmp
unitoutrecept,unitoutreceptppt, nxmax,unittmp, &
write_p0t0
use com_mod, only: path,length,ldirect,bdate,ibdate,ibtime,iedate,ietime, &
loutstep,loutaver,loutsample,outlon0,outlat0,&
numxgrid,numygrid,dxout,dyout,numzgrid, height, &
......@@ -53,7 +57,7 @@ module netcdf_output_mod
itsplit, lsynctime, ctl, ifine, lagespectra, ipin, &
ioutputforeachrelease, iflux, mdomainfill, mquasilag, &
nested_output, ipout, surf_only, linit_cond, &
flexversion,mpi_mode,DRYBKDEP,WETBKDEP
flexversion,mpi_mode,DRYBKDEP,WETBKDEP, ps, tt2
use mean_mod
......@@ -77,6 +81,7 @@ module netcdf_output_mod
! netcdf dimension and variable IDs for main and nested output grid
integer, dimension(maxspec) :: specID,specIDppt, wdspecID,ddspecID
integer, dimension(maxspec) :: specIDn,specIDnppt, wdspecIDn,ddspecIDn
integer :: psID, tt2ID
integer :: timeID, timeIDn
integer, dimension(6) :: dimids, dimidsn
integer, dimension(5) :: depdimids, depdimidsn
......@@ -176,7 +181,7 @@ subroutine writemetadata(ncid,lnest)
call nf90_err(nf90_put_att(ncid, nf90_global, 'dxout', dxout))
call nf90_err(nf90_put_att(ncid, nf90_global, 'dyout', dyout))
endif
! vertical levels stored in grid structure
! vertical levels stored in grid structure
! COMMAND file settings
call nf90_err(nf90_put_att(ncid, nf90_global, 'ldirect', ldirect))
......@@ -385,6 +390,14 @@ subroutine writeheader_netcdf(lnest)
if (write_area) call nf90_err(nf90_def_var(ncid, 'area', nf90_float, &
&(/ lonDimID, latDimID /), areaID))
! surfarce pressure / temperature
if (write_p0t0) then
call nf90_err(nf90_def_var(ncid, 'pressure', nf90_float, &
&(/ lonDimID, latDimID, timeDimID /), psID))
call nf90_err(nf90_def_var(ncid, 'temperature', nf90_float, &
&(/ lonDimID, latDimID, timeDimID /), tt2ID))
end if
if (write_releases.eqv..true.) then
! release comment
......@@ -757,6 +770,8 @@ subroutine concoutput_netcdf(itime,outnum,gridtotalunc,wetgridtotalunc,drygridto
! real(sp) :: gridtotal,gridsigmatotal
! real(sp) :: wetgridtotal,wetgridsigmatotal
! real(sp) :: drygridtotal,drygridsigmatotal
real :: ddx,ddy,p0h,t0h,p1,p2,p3,p4,rddx,rddy,xlon,xlat,ylat,xtn,ytn
integer :: i1,ixp,j1,jyp,j
real, parameter :: weightair=28.97
......@@ -1037,6 +1052,87 @@ subroutine concoutput_netcdf(itime,outnum,gridtotalunc,wetgridtotalunc,drygridto
end do
if (write_p0t0) then
! Loop over all output grid cells
!********************************
do jjy=0,numygrid-1
do iix=0,numxgrid-1
p0h=0.
t0h=0.
! Take 100 samples of the topography in every grid cell
!******************************************************
do j1=1,10
ylat=outlat0+(real(jjy)+real(j1)/10.-0.05)*dyout
yl=(ylat-ylat0)/dy
do i1=1,10
xlon=outlon0+(real(iix)+real(i1)/10.-0.05)*dxout
xl=(xlon-xlon0)/dx
! Determine the nest we are in
!*****************************
ngrid=0
do j=numbnests,1,-1
if ((xl.gt.xln(j)+eps).and.(xl.lt.xrn(j)-eps).and. &
(yl.gt.yln(j)+eps).and.(yl.lt.yrn(j)-eps)) then
ngrid=j
goto 43
endif
end do
43 continue
! Determine (nested) grid coordinates and auxiliary parameters used for interpolation
!*****************************************************************************
if (ngrid.gt.0) then
xtn=(xl-xln(ngrid))*xresoln(ngrid)
ytn=(yl-yln(ngrid))*yresoln(ngrid)
ix=int(xtn)
jy=int(ytn)
ddy=ytn-real(jy)
ddx=xtn-real(ix)
else
ix=int(xl)
jy=int(yl)
ddy=yl-real(jy)
ddx=xl-real(ix)
endif
ixp=ix+1
jyp=jy+1
rddx=1.-ddx
rddy=1.-ddy
p1=rddx*rddy
p2=ddx*rddy
p3=rddx*ddy
p4=ddx*ddy
p0h=p0h+p1*ps(ix ,jy,1,memind(1)) &
+ p2*ps(ixp,jy,1,memind(1)) &
+ p3*ps(ix ,jyp,1,memind(1)) &
+ p4*ps(ixp,jyp,1,memind(1))
t0h=t0h+p1*tt2(ix ,jy,1,memind(1)) &
+ p2*tt2(ixp,jy,1,memind(1)) &
+ p3*tt2(ix ,jyp,1,memind(1)) &
+ p4*tt2(ixp,jyp,1,memind(1))
end do
end do
! Divide by the number of samples taken
!**************************************
p0out(iix,jjy)=p0h/100.
t0out(iix,jjy)=t0h/100.
end do
end do
call nf90_err(nf90_put_var(ncid, psID, p0out, (/ 1,1,tpointer /), (/ numxgrid,numygrid,1 /)))
call nf90_err(nf90_put_var(ncid, tt2ID, t0out,(/ 1,1,tpointer /), (/ numxgrid,numygrid,1 /)))
end if
! Close netCDF file
!**************************
call nf90_err(nf90_close(ncid))
......
! SPDX-FileCopyrightText: FLEXPART 1998-2019, see flexpart_license.txt
! SPDX-License-Identifier: GPL-3.0-or-later
real function obukhov(ps,tsurf,tdsurf,tlev,ustar,hf,akm,bkm,plev,metdata_format)
!********************************************************************
......
! SPDX-FileCopyrightText: FLEXPART 1998-2019, see flexpart_license.txt
! SPDX-License-Identifier: GPL-3.0-or-later
module oh_mod
!includes OH concentration field as well as the height information
......
! SPDX-FileCopyrightText: FLEXPART 1998-2019, see flexpart_license.txt
! SPDX-License-Identifier: GPL-3.0-or-later
subroutine ohreaction(itime,ltsample,loutnext)
! i i i
!*****************************************************************************
......
! SPDX-FileCopyrightText: FLEXPART 1998-2019, see flexpart_license.txt
! SPDX-License-Identifier: GPL-3.0-or-later
subroutine openouttraj
!*****************************************************************************
......
! SPDX-FileCopyrightText: FLEXPART 1998-2019, see flexpart_license.txt
! SPDX-License-Identifier: GPL-3.0-or-later
subroutine openreceptors
!*****************************************************************************
......
! SPDX-FileCopyrightText: FLEXPART 1998-2019, see flexpart_license.txt
! SPDX-License-Identifier: GPL-3.0-or-later
module outg_mod
use par_mod, only: dep_prec, sp
......@@ -8,6 +11,8 @@ module outg_mod
real,allocatable, dimension (:) :: outheighthalf
real,allocatable, dimension (:,:) :: oroout
real,allocatable, dimension (:,:) :: orooutn
real,allocatable, dimension (:,:) :: t0out
real,allocatable, dimension (:,:) :: p0out
real,allocatable, dimension (:,:) :: area
real,allocatable, dimension (:,:) :: arean
real,allocatable, dimension (:,:,:) :: volume
......
! SPDX-FileCopyrightText: FLEXPART 1998-2019, see flexpart_license.txt
! SPDX-License-Identifier: GPL-3.0-or-later
! DJM - 2017-05-09 - added #ifdef USE_MPIINPLACE cpp directive to *
! enable allocation of a gridunc0 array if required by MPI code in *
! mpi_mod.f90 *
......@@ -293,6 +296,14 @@ subroutine outgrid_init
allocate(init_cond(0:numxgrid-1,0:numygrid-1,numzgrid,maxspec, &
maxpointspec_act),stat=stat)
if (stat.ne.0) write(*,*)'ERROR: could not allocate init_cond'
if (mpi_mode.gt.0) then
if (lroot) then
allocate(init_cond0(0:numxgrid-1,0:numygrid-1,numzgrid,maxspec, &
maxpointspec_act),stat=stat)
else
allocate(init_cond0(1,1,1,1,1))
end if
end if
endif
!************************
......
! SPDX-FileCopyrightText: FLEXPART 1998-2019, see flexpart_license.txt
! SPDX-License-Identifier: GPL-3.0-or-later
subroutine outgrid_init_nest
!*****************************************************************************
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment