makefile 14.6 KB
Newer Older
Matthias Langer's avatar
 
Matthias Langer committed
1
SHELL = /bin/bash
2
3
4
5
6
7
################################################################################
#  DESCRIPTION
#    Makefile for FLEXPART. Standard (serial) and parallel (MPI) version
#
#    Dependencies are resolved in this makefile, so parallel make is
#    possible ("make -j")
8
9
10
11
12
#
#    At NILU we have installed gcc-4.9.1 and libraries under user /homevip/flexpart
#    ("ROOT_DIR")
#    To use gfortran version 4.9, add "gcc=4.9" to the make command, e.g.
#       'make -j ecmwf gcc=4.9',
13
#    also set environment variable LD_LIBRARY_PATH to point to compiler libraries
14
15
16
17
18
19
20
21
#
#    Makefile was modified to produce unified executable for both ECMWF and GFS meteo data formats
#    gributils were included to detect format of meteo data
#
#    Cpp directives USE_MPIINPLACE were added to three source files. The effect of these directives 
#    are to enable the MPI_IN_PLACE option only if compiled with a -DUSE_MPIINPLACE directive. 
#    Otherwise, a safer option (which requires the allocation of another array) is used by default. 
#    In makefile added the -x f95-cpp-input flag for compiling of cpp directives.
22
23
# 
#  USAGE
24
25
#    Compile serial FLEXPART 
#      make [-j] serial
26
#
27
28
#    Compile parallel FLEXPART 
#      make [-j] mpi
29
#     
30
31
#    Compile for debugging parallel FLEXPART
#      make [-j] mpi-dbg
32
33
#
################################################################################
Matthias Langer's avatar
 
Matthias Langer committed
34

35
## PROGRAMS
36
37
38
39
40
41
42
43
44
45
46
47
# Unified executable names
# The same executable is used for both ECMWF and GFS metdata

# Parallel processing executable
FLEXPART-MPI = FLEXPART_MPI

# Parallel processing executable with debugging info
FLEXPART-MPI-DBG = DBG_FLEXPART_MPI

# Serial processing executable
FLEXPART-SERIAL = FLEXPART

48

49
ifeq ($(gcc), 4.9)
50
# Compiled libraries under users ~flexpart, gfortran v4.9
51
52
53
54
55
56
57
58
59
	ROOT_DIR = /homevip/flexpart/
#	ROOT_DIR = /homevip/espen/

	F90	  = ${ROOT_DIR}/gcc-4.9.1/bin/gfortran
	MPIF90    = ${ROOT_DIR}/bin/mpifort

	INCPATH1  = ${ROOT_DIR}/gcc-4.9.1/include	
	INCPATH2  = ${ROOT_DIR}/include
	LIBPATH1 = ${ROOT_DIR}/lib
Espen Sollum's avatar
Espen Sollum committed
60

61
62
63
64
65
66
67
68
69
else
# Default: System libraries at NILU, gfortran v4.6
	F90       = /usr/bin/gfortran
	MPIF90    = /usr/bin/mpif90.openmpi

	INCPATH1 = /xnilu_wrk/flex_wrk/bin64/grib_api/include
	INCPATH2 = /usr/include
	LIBPATH1 = /xnilu_wrk/flex_wrk/bin64/grib_api/lib
endif
70

71

72
73
74
75
# path to gributils used to detect meteodata format
VPATH = gributils/


76
77
## OPTIMIZATION LEVEL
O_LEV = 2 # [0,1,2,3,g,s,fast]
78
O_LEV_DBG = g # [0,g]
79
80

## LIBRARIES
81
LIBS = -lgrib_api_f90 -lgrib_api -lm -ljasper -lnetcdff # -fopenmp
82

83
FFLAGS   = -I$(INCPATH1) -I$(INCPATH2) -O$(O_LEV) -g -m64 -mcmodel=medium -fconvert=little-endian -frecord-marker=4 -fmessage-length=0 -flto=jobserver -O$(O_LEV) $(FUSER)  #-Warray-bounds -fcheck=all # -march=native
84

