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

Added module gfs_mod / ecmwf_mod to allow compilation of different versions...

Added module gfs_mod / ecmwf_mod to allow compilation of different versions without editing source code
parent c04b739b
!**********************************************************************
! Copyright 1998,1999,2000,2001,2002,2005,2007,2008,2009,2010 *
! Andreas Stohl, Petra Seibert, A. Frank, Gerhard Wotawa, *
! Caroline Forster, Sabine Eckhardt, John Burkhart, Harald Sodemann *
! *
! 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/>. *
!**********************************************************************
!*******************************************************************************
! Include file for calculation of particle trajectories (Program FLEXPART) *
! This file contains ECMWF specific parameters used in FLEXPART *
! Note that module name differs from file name. *
! The makefile selects either this file, or gfs_mod.f90, depending *
! on target. *
! *
! Author: ESO *
! *
! 2015 *
! *
!*******************************************************************************
module wind_mod
implicit none
!*********************************************
! Maximum dimensions of the input mother grids
!*********************************************
integer,parameter :: nxmax=361,nymax=181,nuvzmax=152,nwzmax=152,nzmax=152 !ECMWF new
integer,parameter :: nxshift=359
!
!*********************************************
! Maximum dimensions of the nested input grids
!*********************************************
! integer,parameter :: maxnests=0,nxmaxn=351,nymaxn=351 !ECMWF
end module wind_mod
!**********************************************************************
! Copyright 1998,1999,2000,2001,2002,2005,2007,2008,2009,2010 *
! Andreas Stohl, Petra Seibert, A. Frank, Gerhard Wotawa, *
! Caroline Forster, Sabine Eckhardt, John Burkhart, Harald Sodemann *
! *
! 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/>. *
!**********************************************************************
!*******************************************************************************
! Include file for calculation of particle trajectories (Program FLEXPART) *
! This file contains GFS specific parameters used in FLEXPART *
! Note that module name differs from file name. *
! The makefile selects either this file, or ecmwf_mod.f90, depending *
! on target. *
! *
! Author: ESO *
! *
! 2015 *
! *
!*******************************************************************************
module wind_mod
implicit none
!*********************************************
! Maximum dimensions of the input mother grids
!*********************************************
integer,parameter :: nxmax=721,nymax=361,nuvzmax=64,nwzmax=64,nzmax=64
integer,parameter :: nxshift=0 ! for GFS or FNL
end module wind_mod
......@@ -5,6 +5,12 @@ SHELL = /bin/bash
#
# Dependencies are resolved in this makefile, so parallel make is
# possible ("make -j")
#
# 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',
# also set environment variable LD_LIBRARY_FLAGS=
#
# USAGE
# Compile serial FLEXPART (ECMWF)
......@@ -24,8 +30,6 @@ SHELL = /bin/bash
#
################################################################################
## PROGRAMS
FLEXPART-ECMWF-MPI = FP_ecmwf_MPI
FLEXPART-ECMWF-MPI-DBG = DBG_FP_ecmwf_MPI
......@@ -33,40 +37,44 @@ FLEXPART-ECMWF = FP_ecmwf_gfortran
FLEXPART-GFS = FP_gfs_gfortran
FLEXPART-GFS-MPI = FP_gfs_MPI
ifeq ($(gcc), 4.9)
# Compiled libraries under user user ~flexpart, gfortran v4.9
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
# LIBPATH2 = ${ROOT_DIR}/gcc-4.9.1/lib
# LIBPATH2 = /lib
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
# LIBPATH2 = /usr/lib/x86_64-linux-gnu
endif
## COMPILERS
F90 = /usr/bin/gfortran
#F90 = ${HOME}/gcc-4.9.1/bin/gfortran
#MPIF90 = ${HOME}/opt/bin/mpifort
#MPIF90 = mpif90.mpich
MPIF90 = mpif90.openmpi
#MPIF90 = mpifort
## OPTIMIZATION LEVEL
O_LEV = 2 # [0,1,2,3,g,s,fast]
O_LEV_DBG = 0 # [0,g]
## LIBRARIES
LIBS = -lgrib_api_f90 -lgrib_api -lm -ljasper -lnetcdff # -fopenmp # -llapack -lnetcdf
## 1) System libraries at NILU
INCPATH1 = /usr/include
#INCPATH1 = /xnilu_wrk/flex_wrk/bin64/grib_api/include
LIBPATH1 = /xnilu_wrk/flex_wrk/bin64/grib_api/lib
#LIBPATH2 = /usr/lib/x86_64-linux-gnu
## 2) Home-made libraries
# INCPATH1 = ${HOME}/include
INCPATH2 = /homevip/flexpart/include/
LIBPATH2 = /homevip/flexpart/lib/
# LIBPATH1 = ${HOME}/lib
LIBS = -lgrib_api_f90 -lgrib_api -lm -ljasper -lnetcdff -llapack # -fopenmp # -llapack
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) -mtune=native -fuse-linker-plugin $(FUSER) # -march=native
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) -mtune=native $(FUSER) # -march=native
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 -Warray-bounds -Wall -fcheck=all $(FUSER) # -ffpe-trap=invalid,overflow,denormal,underflow,zero -fdump-core
LDFLAGS = $(FFLAGS) -L$(LIBPATH1) -L$(LIBPATH2) $(LIBS)
LDDEBUG = $(DBGFLAGS) -L$(LIBPATH1) -L$(LIBPATH2) $(LIBS)
LDFLAGS = $(FFLAGS) -L$(LIBPATH1) $(LIBS) #-L$(LIBPATH2)
LDDEBUG = $(DBGFLAGS) -L$(LIBPATH1) $(LIBS) #-L$(LIBPATH2)
MODOBJS = \
par_mod.o com_mod.o \
......@@ -113,7 +121,8 @@ OBJECTS_ECMWF = \
calcpar.o readwind.o \
richardson.o verttransform.o \
obukhov.o gridcheck.o \
convmix.o calcmatrix.o
convmix.o calcmatrix.o \
ecmwf_mod.o
## For ECMWF MPI version:
......@@ -122,14 +131,16 @@ OBJECTS_ECMWF_MPI = \
calcpar.o \
richardson.o verttransform.o \
obukhov.o \
convmix.o calcmatrix.o
convmix.o calcmatrix.o \
ecmwf_mod.o
## For GFS (serial) version:
OBJECTS_GFS = \
calcpar_gfs.o readwind_gfs.o \
richardson_gfs.o verttransform_gfs.o \
obukhov_gfs.o gridcheck_gfs.o \
convmix_gfs.o calcmatrix_gfs.o
convmix_gfs.o calcmatrix_gfs.o \
gfs_mod.o
OBJECTS = \
advance.o initialize.o \
......@@ -202,12 +213,32 @@ ecmwf-mpi-dbg: FC := $(MPIF90)
gfs: $(FLEXPART-GFS)
gfs: FC := $(F90)
gfs-mpi: $(FLEXPART-GFS-MPI)
gfs-mpi: FC := $(MPIF90)
#all: $(FLEXPART-ECMWF)
#all: $(FLEXPART-ECMWF-MPI)
## This allows for switching between ECMWF/GFS without editing source code.
wind_mod = ecmwf_mod.o # default wind
# ifeq ($(MAKECMDGOALS),ecmwf)
# wind_mod = ecmwf_mod.o
# endif
# ifeq ($(MAKECMDGOALS),ecmwf-mpi)
# wind_mod = ecmwf_mod.o
# endif
# ifeq ($(MAKECMDGOALS),ecmwf-mpi-dbg)
# wind_mod = ecmwf_mod.o
# endif
ifeq ($(MAKECMDGOALS),gfs)
wind_mod = gfs_mod.o
endif
ifeq ($(MAKECMDGOALS),gfs-mpi)
wind_mod = gfs_mod.o
endif
$(FLEXPART-ECMWF): $(MODOBJS) $(OBJECTS) $(OBJECTS_SERIAL) $(OBJECTS_ECMWF)
+$(FC) -o $@ $(MODOBJS) $(OBJECTS) $(OBJECTS_SERIAL) $(OBJECTS_ECMWF) $(LDFLAGS)
......@@ -338,6 +369,7 @@ openouttraj.o: com_mod.o par_mod.o point_mod.o
openreceptors.o: com_mod.o par_mod.o
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
par_mod.o : $(wind_mod)
part0.o: par_mod.o
partdep.o: par_mod.o
partoutput.o: com_mod.o par_mod.o
......
......@@ -33,6 +33,10 @@
module par_mod
! wind_mod: is gfs_mod.f90 for target gfs, ecmwf_mod.f90 for target ecmwf
!************************************************************************
use wind_mod
implicit none
!****************************************************************
......@@ -121,20 +125,25 @@ module par_mod
! Maximum dimensions of the input mother grids
!*********************************************
! nxmax,nymax,nuvzmax,nwzmax,nzmax:
! Moved to ecmwf.f90 (for ECMWF) / gfs.f90 (GFS)
!integer,parameter :: nxmax=361,nymax=181,nuvzmax=92,nwzmax=92,nzmax=92 !FNL XF
integer,parameter :: nxmax=361,nymax=181,nuvzmax=152,nwzmax=152,nzmax=152 !ECMWF new
!integer,parameter :: nxmax=361,nymax=181,nuvzmax=152,nwzmax=152,nzmax=152 !ECMWF new
!integer,parameter :: nxmax=361,nymax=181,nuvzmax=92,nwzmax=92,nzmax=92 !ECMWF
!integer,parameter :: nxmax=361,nymax=181,nuvzmax=26,nwzmax=26,nzmax=26
!integer,parameter :: nxmax=721,nymax=361,nuvzmax=64,nwzmax=64,nzmax=64
!integer,parameter :: nxmax=1201,nymax=235,nuvzmax=58,nwzmax=58,nzmax=58
integer,parameter :: nxshift=359 ! for ECMWF
! integer,parameter :: nxshift=359 ! for ECMWF
!integer,parameter :: nxshift=0 ! for GFS or FNL
integer,parameter :: nconvlevmax = nuvzmax-1
integer,parameter :: na = nconvlevmax+1
! moved to gfs_mod.f90 / ecmwf_mod.f90
!
! nxmax,nymax maximum dimension of wind fields in x and y
! direction, respectively
! nuvzmax,nwzmax maximum dimension of (u,v) and (w) wind fields in z
......@@ -145,6 +154,7 @@ module par_mod
! nxshift grid points, in order to accomodate nested
! grids, and output grids overlapping the domain "boundary"
! nxshift must not be negative; "normal" setting would be 0
! ntracermax maximum number of tracer species in convection
! nconvlevmax maximum number of levels for convection
! na parameter used in Emanuel's convect subroutine
......@@ -155,7 +165,7 @@ module par_mod
!*********************************************
!integer,parameter :: maxnests=0, nxmaxn=0, nymaxn=0
integer,parameter :: maxnests=1,nxmaxn=351,nymaxn=351 !ECMWF
integer,parameter :: maxnests=0,nxmaxn=351,nymaxn=351 !ECMWF
!integer,parameter :: maxnests=1, nxmaxn=201, nymaxn=161 ! FNL XF
! maxnests maximum number of nested grids
......@@ -199,10 +209,10 @@ module par_mod
! Maximum number of particles, species, and similar
!**************************************************
integer,parameter :: maxpart=50000000
integer,parameter :: maxpart=60000000
! integer,parameter :: maxpart=60000000
! integer,parameter :: maxpart=120000000
integer,parameter :: maxspec=1
integer,parameter :: maxspec=6
! maxpart Maximum number of particles
! maxspec Maximum number of chemical species per release
......@@ -270,6 +280,7 @@ module par_mod
integer,parameter :: unitOH=1
integer,parameter :: unitdates=94, unitheader=90,unitheader_txt=100, unitshortpart=95
integer,parameter :: unitboundcond=89
integer,parameter :: unittmp=101
!******************************************************
! integer code for missing values, used in wet scavenging (PS, 2012)
......
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