From b1360b767102f1e0f9be330e401124373b7f25b3 Mon Sep 17 00:00:00 2001
From: Mark Olesen <Mark.Olesen@Germany>
Date: Mon, 6 Oct 2008 17:38:29 +0200
Subject: [PATCH] etc/settings.{csh,sh} - streamline

  - avoid mkdir except for a few directories
  - grouped settings and added comments
  - minor bugfix: $FOAM_INST_DIR/linux64/bin was in path (pre OpenFOAM-1.5)
  - local (non-exported) variables in lowercase
---
 ReleaseNotes-1.5      |   4 +-
 ReleaseNotes-1.5.html |   4 +-
 etc/bashrc            |  13 +++---
 etc/cshrc             |  11 +++--
 etc/settings.csh      |  84 +++++++++++++++++++----------------
 etc/settings.sh       | 101 ++++++++++++++++++++----------------------
 6 files changed, 112 insertions(+), 105 deletions(-)

diff --git a/ReleaseNotes-1.5 b/ReleaseNotes-1.5
index faa5dad6b2c..387d65d9a09 100644
--- a/ReleaseNotes-1.5
+++ b/ReleaseNotes-1.5
@@ -2,7 +2,7 @@
 #
 #+TITLE:          *OpenFOAM release notes for version 1.5*
 #+AUTHOR:                      OpenCFD Ltd.
-#+DATE:                       26 August 2008
+#+DATE:                       07 October 2008
 #+LINK:                  http://www.opencfd.co.uk
 #+OPTIONS: author:nil ^:{}
 
@@ -34,7 +34,7 @@
     and $WM_COMPILER_ARCH environment variables in the OpenFOAM-1.5/etc/bashrc
     (or cshrc) file.
   + The location of the installation of the compiler is controlled by the
-    $WM_COMPILER_INST environment variable in the OpenFOAM-1.5/etc/settings.sh
+    $compilerInstall environment variable in the OpenFOAM-1.5/etc/settings.sh
     (or settings.csh) file.
 
 * Developments to solvers (applications)
diff --git a/ReleaseNotes-1.5.html b/ReleaseNotes-1.5.html
index a1805d5e9d0..d1c62c685bd 100644
--- a/ReleaseNotes-1.5.html
+++ b/ReleaseNotes-1.5.html
@@ -49,7 +49,7 @@ quires the installation of Qt 4.3.? for ParaView-3 to run.
     $WM_COMPILER and $WM_COMPILER_ARCH environment variables in the
     OpenFOAM-1.5/etc/bashrc (or cshrc) file.
   * The location of the installation of the compiler is controlled by the
-    $WM_COMPILER_INST environment variable in the OpenFOAM-1.5/etc/settings.sh
+    $compilerInstall environment variable in the OpenFOAM-1.5/etc/settings.sh
     (or settings.csh) file.
 
 4 Developments to solvers (applications)
@@ -202,7 +202,7 @@ To aid common monitoring and post-processing activities.
   * Non-blocking, non-buffered, parallel transfers with potential scaling
     benefits for larger number of processors.
 
-Date: 26 August 2008
+Date: 07 October 2008
 
 HTML generated by org-mode 6.06b in emacs 23
 
diff --git a/etc/bashrc b/etc/bashrc
index aff71726e00..b862b6a9331 100644
--- a/etc/bashrc
+++ b/etc/bashrc
@@ -23,16 +23,17 @@
 #     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 #
 # Script
-#     bashrc
+#     etc/bashrc
 #
 # Description
 #     Startup file for OpenFOAM
 #     Sourced from ~/.profile or ~/.bashrc
+#     Should be usable by any POSIX-compliant shell (eg, ksh)
 #
 #------------------------------------------------------------------------------
 
 export WM_PROJECT=OpenFOAM
-#export WM_PROJECT_VERSION=1.5
+#export WM_PROJECT_VERSION=1.5.x
 : ${WM_PROJECT_VERSION:=dev}; export WM_PROJECT_VERSION
 
 
@@ -53,7 +54,7 @@ foamInstall=$HOME/$WM_PROJECT
 # Location of site/user files
 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~
 export WM_PROJECT_INST_DIR=$FOAM_INST_DIR