85
DBGFLAGS = -I$(INCPATH1) -I$(INCPATH2) -O$(O_LEV_DBG) -g3 -ggdb3 -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
86

87
88
LDFLAGS  = $(FFLAGS) -L$(LIBPATH1) $(LIBS) #-L$(LIBPATH2)
LDDEBUG  = $(DBGFLAGS) -L$(LIBPATH1) $(LIBS) #-L$(LIBPATH2)
89

Matthias Langer's avatar
 
Matthias Langer committed
90
MODOBJS = \
91
par_mod.o    		com_mod.o \
Matthias Langer's avatar
 
Matthias Langer committed
92
93
94
95
conv_mod.o              hanna_mod.o \
interpol_mod.o          cmapf_mod.o \
unc_mod.o               oh_mod.o \
xmass_mod.o             flux_mod.o \
96
point_mod.o             outg_mod.o \
97
98
mean_mod.o	 	random_mod.o \
class_gribfile_mod.o
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114

MPI_MODOBJS = \
mpi_mod.o

## Serial versions (MPI version with same functionality and name '_mpi.f90' exists)
OBJECTS_SERIAL = \
	releaseparticles.o 	partoutput.o \
	conccalc.o \
	init_domainfill.o 	concoutput.o  \
	timemanager.o FLEXPART.o	\
	readpartpositions.o \
	partoutput_short.o		\
	concoutput_nest.o 	\
	boundcond_domainfill.o	\
	redist.o		\
	concoutput_surf.o	concoutput_surf_nest.o	\
115
116
	getfields.o \
        readwind_ecmwf.o
117
118
119
120
121
122
123
124
125
126
127
128

## For MPI version 
OBJECTS_MPI = releaseparticles_mpi.o partoutput_mpi.o \
	conccalc_mpi.o \
	init_domainfill_mpi.o concoutput_mpi.o 	\
	timemanager_mpi.o FLEXPART_MPI.o	\
	readpartpositions_mpi.o		\
	partoutput_short_mpi.o	 	\
	concoutput_nest_mpi.o 		\
	boundcond_domainfill_mpi.o	\
	redist_mpi.o		\
	concoutput_surf_mpi.o	concoutput_surf_nest_mpi.o	\
129
130
	getfields_mpi.o \
        readwind_ecmwf_mpi.o 
Matthias Langer's avatar
 
Matthias Langer committed
131
132

OBJECTS = \
133
134
advance.o		initialize.o		\
writeheader.o		writeheader_txt.o  	\
135
writeprecip.o \
136
137
writeheader_surf.o     	assignland.o\
part0.o 		gethourlyOH.o\
Matthias Langer's avatar
 
Matthias Langer committed
138
139
caldate.o               partdep.o \
coordtrafo.o            psih.o \
140
141
raerod.o 		readcommand.o 	\
drydepokernel.o         readreceptors.o \
Matthias Langer's avatar
 
Matthias Langer committed
142
erf.o                   readavailable.o \
143
ew.o			readreleases.o  \
Sabine's avatar
Sabine committed
144
readdepo.o              get_vdep_prob.o   \
145
get_wetscav.o		readwind_gfs.o \
146
psim.o			outgrid_init.o 	\
147
outgrid_init_nest.o   	calcmatrix.o \
148
photo_O1D.o 		readlanduse.o \
Matthias Langer's avatar
 
Matthias Langer committed
149
150
interpol_wind.o         readoutgrid.o \
interpol_all.o          readpaths.o \
151
152
getrb.o                 obukhov.o \
getrc.o                 convmix.o \
Matthias Langer's avatar
 
Matthias Langer committed
153
getvdep.o               readspecies.o \
154
155
156
157
interpol_misslev.o      richardson.o \
scalev.o                verttransform_ecmwf.o \
pbl_profile.o           readOHfield.o \
juldate.o               verttransform_gfs.o \
Matthias Langer's avatar
 
