#%Module######################################################################
##
##    NEMS FV3 Prerequisites: Cheyenne/PGI

proc ModulesHelp {} {
  puts stderr "\tcit - loads modules required for building and running FV3 under NEMS on Cheyenne/PGI"
}

module-whatis "loads NEMS FV3 prerequisites for Cheyenne/PGI"

# NOTE: the "module purge" and loading of the module command are
# handled by the module-setup.sh (or .csh) script.

##
## load programming environment
## this typically includes compiler, MPI and job scheduler
##
module load ncarenv/1.2
module load pgi/17.9
module load mpt/2.19
module load ncarcompilers/0.4.1
module load netcdf/4.4.1.1

##
## use pre-compiled EMSF library for pgi-17.9 and mpt-2.15f, because
## building it with mpt-2.19 was a hopeless undertaking
##
set ESMF_DIR /glade/p/ral/jntp/GMTB/tools/esmf-7.1.0r/pgi-17.9/mpt-2.15f
setenv ESMF_DIR              ${ESMF_DIR}
setenv ESMF_INC              ${ESMF_DIR}/include
setenv ESMF_BIN              ${ESMF_DIR}/bin/binO/Linux.pgi.64.mpi.default
setenv ESMF_LIB              ${ESMF_DIR}/lib/libO/Linux.pgi.64.mpi.default
setenv ESMF_MOD              ${ESMF_DIR}/mod/modO/Linux.pgi.64.mpi.default
setenv ESMFMKFILE            ${ESMF_DIR}/lib/libO/Linux.pgi.64.mpi.default/esmf.mk
prepend-path PATH            ${ESMF_DIR}/bin/binO/Linux.pgi.64.mpi.default
prepend-path LD_LIBRARY_PATH ${ESMF_DIR}/lib/libO/Linux.pgi.64.mpi.default

##
## NCEP libraries (download and build manually for the time being; https://github.com/NCAR/NCEPlibs)
##
set NCEPLIBS_DIR /glade/p/ral/jntp/GMTB/tools/NCEPlibs/20190307/pgi-17.9/mpt-2.19
setenv NCEPLIBS_DIR ${NCEPLIBS_DIR}
setenv NEMSIO_INC   ${NCEPLIBS_DIR}/include
setenv NEMSIO_LIB   ${NCEPLIBS_DIR}/lib/libnemsio_d.a
setenv BACIO_LIB4   ${NCEPLIBS_DIR}/lib/libbacio_4.a
setenv SP_LIBd      ${NCEPLIBS_DIR}/lib/libsp_v2.0.2_d.a
setenv W3EMC_LIBd   ${NCEPLIBS_DIR}/lib/libw3emc_d.a
setenv W3NCO_LIBd   ${NCEPLIBS_DIR}/lib/libw3nco_d.a