From 50ad197bdbd769f7f8adfeaf5dd57d22d2ab59d6 Mon Sep 17 00:00:00 2001
From: Panagiotis Velissariou <panagiotis.velissariou@noaa.gov>
Date: Wed, 13 Sep 2023 11:31:38 -0500
Subject: [PATCH 1/3] NEMS: modified the SCHISM component make module to allow
 using user defined flags from the environment and to build the model's
 utilities

---
 NEMS | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/NEMS b/NEMS
index 62b0bfd2..11482fcc 160000
--- a/NEMS
+++ b/NEMS
@@ -1 +1 @@
-Subproject commit 62b0bfd2ef888f0405d930c104473ae4fa9f73b2
+Subproject commit 11482fcc2c17f74fd33e80534a36f95d94a3c2b8

From 65b8ca621511ec34d19dc78d4fc4d645a40da0ad Mon Sep 17 00:00:00 2001
From: Panagiotis Velissariou <panagiotis.velissariou@noaa.gov>
Date: Wed, 13 Sep 2023 12:06:52 -0500
Subject: [PATCH 2/3] added USE_PAHM/NO_PARMETIS functionality in the build
 scripts for the SCHISM component

---
 scripts/functions_build     | 54 ++++++++++++++++++++++++++++++-------
 scripts/functions_utilities |  6 ++---
 2 files changed, 47 insertions(+), 13 deletions(-)

diff --git a/scripts/functions_build b/scripts/functions_build
index 6129dd67..83dc7802 100644
--- a/scripts/functions_build
+++ b/scripts/functions_build
@@ -740,16 +740,35 @@ UsageBuild()
   # by using the --thirdparty="parmetis" option. We issue a warning here to let the user
   # know that he/she might need to specify this library.
   if [[ ":${chk_component}:" == *:"SCHISM":* ]]; then
-    if ! $( checkSUBSTR "${tmp_thirdparty}" PARMETIS ) && \
-       [ -z "${PARMETIS_HOME}" ] && [ -z "${PARMETISHOME}" ]; then
-      procWarn "The PARMETIS library might be needed for the compilation of SCHISM." \
-               "Please supply the PARMETIS_HOME or PARMETISHOME environment" \
-               "variable that points to the location of the pre-compiled library or use the" \
-               "--thirdparty="parmetis" option in the build.sh script to compile the" \
-               "library from within CoastalApp (NOTE: need to download first the library" \
-               "by running the download_parmetis.sh script found in the scripts directory." \
-               "Finally, if the library is not provided, then SCHISM can use its internal" \
-               "version of ParMETIS or the NO_PARMETIS option (OFF by default)."
+    # This block might need to be moved elsewhere in th build system
+    if [ -n "${USE_PAHM}" ]; then
+      USE_PAHM="$( getYesNo "${USE_PAHM}" )"
+      if [ -z "${USE_PAHM}" -o "${USE_PAHM}" == "no" ]; then
+        export USE_PAHM=
+      else
+       export USE_PAHM=ON 
+    fi
+
+    if [ -n "${NO_PARMETIS}" ]; then
+      NO_PARMETIS="$( getYesNo "${NO_PARMETIS}" )"
+      if [ -z "${NO_PARMETIS}" -o "${NO_PARMETIS}" == "no" ]; then
+        export NO_PARMETIS=
+      else
+       export NO_PARMETIS=ON 
+    fi
+
+    if [ -z "${NO_PARMETIS}" ]; then
+      if ! $( checkSUBSTR "${tmp_thirdparty}" PARMETIS ) && \
+         [ -z "${PARMETIS_HOME}" ] && [ -z "${PARMETISHOME}" ]; then
+        procWarn "The PARMETIS library might be needed for the compilation of SCHISM." \
+                 "Please supply the PARMETIS_HOME or PARMETISHOME environment" \
+                 "variable that points to the location of the pre-compiled library or use the" \
+                 "--thirdparty="parmetis" option in the build.sh script to compile the" \
+                 "library from within CoastalApp (NOTE: need to download first the library" \
+                 "by running the download_parmetis.sh script found in the scripts directory." \
+                 "Finally, if the library is not provided, then SCHISM can use its internal" \
+                 "version of ParMETIS or the NO_PARMETIS option (OFF by default)."
+      fi
     fi
   fi
 
@@ -1883,6 +1902,21 @@ installNems() {
       done
     fi
     ######
+
+    ###### Extra SCHISM files
+    if [ "${icmp}" == "SCHISM" ]; then
+      echo
+      echo "   --- Installing from: ${icmp} to ${instdir} ---"
+      for iprog in ${APP_DIR}/SCHISM/build/bin/*
+      do
+        prog="${iprog}"
+
+        if [ -n "${prog:+1}" ]; then
+          ${CPBIN} ${prog} ${instdir}/
+        fi
+      done
+    fi
+    ######
   done
 
   ###### Install the NEMS/exe/NEMS* files
diff --git a/scripts/functions_utilities b/scripts/functions_utilities
index c4a01cbe..ad48ad16 100644
--- a/scripts/functions_utilities
+++ b/scripts/functions_utilities
@@ -817,9 +817,9 @@ getYesNo()
   fi
 
   case "${param}" in
-    1|y|yes|yea|yeah|yep) answer="yes" ;;
-     0|n|no|not|nop|nope) answer="no"  ;;
-                       *) answer=""    ;; # DEFAULT
+    1|y|yes|yea|yeah|yep|on)  answer="yes" ;;
+     0|n|no|not|nop|nope|off) answer="no"  ;;
+                       *)     answer=""    ;; # DEFAULT
   esac
 
   echo -n "${answer}"

From 8046a56028a860953d27463a29cd934ebba18e3f Mon Sep 17 00:00:00 2001
From: Panagiotis Velissariou <panagiotis.velissariou@noaa.gov>
Date: Wed, 13 Sep 2023 13:36:20 -0500
Subject: [PATCH 3/3] fixed incomplete if blocks for SCHISM component in the
 scripts/functions_build file

---
 scripts/functions_build | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/scripts/functions_build b/scripts/functions_build
index 83dc7802..d3a5a2b3 100644
--- a/scripts/functions_build
+++ b/scripts/functions_build
@@ -740,13 +740,16 @@ UsageBuild()
   # by using the --thirdparty="parmetis" option. We issue a warning here to let the user
   # know that he/she might need to specify this library.
   if [[ ":${chk_component}:" == *:"SCHISM":* ]]; then
+
+    #################### BEG :: TO BE MOVED? ####################
     # This block might need to be moved elsewhere in th build system
     if [ -n "${USE_PAHM}" ]; then
       USE_PAHM="$( getYesNo "${USE_PAHM}" )"
       if [ -z "${USE_PAHM}" -o "${USE_PAHM}" == "no" ]; then
         export USE_PAHM=
       else
-       export USE_PAHM=ON 
+        export USE_PAHM=ON 
+      fi
     fi
 
     if [ -n "${NO_PARMETIS}" ]; then
@@ -754,8 +757,10 @@ UsageBuild()
       if [ -z "${NO_PARMETIS}" -o "${NO_PARMETIS}" == "no" ]; then
         export NO_PARMETIS=
       else
-       export NO_PARMETIS=ON 
+        export NO_PARMETIS=ON 
+      fi
     fi
+    #################### END:: TO BE MOVED? ####################
 
     if [ -z "${NO_PARMETIS}" ]; then
       if ! $( checkSUBSTR "${tmp_thirdparty}" PARMETIS ) && \