Index: /issm/trunk-jpl/etc/environment.sh
===================================================================
--- /issm/trunk-jpl/etc/environment.sh	(revision 27201)
+++ /issm/trunk-jpl/etc/environment.sh	(revision 27202)
@@ -355,4 +355,11 @@
 fi
 
+QD_ROOT="${ISSM_EXT_DIR}/qd/install"
+if [ -d "${QD_ROOT}" ]; then
+	export QD_ROOT # Used in installation of MPLAPACK
+	library_path_prepend "${QD_ROOT}/lib"
+	ld_library_path_prepend "${QD_ROOT}/lib"
+fi
+
 SCALAPACK_ROOT="${ISSM_EXT_DIR}/scalapack/install"
 if [ -d "${SCALAPACK_ROOT}" ]; then
@@ -443,23 +450,4 @@
 ld_library_path_append "${TAO_ROOT}/lib"
 
-DAKOTA_ROOT="${ISSM_EXT_DIR}/dakota/install"
-if [ -d "${DAKOTA_ROOT}" ]; then
-	path_append "${DAKOTA_ROOT}/bin"
-	ld_library_path_append "${DAKOTA_ROOT}/lib"
-	dyld_library_path_prepend "${DAKOTA_ROOT}/lib"
-fi
-
-NCO_ROOT="${ISSM_EXT_DIR}/nco/install/bin"
-path_prepend "${NCO_ROOT}/bin"
-
-CPPCHECK_ROOT="${ISSM_EXT_DIR}/cppcheck/install"
-path_append "${CPPCHECK_ROOT}/bin"
-
-MERCURIAL_ROOT="${ISSM_EXT_DIR}/mercurial/install"
-if [ -d "${MERCURIAL_ROOT}" ]; then
-	export PYTHONPATH="${PYTHONPATH}:${MERCURIAL_ROOT}/mercurial/pure/"
-	path_append "${MERCURIAL_ROOT}"
-fi
-
 BOOST_ROOT="${ISSM_EXT_DIR}/boost/install"
 if [ -d "${BOOST_ROOT}" ]; then
@@ -467,8 +455,27 @@
 	export BOOST_DIR=${BOOST_ROOT}
 	export BOOSTROOT=${BOOST_ROOT}
-	library_path_append "${BOOST_ROOT}/lib"
-	ld_library_path_append "${BOOST_ROOT}/lib"
-	dyld_library_path_append "${BOOST_ROOT}/lib"
 	path_append "${BOOST_ROOT}/bin"
+	library_path_prepend "${BOOST_ROOT}/lib"
+	ld_library_path_prepend "${BOOST_ROOT}/lib"
+	dyld_library_path_prepend "${BOOST_ROOT}/lib"
+fi
+
+DAKOTA_ROOT="${ISSM_EXT_DIR}/dakota/install"
+if [ -d "${DAKOTA_ROOT}" ]; then
+	path_append "${DAKOTA_ROOT}/bin"
+	ld_library_path_prepend "${DAKOTA_ROOT}/lib"
+	dyld_library_path_prepend "${DAKOTA_ROOT}/lib"
+fi
+
+NCO_ROOT="${ISSM_EXT_DIR}/nco/install/bin"
+path_prepend "${NCO_ROOT}/bin"
+
+CPPCHECK_ROOT="${ISSM_EXT_DIR}/cppcheck/install"
+path_append "${CPPCHECK_ROOT}/bin"
+
+MERCURIAL_ROOT="${ISSM_EXT_DIR}/mercurial/install"
+if [ -d "${MERCURIAL_ROOT}" ]; then
+	export PYTHONPATH="${PYTHONPATH}:${MERCURIAL_ROOT}/mercurial/pure/"
+	path_append "${MERCURIAL_ROOT}"
 fi
 
Index: /issm/trunk-jpl/externalpackages/autotools/install-linux.sh
===================================================================
--- /issm/trunk-jpl/externalpackages/autotools/install-linux.sh	(revision 27201)
+++ /issm/trunk-jpl/externalpackages/autotools/install-linux.sh	(revision 27202)
@@ -60,4 +60,5 @@
 fi
 cd ..
+
 # Install Automake
 echo " === INSTALLING AUTOMAKE ==="
Index: /issm/trunk-jpl/externalpackages/boost/install-1.7-mac.sh
===================================================================
--- /issm/trunk-jpl/externalpackages/boost/install-1.7-mac.sh	(revision 27201)
+++ /issm/trunk-jpl/externalpackages/boost/install-1.7-mac.sh	(revision 27202)
@@ -54,2 +54,10 @@
 	install_name_tool -id ${PREFIX}/lib/${name} ${name} 2>/dev/null
 done
+
+if [ "${VER}" == "1_79_0" ]; then
+	## Patch install names for certain libraries
+	#
+	# TODO: Figure out how to reconfigure source to apply these install names at compile time
+	#
+	install_name_tool -change @rpath/libboost_atomic.dylib ${PREFIX}/lib/libboost_atomic.dylib libboost_filesystem.dylib
+fi
Index: /issm/trunk-jpl/externalpackages/chaco/install.sh
===================================================================
--- /issm/trunk-jpl/externalpackages/chaco/install.sh	(revision 27201)
+++ /issm/trunk-jpl/externalpackages/chaco/install.sh	(revision 27202)
@@ -8,4 +8,8 @@
 
 PREFIX="${ISSM_DIR}/externalpackages/chaco/install" # Set to location where external package should be installed
+
+## Environment
+#
+export CFLAGS="-Wno-error=implicit-function-declaration"
 
 # Cleanup
Index: /issm/trunk-jpl/externalpackages/dakota/install-6.2-linux-static.sh
===================================================================
--- /issm/trunk-jpl/externalpackages/dakota/install-6.2-linux-static.sh	(revision 27201)
+++ /issm/trunk-jpl/externalpackages/dakota/install-6.2-linux-static.sh	(revision 27202)
@@ -53,4 +53,7 @@
 cp configs/${VER}/linux/cmake/DakotaDev.cmake ${DAK_SRC}/cmake
 
+# Disable requirement of Python 2 for TriBITS
+sed -i'' -e 's|SET(PythonInterp_FIND_VERSION|#SET(PythonInterp_FIND_VERSION|' ${DAK_SRC}/packages/teuchos/cmake/tribits/package_arch/TribitsFindPythonInterp.cmake
+
 # Configure
 cd ${DAK_BUILD}
Index: /issm/trunk-jpl/externalpackages/dakota/install-6.2-linux.sh
===================================================================
--- /issm/trunk-jpl/externalpackages/dakota/install-6.2-linux.sh	(revision 27201)
+++ /issm/trunk-jpl/externalpackages/dakota/install-6.2-linux.sh	(revision 27202)
@@ -44,4 +44,7 @@
 cp configs/${VER}/linux/cmake/DakotaDev.cmake ${DAK_SRC}/cmake
 
+# Disable requirement of Python 2 for TriBITS
+sed -i'' -e 's|SET(PythonInterp_FIND_VERSION|#SET(PythonInterp_FIND_VERSION|' ${DAK_SRC}/packages/teuchos/cmake/tribits/package_arch/TribitsFindPythonInterp.cmake
+
 # Configure
 cd ${DAK_BUILD}
Index: /issm/trunk-jpl/externalpackages/dakota/install-6.2-mac-static.sh
===================================================================
--- /issm/trunk-jpl/externalpackages/dakota/install-6.2-mac-static.sh	(revision 27201)
+++ /issm/trunk-jpl/externalpackages/dakota/install-6.2-mac-static.sh	(revision 27202)
@@ -71,4 +71,7 @@
 # cp configs/${VER}/mac/static/packages/nidr/nidr-scanner.c ${DAK_SRC}/packages/nidr
 
+# Disable requirement of Python 2 for TriBITS
+sed -i'' -e 's|SET(PythonInterp_FIND_VERSION|#SET(PythonInterp_FIND_VERSION|' ${DAK_SRC}/packages/teuchos/cmake/tribits/package_arch/TribitsFindPythonInterp.cmake
+
 # Configure
 cd ${DAK_BUILD}
Index: /issm/trunk-jpl/externalpackages/gmsh/install-4-linux-static.sh
===================================================================
--- /issm/trunk-jpl/externalpackages/gmsh/install-4-linux-static.sh	(revision 27201)
+++ /issm/trunk-jpl/externalpackages/gmsh/install-4-linux-static.sh	(revision 27202)
@@ -5,13 +5,17 @@
 # TODO:
 # - Add support for,
-#	- BLAS_LAPACK
 #	- MUMPS
-#	- PETSC
-# (see configs/4/static/CMakeLists.txt)
+#	- PETSc
+# 
+# See Also:
+# - configs/4/static/CMakeLists.txt
+# - http://gmsh.info/doc/texinfo/gmsh.html#Compiling-the-source-code
 #
 
 ## Constants
 #
-VER="4.5.6"
+VER="4.10.5"
+
+PREFIX="${ISSM_DIR}/externalpackages/gmsh/install" # Set to location where external package should be installed
 
 # Find libgfortran and libgcc so we do not have to hardcode them