-export WM_PROJECT_DIR=$FOAM_INST_DIR/$WM_PROJECT-$WM_PROJECT_VERSION
+export WM_PROJECT_DIR=$WM_PROJECT_INST_DIR/$WM_PROJECT-$WM_PROJECT_VERSION
 export WM_PROJECT_USER_DIR=$HOME/$WM_PROJECT/$USER-$WM_PROJECT_VERSION
 
 
@@ -163,7 +164,7 @@ esac
 cleanProg=$WM_PROJECT_DIR/bin/foamCleanPath
 
 # Remove anything under top-level foam directory
-wildCards="$FOAM_INST_DIR $HOME/$WM_PROJECT/$USER"
+wildCards="$WM_PROJECT_INST_DIR $HOME/$WM_PROJECT/$USER"
 
 #- Clean path/PATH
 cleanPath=`$cleanProg "$PATH" "$wildCards"` && PATH="$cleanPath"
@@ -182,9 +183,7 @@ _foamSource()
 {
    while [ $# -ge 1 ]
    do
-      if [ "$FOAM_VERBOSE" -a "$PS1" ]; then
-         echo "Sourcing: $1"
-      fi
+      [ "$FOAM_VERBOSE" -a "$PS1" ] && echo "Sourcing: $1"
       . $1
       shift
    done
diff --git a/etc/cshrc b/etc/cshrc
index ace795241c2..b39618f7401 100644
--- a/etc/cshrc
+++ b/etc/cshrc
@@ -23,7 +23,7 @@
 #     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 #
 # Script
-#     cshrc
+#     etc/cshrc
 #
 # Description
 #     Startup file for OpenFOAM
@@ -32,7 +32,7 @@
 #------------------------------------------------------------------------------
 
 setenv WM_PROJECT OpenFOAM
-#setenv WM_PROJECT_VERSION 1.5
+#setenv WM_PROJECT_VERSION 1.5.x
 if ( ! $?WM_PROJECT_VERSION ) setenv WM_PROJECT_VERSION dev
 
 #!!User:
@@ -52,7 +52,7 @@ if ( ! $?FOAM_INST_DIR ) setenv FOAM_INST_DIR $foamInstall
 # Location of site/user files
 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~
 setenv WM_PROJECT_INST_DIR $FOAM_INST_DIR
-setenv WM_PROJECT_DIR $FOAM_INST_DIR/$WM_PROJECT-$WM_PROJECT_VERSION
+setenv WM_PROJECT_DIR $WM_PROJECT_INST_DIR/$WM_PROJECT-$WM_PROJECT_VERSION
 setenv WM_PROJECT_USER_DIR $HOME/$WM_PROJECT/$LOGNAME-$WM_PROJECT_VERSION
 
 
@@ -167,7 +167,7 @@ if (! $?MANPATH) then
 endif
 
 # Remove anything under top-level foam directory
-set wildCards="$FOAM_INST_DIR $HOME/$WM_PROJECT/$LOGNAME"
+set wildCards="$WM_PROJECT_INST_DIR $HOME/$WM_PROJECT/$LOGNAME"
 
 #- Clean path/PATH
 set colonPath=`echo "$path" | sed -e 's/ /:/g'`
@@ -219,5 +219,8 @@ endif
 
 # cleanup environment:
 # ~~~~~~~~~~~~~~~~~~~~
+unset cleanProg
+unset wildCards
+unset colonPath
 unalias _foamSource
 # -----------------------------------------------------------------------------
diff --git a/etc/settings.csh b/etc/settings.csh
index 2c9c7699c19..dc312646e08 100644
--- a/etc/settings.csh
+++ b/etc/settings.csh
@@ -23,7 +23,7 @@
 #     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 #
 # Script
-#     settings.csh
+#     etc/settings.csh
 #
 # Description
 #     Startup file for OpenFOAM
@@ -31,54 +31,64 @@
 #
 #------------------------------------------------------------------------------
 
-alias _foamAddPath 'set path=(\!* $path) ; if ( ! -d \!* ) mkdir -p \!*'
-alias _foamAddLib 'setenv LD_LIBRARY_PATH \!*\:${LD_LIBRARY_PATH} ; set xx=`echo $LD_LIBRARY_PATH | sed -e "s/:.*//"`; if ( ! -d  $xx ) mkdir -p $xx'
+# prefix to PATH
+alias _foamAddPath 'set path=(\!* $path)'
+# prefix to LD_LIBRARY_PATH
+alias _foamAddLib 'setenv LD_LIBRARY_PATH \!*\:${LD_LIBRARY_PATH}'
+# make directory if it doesn't already exist
+alias _foamMkDir 'if ( ! -d \!* ) mkdir -p \!*'
 
+# location of the jobControl directory
+setenv FOAM_JOB_DIR $WM_PROJECT_INST_DIR/jobControl
 
-#- Add the system-specific executables path to the path
-set path=($WM_PROJECT_DIR/bin $FOAM_INST_DIR/$WM_ARCH/bin $path)
-
-#- Location of the jobControl directory
-setenv FOAM_JOB_DIR $FOAM_INST_DIR/jobControl
-
+# wmake configuration
 setenv WM_DIR $WM_PROJECT_DIR/wmake
 setenv WM_LINK_LANGUAGE c++
 setenv WM_OPTIONS $WM_ARCH$WM_COMPILER$WM_PRECISION_OPTION$WM_COMPILE_OPTION
-set path=($WM_DIR $path)
 
+# base configuration
 setenv FOAM_SRC $WM_PROJECT_DIR/src
 setenv FOAM_LIB $WM_PROJECT_DIR/lib
-setenv FOAM_LIBBIN $FOAM_LIB/$WM_OPTIONS
-_foamAddLib $FOAM_LIBBIN
-
+setenv FOAM_LIBBIN $WM_PROJECT_DIR/lib/$WM_OPTIONS
 setenv FOAM_APP $WM_PROJECT_DIR/applications
 setenv FOAM_APPBIN $WM_PROJECT_DIR/applications/bin/$WM_OPTIONS
-_foamAddPath $FOAM_APPBIN
 
+# user configuration
+setenv FOAM_USER_LIBBIN $WM_PROJECT_USER_DIR/lib/$WM_OPTIONS
+setenv FOAM_USER_APPBIN $WM_PROJECT_USER_DIR/applications/bin/$WM_OPTIONS
+
+# convenience
 setenv FOAM_TUTORIALS $WM_PROJECT_DIR/tutorials
 setenv FOAM_UTILITIES $FOAM_APP/utilities
 setenv FOAM_SOLVERS $FOAM_APP/solvers
+setenv FOAM_RUN $WM_PROJECT_USER_DIR/run
 
-setenv FOAM_USER_LIBBIN $WM_PROJECT_USER_DIR/lib/$WM_OPTIONS
-_foamAddLib $FOAM_USER_LIBBIN
+# add OpenFOAM scripts and wmake to the path
+set path=($WM_DIR $WM_PROJECT_DIR/bin $path)
 
-setenv FOAM_USER_APPBIN $WM_PROJECT_USER_DIR/applications/bin/$WM_OPTIONS
+_foamAddPath $FOAM_APPBIN
 _foamAddPath $FOAM_USER_APPBIN
+_foamAddLib  $FOAM_LIBBIN
+_foamAddLib  $FOAM_USER_LIBBIN
 
-setenv FOAM_RUN $WM_PROJECT_USER_DIR/run
+# create these directories if necessary:
+_foamMkDir $FOAM_LIBBIN
+_foamMkDir $FOAM_APPBIN
+_foamMkDir $FOAM_USER_LIBBIN
+_foamMkDir $FOAM_USER_APPBIN
 
 
 # Compiler settings
 # ~~~~~~~~~~~~~~~~~
-set WM_COMPILER_BIN=
-set WM_COMPILER_LIB=
+set compilerBin=
+set compilerLib=
 
 # Select compiler installation
 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-# WM_COMPILER_INST = OpenFOAM | System
-set WM_COMPILER_INST=OpenFOAM
+# compilerInstall = OpenFOAM | System
+set compilerInstall=OpenFOAM
 
-switch ("$WM_COMPILER_INST")
+switch ("$compilerInstall")
 case OpenFOAM:
     switch ("$WM_COMPILER")
     case Gcc:
@@ -97,22 +107,22 @@ case OpenFOAM:
         echo "Warning in $WM_PROJECT_DIR/etc/settings.csh:"
         echo "    Cannot find $WM_COMPILER_DIR installation."
         echo "    Please install this compiler version or if you wish to use the system compiler,"
-        echo "    change the WM_COMPILER_INST setting to 'System' in this file"
+        echo "    change the 'compilerInstall' setting to 'System' in this file"
         echo
     endif
 
-    set WM_COMPILER_BIN="$WM_COMPILER_DIR/bin"
-    set WM_COMPILER_LIB=$WM_COMPILER_DIR/lib${WM_COMPILER_LIB_ARCH}:$WM_COMPILER_DIR/lib
+    set compilerBin=$WM_COMPILER_DIR/bin
+    set compilerLib=$WM_COMPILER_DIR/lib$WM_COMPILER_LIB_ARCH:$WM_COMPILER_DIR/lib
     breaksw
 endsw
 
-if ($?WM_COMPILER_BIN) then
-    _foamAddPath $WM_COMPILER_BIN
-    _foamAddLib $WM_COMPILER_LIB
+if ($?compilerBin) then
+    _foamAddPath $compilerBin
+    _foamAddLib  $compilerLib
 endif
 
-unset WM_COMPILER_BIN
-unset WM_COMPILER_LIB
+unset compilerBin
+unset compilerLib
 
 
 # Communications library
@@ -129,8 +139,8 @@ case OPENMPI:
     # Tell OpenMPI where to find its install directory
     setenv OPAL_PREFIX $MPI_ARCH_PATH
 
-    _foamAddLib  $MPI_ARCH_PATH/lib
     _foamAddPath $MPI_ARCH_PATH/bin
+    _foamAddLib  $MPI_ARCH_PATH/lib
 
     setenv FOAM_MPI_LIBBIN $FOAM_LIBBIN/$mpi_version
     unset mpi_version
@@ -143,8 +153,8 @@ case LAM:
     setenv LAMHOME $WM_THIRD_PARTY_DIR/$mpi_version
     # note: LAMHOME is deprecated, should probably point to MPI_ARCH_PATH too
 
-    _foamAddLib  $MPI_ARCH_PATH/lib
     _foamAddPath $MPI_ARCH_PATH/bin
+    _foamAddLib  $MPI_ARCH_PATH/lib
 
     setenv FOAM_MPI_LIBBIN $FOAM_LIBBIN/$mpi_version
     unset mpi_version
@@ -156,8 +166,8 @@ case MPICH:
     setenv MPI_ARCH_PATH $MPI_HOME/platforms/$WM_OPTIONS
     setenv MPICH_ROOT $MPI_ARCH_PATH
 
-    _foamAddLib  $MPI_ARCH_PATH/lib
     _foamAddPath $MPI_ARCH_PATH/bin
+    _foamAddLib  $MPI_ARCH_PATH/lib
 
     setenv FOAM_MPI_LIBBIN $FOAM_LIBBIN/$mpi_version
     unset mpi_version
@@ -169,9 +179,9 @@ case MPICH-GM:
     setenv MPICH_ROOT $MPI_ARCH_PATH
     setenv GM_LIB_PATH /opt/gm/lib64
 
+    _foamAddPath $MPI_ARCH_PATH/bin
     _foamAddLib  $MPI_ARCH_PATH/lib
     _foamAddLib  $GM_LIB_PATH
-    _foamAddPath $MPI_ARCH_PATH/bin
 
     setenv FOAM_MPI_LIBBIN $FOAM_LIBBIN/mpich-gm
     breaksw
@@ -215,8 +225,8 @@ endif
 
 # cleanup environment:
 # ~~~~~~~~~~~~~~~~~~~~
-unalias _foamAddLib
 unalias _foamAddPath
-
+unalias _foamAddLib
+unalias _foamMkDir
 
 # -----------------------------------------------------------------------------
diff --git a/etc/settings.sh b/etc/settings.sh
index 51b540dc84d..133137d3a4f 100644
--- a/etc/settings.sh
+++ b/etc/settings.sh
@@ -23,7 +23,7 @@
 #     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 #
 # Script
-#     settings.sh
+#     etc/settings.sh
 #
 # Description
 #     Startup file for OpenFOAM
@@ -31,89 +31,83 @@
 #
 #------------------------------------------------------------------------------
 
+# prefix to PATH
 _foamAddPath()
 {
-   if [ $# -eq 1 ]
-   then
-      oldIFS="$IFS"
-      IFS=':'    # split on ':'
-      set -- $1
-      IFS="$oldIFS"
-      unset oldIFS
-   fi
-
    while [ $# -ge 1 ]
    do
-      [ -d $1 ] || mkdir -p $1
       export PATH=$1:$PATH
       shift
    done
 }
 
+# prefix to LD_LIBRARY_PATH
 _foamAddLib()
 {
-   if [ $# -eq 1 ]
-   then
-      oldIFS="$IFS"
-      IFS=':'    # split on ':'
-      set -- $1
-      IFS="$oldIFS"
-      unset oldIFS
-   fi
-
    while [ $# -ge 1 ]
    do
-      [ -d $1 ] || mkdir -p $1
       export LD_LIBRARY_PATH=$1:$LD_LIBRARY_PATH
       shift
    done
 }
 
 
-#- Add the system-specific executables path to the path
-export PATH=$WM_PROJECT_DIR/bin:$FOAM_INST_DIR/$WM_ARCH/bin:$PATH
+# make directories if they don't already exist
+_foamMkDir()
+{
+   while [ $# -ge 1 ]
+   do
+      [ -d $1 ] || mkdir -p $1
+      shift
+   done
+}
+
 
-#- Location of the jobControl directory
-export FOAM_JOB_DIR=$FOAM_INST_DIR/jobControl
+# location of the jobControl directory
+export FOAM_JOB_DIR=$WM_PROJECT_INST_DIR/jobControl
 
+# wmake configuration
 export WM_DIR=$WM_PROJECT_DIR/wmake
 export WM_LINK_LANGUAGE=c++
-export WM_OPTIONS=$WM_ARCH${WM_COMPILER}$WM_PRECISION_OPTION$WM_COMPILE_OPTION
-export PATH=$WM_DIR:$PATH
+export WM_OPTIONS=$WM_ARCH$WM_COMPILER$WM_PRECISION_OPTION$WM_COMPILE_OPTION
 
+# base configuration
 export FOAM_SRC=$WM_PROJECT_DIR/src
 export FOAM_LIB=$WM_PROJECT_DIR/lib
-export FOAM_LIBBIN=$FOAM_LIB/$WM_OPTIONS
-_foamAddLib $FOAM_LIBBIN
-
+export FOAM_LIBBIN=$WM_PROJECT_DIR/lib/$WM_OPTIONS
 export FOAM_APP=$WM_PROJECT_DIR/applications
 export FOAM_APPBIN=$WM_PROJECT_DIR/applications/bin/$WM_OPTIONS
-_foamAddPath $FOAM_APPBIN
 
+# user configuration
+export FOAM_USER_LIBBIN=$WM_PROJECT_USER_DIR/lib/$WM_OPTIONS
+export FOAM_USER_APPBIN=$WM_PROJECT_USER_DIR/applications/bin/$WM_OPTIONS
+
+# convenience
 export FOAM_TUTORIALS=$WM_PROJECT_DIR/tutorials
 export FOAM_UTILITIES=$FOAM_APP/utilities
 export FOAM_SOLVERS=$FOAM_APP/solvers
+export FOAM_RUN=$WM_PROJECT_USER_DIR/run
 
-export FOAM_USER_LIBBIN=$WM_PROJECT_USER_DIR/lib/$WM_OPTIONS
-_foamAddLib $FOAM_USER_LIBBIN
+# add OpenFOAM scripts and wmake to the path
+export PATH=$WM_DIR:$WM_PROJECT_DIR/bin:$PATH
 
-export FOAM_USER_APPBIN=$WM_PROJECT_USER_DIR/applications/bin/$WM_OPTIONS
-_foamAddPath $FOAM_USER_APPBIN
+_foamAddPath $FOAM_APPBIN $FOAM_USER_APPBIN
+_foamAddLib  $FOAM_LIBBIN $FOAM_USER_LIBBIN
 
-export FOAM_RUN=$WM_PROJECT_USER_DIR/run
+# create these directories if necessary:
+_foamMkDir $FOAM_LIBBIN $FOAM_USER_LIBBIN $FOAM_APPBIN $FOAM_USER_APPBIN
 
 
 # Compiler settings
 # ~~~~~~~~~~~~~~~~~
-WM_COMPILER_BIN=
-WM_COMPILER_LIB=
+unset compilerBin compilerLib
 
 # Select compiler installation
 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-# WM_COMPILER_INST = OpenFOAM | System
-WM_COMPILER_INST=OpenFOAM
+# compilerInstall = OpenFOAM | System
+compilerInstall=OpenFOAM
 
-case "$WM_COMPILER_INST" in
+case "$compilerInstall" in
 OpenFOAM)
     case "$WM_COMPILER" in
     Gcc)
@@ -133,21 +127,22 @@ OpenFOAM)
         echo "Warning in $WM_PROJECT_DIR/etc/settings.sh:"
         echo "    Cannot find $WM_COMPILER_DIR installation."
         echo "    Please install this compiler version or if you wish to use the system compiler,"
-        echo "    change the WM_COMPILER_INST setting to 'System' in this file"
+        echo "    change the 'compilerInstall' setting to 'System' in this file"
         echo
     fi
 
-    WM_COMPILER_BIN=$WM_COMPILER_DIR/bin
-    WM_COMPILER_LIB=$WM_COMPILER_DIR/lib$WM_COMPILER_LIB_ARCH:$WM_COMPILER_DIR/lib
+    compilerBin=$WM_COMPILER_DIR/bin
+    compilerLib=$WM_COMPILER_DIR/lib$WM_COMPILER_LIB_ARCH:$WM_COMPILER_DIR/lib
     ;;
 esac
 
-if [ -d "$WM_COMPILER_BIN" ]; then
-    _foamAddPath $WM_COMPILER_BIN
-    _foamAddLib  $WM_COMPILER_LIB
+if [ -d "$compilerBin" ]
+then
+    _foamAddPath $compilerBin
+    _foamAddLib  $compilerLib
 fi
 
-unset WM_COMPILER_BIN WM_COMPILER_LIB
+unset compilerBin compilerLib compilerInstall
 
 # Communications library
 # ~~~~~~~~~~~~~~~~~~~~~~
@@ -163,8 +158,8 @@ OPENMPI)
     # Tell OpenMPI where to find its install directory
     export OPAL_PREFIX=$MPI_ARCH_PATH
 
-    _foamAddLib  $MPI_ARCH_PATH/lib
     _foamAddPath $MPI_ARCH_PATH/bin
+    _foamAddLib  $MPI_ARCH_PATH/lib
 
     export FOAM_MPI_LIBBIN=$FOAM_LIBBIN/$mpi_version
     unset mpi_version
@@ -177,8 +172,8 @@ LAM)
     export LAMHOME=$WM_THIRD_PARTY_DIR/$mpi_version
     # note: LAMHOME is deprecated, should probably point to MPI_ARCH_PATH too
 
-    _foamAddLib  $MPI_ARCH_PATH/lib
     _foamAddPath $MPI_ARCH_PATH/bin
+    _foamAddLib  $MPI_ARCH_PATH/lib
 
     export FOAM_MPI_LIBBIN=$FOAM_LIBBIN/$mpi_version
     unset mpi_version
@@ -190,8 +185,8 @@ MPICH)
     export MPI_ARCH_PATH=$MPI_HOME/platforms/$WM_OPTIONS
     export MPICH_ROOT=$MPI_ARCH_PATH
 
-    _foamAddLib  $MPI_ARCH_PATH/lib
     _foamAddPath $MPI_ARCH_PATH/bin
+    _foamAddLib  $MPI_ARCH_PATH/lib
 
     export FOAM_MPI_LIBBIN=$FOAM_LIBBIN/$mpi_version
     unset mpi_version
@@ -203,9 +198,9 @@ MPICH-GM)
     export MPICH_ROOT=$MPI_ARCH_PATH
     export GM_LIB_PATH=/opt/gm/lib64
 
+    _foamAddPath $MPI_ARCH_PATH/bin
     _foamAddLib  $MPI_ARCH_PATH/lib
     _foamAddLib  $GM_LIB_PATH
-    _foamAddPath $MPI_ARCH_PATH/bin
 
     export FOAM_MPI_LIBBIN=$FOAM_LIBBIN/mpich-gm
     ;;
@@ -247,6 +242,6 @@ export MPI_BUFFER_SIZE=20000000
 
 # cleanup environment:
 # ~~~~~~~~~~~~~~~~~~~~
-unset _foamAddLib _foamAddPath
+unset _foamAddPath _foamAddLib _foamMkDir
 
 # -----------------------------------------------------------------------------
-- 
GitLab