Matthias Langer committed
158
159
interpol_vdep.o         interpol_rain.o \
hanna.o                 wetdepokernel.o \
160
calcpar.o               wetdepo.o \
Matthias Langer's avatar
 
Matthias Langer committed
161
hanna_short.o           windalign.o \
162
163
hanna1.o                gridcheck_ecmwf.o \
gridcheck_gfs.o         gridcheck_nests.o \
164
readwind_nests.o        calcpar_nests.o \
Matthias Langer's avatar
 
Matthias Langer committed
165
166
167
verttransform_nests.o   interpol_all_nests.o \
interpol_wind_nests.o   interpol_misslev_nests.o \
interpol_vdep_nests.o   interpol_rain_nests.o \
168
readageclasses.o        detectformat.o  \
Matthias Langer's avatar
 
Matthias Langer committed
169
170
calcfluxes.o            fluxoutput.o \
qvsat.o                 skplin.o \
171
convect43c.o            \
Matthias Langer's avatar
 
Matthias Langer committed
172
173
174
175
176
177
sort2.o                 distance.o \
centerofmass.o          plumetraj.o \
openouttraj.o           calcpv.o \
calcpv_nests.o          distance2.o \
clustering.o            interpol_wind_short.o \
interpol_wind_short_nests.o shift_field_0.o \
178
179
180
181
182
shift_field.o             \
openreceptors.o         \
readoutgrid_nest.o \
writeheader_nest.o writeheader_nest_surf.o \
wetdepokernel_nest.o \
Matthias Langer's avatar
 
Matthias Langer committed
183
184
185
drydepokernel_nest.o    zenithangle.o \
ohreaction.o            getvdep_nests.o \
initial_cond_calc.o     initial_cond_output.o \
186
187
188
189
190
191
dynamic_viscosity.o     get_settling.o	\
initialize_cbl_vel.o	re_initialize_particle.o \
cbl.o			netcdf_output_mod.o

%.o: %.mod

192
193
194
# serial executable
serial: $(FLEXPART-SERIAL)
serial: FC := $(F90)
195

196
197
198
# parallel processing executable
mpi: $(FLEXPART-MPI)
mpi: FC := $(MPIF90)
199

200
201
202
203
204
# parallel processing with debugging info
mpi-dbg: $(FLEXPART-MPI-DBG)
mpi-dbg: FFLAGS := $(DBGFLAGS)
mpi-dbg: LDFLAGS:= $(LDDEBUG)
mpi-dbg: FC := $(MPIF90)
205

206
207
$(FLEXPART-SERIAL): $(MODOBJS) $(OBJECTS) $(OBJECTS_SERIAL)
	+$(FC) -o $@ $(MODOBJS) $(OBJECTS) $(OBJECTS_SERIAL) $(LDFLAGS)
Matthias Langer's avatar
 
Matthias Langer committed
208

209
$(FLEXPART-MPI): $(MODOBJS) $(MPI_MODOBJS) $(OBJECTS) $(OBJECTS_MPI)
210
	+$(FC) -o $@ $(MODOBJS) $(MPI_MODOBJS) $(OBJECTS) $(OBJECTS_MPI) \
211
	$(LDFLAGS)
212

213
$(FLEXPART-MPI-DBG): $(MODOBJS) $(MPI_MODOBJS) $(OBJECTS) $(OBJECTS_MPI)
214
	+$(FC) -o $@ $(MODOBJS) $(MPI_MODOBJS) $(OBJECTS) $(OBJECTS_MPI) \
215
	$(LDFLAGS)
Matthias Langer's avatar
 
Matthias Langer committed
216
217

%.o: %.f90
218
	+$(FC) -c $(FFLAGS) $<
Matthias Langer's avatar
 
Matthias Langer committed
219
220

clean:
221
	\rm -f *.o *.mod
Matthias Langer's avatar
 
Matthias Langer committed
222