@@ -23,6 +27,4 @@
 LIBGFORTRAN_ROOT=${LIBGFORTRAN%/*}
 LIBGCC=$(find ${LIBGFORTRAN_ROOT} -name libgcc* | egrep -n libgcc.a | sed "s/[0-9]*://g" | head -1)
-
-PREFIX="${ISSM_DIR}/externalpackages/gmsh/install" # Set to location where external package should be installed
 
 # Cleanup
@@ -39,7 +41,4 @@
 mv gmsh-${VER}-source/* src
 rm -rf gmsh-${VER}-source
-
-# Copy customized source and config files to 'src' directory
-cp configs/${VER}/static/CMakeLists.txt src
 
 # Configure
@@ -59,4 +58,7 @@
 	-DCMAKE_INSTALL_PREFIX="${PREFIX}" \
 	-DENABLE_BUILD_LIB=1 \
+	-DBLAS_LAPACK_LIBRARIES="-L${LAPACK_ROOT}/lib -lflapack -L${BLAS_ROOT}/lib -lfblas ${LIBGFORTRAN_ROOT}/libgfortran.a ${LIBGFORTRAN_ROOT}/libquadmath.a ${LIBGCC}" \
+	-DENABLE_BLAS_LAPACK=1 \
+	-DENABLE_EIGEN=0 \
 	-DENABLE_FLTK=0 \
 	-DENABLE_MPEG_ENCODE=0 \
@@ -64,5 +66,4 @@
 	-DENABLE_OCC=0 \
 	-DENABLE_TOUCHBAR=0 \
-	-DBLAS_LAPACK_LIBRARIES="-L${LAPACK_ROOT}/lib -lflapack -L${BLAS_ROOT}/lib -lfblas ${LIBGFORTRAN_ROOT}/libgfortran.a ${LIBGFORTRAN_ROOT}/libquadmath.a ${LIBGCC}" \
 	-DMETIS_ROOT="${METIS_ROOT}"
 
Index: /issm/trunk-jpl/externalpackages/gmsh/install-4-linux.sh
===================================================================
--- /issm/trunk-jpl/externalpackages/gmsh/install-4-linux.sh	(revision 27201)
+++ /issm/trunk-jpl/externalpackages/gmsh/install-4-linux.sh	(revision 27202)
@@ -5,13 +5,15 @@
 # TODO:
 # - Add support for,
-#	- BLAS_LAPACK
 #	- MUMPS
-#	- PETSC
-# (see configs/4/static/CMakeLists.txt)
+#	- PETSc
+# 
+# See Also:
+# - configs/4/static/CMakeLists.txt
+# - http://gmsh.info/doc/texinfo/gmsh.html#Compiling-the-source-code
 #
 
 ## Constants
 #
-VER="4.5.6"
+VER="4.10.5"
 
 PREFIX="${ISSM_DIR}/externalpackages/gmsh/install" # Set to location where external package should be installed
@@ -56,4 +58,7 @@
 	-DENABLE_BUILD_DYNAMIC=1 \
 	-DENABLE_BUILD_SHARED=1 \
+	-DBLAS_LAPACK_LIBRARIES="-L${LAPACK_ROOT}/lib -lflapack -L${BLAS_ROOT}/lib -lfblas -L${LIBGFORTRAN_ROOT} -lgfortran" \
+	-DENABLE_BLAS_LAPACK=1 \
+	-DENABLE_EIGEN=0 \
 	-DENABLE_FLTK=0 \
 	-DENABLE_MPEG_ENCODE=0 \
@@ -61,5 +66,4 @@
 	-DENABLE_OCC=0 \
 	-DENABLE_TOUCHBAR=0 \
-	-DBLAS_LAPACK_LIBRARIES="-L${LAPACK_ROOT}/lib -lflapack -L${BLAS_ROOT}/lib -lfblas -L${LIBGFORTRAN_ROOT} -lgfortran" \
 	-DMETIS_ROOT="${METIS_ROOT}"
 
Index: /issm/trunk-jpl/externalpackages/gmsh/install-4-mac-static.sh
===================================================================
--- /issm/trunk-jpl/externalpackages/gmsh/install-4-mac-static.sh	(revision 27201)
+++ /issm/trunk-jpl/externalpackages/gmsh/install-4-mac-static.sh	(revision 27202)
@@ -5,13 +5,18 @@
 # TODO:
 # - Add support for,
-#	- BLAS_LAPACK
 #	- MUMPS
-#	- PETSC
-# (see configs/4/static/CMakeLists.txt)
+#	- PETSc
+# 
+# See Also:
+# - configs/4/static/CMakeLists.txt
+# - http://gmsh.info/doc/texinfo/gmsh.html#Compiling-the-source-code
 #
 
 ## Constants
 #
-VER="4.5.6"
+VER="4.10.5"
+
+PREFIX="${ISSM_DIR}/externalpackages/gmsh/install" # Set to location where external package should be installed
+
 
 # Find libgfortran and libgcc so we do not have to hardcode them
@@ -27,6 +32,4 @@
 LIBGFORTRAN_ROOT=${LIBGFORTRAN%/*}
 LIBGCC=$(mdfind -onlyin ${LIBGFORTRAN_ROOT} -name libgcc | egrep -n libgcc.a | egrep -v i386 | sed "s/[0-9]*://g" | head -1)
-
-PREFIX="${ISSM_DIR}/externalpackages/gmsh/install" # Set to location where external package should be installed
 
 # Cleanup
@@ -63,4 +66,7 @@
 	-DCMAKE_INSTALL_PREFIX="${PREFIX}" \
 	-DENABLE_BUILD_LIB=1 \
+	-DBLAS_LAPACK_LIBRARIES="-L${LAPACK_ROOT}/lib -lflapack -L${BLAS_ROOT}/lib -lfblas ${LIBGFORTRAN_ROOT}/libgfortran.a ${LIBGFORTRAN_ROOT}/libquadmath.a ${LIBGCC}" \
+	-DENABLE_BLAS_LAPACK=1 \
+	-DENABLE_EIGEN=0 \
 	-DENABLE_FLTK=0 \
 	-DENABLE_MPEG_ENCODE=0 \
@@ -68,5 +74,4 @@
 	-DENABLE_OCC=0 \
 	-DENABLE_TOUCHBAR=0 \
-	-DBLAS_LAPACK_LIBRARIES="-L${LAPACK_ROOT}/lib -lflapack -L${BLAS_ROOT}/lib -lfblas ${LIBGFORTRAN_ROOT}/libgfortran.a ${LIBGFORTRAN_ROOT}/libquadmath.a ${LIBGCC}" \
 	-DMETIS_ROOT="${METIS_ROOT}"
 
Index: /issm/trunk-jpl/externalpackages/gmsh/install-4-mac.sh
===================================================================
--- /issm/trunk-jpl/externalpackages/gmsh/install-4-mac.sh	(revision 27201)
+++ /issm/trunk-jpl/externalpackages/gmsh/install-4-mac.sh	(revision 27202)
@@ -5,13 +5,15 @@
 # TODO:
 # - Add support for,
-#	- BLAS_LAPACK
 #	- MUMPS
-#	- PETSC
-# (see configs/4/static/CMakeLists.txt)
+#	- PETSc
+# 
+# See Also:
+# - configs/4/static/CMakeLists.txt
+# - http://gmsh.info/doc/texinfo/gmsh.html#Compiling-the-source-code
 #
 
 ## Constants
 #
-VER="4.5.6"
+VER="4.10.5"
 
 PREFIX="${ISSM_DIR}/externalpackages/gmsh/install" # Set to location where external package should be installed
@@ -59,4 +61,7 @@
 	-DENABLE_BUILD_DYNAMIC=1 \
 	-DENABLE_BUILD_SHARED=1 \
+	-DBLAS_LAPACK_LIBRARIES="-L${LAPACK_ROOT}/lib -lflapack -L${BLAS_ROOT}/lib -lfblas -L${LIBGFORTRAN_ROOT} -lgfortran" \
+	-DENABLE_BLAS_LAPACK=1 \
+	-DENABLE_EIGEN=0 \
 	-DENABLE_FLTK=0 \
 	-DENABLE_MPEG_ENCODE=0 \
@@ -64,5 +69,4 @@
 	-DENABLE_OCC=0 \
 	-DENABLE_TOUCHBAR=0 \
-	-DBLAS_LAPACK_LIBRARIES="-L${LAPACK_ROOT}/lib -lflapack -L${BLAS_ROOT}/lib -lfblas -L${LIBGFORTRAN_ROOT} -lgfortran" \
 	-DMETIS_ROOT="${METIS_ROOT}"
 
Index: /issm/trunk-jpl/externalpackages/gmt/install-6-linux-static.sh
===================================================================
--- /issm/trunk-jpl/externalpackages/gmt/install-6-linux-static.sh	(revision 27201)
+++ /issm/trunk-jpl/externalpackages/gmt/install-6-linux-static.sh	(revision 27202)
@@ -5,5 +5,5 @@
 ## Constants
 #
-VER="6.0.0"
+VER="6.4.0"
 
 # Find libgfortran and libgcc so we do not have to hardcode them
@@ -61,4 +61,6 @@
 cmake \
 	-DBLAS_LIBRARIES="${BLAS_ROOT}/lib/libfblas.a;${LIBGFORTRAN_ROOT}/libgfortran.a;${LIBGFORTRAN_ROOT}/libquadmath.a;${LIBGCC}" \
+	-DCURL_INCLUDE_DIR="${CURL_ROOT}/include" \
+	-DCURL_LIBRARY="${CURL_ROOT}/lib/libcurl.a" \
 	-DGDAL_EXTRA_LIBS="${GDAL_EXTRA_LIBS}" \
 	-DHDF5_ROOT="${HDF5_ROOT}" \
Index: /issm/trunk-jpl/externalpackages/gmt/install-6-linux.sh
===================================================================
--- /issm/trunk-jpl/externalpackages/gmt/install-6-linux.sh	(revision 27201)
+++ /issm/trunk-jpl/externalpackages/gmt/install-6-linux.sh	(revision 27202)
@@ -5,5 +5,13 @@
 ## Constants
 #
-VER="6.0.0"
+VER="6.4.0"
+
+# Find libgfortran so that we do not have to hardcode it.
+#
+# TODO:
+# - Move this to etc/environment.sh
+#
+LIBGFORTRAN=$(find /usr -name libgfortran* | egrep -n libgfortran.a | sed "s/[0-9]*://g" | head -1)
+LIBGFORTRAN_ROOT=${LIBGFORTRAN%/*}
 
 # Environment
@@ -42,6 +50,8 @@
 #
 cmake \
-	-DCURL_LIBRARY="${CURL_ROOT}/lib" \
+	-DBLAS_LIBRARIES="-L${BLAS_ROOT}/lib;-lfblas;-L${LIBGFORTRAN_ROOT};-lgfortran" \
 	-DCURL_INCLUDE_DIR="${CURL_ROOT}/include" \
+	-DCURL_LIBRARY="-L${CURL_ROOT}/lib;-lcurl" \
+	-DLAPACK_LIBRARIES="-L${LAPACK_ROOT}/lib;-lflapack;-L${LIBGFORTRAN_ROOT};-lgfortran" \
 	..
 
Index: /issm/trunk-jpl/externalpackages/gmt/install-6-mac-static.sh
===================================================================
--- /issm/trunk-jpl/externalpackages/gmt/install-6-mac-static.sh	(revision 27201)
+++ /issm/trunk-jpl/externalpackages/gmt/install-6-mac-static.sh	(revision 27202)
@@ -5,5 +5,5 @@
 ## Constants
 #
-VER="6.0.0"
+VER="6.4.0"
 
 # Find libgfortran and libgcc so we do not have to hardcode them
@@ -65,4 +65,6 @@
 cmake \
 	-DBLAS_LIBRARIES="${BLAS_ROOT}/lib/libfblas.a;${LIBGFORTRAN_ROOT}/libgfortran.a;${LIBGFORTRAN_ROOT}/libquadmath.a;${LIBGCC}" \
+	-DCURL_INCLUDE_DIR="${CURL_ROOT}/include" \
+	-DCURL_LIBRARY="${CURL_ROOT}/lib/libcurl.a" \
 	-DGDAL_EXTRA_LIBS="${GDAL_EXTRA_LIBS}" \
 	-DHDF5_ROOT="${HDF5_ROOT}" \
Index: /issm/trunk-jpl/externalpackages/gmt/install-6-mac.sh
===================================================================
--- /issm/trunk-jpl/externalpackages/gmt/install-6-mac.sh	(revision 27201)
+++ /issm/trunk-jpl/externalpackages/gmt/install-6-mac.sh	(revision 27202)
@@ -5,5 +5,16 @@
 ## Constants
 #
-VER="6.0.0"
+VER="6.4.0"
+
+# Find libgfortran so that we do not have to hardcode it.
+#
+# Should retrieve a copy of gfortran that is compiled from source before 
+# returning one that is installed via package manager.
+#
+# TODO:
+# - Move this to etc/environment.sh
+#
+LIBGFORTRAN=$(mdfind -onlyin /usr -name libgfortran | egrep -n libgfortran.a | egrep -v i386 | sed "s/[0-9]*://g" | head -1)
+LIBGFORTRAN_ROOT=${LIBGFORTRAN%/*}
 
 # Environment
@@ -42,6 +53,8 @@
 #
 cmake \
-	-DCURL_LIBRARY="${CURL_ROOT}/lib" \
+	-DBLAS_LIBRARIES="-L${BLAS_ROOT}/lib;-lfblas;-L${LIBGFORTRAN_ROOT};-lgfortran" \
 	-DCURL_INCLUDE_DIR="${CURL_ROOT}/include" \
+	-DCURL_LIBRARY="-L${CURL_ROOT}/lib;-lcurl" \
+	-DLAPACK_LIBRARIES="-L${LAPACK_ROOT}/lib;-lflapack;-L${LIBGFORTRAN_ROOT};-lgfortran" \
 	..
 
Index: /issm/trunk-jpl/externalpackages/gsl/install.sh
===================================================================
--- /issm/trunk-jpl/externalpackages/gsl/install.sh	(revision 27201)
+++ /issm/trunk-jpl/externalpackages/gsl/install.sh	(revision 27202)
@@ -3,5 +3,5 @@
 
 
-# Constants
+## Constants
 #
 VER="2.7"
Index: /issm/trunk-jpl/externalpackages/petsc/install-3.12-linux.sh
===================================================================
--- /issm/trunk-jpl/externalpackages/petsc/install-3.12-linux.sh	(revision 27201)
+++ /issm/trunk-jpl/externalpackages/petsc/install-3.12-linux.sh	(revision 27202)
@@ -18,5 +18,5 @@
 # Cleanup
 rm -rf ${PREFIX} ${PETSC_DIR}
-mkdir ${PETSC_DIR}
+mkdir -p ${PETSC_DIR}
 
 # Move source to $PETSC_DIR
Index: /issm/trunk-jpl/externalpackages/petsc/install-3.12-lonestar.sh
===================================================================
--- /issm/trunk-jpl/externalpackages/petsc/install-3.12-lonestar.sh	(revision 27201)
+++ /issm/trunk-jpl/externalpackages/petsc/install-3.12-lonestar.sh	(revision 27202)
@@ -1,8 +1,12 @@
 #!/bin/bash
 set -eu
+
 
 ## Constants
 #
 VER="3.12.3"
+
+PETSC_DIR="${ISSM_DIR}/externalpackages/petsc/src" # DO NOT CHANGE THIS
+PREFIX="${ISSM_DIR}/externalpackages/petsc/install" # Set to location where external package should be installed
 
 # Download source
@@ -13,16 +17,16 @@
 
 # Cleanup
-rm -rf install src
-mkdir install src
+rm -rf ${PREFIX} ${PETSC_DIR}
+mkdir -p ${PETSC_DIR}
 
-# Move source to 'src' directory
-mv petsc-${VER}/* src/
+# Move source to $PETSC_DIR
+mv petsc-${VER}/* ${PETSC_DIR}
 rm -rf petsc-${VER}
 
-#configure
-cd src
+# Configure
+cd ${PETSC_DIR}
 ./config/configure.py \
-	--prefix="$ISSM_DIR/externalpackages/petsc/install" \
-	--PETSC_DIR="$ISSM_DIR/externalpackages/petsc/src" \
+	--prefix="${PREFIX}" \
+	--PETSC_DIR="${PETSC_DIR}" \
 	--with-mpi-dir="/opt/cray/pe/mpt/7.7.3/gni/mpich-intel/16.0/" \
 	--with-blas-lapack-dir="$TACC_MKL_LIB" \
Index: /issm/trunk-jpl/externalpackages/petsc/install-3.12-mac.sh
===================================================================
--- /issm/trunk-jpl/externalpackages/petsc/install-3.12-mac.sh	(revision 27201)
+++ /issm/trunk-jpl/externalpackages/petsc/install-3.12-mac.sh	(revision 27202)
@@ -18,5 +18,5 @@
 # Cleanup
 rm -rf ${PREFIX} ${PETSC_DIR}
-mkdir ${PETSC_DIR}
+mkdir -p ${PETSC_DIR}
 
 # Move source to $PETSC_DIR
Index: /issm/trunk-jpl/externalpackages/petsc/install-3.12-win-msys2-gcc-msmpi.sh
===================================================================
--- /issm/trunk-jpl/externalpackages/petsc/install-3.12-win-msys2-gcc-msmpi.sh	(revision 27201)
+++ /issm/trunk-jpl/externalpackages/petsc/install-3.12-win-msys2-gcc-msmpi.sh	(revision 27202)
@@ -18,5 +18,5 @@
 # Cleanup
 rm -rf ${PREFIX} ${PETSC_DIR}
-mkdir ${PETSC_DIR}
+mkdir -p ${PETSC_DIR}
 
 # Move source to $PETSC_DIR
Index: /issm/trunk-jpl/externalpackages/petsc/install-3.13-pleiades.sh
===================================================================
--- /issm/trunk-jpl/externalpackages/petsc/install-3.13-pleiades.sh	(revision 27201)
+++ /issm/trunk-jpl/externalpackages/petsc/install-3.13-pleiades.sh	(revision 27202)
@@ -20,5 +20,5 @@
 # Cleanup
 rm -rf ${PREFIX} ${PETSC_DIR}
-mkdir ${PETSC_DIR}
+mkdir -p ${PETSC_DIR}
 
 # Move source to $PETSC_DIR
Index: /issm/trunk-jpl/externalpackages/petsc/install-3.14-discover.sh
===================================================================
--- /issm/trunk-jpl/externalpackages/petsc/install-3.14-discover.sh	(revision 27201)
+++ /issm/trunk-jpl/externalpackages/petsc/install-3.14-discover.sh	(revision 27202)
@@ -3,15 +3,13 @@
 
 
-# NOTE: There is a single difference between the Linux and macOS 
-#		configurations, which is the addition of the -static-libgfortran 
-#		option to FFLAGS on the macOS static configurations. For the sake of 
-#		consistency, we maintain separate files for each, respective Linux and 
-#		macOS configuration.
-
-# Constants
+## Constants
+#
 VER="3.14.6"
 
+PETSC_DIR="${ISSM_DIR}/externalpackages/petsc/src" # DO NOT CHANGE THIS
+PREFIX="${ISSM_DIR}/externalpackages/petsc/install" # Set to location where external package should be installed
+
 # Download source
-$ISSM_DIR/scripts/DownloadExternalPackage.sh "https://ftp.mcs.anl.gov/pub/petsc/release-snapshots/petsc-lite-${VER}.tar.gz" "petsc-${VER}.tar.gz"
+$ISSM_DIR/scripts/DownloadExternalPackage.sh "https://issm.ess.uci.edu/files/externalpackages/petsc-lite-${VER}.tar.gz" "petsc-${VER}.tar.gz"
 
 # Unpack source
@@ -19,17 +17,17 @@
 
 # Cleanup
-rm -rf install src
-mkdir install src
+rm -rf ${PREFIX} ${PETSC_DIR}
+mkdir -p ${PETSC_DIR}
 
-# Move source to 'src' directory
-mv petsc-${VER}/* src/
+# Move source to $PETSC_DIR
+mv petsc-${VER}/* ${PETSC_DIR}
 rm -rf petsc-${VER}
 
 # Configure
-cd src
+cd ${PETSC_DIR}
 ./config/configure.py \
 	COPTFLAGS="-g -O3" CXXOPTFLAGS="-g -O3" FOPTFLAGS="-g -O3" \
-	--prefix="${ISSM_DIR}/externalpackages/petsc/install" \
-	--PETSC_DIR="${ISSM_DIR}/externalpackages/petsc/src" \
+	--prefix="${PREFIX}" \
+	--PETSC_DIR="${PETSC_DIR}" \
 	--with-debugging=0 \
 	--with-valgrind=0 \
Index: /issm/trunk-jpl/externalpackages/petsc/install-3.14-greenplanet.sh
===================================================================
--- /issm/trunk-jpl/externalpackages/petsc/install-3.14-greenplanet.sh	(revision 27201)
+++ /issm/trunk-jpl/externalpackages/petsc/install-3.14-greenplanet.sh	(revision 27202)
@@ -2,24 +2,34 @@
 set -eu
 
-#WARNING: make sure you have the right mpi
 
-#Some cleanup
-rm -rf install petsc-3.14.0 src
-mkdir install src
+# WARNING: Make sure you have the right MPI
 
-#Download from ISSM server
-$ISSM_DIR/scripts/DownloadExternalPackage.sh 'https://ftp.mcs.anl.gov/pub/petsc/release-snapshots/petsc-lite-3.14.0.tar.gz' 'petsc-3.14.0.tar.gz'
+## Constants
+#
+VER="3.14.0"
 
-#Untar and move petsc to install directory
-tar -zxvf  petsc-3.14.0.tar.gz
-mv petsc-3.14.0/* src/
-rm -rf petsc-3.14.0
+PETSC_DIR="${ISSM_DIR}/externalpackages/petsc/src" # DO NOT CHANGE THIS
+PREFIX="${ISSM_DIR}/externalpackages/petsc/install" # Set to location where external package should be installed
+
+# Download source
+$ISSM_DIR/scripts/DownloadExternalPackage.sh "https://issm.ess.uci.edu/files/externalpackages/petsc-lite-${VER}.tar.gz" "petsc-${VER}.tar.gz"
+
+# Unpack source
+tar -zxvf petsc-${VER}.tar.gz
+
+# Cleanup
+rm -rf ${PREFIX} ${PETSC_DIR}
+mkdir -p ${PETSC_DIR}
+
+# Move source to $PETSC_DIR
+mv petsc-${VER}/* ${PETSC_DIR}
+rm -rf petsc-${VER}
 
 #configure
-cd src
+cd ${PETSC_DIR}
 ./config/configure.py \
 	COPTFLAGS="-g -O3" CXXOPTFLAGS="-g -O3" FOPTFLAGS="-g -O3" \
-	--prefix="$ISSM_DIR/externalpackages/petsc/install" \
-	--PETSC_DIR="$ISSM_DIR/externalpackages/petsc/src" \
+	--prefix="${PREFIX}" \
+	--PETSC_DIR="${PETSC_DIR}" \
 	--with-blas-lapack-dir="/sopt/INTEL/compilers_and_libraries_2018.3.222/linux/mkl/" \
 	--with-mpi-dir="/sopt/OpenMPI/3.1.2/intel-2018.3-slim/" \
Index: /issm/trunk-jpl/externalpackages/petsc/install-3.14-linux.sh
===================================================================
--- /issm/trunk-jpl/externalpackages/petsc/install-3.14-linux.sh	(revision 27201)
+++ /issm/trunk-jpl/externalpackages/petsc/install-3.14-linux.sh	(revision 27202)
@@ -18,5 +18,5 @@
 # Cleanup
 rm -rf ${PREFIX} ${PETSC_DIR}
-mkdir ${PETSC_DIR}
+mkdir -p ${PETSC_DIR}
 
 # Move source to $PETSC_DIR
Index: /issm/trunk-jpl/externalpackages/petsc/install-3.14-mac-nohdf5.sh
===================================================================
--- /issm/trunk-jpl/externalpackages/petsc/install-3.14-mac-nohdf5.sh	(revision 27201)
+++ /issm/trunk-jpl/externalpackages/petsc/install-3.14-mac-nohdf5.sh	(revision 27202)
@@ -18,5 +18,5 @@
 # Cleanup
 rm -rf ${PREFIX} ${PETSC_DIR}
-mkdir ${PETSC_DIR}
+mkdir -p ${PETSC_DIR}
 
 # Move source to $PETSC_DIR
Index: /issm/trunk-jpl/externalpackages/petsc/install-3.14-mac.sh
===================================================================
--- /issm/trunk-jpl/externalpackages/petsc/install-3.14-mac.sh	(revision 27201)
+++ /issm/trunk-jpl/externalpackages/petsc/install-3.14-mac.sh	(revision 27202)
@@ -18,5 +18,5 @@
 # Cleanup
 rm -rf ${PREFIX} ${PETSC_DIR}
-mkdir ${PETSC_DIR}
+mkdir -p ${PETSC_DIR}
 
 # Move source to $PETSC_DIR
Index: /issm/trunk-jpl/externalpackages/petsc/install-3.14-pleiades.sh
===================================================================
--- /issm/trunk-jpl/externalpackages/petsc/install-3.14-pleiades.sh	(revision 27201)
+++ /issm/trunk-jpl/externalpackages/petsc/install-3.14-pleiades.sh	(revision 27202)
@@ -18,5 +18,5 @@
 # Cleanup
 rm -rf ${PREFIX} ${PETSC_DIR}
-mkdir ${PETSC_DIR}
+mkdir -p ${PETSC_DIR}
 
 # Move source to $PETSC_DIR
Index: /issm/trunk-jpl/externalpackages/petsc/install-3.14-tetralith.sh
===================================================================
--- /issm/trunk-jpl/externalpackages/petsc/install-3.14-tetralith.sh	(revision 27201)
+++ /issm/trunk-jpl/externalpackages/petsc/install-3.14-tetralith.sh	(revision 27202)
@@ -3,12 +3,10 @@
 
 
-# NOTE: There is a single difference between the Linux and macOS 
-#		configurations, which is the addition of the -static-libgfortran 
-#		option to FFLAGS on the macOS static configurations. For the sake of 
-#		consistency, we maintain separate files for each, respective Linux and 
-#		macOS configuration.
+## Constants
+#
+VER="3.14.6"
 
-# Constants
-VER="3.14.6"
+PETSC_DIR="${ISSM_DIR}/externalpackages/petsc/src" # DO NOT CHANGE THIS
+PREFIX="${ISSM_DIR}/externalpackages/petsc/install" # Set to location where external package should be installed
 
 # Download source
@@ -19,17 +17,17 @@
 
 # Cleanup
-rm -rf install src
-mkdir install src
+rm -rf ${PREFIX} ${PETSC_DIR}
+mkdir -p ${PETSC_DIR}
 
-# Move source to 'src' directory
-mv petsc-${VER}/* src/
+# Move source to $PETSC_DIR
+mv petsc-${VER}/* ${PETSC_DIR}
 rm -rf petsc-${VER}
 
 # Configure
-cd src
+cd ${PETSC_DIR}
 ./config/configure.py \
 	COPTFLAGS="-g -O2" CXXOPTFLAGS="-g -O2" FOPTFLAGS="-g -O2" \
-	--prefix="${ISSM_DIR}/externalpackages/petsc/install" \
-	--PETSC_DIR="${ISSM_DIR}/externalpackages/petsc/src" \
+	--prefix="${PREFIX}" \
+	--PETSC_DIR="${PETSC_DIR}" \
 	--with-debugging=0 \
 	--with-valgrind=0 \
Index: /issm/trunk-jpl/externalpackages/petsc/install-3.14-win-msys2-mingw-msmpi.sh
===================================================================
--- /issm/trunk-jpl/externalpackages/petsc/install-3.14-win-msys2-mingw-msmpi.sh	(revision 27201)
+++ /issm/trunk-jpl/externalpackages/petsc/install-3.14-win-msys2-mingw-msmpi.sh	(revision 27202)
@@ -32,5 +32,5 @@
 # Cleanup
 rm -rf ${PREFIX} ${PETSC_DIR}
-mkdir ${PETSC_DIR}
+mkdir -p ${PETSC_DIR}
 
 # Move source to $PETSC_DIR
Index: /issm/trunk-jpl/externalpackages/petsc/install-3.15-babylon.sh
===================================================================
--- /issm/trunk-jpl/externalpackages/petsc/install-3.15-babylon.sh	(revision 27201)
+++ /issm/trunk-jpl/externalpackages/petsc/install-3.15-babylon.sh	(revision 27202)
@@ -11,5 +11,5 @@
 
 # Download source
-$ISSM_DIR/scripts/DownloadExternalPackage.sh "https://ftp.mcs.anl.gov/pub/petsc/release-snapshots/petsc-lite-${VER}.tar.gz" "petsc-${VER}.tar.gz"
+$ISSM_DIR/scripts/DownloadExternalPackage.sh "https://issm.ess.uci.edu/files/externalpackages/petsc-lite-${VER}.tar.gz" "petsc-${VER}.tar.gz"
 
 # Unpack source
@@ -18,5 +18,5 @@
 # Cleanup
 rm -rf ${PREFIX} ${PETSC_DIR}
-mkdir ${PETSC_DIR}
+mkdir -p ${PETSC_DIR}
 
 # Move source to $PETSC_DIR
Index: /issm/trunk-jpl/externalpackages/petsc/install-3.15-discovery.sh
===================================================================
--- /issm/trunk-jpl/externalpackages/petsc/install-3.15-discovery.sh	(revision 27201)
+++ /issm/trunk-jpl/externalpackages/petsc/install-3.15-discovery.sh	(revision 27202)
@@ -3,8 +3,12 @@
 
 ## Constants
+#
 VER="3.15.3"
 
+PETSC_DIR="${ISSM_DIR}/externalpackages/petsc/src" # DO NOT CHANGE THIS
+PREFIX="${ISSM_DIR}/externalpackages/petsc/install" # Set to location where external package should be installed
+
 # Download source
-$ISSM_DIR/scripts/DownloadExternalPackage.sh "https://ftp.mcs.anl.gov/pub/petsc/release-snapshots/petsc-lite-${VER}.tar.gz" "petsc-${VER}.tar.gz"
+$ISSM_DIR/scripts/DownloadExternalPackage.sh "https://issm.ess.uci.edu/files/externalpackages/petsc-lite-${VER}.tar.gz" "petsc-${VER}.tar.gz"
 
 # Unpack source
@@ -12,16 +16,17 @@
 
 # Cleanup
-rm -rf install src
-mkdir install src
+rm -rf ${PREFIX} ${PETSC_DIR}
+mkdir -p ${PETSC_DIR}
 
-# Move source to 'src' directory
-mv petsc-${VER}/* src/
+# Move source to $PETSC_DIR
+mv petsc-${VER}/* ${PETSC_DIR}
 rm -rf petsc-${VER}
 
-cd src
+# Configure
+cd ${PETSC_DIR}
 ./config/configure.py \
 	COPTFLAGS="-g -O3" CXXOPTFLAGS="-g -O3" FOPTFLAGS="-g -O3" \
-	--prefix="${ISSM_DIR}/externalpackages/petsc/install" \
-	--PETSC_DIR="${ISSM_DIR}/externalpackages/petsc/src" \
+	--prefix="${PREFIX}" \
+	--PETSC_DIR="${PETSC_DIR}" \
 	--with-make-np=20 \
 	--with-blas-lapack-dir=$MKL_ROOT \
Index: /issm/trunk-jpl/externalpackages/petsc/install-3.15-pleiades.sh
===================================================================
--- /issm/trunk-jpl/externalpackages/petsc/install-3.15-pleiades.sh	(revision 27201)
+++ /issm/trunk-jpl/externalpackages/petsc/install-3.15-pleiades.sh	(revision 27202)
@@ -14,20 +14,21 @@
 
 # Unpack source
-tar -zxvf petsc-3.15.0.tar.gz
+tar -zxvf petsc-${VER}.tar.gz
 
 # Cleanup
-rm -rf install src
-mkdir install src
+rm -rf ${PREFIX} ${PETSC_DIR}
+mkdir -p ${PETSC_DIR}
 
 # Move source to $PETSC_DIR
-mv petsc-3.15.0/* src/
-rm -rf petsc-3.15.0
-
+mv petsc-${VER}/* ${PETSC_DIR}
+rm -rf petsc-${VER}
 
 # Configure
 #
-# NOTE: Based on /nasa/petsc/3.7.5/intel_mpt/lib/petsc/conf/petscvariables; look for CONFIGURE_OPTIONS
+# NOTE:
+# - Based on /nasa/petsc/3.7.5/intel_mpt/lib/petsc/conf/petscvariables (look 
+#	for CONFIGURE_OPTIONS)
 #
-cd src
+cd ${PETSC_DIR}
 ./config/configure.py \
 	--prefix="${PREFIX}" \
Index: /issm/trunk-jpl/externalpackages/petsc/install-3.16-linux.sh
===================================================================
--- /issm/trunk-jpl/externalpackages/petsc/install-3.16-linux.sh	(revision 27201)
+++ /issm/trunk-jpl/externalpackages/petsc/install-3.16-linux.sh	(revision 27202)
@@ -3,4 +3,5 @@
 
 ## Constants
+#
 VER="3.16.0"
 
@@ -9,5 +10,5 @@
 
 # Download source
-$ISSM_DIR/scripts/DownloadExternalPackage.sh "https://ftp.mcs.anl.gov/pub/petsc/release-snapshots/petsc-lite-${VER}.tar.gz" "petsc-${VER}.tar.gz"
+$ISSM_DIR/scripts/DownloadExternalPackage.sh "https://issm.ess.uci.edu/files/externalpackages/petsc-lite-${VER}.tar.gz" "petsc-${VER}.tar.gz"
 
 # Unpack source
@@ -15,16 +16,16 @@
 
 # Cleanup
-rm -rf install src
-mkdir install src
+rm -rf ${PREFIX} ${PETSC_DIR}
+mkdir -p ${PETSC_DIR}
 
 # Move source to $PETSC_DIR
-mv petsc-${VER}/* src/
+mv petsc-${VER}/* ${PETSC_DIR}
 rm -rf petsc-${VER}
 
 # Configure
-cd src
+cd ${PETSC_DIR}
 ./config/configure.py \
-	--prefix="${ISSM_DIR}/externalpackages/petsc/install" \
-	--PETSC_DIR="${ISSM_DIR}/externalpackages/petsc/src" \
+	--prefix="${PREFIX}" \
+	--PETSC_DIR="${PETSC_DIR}" \
 	-COPTFLAGS="-g -O2" -CXXOPTFLAGS="-g -O2" -FOPTFLAGS="-g -O2" \
 	--with-debugging=0 \
Index: /issm/trunk-jpl/externalpackages/petsc/install-3.16-mac.sh
===================================================================
--- /issm/trunk-jpl/externalpackages/petsc/install-3.16-mac.sh	(revision 27202)
+++ /issm/trunk-jpl/externalpackages/petsc/install-3.16-mac.sh	(revision 27202)
@@ -0,0 +1,60 @@
+#!/bin/bash
+set -eu
+
+
+## Constants
+#
+VER="3.16.6"
+
+PETSC_DIR="${ISSM_DIR}/externalpackages/petsc/src" # DO NOT CHANGE THIS
+PREFIX="${ISSM_DIR}/externalpackages/petsc/install" # Set to location where external package should be installed
+
+# Download source
+$ISSM_DIR/scripts/DownloadExternalPackage.sh "https://issm.ess.uci.edu/files/externalpackages/petsc-lite-${VER}.tar.gz" "petsc-${VER}.tar.gz"
+
+# Unpack source
+tar -zxvf petsc-${VER}.tar.gz
+
+# Cleanup
+rm -rf ${PREFIX} ${PETSC_DIR}
+mkdir -p ${PETSC_DIR}
+
+# Move source to $PETSC_DIR
+mv petsc-${VER}/* ${PETSC_DIR}
+rm -rf petsc-${VER}
+
+# Configure
+#
+# NOTE:
+# - Added -Wno-error=implicit-function-declaration to CFLAGS for Clang >= 12. 
+#	(may need to remove it for earlier versions not using the C99 standard).
+# - Added -fallow-argument-mismatch to FFLAGS in order to clear,
+#
+#		error: The Fortran compiler gfortran will not compile files that call 
+#		the same routine with arguments of different types.
+#
+#	for gfortran 10 or later (may need to remove it for earlier versions).
+#
+cd ${PETSC_DIR}
+./config/configure.py \
+	--prefix="${PREFIX}" \
+	--PETSC_DIR="${PETSC_DIR}" \
+	--CFLAGS="-Wno-error=implicit-function-declaration" \
+	--FFLAGS="-fallow-argument-mismatch" \
+	--with-debugging=0 \
+	--with-valgrind=0 \
+	--with-x=0 \
+	--with-ssl=0 \
+	--with-pic=1 \
+	--download-fblaslapack=1 \
+	--download-mpich=1 \
+	--download-metis=1 \
+	--download-parmetis=1 \
+	--download-scalapack=1 \
+	--download-mumps=1 \
+	--download-zlib=1 \
+	--download-hdf5=1
+
+# Compile and install
+make
+make install
Index: /issm/trunk-jpl/externalpackages/petsc/install-3.16-pleiades.sh
===================================================================
--- /issm/trunk-jpl/externalpackages/petsc/install-3.16-pleiades.sh	(revision 27201)
+++ /issm/trunk-jpl/externalpackages/petsc/install-3.16-pleiades.sh	(revision 27202)
@@ -17,9 +17,9 @@
 
 # Cleanup
-rm -rf install src
-mkdir install src
+rm -rf ${PREFIX} ${PETSC_DIR}
+mkdir -p ${PETSC_DIR}
 
 # Move source to $PETSC_DIR
-mv petsc-${VER}/* src/
+mv petsc-${VER}/* ${PETSC_DIR}
 rm -rf petsc-${VER}
 
@@ -27,7 +27,9 @@
 # Configure
 #
-# NOTE: Based on /nasa/petsc/3.7.5/intel_mpt/lib/petsc/conf/petscvariables; look for CONFIGURE_OPTIONS
+# NOTE:
+# - Based on /nasa/petsc/3.7.5/intel_mpt/lib/petsc/conf/petscvariables (look 
+#	for CONFIGURE_OPTIONS)
 #
-cd src
+cd ${PETSC_DIR}
 ./config/configure.py \
 	--prefix="${PREFIX}" \
Index: /issm/trunk-jpl/externalpackages/petsc/install-3.17-mac-intel.sh
===================================================================
--- /issm/trunk-jpl/externalpackages/petsc/install-3.17-mac-intel.sh	(revision 27201)
+++ /issm/trunk-jpl/externalpackages/petsc/install-3.17-mac-intel.sh	(revision 27202)
@@ -2,9 +2,14 @@
 set -eu
 
+
 ## Constants
-VER="3.17.1"
+#
+VER="3.17.4"
+
+PETSC_DIR="${ISSM_DIR}/externalpackages/petsc/src" # DO NOT CHANGE THIS
+PREFIX="${ISSM_DIR}/externalpackages/petsc/install" # Set to location where external package should be installed
 
 # Download source
-$ISSM_DIR/scripts/DownloadExternalPackage.sh "https://ftp.mcs.anl.gov/pub/petsc/release-snapshots/petsc-lite-${VER}.tar.gz" "petsc-${VER}.tar.gz"
+$ISSM_DIR/scripts/DownloadExternalPackage.sh "https://issm.ess.uci.edu/files/externalpackages/petsc-lite-${VER}.tar.gz" "petsc-${VER}.tar.gz"
 
 # Unpack source
@@ -12,15 +17,16 @@
 
 # Cleanup
-rm -rf install src
-mkdir install src
+rm -rf ${PREFIX} ${PETSC_DIR}
+mkdir -p ${PETSC_DIR}
 
-# Move source to 'src' directory
-mv petsc-${VER}/* src/
+# Move source to $PETSC_DIR
+mv petsc-${VER}/* ${PETSC_DIR}
 rm -rf petsc-${VER}
 
-cd src
+# Configure
+cd ${PETSC_DIR}
 ./configure \
-	--prefix="${ISSM_DIR}/externalpackages/petsc/install" \
-	--PETSC_DIR="${ISSM_DIR}/externalpackages/petsc/src" \
+	--prefix="${PREFIX}" \
+	--PETSC_DIR="${PETSC_DIR}" \
 	--with-debugging=0 \
 	--with-valgrind=0 \
@@ -34,7 +40,9 @@
 	--download-scalapack=1 \
 	--download-mumps=1 \
-	--download-zlib=1 
+	--download-zlib=1 \
+	--download-hdf5=1
 
 # Compile and install
 make
 make install
+
Index: /issm/trunk-jpl/externalpackages/petsc/install-3.17-mac-m1-static.sh
===================================================================
--- /issm/trunk-jpl/externalpackages/petsc/install-3.17-mac-m1-static.sh	(revision 27201)
+++ /issm/trunk-jpl/externalpackages/petsc/install-3.17-mac-m1-static.sh	(revision 27202)
@@ -2,9 +2,14 @@
 set -eu
 
+
 ## Constants
-VER="3.17.1"
+#
+VER="3.17.4"
+
+PETSC_DIR="${ISSM_DIR}/externalpackages/petsc/src" # DO NOT CHANGE THIS
+PREFIX="${ISSM_DIR}/externalpackages/petsc/install" # Set to location where external package should be installed
 
 # Download source
-$ISSM_DIR/scripts/DownloadExternalPackage.sh "https://ftp.mcs.anl.gov/pub/petsc/release-snapshots/petsc-lite-${VER}.tar.gz" "petsc-${VER}.tar.gz"
+$ISSM_DIR/scripts/DownloadExternalPackage.sh "https://issm.ess.uci.edu/files/externalpackages/petsc-lite-${VER}.tar.gz" "petsc-${VER}.tar.gz"
 
 # Unpack source
@@ -12,9 +17,9 @@
 
 # Cleanup
-rm -rf install src
-mkdir install src
+rm -rf ${PREFIX} ${PETSC_DIR}
+mkdir -p ${PETSC_DIR}
 
-# Move source to 'src' directory
-mv petsc-${VER}/* src/
+# Move source to $PETSC_DIR
+mv petsc-${VER}/* ${PETSC_DIR}
 rm -rf petsc-${VER}
 
@@ -34,8 +39,8 @@
 #
 #	for gfortran 10 or later (may need to remove it for earlier versions).
-cd src
-./configure \
-	--prefix="${ISSM_DIR}/externalpackages/petsc/install" \
-	--PETSC_DIR="${ISSM_DIR}/externalpackages/petsc/src" \
+cd ${PETSC_DIR}
+./config/configure.py \
+	--prefix="${PREFIX}" \
+	--PETSC_DIR="${PETSC_DIR}" \
 	--LDFLAGS="-Wl,-no_compact_unwind" \
 	--with-shared-libraries=0 \
Index: /issm/trunk-jpl/externalpackages/petsc/install-3.17-mac-m1.sh
===================================================================
--- /issm/trunk-jpl/externalpackages/petsc/install-3.17-mac-m1.sh	(revision 27201)
+++ /issm/trunk-jpl/externalpackages/petsc/install-3.17-mac-m1.sh	(revision 27202)
@@ -4,8 +4,12 @@
 
 ## Constants
-VER="3.17.0"
+#
+VER="3.17.4"
+
+PETSC_DIR="${ISSM_DIR}/externalpackages/petsc/src" # DO NOT CHANGE THIS
+PREFIX="${ISSM_DIR}/externalpackages/petsc/install" # Set to location where external package should be installed
 
 # Download source
-$ISSM_DIR/scripts/DownloadExternalPackage.sh "https://ftp.mcs.anl.gov/pub/petsc/release-snapshots/petsc-lite-${VER}.tar.gz" "petsc-${VER}.tar.gz"
+$ISSM_DIR/scripts/DownloadExternalPackage.sh "https://issm.ess.uci.edu/files/externalpackages/petsc-lite-${VER}.tar.gz" "petsc-${VER}.tar.gz"
 
 # Unpack source
@@ -13,15 +17,16 @@
 
 # Cleanup
-rm -rf install src
-mkdir install src
+rm -rf ${PREFIX} ${PETSC_DIR}
+mkdir -p ${PETSC_DIR}
 
-# Move source to 'src' directory
-mv petsc-${VER}/* src/
+# Move source to $PETSC_DIR
+mv petsc-${VER}/* ${PETSC_DIR}
 rm -rf petsc-${VER}
 
-cd src
-./configure \
-	--prefix="${ISSM_DIR}/externalpackages/petsc/install" \
-	--PETSC_DIR="${ISSM_DIR}/externalpackages/petsc/src" \
+# Configure
+cd ${PETSC_DIR}
+./config/configure.py \
+	--prefix="${PREFIX}" \
+	--PETSC_DIR="${PETSC_DIR}" \
 	--LDFLAGS="-Wl,-no_compact_unwind" \
 	--with-debugging=0 \
Index: /issm/trunk-jpl/externalpackages/petsc/install-3.17-pleiades.sh
===================================================================
--- /issm/trunk-jpl/externalpackages/petsc/install-3.17-pleiades.sh	(revision 27201)
+++ /issm/trunk-jpl/externalpackages/petsc/install-3.17-pleiades.sh	(revision 27202)
@@ -2,9 +2,14 @@
 set -eu
 
+
 ## Constants
+#
 VER="3.17.4"
 
+PETSC_DIR="${ISSM_DIR}/externalpackages/petsc/src" # DO NOT CHANGE THIS
+PREFIX="${ISSM_DIR}/externalpackages/petsc/install" # Set to location where external package should be installed
+
 # Download source
-$ISSM_DIR/scripts/DownloadExternalPackage.sh "https://ftp.mcs.anl.gov/pub/petsc/release-snapshots/petsc-lite-${VER}.tar.gz" "petsc-${VER}.tar.gz"
+$ISSM_DIR/scripts/DownloadExternalPackage.sh "https://issm.ess.uci.edu/files/externalpackages/petsc-lite-${VER}.tar.gz" "petsc-${VER}.tar.gz"
 
 # Unpack source
@@ -12,16 +17,22 @@
 
 # Cleanup
-rm -rf install src
-mkdir install src
+rm -rf ${PREFIX} ${PETSC_DIR}
+mkdir -p ${PETSC_DIR}
 
-# Move source to 'src' directory
-mv petsc-${VER}/* src/
+# Move source to $PETSC_DIR
+mv petsc-${VER}/* ${PETSC_DIR}
 rm -rf petsc-${VER}
 
-#options from cat /nasa/petsc/3.14.5_toss3/lib/petsc/conf/petscvariables | grep CONF
-cd src
+# Configure
+#
+# NOTE:
+# - Options from,
+#
+# 		cat /nasa/petsc/3.14.5_toss3/lib/petsc/conf/petscvariables | grep CONF
+#
+cd ${PETSC_DIR}
 ./configure \
-	--prefix="${ISSM_DIR}/externalpackages/petsc/install" \
-	--PETSC_DIR="${ISSM_DIR}/externalpackages/petsc/src" \
+	--prefix="${PREFIX}" \
+	--PETSC_DIR="${PETSC_DIR}" \
 	--with-blas-lapack-dir="/nasa/intel/Compiler/2018.3.222/compilers_and_libraries_2018.3.222/linux/mkl" \
 	--with-scalapack-include="/nasa/intel/Compiler/2018.3.222/mkl/include" \
Index: /issm/trunk-jpl/jenkins/examples_tests.sh
===================================================================
--- /issm/trunk-jpl/jenkins/examples_tests.sh	(revision 27201)
+++ /issm/trunk-jpl/jenkins/examples_tests.sh	(revision 27202)
@@ -40,4 +40,10 @@
 for dir in ./* ; do
 	if [ -d "${dir}" ]; then
+		# # Temporary short circuit to check single example
+		# example="./AMR"
+		# if [ "${dir}" != "${example}" ]; then
+		# 	continue
+		# fi
+
 		# Some of the examples are incomplete (on purpose). As such, we will 
 		# have to populate the missing steps in order to make sure that 
@@ -45,5 +51,4 @@
 
 		cd ${dir}
-
 		if [ "${dir}" == "./AMR" ]; then
 			sed -i.bak -e '1 s|^.*$|try\n\n&|' $RUNME_FILE
Index: /issm/trunk-jpl/jenkins/jenkins.sh
===================================================================
--- /issm/trunk-jpl/jenkins/jenkins.sh	(revision 27201)
+++ /issm/trunk-jpl/jenkins/jenkins.sh	(revision 27202)
@@ -178,28 +178,40 @@
 		cd ${ISSM_DIR}/externalpackages/$PACKAGENAME
 
-		echo "======================================================";
-		echo "       Installing $PACKAGENAME                        ";
-		echo "======================================================";
-
-		./$PACKAGEINST $NUMCPUS_INSTALL &> compil.log
-		if [ $? -ne 0 ] && [ "${PACKAGENAME}" != "boost" ]; then
-			cat compil.log
+		# Do not install package if it already exists
+		#
+		# NOTE: Assumes PREFIX is defined in package installation script
+		#
+		PREFIX=$(egrep "PREFIX=" ./$PACKAGEINST | cut -d'"' -f 2 | envsubst)
+		if [ ! -d "${PREFIX}" ]; then
 			echo "======================================================";
-			echo "    ERROR: installation of $PACKAGENAME failed        ";
+			echo "       Installing $PACKAGENAME                        ";
 			echo "======================================================";
-			echo "<testcase classname=\"externalpackages\" name=\"$PACKAGENAME\">" >> $EXTERNAL_TEST_FILE
-			echo '<failure message="failure">External packages did not install right. Check it.' >> $EXTERNAL_TEST_FILE
-			cat compil.log >> $EXTERNAL_TEST_FILE
-			echo '</failure>' >> $EXTERNAL_TEST_FILE
-			echo '</testcase>' >> $EXTERNAL_TEST_FILE
-			EXTERNALPACKAGES_FAILED=1;
+
+			./$PACKAGEINST $NUMCPUS_INSTALL &> compil.log
+			if [ $? -ne 0 ] && [ "${PACKAGENAME}" != "boost" ]; then
+				cat compil.log
+				echo "======================================================";
+				echo "    ERROR: installation of $PACKAGENAME failed        ";
+				echo "======================================================";
+				echo "<testcase classname=\"externalpackages\" name=\"$PACKAGENAME\">" >> $EXTERNAL_TEST_FILE
+				echo '<failure message="failure">External packages did not install right. Check it.' >> $EXTERNAL_TEST_FILE
+				cat compil.log >> $EXTERNAL_TEST_FILE
+				echo '</failure>' >> $EXTERNAL_TEST_FILE
+				echo '</testcase>' >> $EXTERNAL_TEST_FILE
+				EXTERNALPACKAGES_FAILED=1;
+			else
+				echo "<testcase classname=\"externalpackages\" name=\"$PACKAGENAME\"/>" >> $EXTERNAL_TEST_FILE
+			fi
+			source ${ISSM_DIR}/etc/environment.sh
+
+			#If external package is rebuilt, we also need to recompile
+			ISSM_RECONFIGURE="yes"
+			ISSM_COMPILATION="yes"
 		else
+			echo "======================================================";
+			echo "       Skipping $PACKAGENAME                          ";
+			echo "======================================================";
 			echo "<testcase classname=\"externalpackages\" name=\"$PACKAGENAME\"/>" >> $EXTERNAL_TEST_FILE
 		fi
-		source ${ISSM_DIR}/etc/environment.sh
-
-		#If external package is rebuilt, we also need to recompile
-		ISSM_RECONFIGURE="yes"
-		ISSM_COMPILATION="yes"
 	else
 		echo "======================================================";
Index: /issm/trunk-jpl/jenkins/pine_island-mac-full
===================================================================
--- /issm/trunk-jpl/jenkins/pine_island-mac-full	(revision 27201)
+++ /issm/trunk-jpl/jenkins/pine_island-mac-full	(revision 27202)
@@ -44,5 +44,5 @@
 	autotools	install-mac.sh
 	cmake		install.sh
-	petsc		install-3.16-mac.sh
+	petsc		install-3.17-mac-intel.sh
 	gsl			install.sh
 	boost		install-1.7-mac.sh
Index: /issm/trunk-jpl/m4/issm_options.m4
===================================================================
--- /issm/trunk-jpl/m4/issm_options.m4	(revision 27201)
+++ /issm/trunk-jpl/m4/issm_options.m4	(revision 27202)
@@ -648,4 +648,5 @@
 		dnl TODO:
 		dnl - Should we also be checking if HAVE_BOOST before adding boost libs?
+		dnl - Clean up the following conditionals
 		dnl
 		case "${host_os}" in
@@ -672,5 +673,5 @@
 				elif test "${DAKOTA_VERSION}" == "6.1" || test "${DAKOTA_VERSION}" == "6.2"; then
 					if test "${BOOST_VERSION_MAJOR}" == "1"; then
-						DAKOTAFLAGS="-DHAVE_CONFIG_H -DHAVE_CONFIG_H -DDISABLE_DAKOTA_CONFIG_H -DBOOST_DISABLE_ASSERTS -DHAVE_UNISTD_H -DHAVE_SYSTEM -DHAVE_WORKING_FORK -DHAVE_WORKING_VFORK -DHAVE_SYS_WAIT_H -DHAVE_USLEEP -DDAKOTA_F90 -DDAKOTA_HAVE_MPI -DHAVE_PECOS -DHAVE_SURFPACK -DHAVE_ADAPTIVE_SAMPLING -DHAVE_ESM -DHAVE_QUESO -DHAVE_QUESO_GPMSA -DHAVE_CONMIN -DHAVE_DDACE -DHAVE_DREAM -DHAVE_FSUDACE -DDAKOTA_HOPS -DHAVE_NCSU -DHAVE_NL2SOL -DHAVE_NOMAD -DHAVE_OPTPP -DDAKOTA_OPTPP -DHAVE_PSUADE -DHAVE_AMPL"
+						DAKOTAFLAGS="-DHAVE_CONFIG_H -DDISABLE_DAKOTA_CONFIG_H -DBOOST_DISABLE_ASSERTS -DHAVE_UNISTD_H -DHAVE_SYSTEM -DHAVE_WORKING_FORK -DHAVE_WORKING_VFORK -DHAVE_SYS_WAIT_H -DHAVE_USLEEP -DDAKOTA_F90 -DDAKOTA_HAVE_MPI -DHAVE_PECOS -DHAVE_SURFPACK -DHAVE_ADAPTIVE_SAMPLING -DHAVE_ESM -DHAVE_QUESO -DHAVE_QUESO_GPMSA -DHAVE_CONMIN -DHAVE_DDACE -DHAVE_DREAM -DHAVE_FSUDACE -DDAKOTA_HOPS -DHAVE_NCSU -DHAVE_NL2SOL -DHAVE_NOMAD -DHAVE_OPTPP -DDAKOTA_OPTPP -DHAVE_PSUADE -DHAVE_AMPL"
 						DAKOTALIB="-L${DAKOTA_ROOT}/lib -ldakota_src -ldakota_src_fortran -lnidr -lteuchos -lpecos -lpecos_src -llhs -llhs_mods -llhs_mod -ldfftpack -lsparsegrid -lsurfpack -lsurfpack -lsurfpack_fortran -lqueso -lconmin -lddace -ldream -lfsudace -lhopspack -lncsuopt -lcport -lnomad -loptpp -lpsuade -lamplsolver"
 						DAKOTALIB+=" -L${BOOST_ROOT}/lib -lboost_filesystem -lboost_program_options -lboost_regex -lboost_serialization -lboost_system"
@@ -685,5 +686,5 @@
 							DAKOTALIB="-L${DAKOTA_ROOT}/lib -ldakota_src -ldream -lfsudace -lddace -lnomad -lpecos_src -llhs -llhs_mods -loptpp -lsurfpack -lconmin -ldakota_src_fortran -llhs_mod -lncsuopt -lsurfpack_fortran -lteuchos -lamplsolver -lcport -ldfftpack -lfsudace -lhopspack -lnidr -lpecos -lpsuade -lsparsegrid -L$BOOST_ROOT/lib -lboost_serialization -lboost_signals -lboost_regex -lboost_filesystem -lboost_system ${BLASLAPACKLIB}"
 						elif test "${BOOST_VERSION_MINOR}" == "72"; then
-							DAKOTAFLAGS="-DHAVE_CONFIG_H -DHAVE_CONFIG_H -DDISABLE_DAKOTA_CONFIG_H -DBOOST_DISABLE_ASSERTS -DHAVE_UNISTD_H -DHAVE_SYSTEM -DHAVE_WORKING_FORK -DHAVE_WORKING_VFORK -DHAVE_SYS_WAIT_H -DHAVE_USLEEP -DDAKOTA_F90 -DDAKOTA_HAVE_MPI -DHAVE_PECOS -DHAVE_SURFPACK -DHAVE_ADAPTIVE_SAMPLING -DHAVE_ESM -DHAVE_CONMIN -DHAVE_DDACE -DHAVE_DREAM -DHAVE_FSUDACE -DDAKOTA_HOPS -DHAVE_NCSU -DHAVE_NL2SOL -DHAVE_NOMAD -DHAVE_OPTPP -DDAKOTA_OPTPP -DHAVE_PSUADE -DHAVE_AMPL"
+							DAKOTAFLAGS="-DHAVE_CONFIG_H -DDISABLE_DAKOTA_CONFIG_H -DBOOST_DISABLE_ASSERTS -DHAVE_UNISTD_H -DHAVE_SYSTEM -DHAVE_WORKING_FORK -DHAVE_WORKING_VFORK -DHAVE_SYS_WAIT_H -DHAVE_USLEEP -DDAKOTA_F90 -DDAKOTA_HAVE_MPI -DHAVE_PECOS -DHAVE_SURFPACK -DHAVE_ADAPTIVE_SAMPLING -DHAVE_ESM -DHAVE_CONMIN -DHAVE_DDACE -DHAVE_DREAM -DHAVE_FSUDACE -DDAKOTA_HOPS -DHAVE_NCSU -DHAVE_NL2SOL -DHAVE_NOMAD -DHAVE_OPTPP -DDAKOTA_OPTPP -DHAVE_PSUADE -DHAVE_AMPL"
 							DAKOTALIB="-L${DAKOTA_ROOT}/lib -ldakota_src -ldakota_src_fortran -lnidr -lteuchosremainder -lteuchosnumerics -lteuchoscomm -lteuchosparameterlist -lteuchosparser -lteuchoscore -lpecos_util -lpecos_src -llhs -llhs_mods -llhs_mod -ldfftpack -lsparsegrid -lsurfpack -lsurfpack -lsurfpack_fortran -lapproxnn -lconmin -lddace -ldream -lfsudace -lhopspack -lncsuopt -lcport -lnomad -loptpp -lpsuade -lamplsolver -L${BOOST_ROOT}/lib -lboost_filesystem -lboost_program_options -lboost_regex -lboost_serialization -lboost_system ${BLASLAPACKLIB}"
 						fi
@@ -705,5 +706,5 @@
 				elif test "${DAKOTA_VERSION}" == "6.1" || test "${DAKOTA_VERSION}" == "6.2"; then
 					if test "${BOOST_VERSION_MAJOR}" == "1"; then
-						DAKOTAFLAGS="-DHAVE_CONFIG_H -DHAVE_CONFIG_H -DDISABLE_DAKOTA_CONFIG_H -DBOOST_DISABLE_ASSERTS -DHAVE_UNISTD_H -DHAVE_SYSTEM -DHAVE_WORKING_FORK -DHAVE_WORKING_VFORK -DHAVE_SYS_WAIT_H -DHAVE_USLEEP -DDAKOTA_F90 -DDAKOTA_HAVE_MPI -DHAVE_PECOS -DHAVE_SURFPACK -DHAVE_ADAPTIVE_SAMPLING -DHAVE_ESM -DHAVE_QUESO -DHAVE_QUESO_GPMSA -DHAVE_CONMIN -DHAVE_DDACE -DHAVE_DREAM -DHAVE_FSUDACE -DDAKOTA_HOPS -DHAVE_NCSU -DHAVE_NL2SOL -DHAVE_NOMAD -DHAVE_OPTPP -DDAKOTA_OPTPP -DHAVE_PSUADE -DHAVE_AMPL"
+						DAKOTAFLAGS="-DHAVE_CONFIG_H -DDISABLE_DAKOTA_CONFIG_H -DBOOST_DISABLE_ASSERTS -DHAVE_UNISTD_H -DHAVE_SYSTEM -DHAVE_WORKING_FORK -DHAVE_WORKING_VFORK -DHAVE_SYS_WAIT_H -DHAVE_USLEEP -DDAKOTA_F90 -DDAKOTA_HAVE_MPI -DHAVE_PECOS -DHAVE_SURFPACK -DHAVE_ADAPTIVE_SAMPLING -DHAVE_ESM -DHAVE_QUESO -DHAVE_QUESO_GPMSA -DHAVE_CONMIN -DHAVE_DDACE -DHAVE_DREAM -DHAVE_FSUDACE -DDAKOTA_HOPS -DHAVE_NCSU -DHAVE_NL2SOL -DHAVE_NOMAD -DHAVE_OPTPP -DDAKOTA_OPTPP -DHAVE_PSUADE -DHAVE_AMPL"
 						DAKOTALIB="-L${DAKOTA_ROOT}/lib -ldakota_src -ldakota_src_fortran -lnidr -lteuchos -lpecos -lpecos_src -llhs -llhs_mods -llhs_mod -ldfftpack -lsparsegrid -lsurfpack -lsurfpack -lsurfpack_fortran -lqueso -lconmin -lddace -ldream -lfsudace -lhopspack -lncsuopt -lcport -lnomad -loptpp -lpsuade -lamplsolver"
 						DAKOTALIB+=" -L${BOOST_ROOT}/lib -lboost_filesystem -lboost_program_options -lboost_regex -lboost_serialization -lboost_system"
Index: /issm/trunk-jpl/src/c/Makefile.am
===================================================================
--- /issm/trunk-jpl/src/c/Makefile.am	(revision 27201)
+++ /issm/trunk-jpl/src/c/Makefile.am	(revision 27202)
@@ -829,5 +829,5 @@
 
 # External packages
-LDADD += $(CHACOLIB) $(DAKOTALIB) $(PETSCLIB) $(MUMPSLIB) $(SCALAPACKLIB) $(BLASLAPACKLIB) $(PARMETISLIB) $(METISLIB) $(NEOPZLIB) $(TAOLIB) $(M1QN3LIB) $(SEMICLIB) $(PLAPACKLIB) $(MPLAPACKLIB) $(SUPERLULIB) $(SPOOLESLIB) $(BLACSLIB) $(HDF5LIB) $(HYPRELIB) $(SPAILIB) $(PROMETHEUSLIB) $(PASTIXLIB) $(MLLIB) $(SCOTCHLIB) $(MKLLIB) $(MPILIB) $(MATHLIB) $(GRAPHICSLIB) $(MULTITHREADINGLIB) $(GSLLIB) $(AMPILIB) $(ADJOINTMPILIB) $(ADOLCLIB) $(MPILIB) $(METEOIOLIB) $(SNOWPACKLIB) $(PROJLIB) $(ESMFLIB) $(OSLIBS)
+LDADD += $(SEMICLIB) $(M1QN3LIB) $(CHACOLIB) $(PETSCLIB) $(MUMPSLIB) $(SCALAPACKLIB) $(BLASLAPACKLIB) $(PARMETISLIB) $(METISLIB) $(NEOPZLIB) $(TAOLIB) $(PLAPACKLIB) $(MPLAPACKLIB) $(SUPERLULIB) $(SPOOLESLIB) $(BLACSLIB) $(HDF5LIB) $(HYPRELIB) $(SPAILIB) $(PROMETHEUSLIB) $(PASTIXLIB) $(MLLIB) $(SCOTCHLIB) $(MKLLIB) $(MATHLIB) $(GRAPHICSLIB) $(MULTITHREADINGLIB) $(GSLLIB) $(AMPILIB) $(ADJOINTMPILIB) $(ADOLCLIB) $(MPILIB) $(METEOIOLIB) $(SNOWPACKLIB) $(PROJLIB) $(ESMFLIB) $(OSLIBS)
 
 if FORTRAN
@@ -840,4 +840,5 @@
 issm_slc_SOURCES = main/issm_slc.cpp
 issm_slc_CXXFLAGS= $(CXXFLAGS) $(CXXOPTFLAGS)
+issm_slc_LDADD = $(DAKOTALIB) $(LDADD)
 
 if OCEAN
@@ -857,5 +858,5 @@
 issm_dakota_SOURCES = main/issm_dakota.cpp
 issm_dakota_CXXFLAGS= $(CXXFLAGS) $(CXXOPTFLAGS) $(COPTFLAGS)
-issm_dakota_LDADD= $(LDADD)
+issm_dakota_LDADD = $(DAKOTALIB) $(LDADD)
 bin_PROGRAMS += issm_post
 issm_post_SOURCES = main/issm_post.cpp
Index: /issm/trunk-jpl/src/m/dev/devpath.py
===================================================================
--- /issm/trunk-jpl/src/m/dev/devpath.py	(revision 27201)
+++ /issm/trunk-jpl/src/m/dev/devpath.py	(revision 27202)
@@ -37,5 +37,8 @@
         print('Warning: devpath.py: cluster settings should be in {}'.format(jpl_path))
 
-from runme import runme  #first because plotmodel may fail
+try: # Avoid circular import
+    from runme import runme  # First, because plotmodel may fail
+except:
+    pass
 from plotmodel import plotmodel
 
Index: /issm/trunk-jpl/test/NightlyRun/IdFromString.py
===================================================================
--- /issm/trunk-jpl/test/NightlyRun/IdFromString.py	(revision 27201)
+++ /issm/trunk-jpl/test/NightlyRun/IdFromString.py	(revision 27202)
@@ -2,4 +2,5 @@
 from IdToName import IdToName
 import os
+import re
 
 # use verbose = False to print output when this is called by command line
@@ -27,12 +28,11 @@
     ids = []
     idnames = []
-    for f in os.listdir('.'):
-        if f.endswith('.py') and f.startswith('test'):
-            # all tests look like: "testwxyz.py" so 5th to 3rd to last is always the full id
-            s = int(f[4:-3])
-            name = IdToName(s)
-            if (string == ' * ') or (name is not None and string in name):
-                ids.append(s)
-                idnames.append(name)
+    flist = [f for f in os.listdir('.') if re.match('test[0-9]+.py', f)] # File name must follow the format "test<integer>.py"
+    list_ids = [int(re.search(r'\d+',file.split('.')[0]).group()) for file in flist] # Retrieve test IDs
+    for i in list_ids:
+        name = IdToName(i)
+        if (string == ' * ') or (name is not None and string in name):
+            ids.append(i)
+            idnames.append(name)
 
 #Return if no test found
Index: /issm/trunk-jpl/test/NightlyRun/runme.m
===================================================================
--- /issm/trunk-jpl/test/NightlyRun/runme.m	(revision 27201)
+++ /issm/trunk-jpl/test/NightlyRun/runme.m	(revision 27202)
@@ -88,5 +88,5 @@
 % }}}
 %GET ids  {{{
-flist=dir;%use dir, as it seems to act OS independent
+flist=dir; %use dir, as it seems to act OS independent
 list_ids=[];
 for i=1:numel(flist),
@@ -101,5 +101,5 @@
 				disp(['WARNING: ignore file ' flist(i).name]);
 			else
-				list_ids(end+1)=id;%Keep test id only (strip 'test' and '.m')
+				list_ids(end+1)=id; %Keep test id only (strip 'test' and '.m')
 			end
 		end
Index: /issm/trunk-jpl/test/NightlyRun/runme.py
===================================================================
--- /issm/trunk-jpl/test/NightlyRun/runme.py	(revision 27201)
+++ /issm/trunk-jpl/test/NightlyRun/runme.py	(revision 27202)
@@ -8,7 +8,6 @@
 #
 import argparse
-from glob import glob
 import os
-from re import search, split
+import re
 from sys import float_info
 from traceback import format_exc
@@ -116,8 +115,7 @@
     # }}}
     #GET ids  {{{
-    flist = glob('test*.py')  #File name must start with 'test' and must end by '.py' and must be different than 'test.py'
-    list_ids = [int(search(r'\d+',file.split('.')[0]).group()) for file in flist if not file == 'test.py'] # Keep test id only (skip 'test' and '.py')
-
-    i1, i2 = parallelrange(rank, numprocs, len(list_ids))  #Get tests for this cpu only
+    flist = [f for f in os.listdir('.') if re.match('test[0-9]+.py', f)] # File name must follow the format "test<integer>.py"
+    list_ids = [int(re.search(r'\d+',file.split('.')[0]).group()) for file in flist] # Retrieve test IDs
+    i1, i2 = parallelrange(rank, numprocs, len(list_ids))  # Get tests for this CPU only
     list_ids = list_ids[i1:i2 + 1]
     if np.size(id) > 0 and id is not None:
@@ -172,4 +170,5 @@
     test_ids = list(test_ids)
     test_ids.sort()
+    print(test_ids)
     # }}}
 
@@ -213,5 +212,5 @@
                 for key in mdl.results.__dict__.keys():
                     if 'Solution' in key:
-                        solvetype = split('Solution', key)[0]
+                        solvetype = re.split('Solution', key)[0]
 
                 #we save the results, scrap them and solve.
@@ -224,16 +223,16 @@
                     try:
                         #first look for indexing
-                        if search(r'\d+$', fieldname):
-                            index = int(search(r'\d+$', fieldname).group()) - 1
-                            fieldname = fieldname[:search(r'\d+$', fieldname).start()]
+                        if re.search(r'\d+$', fieldname):
+                            index = int(re.search(r'\d+$', fieldname).group()) - 1
+                            fieldname = fieldname[:re.search(r'\d+$', fieldname).start()]
                         elif 'FirstStep' in fieldname:
                             index = 0
-                            fieldname = fieldname[:search('FirstStep', fieldname).start()]
+                            fieldname = fieldname[:re.search('FirstStep', fieldname).start()]
                         elif 'SecondStep' in fieldname:
                             index = 1
-                            fieldname = fieldname[:search('SecondStep', fieldname).start()]
+                            fieldname = fieldname[:re.search('SecondStep', fieldname).start()]
                         elif 'ThirdStep' in fieldname:
                             index = 2
-                            fieldname = fieldname[:search('ThirdStep', fieldname).start()]
+                            fieldname = fieldname[:re.search('ThirdStep', fieldname).start()]
                         else:
                             index = 0
@@ -270,5 +269,5 @@
                                     #probably severalmatches, we take the last one which should be the good one (Needs to be controled in the list above)
                                     sufix = sufixes[np.squeeze(np.where([suf in fieldname for suf in sufixes]))[-1]]
-                                fieldname = fieldname[:search(sufix, fieldname).start()]
+                                fieldname = fieldname[:re.search(sufix, fieldname).start()]
                             elif fieldname.endswith("P") and index == 1:
                                 #we are looking for P2 but 2 as been considered as an index and so shifted by -1
