post_rebuild.sh 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. #!/usr/bin/env bash
  2. #PBS -q main
  3. #PBS -r y
  4. #PBS -W group_list=cclm
  5. #PBS -l walltime=23:50:00
  6. #PBS -l select=1:ncpus=24:ompthreads=24:mem=63000mb
  7. #PBS -M pierre-yves.barriat@uclouvain.be
  8. #PBS -m abe
  9. exec > ${PBS_O_WORKDIR-$PWD}/${PBS_JOBNAME-"local"}_${PBS_JOBID-"id"}.log
  10. echo "------------------ Job Info --------------------"
  11. echo "jobid : $PBS_JOBID"
  12. echo "jobname : $PBS_JOBNAME"
  13. echo "job type : $PBS_ENVIRONMENT"
  14. echo "submit dir : $PBS_O_WORKDIR"
  15. echo "queue : $PBS_O_QUEUE"
  16. echo "user : $PBS_O_LOGNAME"
  17. echo "threads : $OMP_NUM_THREADS"
  18. set -ue
  19. # Configure and load modules
  20. module purge
  21. module load netCDF-Fortran/4.5.3-gompi-2020b
  22. exp="NE4_SP"
  23. cores="24"
  24. path_out="/scratch/ucl/elic/pbarriat/nemo/archive/${exp}"
  25. path_exe="/home/ucl/elic/pbarriat/modeles/nemo/nemo_dev_4/tools/REBUILD_NEMO"
  26. ###
  27. files=${path_out}/output/*
  28. dir=`echo $files | cut -d' ' -f1`
  29. cd ${dir}
  30. #
  31. file=`ls ${exp}_1m_*_grid_T_*.nc | tail -n 1`
  32. xios_split=`echo ${file%.nc} | rev | cut -d'_' -f1 | rev`
  33. xios_split=`expr $xios_split + 1`
  34. #
  35. for dir in ${files}
  36. do
  37. cd ${dir}
  38. #
  39. file=`ls ${exp}_1m_*_grid_T_0000.nc`
  40. to_year=`echo ${file%_grid_T_0000.nc} | rev | cut -d'_' -f1 | rev`
  41. from_year=`echo ${file%_grid_T_0000.nc} | rev | cut -d'_' -f2 | rev`
  42. #
  43. echo "In ${dir} :"
  44. echo "Processing ${exp}_1m_${from_year}_${to_year} ..."
  45. rm -f nam_rebuild_*
  46. rm -f ${exp}_1m_${from_year}_${to_year}_grid_T.nc
  47. rm -f ${exp}_1m_${from_year}_${to_year}_grid_U.nc
  48. rm -f ${exp}_1m_${from_year}_${to_year}_grid_V.nc
  49. rm -f ${exp}_1m_${from_year}_${to_year}_SBC.nc
  50. rm -f ${exp}_1m_${from_year}_${to_year}_icemod.nc
  51. if [ -s ${exp}_1m_${from_year}_${to_year}_grid_T_0000.nc ]
  52. then
  53. [[ ! -s ${exp}_1m_${from_year}_${to_year}_grid_T.nc ]] && ${path_exe}/rebuild_nemo -t ${cores} ${exp}_1m_${from_year}_${to_year}_grid_T ${xios_split}
  54. fi
  55. if [ -s ${exp}_1m_${from_year}_${to_year}_grid_U_0000.nc ]
  56. then
  57. [[ ! -s ${exp}_1m_${from_year}_${to_year}_grid_U.nc ]] && ${path_exe}/rebuild_nemo -t ${cores} ${exp}_1m_${from_year}_${to_year}_grid_U ${xios_split}
  58. fi
  59. if [ -s ${exp}_1m_${from_year}_${to_year}_grid_V_0000.nc ]
  60. then
  61. [[ ! -s ${exp}_1m_${from_year}_${to_year}_grid_V.nc ]] && ${path_exe}/rebuild_nemo -t ${cores} ${exp}_1m_${from_year}_${to_year}_grid_V ${xios_split}
  62. fi
  63. if [ -s ${exp}_1m_${from_year}_${to_year}_SBC_0000.nc ]
  64. then
  65. [[ ! -s ${exp}_1m_${from_year}_${to_year}_SBC.nc ]] && ${path_exe}/rebuild_nemo -t ${cores} ${exp}_1m_${from_year}_${to_year}_SBC ${xios_split}
  66. fi
  67. if [ -s ${exp}_1m_${from_year}_${to_year}_icemod_0000.nc ]
  68. then
  69. [[ ! -s ${exp}_1m_${from_year}_${to_year}_icemod.nc ]] && ${path_exe}/rebuild_nemo -t ${cores} ${exp}_1m_${from_year}_${to_year}_icemod ${xios_split}
  70. fi
  71. done
  72. ###
  73. files=`ls ${path_out}/restart/ | tail -n 1`
  74. dir=${path_out}/restart/${files}
  75. cd ${dir}
  76. file=`ls ${exp}_*_restart_ice* | tail -n 1`
  77. nemo_split=`echo ${file%.nc} | rev | cut -d'_' -f1 | rev`
  78. nemo_split=`expr $nemo_split + 1`
  79. restart_step=`echo ${file%.nc} | rev | cut -d'_' -f4 | rev`
  80. echo "In ${dir} processing ${exp}_${restart_step}_restart_ice ..."
  81. rm -f ${exp}_${restart_step}_restart_ice.nc
  82. rm -f ${exp}_${restart_step}_restart_oce.nc
  83. if [ -s ${exp}_${restart_step}_restart_ice_0000.nc ]
  84. then
  85. [[ ! -s ${exp}_${restart_step}_restart_ice.nc ]] && ${path_exe}/rebuild_nemo -t ${cores} ${exp}_${restart_step}_restart_ice ${nemo_split}
  86. fi
  87. if [ -s ${exp}_${restart_step}_restart_oce_0000.nc ]
  88. then
  89. [[ ! -s ${exp}_${restart_step}_restart_oce.nc ]] && ${path_exe}/rebuild_nemo -t ${cores} ${exp}_${restart_step}_restart_oce ${nemo_split}
  90. fi
  91. echo ----- REBUILD post finished