From 516c926a1b99efc19b455aa0c00c25022d9c361e Mon Sep 17 00:00:00 2001
From: POLCHER Jan <jan.polcher@lmd.jussieu.fr>
Date: Mon, 3 Feb 2020 17:23:27 +0100
Subject: [PATCH] Add a larger scale test. Corrected some errors in the
 scripts.

---
 .gitignore                            |  3 ++-
 tests/Iberia_n48/BuildHTUs_IP.pbs     | 35 ++++++++++++++++++++++++++
 tests/Iberia_n48/run.def              | 28 +++++++++++++++++++++
 tests/Mallorca/BuildHTUs_Mallorca.pbs | 36 ++++++++++++++++++++++++---
 4 files changed, 97 insertions(+), 5 deletions(-)
 create mode 100644 tests/Iberia_n48/BuildHTUs_IP.pbs
 create mode 100644 tests/Iberia_n48/run.def

diff --git a/.gitignore b/.gitignore
index 67680e9..9988015 100644
--- a/.gitignore
+++ b/.gitignore
@@ -38,8 +38,9 @@ xcuserdata/
 *.nc
 Weights/
 tests/*/Weights/
+tests/*/DocumentationInterface
 __pycache__/
-run.def
+./run.def
 Out*.txt
 #
 # Test configurations and directories
diff --git a/tests/Iberia_n48/BuildHTUs_IP.pbs b/tests/Iberia_n48/BuildHTUs_IP.pbs
new file mode 100644
index 0000000..b8e5683
--- /dev/null
+++ b/tests/Iberia_n48/BuildHTUs_IP.pbs
@@ -0,0 +1,35 @@
+#!/bin/bash
+#
+#PBS -N BuildHTUs_IP
+#
+#PBS -j oe
+#PBS -l nodes=1:ppn=48
+#PBS -l walltime=128:00:00
+#PBS -l mem=160gb
+#PBS -l vmem=160gb
+#
+cd ${PBS_O_WORKDIR}
+export NSLOTS=$(($PBS_NUM_NODES*$PBS_NUM_PPN))
+#
+# Set the right Python 3 Anaconda environment
+#
+source ../../Environment
+#
+# Clean-up. Weights are kept for future runs.
+#
+/bin/rm -f DocumentationInterface *.nc *.txt
+#
+# Run the Python code to generate the HTUs and write them into a netCDF file.
+#
+mpirun -n ${NSLOTS} python ../../RoutingPreProc.py
+if [ $? -gt 0 ] ; then
+    echo "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
+    echo "X    Run on Iberian Peninsula failed    X"
+    echo "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
+else
+    echo "======================================="
+    echo "= Run on Iberian Peninsula successful ="
+    echo "======================================="
+fi
+#
+ls -l
diff --git a/tests/Iberia_n48/run.def b/tests/Iberia_n48/run.def
new file mode 100644
index 0000000..3e11dd5
--- /dev/null
+++ b/tests/Iberia_n48/run.def
@@ -0,0 +1,28 @@
+[OverAll]
+#
+#
+#
+EarthRadius = 6370000.
+#
+ModelGridFile = /bdd/MEDI/workspaces/polcher/NewRouting/geo_MEDCORDEX.nc
+WEST_EAST = -9.75, 5.25
+SOUTH_NORTH = 35.5, 43.5
+HydroFile = /bdd/MEDI/workspaces/polcher/NewRouting/routing_MED.nc
+#
+# FORTRAN interface parameters
+#
+Documentation = true
+#
+# Configuration for the graph to be generated
+#
+nbasmax = 35
+#
+# Output
+#
+GraphFile = LC_Spain_test_graph.nc
+#
+# Diagnostics
+# You need to provide an interval in longitude and Latitude.
+#
+DiagLon = 3.9, 3.9
+DiagLat = 40.0, 40.0
diff --git a/tests/Mallorca/BuildHTUs_Mallorca.pbs b/tests/Mallorca/BuildHTUs_Mallorca.pbs
index 1fc7488..b54bb31 100644
--- a/tests/Mallorca/BuildHTUs_Mallorca.pbs
+++ b/tests/Mallorca/BuildHTUs_Mallorca.pbs
@@ -15,15 +15,43 @@ export NSLOTS=$(($PBS_NUM_NODES*$PBS_NUM_PPN))
 #
 source ../../Environment
 #
+# Clean-up
+#
+/bin/rm -f DocumentationInterface *.nc *.txt
+#
+# Force RoutingPreProc to recompute the weights.
+#
+/bin/rm -rf Weights
+#
 # 1 Proc
 #
 mpirun -n 1 python ../../RoutingPreProc.py
-mv MEDCORDEX_test_graph.nc MEDCORDEX_test_graph_n1.nc
-mv MEDCORDEX_test_graph_HydroSuper.nc MEDCORDEX_test_graph_HydroSuper_n1.nc
+if [ $? -gt 0 ] ; then
+    echo "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
+    echo "X    Run on 1 Proc failed    X"
+    echo "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
+else
+    echo "============================"
+    echo "= Run on 1 Proc successful ="
+    echo "============================"
+    mv MEDCORDEX_test_graph.nc MEDCORDEX_test_graph_n1.nc
+    mv MEDCORDEX_test_graph_HydroSuper.nc MEDCORDEX_test_graph_HydroSuper_n1.nc
+fi
+#
 #
 # 2 Proc
 #
 mpirun -n 2 python ../../RoutingPreProc.py
-mv MEDCORDEX_test_graph.nc MEDCORDEX_test_graph_n2.nc
-mv MEDCORDEX_test_graph_HydroSuper.nc MEDCORDEX_test_graph_HydroSuper_n2.nc
+if [ $? -gt 0 ] ; then
+    echo "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
+    echo "X    Run on 2 Proc failed    X"
+    echo "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
+else
+    echo "============================"
+    echo "= Run on 2 Proc successful ="
+    echo "============================"
+    mv MEDCORDEX_test_graph.nc MEDCORDEX_test_graph_n2.nc
+    mv MEDCORDEX_test_graph_HydroSuper.nc MEDCORDEX_test_graph_HydroSuper_n2.nc
+fi
+
 ls -l
-- 
GitLab