223
cleanall:
224
225
	\rm -f *.o *.mod $(FLEXPART-MPI) $(FLEXPART-MPI-DBG) $(FLEXPART-SERIAL)

226
227
228
229

.SUFFIXES = $(SUFFIXES) .f90

## DEPENDENCIES
Sabine's avatar
Sabine committed
230
get_vdep_prob.o: cmapf_mod.o com_mod.o hanna_mod.o interpol_mod.o par_mod.o \
231
	point_mod.o random_mod.o
232
233
234
235
236
237
238
advance.o: cmapf_mod.o com_mod.o hanna_mod.o interpol_mod.o par_mod.o \
	point_mod.o random_mod.o
assignland.o: com_mod.o par_mod.o
boundcond_domainfill.o: com_mod.o par_mod.o point_mod.o random_mod.o
boundcond_domainfill_mpi.o: com_mod.o mpi_mod.o par_mod.o point_mod.o \
	random_mod.o
calcfluxes.o: com_mod.o flux_mod.o outg_mod.o par_mod.o
239
240
calcmatrix.o: com_mod.o conv_mod.o par_mod.o class_gribfile_mod.o
calcpar.o: com_mod.o par_mod.o class_gribfile_mod.o
241
242
243
244
245
246
247
248
249
250
251
calcpar_nests.o: com_mod.o par_mod.o
calcpv.o: com_mod.o par_mod.o
calcpv_nests.o: com_mod.o par_mod.o
caldate.o: par_mod.o
cbl.o: com_mod.o par_mod.o
centerofmass.o: par_mod.o
clustering.o: par_mod.o
cmapf_mod.o: par_mod.o
com_mod.o: par_mod.o
conccalc.o: com_mod.o outg_mod.o par_mod.o unc_mod.o
conccalc_mpi.o: com_mod.o mpi_mod.o outg_mod.o par_mod.o unc_mod.o
252
concoutput.o: com_mod.o outg_mod.o par_mod.o point_mod.o unc_mod.o mean_mod.o
253
concoutput_mpi.o: com_mod.o mpi_mod.o outg_mod.o par_mod.o point_mod.o \
254
255
	unc_mod.o mean_mod.o
concoutput_nest.o: com_mod.o outg_mod.o par_mod.o point_mod.o unc_mod.o mean_mod.o
256
concoutput_nest_mpi.o: com_mod.o mpi_mod.o outg_mod.o par_mod.o point_mod.o \
257
258
	unc_mod.o mean_mod.o
concoutput_surf.o: com_mod.o outg_mod.o par_mod.o point_mod.o unc_mod.o mean_mod.o
259
concoutput_surf_mpi.o: com_mod.o mpi_mod.o outg_mod.o par_mod.o point_mod.o \
260
261
	unc_mod.o mean_mod.o
concoutput_surf_nest.o: com_mod.o outg_mod.o par_mod.o point_mod.o unc_mod.o mean_mod.o
262
concoutput_surf_nest_mpi.o: com_mod.o mpi_mod.o outg_mod.o par_mod.o \
263
	point_mod.o unc_mod.o mean_mod.o
264
265
conv_mod.o: par_mod.o
convect43c.o: conv_mod.o par_mod.o
266
convmix.o: com_mod.o conv_mod.o flux_mod.o par_mod.o class_gribfile_mod.o
267
coordtrafo.o: com_mod.o par_mod.o point_mod.o
268
detectformat.o: com_mod.o par_mod.o class_gribfile_mod.o
269
270
271
272
273
distance.o: par_mod.o
distance2.o: par_mod.o
drydepokernel.o: com_mod.o par_mod.o unc_mod.o
drydepokernel_nest.o: com_mod.o par_mod.o unc_mod.o
erf.o: par_mod.o
274
FLEXPART.o: com_mod.o conv_mod.o par_mod.o point_mod.o random_mod.o netcdf_output_mod.o class_gribfile_mod.o
275
FLEXPART_MPI.o: com_mod.o conv_mod.o mpi_mod.o par_mod.o point_mod.o \
276
	random_mod.o netcdf_output_mod.o class_gribfile_mod.o
