Prechádzať zdrojové kódy

Adding special restart feature

Pierre-Yves Barriat 7 rokov pred
rodič
commit
5df86f017f

+ 39 - 0
3.2.2/runtime/classic/ece-ifs+nemo.sh.tmpl

@@ -50,6 +50,9 @@ run_end_date="[[[MOD:GENERAL:RUN_END_DATE]]]"
 # directory. Leave set to 'false' otherwise.
 # NOTE: If set to 'true' the run directory $run_dir is cleaned!
 force_run_from_scratch=[[[MOD:GENERAL:FORCE_RUN_FROM_SCRATCH]]]
+special_restart=false
+special_restart_from=ECE3
+special_restart_date="1995-01-01"
 
 # Resolution
 ifs_grid=[[[MOD:IFS:GRID]]]
@@ -209,6 +212,41 @@ xio_numproc=[[[MOD:XIO:NUMPROC]]]
 if [ ! -d ${run_dir} ]
 then
     mkdir -p ${run_dir}
+    if $special_restart
+    then
+        force_run_from_scratch=false
+        rsync -av --delete ${run_dir}/../${special_restart_from}/ --exclude log --exclude output --exclude restart --exclude="${special_restart_from}_*" --exclude="srf*" --exclude="restart_*" --exclude="debug.*" --exclude="output.*" ${run_dir}
+        cp -f ${nem_exe_file} ${run_dir}
+        cp -f ${ifs_exe_file} ${run_dir}
+        cp -f ${rnf_exe_file} ${run_dir}
+        cp -f ${xio_exe_file} ${run_dir}
+        special_year=${special_restart_date:0:4}
+        sed -i "/$special_year/q" ${run_dir}/ece.info
+        . ${run_dir}/ece.info
+        special_restart_leg=$(printf %03d $((leg_number+1)))
+        # PUT HERE THE INSTRUCTIONS TO COPY THE restart files
+        rsync -av ${run_dir}/../${special_restart_from}/restart/ifs/${special_restart_leg}/ ${run_dir}
+        rsync -av ${run_dir}/../${special_restart_from}/restart/oasis/${special_restart_leg}/ ${run_dir}
+        cd ${run_dir}/../${special_restart_from}/restart/nemo/${special_restart_leg}
+        for f in *.nc; do
+            nf=${exp_name}${f:4}
+            cp $f ${run_dir}/$nf
+        done
+        cd -
+        cd ${run_dir}
+        for f in ${exp_name}_????????_restart_???_????.nc; do
+            nf=${f:14}
+            ln -s $f $nf
+        done
+        cd -
+        rm -f ${run_dir}/ICMCL${special_restart_from}INIT
+        mv ${run_dir}/ICMGG${special_restart_from}INIUA ${run_dir}/ICMGG${exp_name}INIUA
+        mv ${run_dir}/ICMGG${special_restart_from}INIT ${run_dir}/ICMGG${exp_name}INIT
+        mv ${run_dir}/ICMSH${special_restart_from}INIT ${run_dir}/ICMSH${exp_name}INIT
+    fi
+else
+    force_run_from_scratch=false
+    special_restart=false
 fi
 cd ${run_dir}
 
@@ -731,6 +769,7 @@ do
 
     # Need to reset force_run_from_scratch in order to avoid destroying the next leg
     force_run_from_scratch=false
+    special_restart=false
 
 done # loop over legs
 

+ 6 - 0
3.2.2/runtime/classic/platform/zenobe.cfg.tmpl

@@ -105,6 +105,12 @@ function finalise()
             <./${PBS_JOBNAME}.$$ \
             >./${PBS_JOBNAME}
 
+        cp -f ./${PBS_JOBNAME} ./${PBS_JOBNAME}.$$
+
+        sed "s:special_restart=true:special_restart=false:" \
+            <./${PBS_JOBNAME}.$$ \
+            >./${PBS_JOBNAME}
+
         \rm -f ./${PBS_JOBNAME}.$$
 
         # Submit command

