Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
flexpart
flexpart
Commits
a9cf4b1e
Commit
a9cf4b1e
authored
Apr 05, 2018
by
Espen Sollum
Browse files
Made enabling netCDF output during compilation optional
parent
8fcfd08c
Changes
8
Hide whitespace changes
Inline
Side-by-side
src/FLEXPART.f90
View file @
a9cf4b1e
...
...
@@ -51,10 +51,14 @@ program flexpart
use
par_mod
use
com_mod
use
conv_mod
use
netcdf_output_mod
,
only
:
writeheader_netcdf
use
random_mod
,
only
:
gasdev1
use
class_gribfile
#ifdef USE_NCF
use
netcdf_output_mod
,
only
:
writeheader_netcdf
#endif
implicit
none
integer
::
i
,
j
,
ix
,
jy
,
inest
...
...
@@ -351,6 +355,7 @@ program flexpart
! and open files that are to be kept open throughout the simulation
!******************************************************************
#ifdef USE_NCF
if
(
lnetcdfout
.eq.
1
)
then
call
writeheader_netcdf
(
lnest
=
.false.
)
else
...
...
@@ -364,6 +369,7 @@ program flexpart
call
writeheader_nest
endif
endif
#endif
if
(
verbosity
.gt.
0
)
then
print
*
,
'call writeheader'
...
...
src/FLEXPART_MPI.f90
View file @
a9cf4b1e
...
...
@@ -52,10 +52,13 @@ program flexpart
use
com_mod
use
conv_mod
use
mpi_mod
use
netcdf_output_mod
,
only
:
writeheader_netcdf
use
random_mod
,
only
:
gasdev1
use
class_gribfile
#ifdef USE_NCF
use
netcdf_output_mod
,
only
:
writeheader_netcdf
#endif
implicit
none
integer
::
i
,
j
,
ix
,
jy
,
inest
...
...
@@ -377,23 +380,24 @@ program flexpart
!******************************************************************
if
(
mp_measure_time
)
call
mpif_mtime
(
'iotime'
,
0
)
if
(
lroot
)
then
! MPI: this part root process only
if
(
lnetcdfout
.eq.
1
)
then
call
writeheader_netcdf
(
lnest
=
.false.
)
else
call
writeheader
end
if
if
(
nested_output
.eq.
1
)
then
if
(
lnetcdfout
.eq.
1
)
then
call
writeheader_netcdf
(
lnest
=
.true.
)
else
call
writeheader_nest
if
(
lroot
)
then
! MPI: this part root process only
#ifdef USE_NCF
if
(
lnetcdfout
.eq.
1
)
then
call
writeheader_netcdf
(
lnest
=
.false.
)
else
call
writeheader
end
if
if
(
nested_output
.eq.
1
)
then
if
(
lnetcdfout
.eq.
1
)
then
call
writeheader_netcdf
(
lnest
=
.true.
)
else
call
writeheader_nest
endif
endif
endif
#
endif
!
if
(
verbosity
.gt.
0
)
then
print
*
,
'call writeheader'
endif
...
...
@@ -401,7 +405,7 @@ program flexpart
call
writeheader
! FLEXPART 9.2 ticket ?? write header in ASCII format
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
.eq.
1
)
call
writeheader_nest_surf
if
(
nested_output
.ne.
1.
and
.
surf_only
.eq.
1
)
call
writeheader_surf
...
...
@@ -409,8 +413,6 @@ program flexpart
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
print
*
,
'call openreceptors'
endif
...
...
src/makefile
View file @
a9cf4b1e
...
...
@@ -30,6 +30,10 @@ SHELL = /bin/bash
# Compile for debugging parallel FLEXPART
# make [-j] mpi-dbg
#
# NETCDF OUTPUT
# To add support for output in netCDF format, append `ncf=yes` to the
# `make` command
#
################################################################################
## PROGRAMS
...
...
@@ -56,8 +60,7 @@ ifeq ($(gcc), 4.9)
INCPATH1
=
${ROOT_DIR}
/gcc-4.9.1/include
INCPATH2
=
${ROOT_DIR}
/include
LIBPATH1
=
${ROOT_DIR}
/lib
else
#ifeq ($(gcc), 5.4)
else
# Compiled libraries under user ~flexpart, gfortran v5.4
ROOT_DIR
=
/homevip/flexpart/
...
...
@@ -67,18 +70,18 @@ else #ifeq ($(gcc), 5.4)
INCPATH1
=
${ROOT_DIR}
/gcc-5.4.0/include
INCPATH2
=
/usr/include
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
# INCPATH2 = /usr/include
# LIBPATH1 = /xnilu_wrk/projects/FLEXPART/flex_wrk/bin64/grib_api/lib
### Enable netCDF output?
ifeq
($(ncf), yes)
NCOPT
=
-DUSE_NCF
-lnetcdff
else
NCOPT
=
-UUSE_NCF
endif
# path to gributils used to detect meteodata format
VPATH
=
gributils/
...
...
@@ -88,11 +91,12 @@ 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
# -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)
LDDEBUG
=
$(DBGFLAGS)
-L
$(LIBPATH1)
$(LIBS)
#-L
$(LIBPATH2)
...
...
@@ -139,6 +143,8 @@ OBJECTS_MPI = releaseparticles_mpi.o partoutput_mpi.o \
getfields_mpi.o
\
readwind_ecmwf_mpi.o
OBJECTS_NCF
=
netcdf_output_mod.o
OBJECTS
=
\
advance.o initialize.o
\
writeheader.o writeheader_txt.o
\
...
...
@@ -195,7 +201,11 @@ ohreaction.o getvdep_nests.o \
initial_cond_calc.o initial_cond_output.o
\
dynamic_viscosity.o get_settling.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
...
...
src/par_mod.f90
View file @
a9cf4b1e
...
...
@@ -147,7 +147,8 @@ module par_mod
! 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
=
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=181,nymax=91,nuvzmax=92,nwzmax=92,nzmax=92,nxshift=0 ! CERA 2.0 degree 92 level
...
...
@@ -208,7 +209,7 @@ module par_mod
!integer maxxgrid,maxygrid,maxzgrid,maxxgridn,maxygridn
!integer,parameter :: maxxgrid=361,maxygrid=181,maxxgridn=0,maxygridn=0)
integer
,
parameter
::
maxreceptor
=
20
integer
,
parameter
::
maxreceptor
=
20
0
! maxreceptor maximum number of receptor points
...
...
@@ -217,8 +218,8 @@ module par_mod
! Maximum number of particles, species, and similar
!**************************************************
integer
,
parameter
::
maxpart
=
1
00000
integer
,
parameter
::
maxspec
=
1
integer
,
parameter
::
maxpart
=
30
00000
integer
,
parameter
::
maxspec
=
6
real
,
parameter
::
minmass
=
0.0001
...
...
@@ -261,7 +262,7 @@ module par_mod
! Dimension of random number field
!*********************************
integer
,
parameter
::
maxrand
=
1
000000
integer
,
parameter
::
maxrand
=
200
000000
! maxrand number of random numbers used
...
...
src/readOHfield.f90
View file @
a9cf4b1e
...
...
@@ -94,7 +94,6 @@ subroutine readOHfield
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_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
src/readcommand.f90
View file @
a9cf4b1e
...
...
@@ -391,15 +391,16 @@ subroutine readcommand
mintime
=
lsynctime
endif
! check for netcdf output switch (use for non-namelist input only!)
! Check for netcdf output switch
!*******************************
if
(
iout
.ge.
8
)
then
lnetcdfout
=
1
iout
=
iout
-
8
!
#ifndef
NETCDF_OUTPUT
!
p
ri
nt*,
'ERROR: netcdf output not activated during compile time but used in COMMAND file!'
!
p
ri
nt*,
'Please recompile with netcdf library or use standard output format.'
!
stop
!
#endif
#ifndef
USE_NCF
w
ri
te
(
*
,
*
)
'ERROR: netcdf output not activated during compile time but used in COMMAND file!'
w
ri
te
(
*
,
*
)
'Please recompile with netcdf library
(`make [...] ncf=yes`)
or use standard output format.'
stop
#endif
endif
! Check whether a valid option for gridded model output has been chosen
...
...
src/timemanager.f90
View file @
a9cf4b1e
...
...
@@ -100,8 +100,10 @@ subroutine timemanager(metdata_format)
use
oh_mod
use
par_mod
use
com_mod
#ifdef USE_NCF
use
netcdf_output_mod
,
only
:
concoutput_netcdf
,
concoutput_nest_netcdf
,&
&
concoutput_surf_netcdf
,
concoutput_surf_nest_netcdf
#endif
implicit
none
...
...
@@ -388,7 +390,9 @@ subroutine timemanager(metdata_format)
if
((
iout
.le.
3.
)
.or.
(
iout
.eq.
5
))
then
if
(
surf_only
.ne.
1
)
then
if
(
lnetcdfout
.eq.
1
)
then
#ifdef USE_NCF
call
concoutput_netcdf
(
itime
,
outnum
,
gridtotalunc
,
wetgridtotalunc
,
drygridtotalunc
)
#endif
else
call
concoutput
(
itime
,
outnum
,
gridtotalunc
,
wetgridtotalunc
,
drygridtotalunc
)
endif
...
...
@@ -398,8 +402,10 @@ subroutine timemanager(metdata_format)
call
system_clock
(
count_clock
)
write
(
*
,
*
)
'system clock'
,
count_clock
-
count_clock0
endif
if
(
lnetcdfout
.eq.
1
)
then
if
(
lnetcdfout
.eq.
1
)
then
#ifdef USE_NCF
call
concoutput_surf_netcdf
(
itime
,
outnum
,
gridtotalunc
,
wetgridtotalunc
,
drygridtotalunc
)
#endif
else
call
concoutput_surf
(
itime
,
outnum
,
gridtotalunc
,
wetgridtotalunc
,
drygridtotalunc
)
if
(
verbosity
.eq.
1
)
then
...
...
@@ -418,11 +424,13 @@ subroutine timemanager(metdata_format)
call
concoutput_surf_nest
(
itime
,
outnum
)
endif
else
#ifdef USE_NCF
if
(
surf_only
.ne.
1
)
then
call
concoutput_nest_netcdf
(
itime
,
outnum
)
else
call
concoutput_surf_nest_netcdf
(
itime
,
outnum
)
endif
#endif
endif
endif
outnum
=
0.
...
...
src/timemanager_mpi.f90
View file @
a9cf4b1e
...
...
@@ -101,8 +101,10 @@ subroutine timemanager(metdata_format)
use
par_mod
use
com_mod
use
mpi_mod
#ifdef USE_NCF
use
netcdf_output_mod
,
only
:
concoutput_netcdf
,
concoutput_nest_netcdf
,&
&
concoutput_surf_netcdf
,
concoutput_surf_nest_netcdf
#endif
implicit
none
...
...
@@ -480,8 +482,10 @@ subroutine timemanager(metdata_format)
if
(
surf_only
.ne.
1
)
then
if
(
lroot
)
then
if
(
lnetcdfout
.eq.
1
)
then
#ifdef USE_NCF
call
concoutput_netcdf
(
itime
,
outnum
,
gridtotalunc
,
wetgridtotalunc
,&
&
drygridtotalunc
)
#endif
else
call
concoutput
(
itime
,
outnum
,
gridtotalunc
,
wetgridtotalunc
,
drygridtotalunc
)
endif
...
...
@@ -493,8 +497,10 @@ subroutine timemanager(metdata_format)
else
if
(
lroot
)
then
if
(
lnetcdfout
.eq.
1
)
then
#ifdef USE_NCF
call
concoutput_surf_netcdf
(
itime
,
outnum
,
gridtotalunc
,
wetgridtotalunc
,&
&
drygridtotalunc
)
#endif
else
call
concoutput_surf
(
itime
,
outnum
,
gridtotalunc
,
wetgridtotalunc
,
drygridtotalunc
)
end
if
...
...
@@ -512,7 +518,7 @@ subroutine timemanager(metdata_format)
!*********************************************
call
mpif_tm_reduce_grid_nest
if
(
mp_measure_time
)
call
mpif_mtime
(
'iotime'
,
0
)
if
(
mp_measure_time
)
call
mpif_mtime
(
'iotime'
,
0
)
if
(
lnetcdfout
.eq.
0
)
then
if
(
surf_only
.ne.
1
)
then
...
...
@@ -525,11 +531,9 @@ subroutine timemanager(metdata_format)
else
! :TODO: check for zeroing in the netcdf module
call
concoutput_surf_nest
(
itime
,
outnum
)
end
if
else
#ifdef USE_NCF
if
(
surf_only
.ne.
1
)
then
if
(
lroot
)
then
call
concoutput_nest_netcdf
(
itime
,
outnum
)
...
...
@@ -543,12 +547,9 @@ subroutine timemanager(metdata_format)
griduncn
(:,:,:,:,:,:,:)
=
0.
end
if
endif
#endif
end
if
end
if
outnum
=
0.
endif
if
((
iout
.eq.
4
)
.or.
(
iout
.eq.
5
))
call
plumetraj
(
itime
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment