Commit a9cf4b1e authored by Espen Sollum's avatar Espen Sollum
Browse files

Made enabling netCDF output during compilation optional

parent 8fcfd08c
...@@ -51,10 +51,14 @@ program flexpart ...@@ -51,10 +51,14 @@ program flexpart
use par_mod use par_mod
use com_mod use com_mod
use conv_mod use conv_mod
use netcdf_output_mod, only: writeheader_netcdf
use random_mod, only: gasdev1 use random_mod, only: gasdev1
use class_gribfile use class_gribfile
#ifdef USE_NCF
use netcdf_output_mod, only: writeheader_netcdf
#endif
implicit none implicit none
integer :: i,j,ix,jy,inest integer :: i,j,ix,jy,inest
...@@ -351,6 +355,7 @@ program flexpart ...@@ -351,6 +355,7 @@ program flexpart
! and open files that are to be kept open throughout the simulation ! and open files that are to be kept open throughout the simulation
!****************************************************************** !******************************************************************
#ifdef USE_NCF
if (lnetcdfout.eq.1) then if (lnetcdfout.eq.1) then
call writeheader_netcdf(lnest=.false.) call writeheader_netcdf(lnest=.false.)
else else
...@@ -364,6 +369,7 @@ program flexpart ...@@ -364,6 +369,7 @@ program flexpart
call writeheader_nest call writeheader_nest
endif endif
endif endif
#endif
if (verbosity.gt.0) then if (verbosity.gt.0) then
print*,'call writeheader' print*,'call writeheader'
......
...@@ -52,10 +52,13 @@ program flexpart ...@@ -52,10 +52,13 @@ program flexpart
use com_mod use com_mod
use conv_mod use conv_mod
use mpi_mod use mpi_mod
use netcdf_output_mod, only: writeheader_netcdf
use random_mod, only: gasdev1 use random_mod, only: gasdev1
use class_gribfile use class_gribfile
#ifdef USE_NCF
use netcdf_output_mod, only: writeheader_netcdf
#endif
implicit none implicit none
integer :: i,j,ix,jy,inest integer :: i,j,ix,jy,inest
...@@ -377,8 +380,9 @@ program flexpart ...@@ -377,8 +380,9 @@ program flexpart
!****************************************************************** !******************************************************************
if (mp_measure_time) call mpif_mtime('iotime',0) if (mp_measure_time) call mpif_mtime('iotime',0)
if (lroot) then ! MPI: this part root process only
if (lroot) then ! MPI: this part root process only
#ifdef USE_NCF
if (lnetcdfout.eq.1) then if (lnetcdfout.eq.1) then
call writeheader_netcdf(lnest=.false.) call writeheader_netcdf(lnest=.false.)
else else
...@@ -392,8 +396,8 @@ program flexpart ...@@ -392,8 +396,8 @@ program flexpart
call writeheader_nest call writeheader_nest
endif endif
endif endif
#endif
!
if (verbosity.gt.0) then if (verbosity.gt.0) then
print*,'call writeheader' print*,'call writeheader'
endif endif
...@@ -401,7 +405,7 @@ program flexpart ...@@ -401,7 +405,7 @@ program flexpart
call writeheader call writeheader
! FLEXPART 9.2 ticket ?? write header in ASCII format ! FLEXPART 9.2 ticket ?? write header in ASCII format
call writeheader_txt call writeheader_txt
!if (nested_output.eq.1) call writeheader_nest
if (nested_output.eq.1.and.surf_only.ne.1) call writeheader_nest if (nested_output.eq.1.and.surf_only.ne.1) call writeheader_nest
if (nested_output.eq.1.and.surf_only.eq.1) call writeheader_nest_surf if (nested_output.eq.1.and.surf_only.eq.1) call writeheader_nest_surf
if (nested_output.ne.1.and.surf_only.eq.1) call writeheader_surf if (nested_output.ne.1.and.surf_only.eq.1) call writeheader_surf
...@@ -409,8 +413,6 @@ program flexpart ...@@ -409,8 +413,6 @@ program flexpart
if (mp_measure_time) call mpif_mtime('iotime',0) if (mp_measure_time) call mpif_mtime('iotime',0)
!open(unitdates,file=path(2)(1:length(2))//'dates')
if (verbosity.gt.0 .and. lroot) then if (verbosity.gt.0 .and. lroot) then
print*,'call openreceptors' print*,'call openreceptors'
endif endif
......
...@@ -30,6 +30,10 @@ SHELL = /bin/bash ...@@ -30,6 +30,10 @@ SHELL = /bin/bash
# Compile for debugging parallel FLEXPART # Compile for debugging parallel FLEXPART
# make [-j] mpi-dbg # make [-j] mpi-dbg
# #
# NETCDF OUTPUT
# To add support for output in netCDF format, append `ncf=yes` to the
# `make` command
#
################################################################################ ################################################################################
## PROGRAMS ## PROGRAMS
...@@ -56,8 +60,7 @@ ifeq ($(gcc), 4.9) ...@@ -56,8 +60,7 @@ ifeq ($(gcc), 4.9)
INCPATH1 = ${ROOT_DIR}/gcc-4.9.1/include INCPATH1 = ${ROOT_DIR}/gcc-4.9.1/include
INCPATH2 = ${ROOT_DIR}/include INCPATH2 = ${ROOT_DIR}/include
LIBPATH1 = ${ROOT_DIR}/lib LIBPATH1 = ${ROOT_DIR}/lib
else
else #ifeq ($(gcc), 5.4)
# Compiled libraries under user ~flexpart, gfortran v5.4 # Compiled libraries under user ~flexpart, gfortran v5.4
ROOT_DIR = /homevip/flexpart/ ROOT_DIR = /homevip/flexpart/
...@@ -67,18 +70,18 @@ else #ifeq ($(gcc), 5.4) ...@@ -67,18 +70,18 @@ else #ifeq ($(gcc), 5.4)
INCPATH1 = ${ROOT_DIR}/gcc-5.4.0/include INCPATH1 = ${ROOT_DIR}/gcc-5.4.0/include
INCPATH2 = /usr/include INCPATH2 = /usr/include
LIBPATH1 = ${ROOT_DIR}/gcc-5.4.0/lib LIBPATH1 = ${ROOT_DIR}/gcc-5.4.0/lib
endif
#else
# Default: System libraries at NILU, gfortran v4.6
# F90 = /usr/bin/gfortran
# MPIF90 = /usr/bin/mpif90.openmpi
# INCPATH1 = /xnilu_wrk/projects/FLEXPART/flex_wrk/bin64/grib_api/include ### Enable netCDF output?
# INCPATH2 = /usr/include ifeq ($(ncf), yes)
# LIBPATH1 = /xnilu_wrk/projects/FLEXPART/flex_wrk/bin64/grib_api/lib NCOPT = -DUSE_NCF -lnetcdff
else
NCOPT = -UUSE_NCF
endif endif
# path to gributils used to detect meteodata format # path to gributils used to detect meteodata format
VPATH = gributils/ VPATH = gributils/
...@@ -88,11 +91,12 @@ O_LEV = 2 # [0,1,2,3,g,s,fast] ...@@ -88,11 +91,12 @@ O_LEV = 2 # [0,1,2,3,g,s,fast]
O_LEV_DBG = g # [0,g] O_LEV_DBG = g # [0,g]
## LIBRARIES ## LIBRARIES
LIBS = -lgrib_api_f90 -lgrib_api -lm -ljasper -lnetcdff # -fopenmp #LIBS = -lgrib_api_f90 -lgrib_api -lm -ljasper -lnetcdff
LIBS = -lgrib_api_f90 -lgrib_api -lm -ljasper $(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) $(FUSER) #-Warray-bounds -fcheck=all # -march=native 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
DBGFLAGS = -I$(INCPATH1) -I$(INCPATH2) -O$(O_LEV_DBG) -g3 -ggdb3 -cpp -m64 -mcmodel=medium -fconvert=little-endian -frecord-marker=4 -fmessage-length=0 -flto=jobserver -O$(O_LEV_DBG) -fbacktrace -Wall -fdump-core $(FUSER) # -ffpe-trap=invalid,overflow,denormal,underflow,zero -Warray-bounds -fcheck=all DBGFLAGS = -I$(INCPATH1) -I$(INCPATH2) -O$(O_LEV_DBG) -g3 -ggdb3 -cpp -m64 -mcmodel=medium -fconvert=little-endian -frecord-marker=4 -fmessage-length=0 -flto=jobserver -O$(O_LEV_DBG) $(NCOPT) -fbacktrace -Wall -fdump-core $(FUSER) # -ffpe-trap=invalid,overflow,denormal,underflow,zero -Warray-bounds -fcheck=all
LDFLAGS = $(FFLAGS) -L$(LIBPATH1) -Wl,-rpath,$(LIBPATH1) $(LIBS) #-L$(LIBPATH2) LDFLAGS = $(FFLAGS) -L$(LIBPATH1) -Wl,-rpath,$(LIBPATH1) $(LIBS) #-L$(LIBPATH2)
LDDEBUG = $(DBGFLAGS) -L$(LIBPATH1) $(LIBS) #-L$(LIBPATH2) LDDEBUG = $(DBGFLAGS) -L$(LIBPATH1) $(LIBS) #-L$(LIBPATH2)
...@@ -139,6 +143,8 @@ OBJECTS_MPI = releaseparticles_mpi.o partoutput_mpi.o \ ...@@ -139,6 +143,8 @@ OBJECTS_MPI = releaseparticles_mpi.o partoutput_mpi.o \
getfields_mpi.o \ getfields_mpi.o \
readwind_ecmwf_mpi.o readwind_ecmwf_mpi.o
OBJECTS_NCF = netcdf_output_mod.o
OBJECTS = \ OBJECTS = \
advance.o initialize.o \ advance.o initialize.o \
writeheader.o writeheader_txt.o \ writeheader.o writeheader_txt.o \
...@@ -195,7 +201,11 @@ ohreaction.o getvdep_nests.o \ ...@@ -195,7 +201,11 @@ ohreaction.o getvdep_nests.o \
initial_cond_calc.o initial_cond_output.o \ initial_cond_calc.o initial_cond_output.o \
dynamic_viscosity.o get_settling.o \ dynamic_viscosity.o get_settling.o \
initialize_cbl_vel.o re_initialize_particle.o \ initialize_cbl_vel.o re_initialize_particle.o \
cbl.o netcdf_output_mod.o cbl.o
ifeq ($(ncf), yes)
OBJECTS := $(OBJECTS) $(OBJECTS_NCF)
endif
%.o: %.mod %.o: %.mod
......
...@@ -147,7 +147,8 @@ module par_mod ...@@ -147,7 +147,8 @@ module par_mod
! ECMWF ! ECMWF
! integer,parameter :: nxmax=361,nymax=181,nuvzmax=92,nwzmax=92,nzmax=92,nxshift=359 ! 1.0 degree 92 level ! integer,parameter :: nxmax=361,nymax=181,nuvzmax=92,nwzmax=92,nzmax=92,nxshift=359 ! 1.0 degree 92 level
integer,parameter :: nxmax=361,nymax=181,nuvzmax=138,nwzmax=138,nzmax=138,nxshift=359 ! 1.0 degree 138 level ! integer,parameter :: nxmax=361,nymax=181,nuvzmax=138,nwzmax=138,nzmax=138,nxshift=359 ! 1.0 degree 138 level
integer,parameter :: nxmax=361,nymax=181,nuvzmax=138,nwzmax=138,nzmax=138,nxshift=0 ! 1.0 degree 138 level
! integer,parameter :: nxmax=721,nymax=361,nuvzmax=138,nwzmax=138,nzmax=138,nxshift=359 ! 0.5 degree 138 level ! integer,parameter :: nxmax=721,nymax=361,nuvzmax=138,nwzmax=138,nzmax=138,nxshift=359 ! 0.5 degree 138 level
! integer,parameter :: nxmax=181,nymax=91,nuvzmax=92,nwzmax=92,nzmax=92,nxshift=0 ! CERA 2.0 degree 92 level ! integer,parameter :: nxmax=181,nymax=91,nuvzmax=92,nwzmax=92,nzmax=92,nxshift=0 ! CERA 2.0 degree 92 level
...@@ -208,7 +209,7 @@ module par_mod ...@@ -208,7 +209,7 @@ module par_mod
!integer maxxgrid,maxygrid,maxzgrid,maxxgridn,maxygridn !integer maxxgrid,maxygrid,maxzgrid,maxxgridn,maxygridn
!integer,parameter :: maxxgrid=361,maxygrid=181,maxxgridn=0,maxygridn=0) !integer,parameter :: maxxgrid=361,maxygrid=181,maxxgridn=0,maxygridn=0)
integer,parameter :: maxreceptor=20 integer,parameter :: maxreceptor=200
! maxreceptor maximum number of receptor points ! maxreceptor maximum number of receptor points
...@@ -217,8 +218,8 @@ module par_mod ...@@ -217,8 +218,8 @@ module par_mod
! Maximum number of particles, species, and similar ! Maximum number of particles, species, and similar
!************************************************** !**************************************************
integer,parameter :: maxpart=100000 integer,parameter :: maxpart=3000000
integer,parameter :: maxspec=1 integer,parameter :: maxspec=6
real,parameter :: minmass=0.0001 real,parameter :: minmass=0.0001
...@@ -261,7 +262,7 @@ module par_mod ...@@ -261,7 +262,7 @@ module par_mod
! Dimension of random number field ! Dimension of random number field
!********************************* !*********************************
integer,parameter :: maxrand=1000000 integer,parameter :: maxrand=200000000
! maxrand number of random numbers used ! maxrand number of random numbers used
......
...@@ -94,7 +94,6 @@ subroutine readOHfield ...@@ -94,7 +94,6 @@ subroutine readOHfield
read(unitOH) (altOH(i),i=1,nzOH) read(unitOH) (altOH(i),i=1,nzOH)
read(unitOH) ((((OH_field(i,j,k,l),i=1,nxOH),j=1,nyOH),k=1,nzOH),l=1,12) read(unitOH) ((((OH_field(i,j,k,l),i=1,nxOH),j=1,nyOH),k=1,nzOH),l=1,12)
read(unitOH) ((((OH_hourly(i,j,k,l),i=1,nxOH),j=1,nyOH),k=1,nzOH),l=1,2) read(unitOH) ((((OH_hourly(i,j,k,l),i=1,nxOH),j=1,nyOH),k=1,nzOH),l=1,2)
write(*,*) 'nzOH: ',nzOH,(altOH(i),i=1,nzOH)
end subroutine readOHfield end subroutine readOHfield
...@@ -391,15 +391,16 @@ subroutine readcommand ...@@ -391,15 +391,16 @@ subroutine readcommand
mintime=lsynctime mintime=lsynctime
endif endif
! check for netcdf output switch (use for non-namelist input only!) ! Check for netcdf output switch
!*******************************
if (iout.ge.8) then if (iout.ge.8) then
lnetcdfout = 1 lnetcdfout = 1
iout = iout - 8 iout = iout - 8
! #ifndef NETCDF_OUTPUT #ifndef USE_NCF
! print*,'ERROR: netcdf output not activated during compile time but used in COMMAND file!' write(*,*) 'ERROR: netcdf output not activated during compile time but used in COMMAND file!'
! print*,'Please recompile with netcdf library or use standard output format.' write(*,*) 'Please recompile with netcdf library (`make [...] ncf=yes`) or use standard output format.'
! stop stop
! #endif #endif
endif endif
! Check whether a valid option for gridded model output has been chosen ! Check whether a valid option for gridded model output has been chosen
......
...@@ -100,8 +100,10 @@ subroutine timemanager(metdata_format) ...@@ -100,8 +100,10 @@ subroutine timemanager(metdata_format)
use oh_mod use oh_mod
use par_mod use par_mod
use com_mod use com_mod
#ifdef USE_NCF
use netcdf_output_mod, only: concoutput_netcdf,concoutput_nest_netcdf,& use netcdf_output_mod, only: concoutput_netcdf,concoutput_nest_netcdf,&
&concoutput_surf_netcdf,concoutput_surf_nest_netcdf &concoutput_surf_netcdf,concoutput_surf_nest_netcdf
#endif
implicit none implicit none
...@@ -388,7 +390,9 @@ subroutine timemanager(metdata_format) ...@@ -388,7 +390,9 @@ subroutine timemanager(metdata_format)
if ((iout.le.3.).or.(iout.eq.5)) then if ((iout.le.3.).or.(iout.eq.5)) then
if (surf_only.ne.1) then if (surf_only.ne.1) then
if (lnetcdfout.eq.1) then if (lnetcdfout.eq.1) then
#ifdef USE_NCF
call concoutput_netcdf(itime,outnum,gridtotalunc,wetgridtotalunc,drygridtotalunc) call concoutput_netcdf(itime,outnum,gridtotalunc,wetgridtotalunc,drygridtotalunc)
#endif
else else
call concoutput(itime,outnum,gridtotalunc,wetgridtotalunc,drygridtotalunc) call concoutput(itime,outnum,gridtotalunc,wetgridtotalunc,drygridtotalunc)
endif endif
...@@ -399,7 +403,9 @@ subroutine timemanager(metdata_format) ...@@ -399,7 +403,9 @@ subroutine timemanager(metdata_format)
write(*,*) 'system clock',count_clock - count_clock0 write(*,*) 'system clock',count_clock - count_clock0
endif endif
if (lnetcdfout.eq.1) then if (lnetcdfout.eq.1) then
#ifdef USE_NCF
call concoutput_surf_netcdf(itime,outnum,gridtotalunc,wetgridtotalunc,drygridtotalunc) call concoutput_surf_netcdf(itime,outnum,gridtotalunc,wetgridtotalunc,drygridtotalunc)
#endif
else else
call concoutput_surf(itime,outnum,gridtotalunc,wetgridtotalunc,drygridtotalunc) call concoutput_surf(itime,outnum,gridtotalunc,wetgridtotalunc,drygridtotalunc)
if (verbosity.eq.1) then if (verbosity.eq.1) then
...@@ -418,11 +424,13 @@ subroutine timemanager(metdata_format) ...@@ -418,11 +424,13 @@ subroutine timemanager(metdata_format)
call concoutput_surf_nest(itime,outnum) call concoutput_surf_nest(itime,outnum)
endif endif
else else
#ifdef USE_NCF
if (surf_only.ne.1) then if (surf_only.ne.1) then
call concoutput_nest_netcdf(itime,outnum) call concoutput_nest_netcdf(itime,outnum)
else else
call concoutput_surf_nest_netcdf(itime,outnum) call concoutput_surf_nest_netcdf(itime,outnum)
endif endif
#endif
endif endif
endif endif
outnum=0. outnum=0.
......
...@@ -101,8 +101,10 @@ subroutine timemanager(metdata_format) ...@@ -101,8 +101,10 @@ subroutine timemanager(metdata_format)
use par_mod use par_mod
use com_mod use com_mod
use mpi_mod use mpi_mod
#ifdef USE_NCF
use netcdf_output_mod, only: concoutput_netcdf,concoutput_nest_netcdf,& use netcdf_output_mod, only: concoutput_netcdf,concoutput_nest_netcdf,&
&concoutput_surf_netcdf,concoutput_surf_nest_netcdf &concoutput_surf_netcdf,concoutput_surf_nest_netcdf
#endif
implicit none implicit none
...@@ -480,8 +482,10 @@ subroutine timemanager(metdata_format) ...@@ -480,8 +482,10 @@ subroutine timemanager(metdata_format)
if (surf_only.ne.1) then if (surf_only.ne.1) then
if (lroot) then if (lroot) then
if (lnetcdfout.eq.1) then if (lnetcdfout.eq.1) then
#ifdef USE_NCF
call concoutput_netcdf(itime,outnum,gridtotalunc,wetgridtotalunc,& call concoutput_netcdf(itime,outnum,gridtotalunc,wetgridtotalunc,&
&drygridtotalunc) &drygridtotalunc)
#endif
else else
call concoutput(itime,outnum,gridtotalunc,wetgridtotalunc,drygridtotalunc) call concoutput(itime,outnum,gridtotalunc,wetgridtotalunc,drygridtotalunc)
endif endif
...@@ -493,8 +497,10 @@ subroutine timemanager(metdata_format) ...@@ -493,8 +497,10 @@ subroutine timemanager(metdata_format)
else else
if (lroot) then if (lroot) then
if (lnetcdfout.eq.1) then if (lnetcdfout.eq.1) then
#ifdef USE_NCF
call concoutput_surf_netcdf(itime,outnum,gridtotalunc,wetgridtotalunc,& call concoutput_surf_netcdf(itime,outnum,gridtotalunc,wetgridtotalunc,&
&drygridtotalunc) &drygridtotalunc)
#endif
else else
call concoutput_surf(itime,outnum,gridtotalunc,wetgridtotalunc,drygridtotalunc) call concoutput_surf(itime,outnum,gridtotalunc,wetgridtotalunc,drygridtotalunc)
end if end if
...@@ -525,11 +531,9 @@ subroutine timemanager(metdata_format) ...@@ -525,11 +531,9 @@ subroutine timemanager(metdata_format)
else ! :TODO: check for zeroing in the netcdf module else ! :TODO: check for zeroing in the netcdf module
call concoutput_surf_nest(itime,outnum) call concoutput_surf_nest(itime,outnum)
end if end if
else else
#ifdef USE_NCF
if (surf_only.ne.1) then if (surf_only.ne.1) then
if (lroot) then if (lroot) then
call concoutput_nest_netcdf(itime,outnum) call concoutput_nest_netcdf(itime,outnum)
...@@ -543,12 +547,9 @@ subroutine timemanager(metdata_format) ...@@ -543,12 +547,9 @@ subroutine timemanager(metdata_format)
griduncn(:,:,:,:,:,:,:)=0. griduncn(:,:,:,:,:,:,:)=0.
end if end if
endif endif
#endif
end if end if
end if end if
outnum=0. outnum=0.
endif endif
if ((iout.eq.4).or.(iout.eq.5)) call plumetraj(itime) if ((iout.eq.4).or.(iout.eq.5)) call plumetraj(itime)
......
Supports Markdown
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