+ 39 - 0
primavera/runtime/classic/ece-ifs+nemo.sh.tmpl

@@ -50,6 +50,9 @@ run_end_date="[[[MOD:GENERAL:RUN_END_DATE]]]"
 # directory. Leave set to 'false' otherwise.
 # NOTE: If set to 'true' the run directory $run_dir is cleaned!
 force_run_from_scratch=[[[MOD:GENERAL:FORCE_RUN_FROM_SCRATCH]]]
+special_restart=false
+special_restart_from=ECE3
+special_restart_date="1995-01-01"
 
 # Resolution
 ifs_grid=[[[MOD:IFS:GRID]]]
@@ -239,6 +242,41 @@ xio_numproc=[[[MOD:XIO:NUMPROC]]]
 if [ ! -d ${run_dir} ]
 then
     mkdir -p ${run_dir}
+    if $special_restart
+    then
+        force_run_from_scratch=false
+        rsync -av --delete ${run_dir}/../${special_restart_from}/ --exclude log --exclude output --exclude restart --exclude="${special_restart_from}_*" --exclude="srf*" --exclude="restart_*" --exclude="debug.*" --exclude="output.*" ${run_dir}
+        cp -f ${nem_exe_file} ${run_dir}
+        cp -f ${ifs_exe_file} ${run_dir}
+        cp -f ${rnf_exe_file} ${run_dir}
+        cp -f ${xio_exe_file} ${run_dir}
+        special_year=${special_restart_date:0:4}
+        sed -i "/$special_year/q" ${run_dir}/ece.info
+        . ${run_dir}/ece.info
+        special_restart_leg=$(printf %03d $((leg_number+1)))
+        # PUT HERE THE INSTRUCTIONS TO COPY THE restart files
+        rsync -av ${run_dir}/../${special_restart_from}/restart/ifs/${special_restart_leg}/ ${run_dir}
+        rsync -av ${run_dir}/../${special_restart_from}/restart/oasis/${special_restart_leg}/ ${run_dir}
+        cd ${run_dir}/../${special_restart_from}/restart/nemo/${special_restart_leg}
+        for f in *.nc; do
+            nf=${exp_name}${f:4}
+            cp $f ${run_dir}/$nf
+        done
+        cd -
+        cd ${run_dir}
+        for f in ${exp_name}_????????_restart_???_????.nc; do
+            nf=${f:14}
+            ln -s $f $nf
+        done
+        cd -
+        rm -f ${run_dir}/ICMCL${special_restart_from}INIT
+        mv ${run_dir}/ICMGG${special_restart_from}INIUA ${run_dir}/ICMGG${exp_name}INIUA
+        mv ${run_dir}/ICMGG${special_restart_from}INIT ${run_dir}/ICMGG${exp_name}INIT
+        mv ${run_dir}/ICMSH${special_restart_from}INIT ${run_dir}/ICMSH${exp_name}INIT
+    fi
+else
+    force_run_from_scratch=false
+    special_restart=false
 fi
 cd ${run_dir}
 
@@ -777,6 +815,7 @@ do
 
     # Need to reset force_run_from_scratch in order to avoid destroying the next leg
     force_run_from_scratch=false
+    special_restart=false
 
 done # loop over legs
 

+ 6 - 0
primavera/runtime/classic/platform/zenobe.cfg.tmpl

@@ -108,6 +108,12 @@ function finalise()
             <./${PBS_JOBNAME}.$$ \
             >./${PBS_JOBNAME}
 
+        cp -f ./${PBS_JOBNAME} ./${PBS_JOBNAME}.$$
+
+        sed "s:special_restart=true:special_restart=false:" \
+            <./${PBS_JOBNAME}.$$ \
+            >./${PBS_JOBNAME}
+
         \rm -f ./${PBS_JOBNAME}.$$
 
         # Submit command