277
278
fluxoutput.o: com_mod.o flux_mod.o outg_mod.o par_mod.o
get_settling.o: com_mod.o par_mod.o
279
280
getfields.o: com_mod.o par_mod.o class_gribfile_mod.o
getfields_mpi.o: com_mod.o par_mod.o mpi_mod.o class_gribfile_mod.o
281
282
283
284
285
gethourlyOH.o: com_mod.o oh_mod.o par_mod.o
getrb.o: par_mod.o
getrc.o: com_mod.o par_mod.o
getvdep.o: com_mod.o par_mod.o
getvdep_nests.o: com_mod.o par_mod.o
286
gridcheck_ecmwf.o: cmapf_mod.o com_mod.o conv_mod.o par_mod.o
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
gridcheck_emos.o: com_mod.o conv_mod.o par_mod.o
gridcheck_fnl.o: cmapf_mod.o com_mod.o conv_mod.o par_mod.o
gridcheck_gfs.o: cmapf_mod.o com_mod.o conv_mod.o par_mod.o
gridcheck_gfs_emos.o: com_mod.o conv_mod.o par_mod.o
gridcheck_nests.o: com_mod.o par_mod.o
gridcheck_nests_emos.o: com_mod.o par_mod.o
gridcheck_orig_ecmwf.o: cmapf_mod.o com_mod.o conv_mod.o par_mod.o
hanna.o: com_mod.o hanna_mod.o par_mod.o
hanna1.o: com_mod.o hanna_mod.o par_mod.o
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_output.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
interpol_all_nests.o: com_mod.o hanna_mod.o interpol_mod.o par_mod.o
interpol_misslev.o: com_mod.o hanna_mod.o interpol_mod.o par_mod.o
interpol_misslev_nests.o: com_mod.o hanna_mod.o interpol_mod.o par_mod.o
interpol_mod.o: par_mod.o
interpol_rain.o: par_mod.o
interpol_rain_nests.o: par_mod.o
interpol_vdep.o: com_mod.o interpol_mod.o par_mod.o
interpol_vdep_nests.o: com_mod.o interpol_mod.o par_mod.o
interpol_wind.o: com_mod.o interpol_mod.o par_mod.o
interpol_wind_nests.o: com_mod.o interpol_mod.o par_mod.o
interpol_wind_short.o: com_mod.o interpol_mod.o par_mod.o
interpol_wind_short_nests.o: com_mod.o interpol_mod.o par_mod.o
juldate.o: par_mod.o
318
mean_mod.o: par_mod.o
319
mpi_mod.o: com_mod.o par_mod.o unc_mod.o
320
netcdf_output_mod.o: com_mod.o outg_mod.o par_mod.o point_mod.o unc_mod.o mean_mod.o
321
obukhov.o: par_mod.o class_gribfile_mod.o
322
323
324
ohreaction.o: com_mod.o oh_mod.o par_mod.o
openouttraj.o: com_mod.o par_mod.o point_mod.o
openreceptors.o: com_mod.o par_mod.o
325
outg_mod.o: par_mod.o
326
327
328
329
330
331
332
333
334
outgrid_init.o: com_mod.o flux_mod.o oh_mod.o outg_mod.o par_mod.o unc_mod.o
outgrid_init_nest.o: com_mod.o outg_mod.o par_mod.o unc_mod.o
part0.o: par_mod.o
partdep.o: par_mod.o
partoutput.o: com_mod.o par_mod.o
partoutput_mpi.o: com_mod.o mpi_mod.o par_mod.o
partoutput_short.o: com_mod.o par_mod.o
partoutput_short_mpi.o: com_mod.o mpi_mod.o par_mod.o
pbl_profile.o: par_mod.o
335
plumetraj.o: com_mod.o par_mod.o point_mod.o mean_mod.o
336
337
338
339
340
341
342
343
344
psih.o: par_mod.o
psim.o: par_mod.o
raerod.o: par_mod.o
re_initialize_particle.o: com_mod.o par_mod.o
readageclasses.o: com_mod.o par_mod.o
readavailable.o: com_mod.o par_mod.o
readcommand.o: com_mod.o par_mod.o
readdepo.o: com_mod.o par_mod.o
readlanduse.o: com_mod.o par_mod.o
345
#readlanduse_int1.o: com_mod.o par_mod.o
346
347
348
349
350
351
352
353
354
readOHfield.o: com_mod.o oh_mod.o par_mod.o
readoutgrid.o: com_mod.o outg_mod.o par_mod.o
readoutgrid_nest.o: com_mod.o outg_mod.o par_mod.o
readpartpositions.o: com_mod.o par_mod.o random_mod.o
readpartpositions_mpi.o: com_mod.o mpi_mod.o par_mod.o random_mod.o
readpaths.o: com_mod.o par_mod.o
readreceptors.o: com_mod.o par_mod.o
readreleases.o: com_mod.o par_mod.o point_mod.o xmass_mod.o
readspecies.o: com_mod.o par_mod.o
355
readwind_ecmwf.o: com_mod.o par_mod.o
356
357
358
readwind_emos.o: com_mod.o par_mod.o
readwind_gfs.o: com_mod.o par_mod.o
readwind_gfs_emos.o: com_mod.o par_mod.o
359
readwind_ecmwf_mpi.o: com_mod.o mpi_mod.o par_mod.o
360
361
362
363
364
365
366
367
readwind_nests.o: com_mod.o par_mod.o
readwind_nests_emos.o: com_mod.o par_mod.o
redist.o: com_mod.o conv_mod.o par_mod.o random_mod.o
redist_mpi.o: com_mod.o conv_mod.o mpi_mod.o par_mod.o random_mod.o
releaseparticles.o: com_mod.o par_mod.o point_mod.o random_mod.o \
	xmass_mod.o
