Browse Source

new special rs rebuilt flag

Charles Pelletier 2 years ago
parent
commit
f555b121b6
2 changed files with 52 additions and 41 deletions
  1. 26 21
      templates/scripts/skeleton.sh
  2. 26 20
      templates/scripts/skeleton_isfcpl.sh

+ 26 - 21
templates/scripts/skeleton.sh

@@ -220,31 +220,36 @@ do
 
 
 	    dir_rs=`dirname ${special_rs_nemo_stencil}`
 	    dir_rs=`dirname ${special_rs_nemo_stencil}`
 	    base_rs=`basename ${special_rs_nemo_stencil}`
 	    base_rs=`basename ${special_rs_nemo_stencil}`
-	    
-	    n_oce_rs=`find ${dir_rs} -name "${base_rs}oce_????.nc" | wc -l`
-	    if(( n_oce_rs != nem_numproc )); then
-		echo "in special_rs_nemo, not the right amount of ocean restart files."
-		echo "${n_oce_rs} instead of ${nem_numproc}. exiting."
-		exit 2
-	    fi
 
 
-	    n_ice_rs=`find ${dir_rs} -name "${base_rs}ice_????.nc" | wc -l`
-	    if(( n_ice_rs != nem_numproc )); then
-		echo "in special_rs_nemo, not the right amount of ice restart files."
-		echo "${n_ice_rs} instead of ${nem_numproc}. exiting."
-		exit 2
+	    if ${special_rs_nemo_rebuilt}
+	    then
+
+		if [[ -f ${special_rs_nemo_stencil}oce.nc && -f ${special_rs_nemo_stencil}ice.nc ]]
+		then
+		    ln -fs ${special_rs_nemo_stencil}oce.nc restart_oce.nc
+		    ln -fs ${special_rs_nemo_stencil}ice.nc restart_ice.nc
+		else
+		    echo "EXITING. ${special_rs_nemo_stencil}oce.nc or ${special_rs_nemo_stencil}ice.nc not found"
+		    exit 2
+		fi
+
+	    else
+	        for (( n=0 ; n<nem_numproc ; n++ ))
+		do
+		    np=$(printf %04d ${n})
+		    if [[ -f ${special_rs_nemo_stencil}oce_${np}.nc && -f ${special_rs_nemo_stencil}ice_${np}.nc ]]
+		    then
+			ln -fs ${special_rs_nemo_stencil}oce_${np}.nc restart_oce_${np}.nc
+			ln -fs ${special_rs_nemo_stencil}ice_${np}.nc restart_ice_${np}.nc
+		    else
+			echo "EXITING. ${special_rs_nemo_stencil}oce_${np}.nc or ${special_rs_nemo_stencil}ice_${np}.nc not found"
+			exit 2
+		    fi
+		done
 	    fi
 	    fi
-	    
-            for (( n=0 ; n<nem_numproc ; n++ ))
-            do
-		np=$(printf %04d ${n})
-		ln -fs ${special_rs_nemo_stencil}oce_${np}.nc restart_oce_${np}.nc
-		ln -fs ${special_rs_nemo_stencil}ice_${np}.nc restart_ice_${np}.nc
-            done
 
 
         fi # if $special_restart
         fi # if $special_restart
 
 
-
     else # if ! $leg_is_restart
     else # if ! $leg_is_restart
 
 
         # ---------------------------------------------------------------------
         # ---------------------------------------------------------------------
@@ -279,6 +284,7 @@ do
     # -------------------------------------------------------------------------
     # -------------------------------------------------------------------------
     # *** Update ocean namelist
     # *** Update ocean namelist
     # -------------------------------------------------------------------------
     # -------------------------------------------------------------------------
+    
     source build_namelist_cfg.sh > namelist_cfg
     source build_namelist_cfg.sh > namelist_cfg
 
 
 
 
@@ -286,7 +292,6 @@ do
     # *** Launch experiment
     # *** Launch experiment
     # -------------------------------------------------------------------------
     # -------------------------------------------------------------------------
 
 
-    
     echo "START of mpirun"
     echo "START of mpirun"
     time_begin=$(date +%s)
     time_begin=$(date +%s)
     mpirun -np "${xio_numproc:?}" "${xio_exe_file:?}" : -np "${nem_numproc:?}" "${nem_exe_file:?}"
     mpirun -np "${xio_numproc:?}" "${xio_exe_file:?}" : -np "${nem_numproc:?}" "${nem_exe_file:?}"

+ 26 - 20
templates/scripts/skeleton_isfcpl.sh

@@ -414,31 +414,37 @@ do
 
 
 	    dir_rs=`dirname ${special_rs_nemo_stencil}`
 	    dir_rs=`dirname ${special_rs_nemo_stencil}`
 	    base_rs=`basename ${special_rs_nemo_stencil}`
 	    base_rs=`basename ${special_rs_nemo_stencil}`
-	    
-	    n_oce_rs=`find ${dir_rs} -name "${base_rs}oce_????.nc" | wc -l`
-	    if(( n_oce_rs != nem_numproc )); then
-		echo "in special_rs_nemo, not the right amount of ocean restart files."
-		echo "${n_oce_rs} instead of ${nem_numproc}. exiting."
-		exit 2
-	    fi
 
 
-	    n_ice_rs=`find ${dir_rs} -name "${base_rs}ice_????.nc" | wc -l`
-	    if(( n_ice_rs != nem_numproc )); then
-		echo "in special_rs_nemo, not the right amount of ice restart files."
-		echo "${n_ice_rs} instead of ${nem_numproc}. exiting."
-		exit 2
+
+	    if ${special_rs_nemo_rebuilt}
+	    then
+
+		if [[ -f ${special_rs_nemo_stencil}oce.nc && -f ${special_rs_nemo_stencil}ice.nc ]]
+		then
+		    ln -fs ${special_rs_nemo_stencil}oce.nc restart_oce.nc
+		    ln -fs ${special_rs_nemo_stencil}ice.nc restart_ice.nc
+		else
+		    echo "EXITING. ${special_rs_nemo_stencil}oce.nc or ${special_rs_nemo_stencil}ice.nc not found"
+		    exit 2
+		fi
+
+	    else
+	        for (( n=0 ; n<nem_numproc ; n++ ))
+		do
+		    np=$(printf %04d ${n})
+		    if [[ -f ${special_rs_nemo_stencil}oce_${np}.nc && -f ${special_rs_nemo_stencil}ice_${np}.nc ]]
+		    then
+			ln -fs ${special_rs_nemo_stencil}oce_${np}.nc restart_oce_${np}.nc
+			ln -fs ${special_rs_nemo_stencil}ice_${np}.nc restart_ice_${np}.nc
+		    else
+			echo "EXITING. ${special_rs_nemo_stencil}oce_${np}.nc or ${special_rs_nemo_stencil}ice_${np}.nc not found"
+			exit 2
+		    fi
+		done
 	    fi
 	    fi
-	    
-            for (( n=0 ; n<nem_numproc ; n++ ))
-            do
-		np=$(printf %04d ${n})
-		ln -fs ${special_rs_nemo_stencil}oce_${np}.nc restart_oce_${np}.nc
-		ln -fs ${special_rs_nemo_stencil}ice_${np}.nc restart_ice_${np}.nc
-            done
 
 
         fi # if $special_restart
         fi # if $special_restart
 
 
-
     else # if ! $leg_is_restart
     else # if ! $leg_is_restart
 
 
         # ---------------------------------------------------------------------
         # ---------------------------------------------------------------------