+ 39 - 0
trunk/runtime/classic/ece-ifs+nemo.sh.tmpl

@@ -50,6 +50,9 @@ run_end_date="[[[MOD:GENERAL:RUN_END_DATE]]]"
 # directory. Leave set to 'false' otherwise.
 # NOTE: If set to 'true' the run directory $run_dir is cleaned!
 force_run_from_scratch=[[[MOD:GENERAL:FORCE_RUN_FROM_SCRATCH]]]
+special_restart=false
+special_restart_from=ECE3
+special_restart_date="1995-01-01"
 
 # Resolution
 ifs_grid=[[[MOD:IFS:GRID]]]
@@ -211,6 +214,41 @@ xio_numproc=[[[MOD:XIO:NUMPROC]]]
 if [ ! -d ${run_dir} ]
 then
     mkdir -p ${run_dir}
+    if $special_restart
+    then
+        force_run_from_scratch=false
+        rsync -av --delete ${run_dir}/../${special_restart_from}/ --exclude log --exclude output --exclude restart --exclude="${special_restart_from}_*" --exclude="srf*" --exclude="restart_*" --exclude="debug.*" --exclude="output.*" ${run_dir}
+        cp -f ${nem_exe_file} ${run_dir}
+        cp -f ${ifs_exe_file} ${run_dir}
+        cp -f ${rnf_exe_file} ${run_dir}
+        cp -f ${xio_exe_file} ${run_dir}
+        special_year=${special_restart_date:0:4}
+        sed -i "/$special_year/q" ${run_dir}/ece.info
+        . ${run_dir}/ece.info
+        special_restart_leg=$(printf %03d $((leg_number+1)))
+        # PUT HERE THE INSTRUCTIONS TO COPY THE restart files
+        rsync -av ${run_dir}/../${special_restart_from}/restart/ifs/${special_restart_leg}/ ${run_dir}
+        rsync -av ${run_dir}/../${special_restart_from}/restart/oasis/${special_restart_leg}/ ${run_dir}
+        cd ${run_dir}/../${special_restart_from}/restart/nemo/${special_restart_leg}
+        for f in *.nc; do
+            nf=${exp_name}${f:4}
+            cp $f ${run_dir}/$nf
+        done
+        cd -
+        cd ${run_dir}
+        for f in ${exp_name}_????????_restart_???_????.nc; do
+            nf=${f:14}
+            ln -s $f $nf
+        done
+        cd -
+        rm -f ${run_dir}/ICMCL${special_restart_from}INIT
+        mv ${run_dir}/ICMGG${special_restart_from}INIUA ${run_dir}/ICMGG${exp_name}INIUA
+        mv ${run_dir}/ICMGG${special_restart_from}INIT ${run_dir}/ICMGG${exp_name}INIT
+        mv ${run_dir}/ICMSH${special_restart_from}INIT ${run_dir}/ICMSH${exp_name}INIT
+    fi
+else
+    force_run_from_scratch=false
+    special_restart=false
 fi
 cd ${run_dir}
 
@@ -733,6 +771,7 @@ do
 
     # Need to reset force_run_from_scratch in order to avoid destroying the next leg
     force_run_from_scratch=false
+    special_restart=false
 
 done # loop over legs
 

+ 6 - 0
trunk/runtime/classic/platform/zenobe.cfg.tmpl

@@ -105,6 +105,12 @@ function finalise()
             <./${PBS_JOBNAME}.$$ \
             >./${PBS_JOBNAME}
 
+        cp -f ./${PBS_JOBNAME} ./${PBS_JOBNAME}.$$
+
+        sed "s:special_restart=true:special_restart=false:" \
+            <./${PBS_JOBNAME}.$$ \
+            >./${PBS_JOBNAME}
+
         \rm -f ./${PBS_JOBNAME}.$$
 
         # Submit command