releaseparticles_mpi.o: com_mod.o mpi_mod.o par_mod.o point_mod.o \
	random_mod.o xmass_mod.o
368
richardson.o: par_mod.o class_gribfile_mod.o
369
370
371
372
373
374
scalev.o: par_mod.o
shift_field.o: par_mod.o
shift_field_0.o: par_mod.o
timemanager.o: com_mod.o flux_mod.o netcdf_output_mod.o oh_mod.o outg_mod.o \
	par_mod.o point_mod.o unc_mod.o xmass_mod.o
timemanager_mpi.o: com_mod.o flux_mod.o mpi_mod.o oh_mod.o outg_mod.o \
375
	par_mod.o point_mod.o unc_mod.o xmass_mod.o netcdf_output_mod.o	
376
unc_mod.o: par_mod.o
377
verttransform_ecmwf.o: cmapf_mod.o com_mod.o par_mod.o 
378
379
verttransform_gfs.o: cmapf_mod.o com_mod.o par_mod.o
verttransform_nests.o: com_mod.o par_mod.o
Sabine's avatar
Sabine committed
380
get_wetscav.o: com_mod.o par_mod.o point_mod.o
381
382
383
384
wetdepo.o: com_mod.o par_mod.o point_mod.o
wetdepokernel.o: com_mod.o par_mod.o unc_mod.o
wetdepokernel_nest.o: com_mod.o par_mod.o unc_mod.o
writeheader.o: com_mod.o outg_mod.o par_mod.o point_mod.o
385
writeprecip.o: com_mod.o par_mod.o point_mod.o
386
387
388
389
390
writeheader_nest.o: com_mod.o outg_mod.o par_mod.o point_mod.o
writeheader_nest_surf.o: com_mod.o outg_mod.o par_mod.o point_mod.o
writeheader_surf.o: com_mod.o outg_mod.o par_mod.o point_mod.o
writeheader_txt.o: com_mod.o outg_mod.o par_mod.o point_mod.o
zenithangle.o: par_mod.o