[2] | 1 | #!/bin/ksh |
---|
| 2 | |
---|
| 3 | #************************************************************** |
---|
| 4 | # Author: Sebastien Denvil |
---|
[373] | 5 | # Contact: Sebastien.Denvil__at__ipsl.jussieu.fr |
---|
| 6 | # $Revision:: $ Revision of last commit |
---|
| 7 | # $Author:: $ Author of last commit |
---|
| 8 | # $Date:: $ Date of last commit |
---|
[2] | 9 | # IPSL (2006) |
---|
| 10 | # This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC |
---|
| 11 | # |
---|
| 12 | #************************************************************** |
---|
| 13 | |
---|
| 14 | #======================================================================= |
---|
[22] | 15 | |
---|
| 16 | function IGCM_post_Configure |
---|
| 17 | { |
---|
[544] | 18 | IGCM_debug_PushStack "IGCM_post_Configure" |
---|
[22] | 19 | |
---|
[544] | 20 | # Debug Print : |
---|
| 21 | echo |
---|
| 22 | IGCM_debug_Print 1 "IGCM_post_Configure" |
---|
| 23 | # |
---|
| 24 | # Initialize |
---|
| 25 | # |
---|
| 26 | POST=false |
---|
| 27 | RebuildFrequency=false |
---|
[554] | 28 | PackFrequency=false |
---|
[544] | 29 | SeasonalFrequency=false |
---|
[554] | 30 | unset list_post |
---|
[544] | 31 | # |
---|
| 32 | # ONLY IF SOMETHING NEEDS TO BE DONE (EATHER TIME SERIES OR SEASONAL) COMPUTE THE MODULOS |
---|
| 33 | # |
---|
| 34 | if [ X${AsynchronousRebuild} = Xtrue ] ; then |
---|
| 35 | list_post="RebuildFrequency" |
---|
| 36 | fi |
---|
| 37 | # |
---|
[554] | 38 | if [ X${Pack} = Xtrue ] ; then |
---|
| 39 | list_post="${list_post} PackFrequency" |
---|
| 40 | fi |
---|
| 41 | # |
---|
[544] | 42 | if [ X${Seasonal} = Xtrue ] ; then |
---|
| 43 | list_post="${list_post} SeasonalFrequency" |
---|
| 44 | fi |
---|
[380] | 45 | |
---|
[1375] | 46 | # Overrule Rebuild triggering. Special case 1. |
---|
[545] | 47 | if ( [ X${AsynchronousRebuild} = Xtrue ] && [ ${SimulationLengthInDays} -ge ${ExperienceLengthInDays} ] ) ; then |
---|
[544] | 48 | RebuildFrequency=true |
---|
| 49 | POST=true |
---|
| 50 | fi |
---|
[1375] | 51 | # Overrule Pack triggering. Special case 2. |
---|
[1034] | 52 | if ( [ X${Pack} = Xtrue ] && [ ${SimulationLengthInDays} -ge ${ExperienceLengthInDays} ] ) ; then |
---|
| 53 | PackFrequency=true |
---|
| 54 | POST=true |
---|
| 55 | fi |
---|
[544] | 56 | |
---|
[1034] | 57 | # READ REBUILD OR PACK OR TIME SERIES OR SEASONAL FREQUENCY |
---|
[544] | 58 | # AND TURN ON THE SUBMISSION FLAG WHEN MODULO IS ZERO |
---|
| 59 | for post_freq in ${list_post} ; do |
---|
| 60 | # Extract frequency from previously defined variable |
---|
| 61 | config_Post_post_freq=$( eval echo \${config_Post_${post_freq}} ) |
---|
| 62 | # Offset for Seasonal Average starting period |
---|
| 63 | if [ ${post_freq} = SeasonalFrequency ] ; then |
---|
| 64 | if ( [ X${config_Post_SeasonalFrequencyOffset} = X${NULL_STR} ] || [ X${config_Post_SeasonalFrequencyOffset} = XNONE ] || [ X${config_Post_SeasonalFrequencyOffset} = X ] ) ; then |
---|
[786] | 65 | PeriodOffset=0 |
---|
[544] | 66 | else |
---|
[786] | 67 | PeriodOffset=${config_Post_SeasonalFrequencyOffset} |
---|
[544] | 68 | fi |
---|
| 69 | else |
---|
| 70 | PeriodOffset=0 |
---|
[380] | 71 | fi |
---|
[544] | 72 | # Compute Modulo between frequencys (/!\second argument will be multiplied by CumuPeriod/!\) |
---|
| 73 | # RebuildFrequency needs additionnal information |
---|
| 74 | if [ ${post_freq} = RebuildFrequency ] ; then |
---|
[639] | 75 | IGCM_post_ModuloRuntimeFrequency config_Post_post_freq config_UserChoices_PeriodLength NbPeriodPerFrequency |
---|
| 76 | NbRebuildDir=${NbPeriodPerFrequency} |
---|
[544] | 77 | else |
---|
| 78 | IGCM_post_ModuloRuntimeFrequency config_Post_post_freq config_UserChoices_PeriodLength |
---|
[380] | 79 | fi |
---|
[34] | 80 | # |
---|
[663] | 81 | eval IGCM_debug_Print 1 \" "${post_freq} flag value : \${${post_freq}}" \" |
---|
[544] | 82 | done |
---|
| 83 | # |
---|
| 84 | IGCM_debug_Print 2 "POST-TREATEMENT flag value : ${POST}" |
---|
| 85 | # |
---|
[653] | 86 | # Prepare headers for the shell dedicated to post-processing |
---|
[1375] | 87 | if ( [ ${PackFrequency} = true ] && [ ${SeasonalFrequency} = true ] ) ; then |
---|
[628] | 88 | if [ $DRYRUN -le 1 ]; then |
---|
| 89 | echo "#!/bin/ksh " > ${R_BUFR}/FlushPost_${PeriodDateEnd}.ksh |
---|
| 90 | echo "function IGCM_FlushPost " >> ${R_BUFR}/FlushPost_${PeriodDateEnd}.ksh |
---|
| 91 | echo "{ " >> ${R_BUFR}/FlushPost_${PeriodDateEnd}.ksh |
---|
| 92 | echo "IGCM_debug_PushStack \"IGCM_FlushPost\" " >> ${R_BUFR}/FlushPost_${PeriodDateEnd}.ksh |
---|
| 93 | echo "echo " >> ${R_BUFR}/FlushPost_${PeriodDateEnd}.ksh |
---|
| 94 | echo "IGCM_debug_Print 1 \"IGCM_FlushPost\" " >> ${R_BUFR}/FlushPost_${PeriodDateEnd}.ksh |
---|
| 95 | echo "echo " >> ${R_BUFR}/FlushPost_${PeriodDateEnd}.ksh |
---|
| 96 | fi |
---|
| 97 | fi |
---|
[544] | 98 | IGCM_debug_PopStack "IGCM_post_Configure" |
---|
[2] | 99 | } |
---|
| 100 | |
---|
| 101 | function IGCM_post_Submit |
---|
| 102 | { |
---|
[544] | 103 | IGCM_debug_PushStack "IGCM_post_Submit" |
---|
[2] | 104 | |
---|
[555] | 105 | typeset listVarEnv DaysTemp |
---|
[381] | 106 | |
---|
[545] | 107 | POST_DIR=${R_BUF_KSH} |
---|
[622] | 108 | |
---|
[544] | 109 | if [ ${POST} = true ]; then |
---|
| 110 | echo |
---|
| 111 | IGCM_debug_Print 1 "IGCM_post_Submit" |
---|
| 112 | echo |
---|
| 113 | IGCM_debug_Print 2 "POST_DIR = ${POST_DIR}" |
---|
| 114 | fi |
---|
[34] | 115 | |
---|
[554] | 116 | #============= SEASONAL POST-PROCESSING ============# |
---|
[544] | 117 | if [ ${SeasonalFrequency} = true ] ; then |
---|
| 118 | # |
---|
[554] | 119 | IGCM_debug_Print 1 "SEASONNAL POST-PROCESSING" |
---|
[544] | 120 | echo |
---|
| 121 | # |
---|
| 122 | Script_Post_Output=create_se.${PeriodDateEnd} |
---|
| 123 | # |
---|
[1290] | 124 | listVarEnv="DEBUG_debug,BigBrother,postProcessingStopLevel,MODIPSL,libIGCM,libIGCM_SX,SUBMIT_DIR,POST_DIR,Script_Post_Output,MASTER,DateBegin,PeriodDateEnd,StandAlone,RESOL_ATM,RESOL_OCE,RESOL_ICE,RESOL_MBG,RESOL_SRF,RESOL_SBG" |
---|
[544] | 125 | |
---|
[1257] | 126 | if ( [ ${RebuildFrequency} = true ] || [ ${PackFrequency} = true ] ) ; then |
---|
[544] | 127 | # |
---|
[628] | 128 | if [ ${PackFrequency} = true ] ; then |
---|
| 129 | FunctionPath=${R_BUFR}/FlushPost_${PeriodDateEnd}.ksh |
---|
| 130 | else |
---|
| 131 | FunctionPath=${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh |
---|
| 132 | fi |
---|
| 133 | # |
---|
| 134 | if [ -f ${FunctionPath} ] ; then |
---|
[786] | 135 | # |
---|
| 136 | # if [ X${MASTER} = Xtitane ] ; then |
---|
| 137 | # echo "IGCM_sys_RshPost <<-EOF" >> ${FunctionPath} |
---|
| 138 | # fi |
---|
[1290] | 139 | echo "export DEBUG_debug=${DEBUG_debug} " >> ${FunctionPath} |
---|
| 140 | echo "export BigBrother=${BigBrother} " >> ${FunctionPath} |
---|
| 141 | echo "export postProcessingStopLevel=${postProcessingStopLevel}" >> ${FunctionPath} |
---|
| 142 | echo "export MODIPSL=${MODIPSL} " >> ${FunctionPath} |
---|
| 143 | echo "export libIGCM_SX=${libIGCM} " >> ${FunctionPath} |
---|
| 144 | echo "export libIGCM=${libIGCM_POST} " >> ${FunctionPath} |
---|
| 145 | echo "export SUBMIT_DIR=${SUBMIT_DIR} " >> ${FunctionPath} |
---|
| 146 | echo "export POST_DIR=${POST_DIR} " >> ${FunctionPath} |
---|
| 147 | echo "export MASTER=${MASTER} " >> ${FunctionPath} |
---|
| 148 | echo "export DateBegin=${DateBegin} " >> ${FunctionPath} |
---|
| 149 | echo "export PeriodDateEnd=${PeriodDateEnd} " >> ${FunctionPath} |
---|
| 150 | echo "export StandAlone=false " >> ${FunctionPath} |
---|
| 151 | echo "export RESOL_ATM=${RESOL_ATM} " >> ${FunctionPath} |
---|
| 152 | echo "export RESOL_OCE=${RESOL_OCE} " >> ${FunctionPath} |
---|
| 153 | echo "export RESOL_ICE=${RESOL_ICE} " >> ${FunctionPath} |
---|
| 154 | echo "export RESOL_MBG=${RESOL_MBG} " >> ${FunctionPath} |
---|
| 155 | echo "export RESOL_SRF=${RESOL_SRF} " >> ${FunctionPath} |
---|
| 156 | echo "export RESOL_SBG=${RESOL_SBG} " >> ${FunctionPath} |
---|
| 157 | echo "export listVarEnv=${listVarEnv} " >> ${FunctionPath} |
---|
| 158 | echo "export Script_Post_Output=${Script_Post_Output} " >> ${FunctionPath} |
---|
[786] | 159 | # if [ X${MASTER} = Xtitane ] ; then |
---|
| 160 | # echo ". ${libIGCM_POST}/libIGCM_debug/libIGCM_debug.ksh" >> ${FunctionPath} |
---|
| 161 | # echo ". ${libIGCM_POST}/libIGCM_sys/libIGCM_sys.ksh" >> ${FunctionPath} |
---|
| 162 | # fi |
---|
| 163 | echo "IGCM_sys_MkdirWork ${POST_DIR} " >> ${FunctionPath} |
---|
[1206] | 164 | echo "IGCM_debug_Verif_Exit " >> ${FunctionPath} |
---|
[786] | 165 | echo "IGCM_sys_QsubPost create_se " >> ${FunctionPath} |
---|
| 166 | # if [ X${MASTER} = Xtitane ] ; then |
---|
| 167 | # echo "EOF" >> ${FunctionPath} |
---|
| 168 | # fi |
---|
[544] | 169 | fi |
---|
| 170 | else |
---|
| 171 | IGCM_sys_RshPost <<-EOF |
---|
[36] | 172 | export DEBUG_debug=${DEBUG_debug} |
---|
[1070] | 173 | export BigBrother=${BigBrother} |
---|
[1290] | 174 | export postProcessingStopLevel=${postProcessingStopLevel} |
---|
[22] | 175 | export MODIPSL=${MODIPSL} |
---|
[1070] | 176 | export libIGCM_SX=${libIGCM} |
---|
[22] | 177 | export libIGCM=${libIGCM_POST} |
---|
| 178 | export SUBMIT_DIR=${SUBMIT_DIR} |
---|
| 179 | export POST_DIR=${POST_DIR} |
---|
[72] | 180 | export MASTER=${MASTER} |
---|
[22] | 181 | export DateBegin=${DateBegin} |
---|
| 182 | export PeriodDateEnd=${PeriodDateEnd} |
---|
| 183 | export StandAlone=false |
---|
| 184 | export RESOL_ATM=${RESOL_ATM} |
---|
| 185 | export RESOL_OCE=${RESOL_OCE} |
---|
| 186 | export RESOL_ICE=${RESOL_ICE} |
---|
[178] | 187 | export RESOL_MBG=${RESOL_MBG} |
---|
[22] | 188 | export RESOL_SRF=${RESOL_SRF} |
---|
[337] | 189 | export RESOL_SBG=${RESOL_SBG} |
---|
[22] | 190 | export listVarEnv=${listVarEnv} |
---|
[387] | 191 | export Script_Post_Output=${Script_Post_Output} |
---|
[22] | 192 | . ${libIGCM_POST}/libIGCM_debug/libIGCM_debug.ksh |
---|
| 193 | . ${libIGCM_POST}/libIGCM_sys/libIGCM_sys.ksh |
---|
| 194 | IGCM_sys_MkdirWork ${POST_DIR} |
---|
[1206] | 195 | IGCM_debug_Verif_Exit |
---|
[22] | 196 | IGCM_sys_QsubPost create_se |
---|
| 197 | EOF |
---|
| 198 | fi |
---|
[544] | 199 | fi |
---|
[22] | 200 | |
---|
[628] | 201 | #============== PACK PROCESSING FOR RESTART, DEBUG AND OUTPUT FILES =============# |
---|
[554] | 202 | if [ ${PackFrequency} = true ] ; then |
---|
| 203 | IGCM_debug_Print 1 "PACK POST-PROCESSING" |
---|
[628] | 204 | # ----------------------------------------------------------------------------------- |
---|
| 205 | # Function IGCM_FlushPost called by pack_output.job has not been closed yet. Do it now |
---|
[1375] | 206 | # Will submit Seasonal Average if needed |
---|
[628] | 207 | # ----------------------------------------------------------------------------------- |
---|
| 208 | if [ -f ${R_BUFR}/FlushPost_${PeriodDateEnd}.ksh ] ; then |
---|
| 209 | echo "IGCM_debug_PopStack \"IGCM_FlushPost\" " >> ${R_BUFR}/FlushPost_${PeriodDateEnd}.ksh |
---|
| 210 | echo "} " >> ${R_BUFR}/FlushPost_${PeriodDateEnd}.ksh |
---|
| 211 | fi |
---|
[554] | 212 | echo |
---|
| 213 | ## Need to Remember This One |
---|
| 214 | SavedDateBegin=${DateBegin} |
---|
| 215 | ## Need to Remember This One |
---|
| 216 | SavedDateEnd=${DateEnd} |
---|
| 217 | # |
---|
[555] | 218 | DaysTemp=$(( $( IGCM_date_DaysInPreviousPeriod ${PeriodDateEnd} ${config_Post_PackFrequency} end ) - 1 )) |
---|
[554] | 219 | # |
---|
[565] | 220 | PackDateBegin=$( IGCM_date_AddDaysToGregorianDate ${PeriodDateEnd} -${DaysTemp} ) |
---|
[555] | 221 | # |
---|
[554] | 222 | script=pack_debug |
---|
| 223 | # |
---|
| 224 | Script_Post_Output=${script}.${PeriodDateEnd} |
---|
| 225 | # |
---|
[1290] | 226 | listVarEnv="DEBUG_debug,BigBrother,postProcessingStopLevel,MODIPSL,libIGCM,libIGCM_SX,SUBMIT_DIR,POST_DIR,Script_Post_Output,MASTER,DateBegin,DateEnd,PeriodPack,StandAlone" |
---|
[554] | 227 | IGCM_sys_RshPost <<-EOF |
---|
| 228 | export DEBUG_debug=${DEBUG_debug} |
---|
[1070] | 229 | export BigBrother=${BigBrother} |
---|
[1290] | 230 | export postProcessingStopLevel=${postProcessingStopLevel} |
---|
[554] | 231 | export MODIPSL=${MODIPSL} |
---|
| 232 | export libIGCM_SX=${libIGCM} |
---|
| 233 | export libIGCM=${libIGCM_POST} |
---|
| 234 | export SUBMIT_DIR=${SUBMIT_DIR} |
---|
[568] | 235 | export POST_DIR=${POST_DIR} |
---|
[554] | 236 | export MASTER=${MASTER} |
---|
| 237 | export DateBegin=${PackDateBegin} |
---|
| 238 | export DateEnd=${PeriodDateEnd} |
---|
[569] | 239 | export PeriodPack=${config_Post_PackFrequency} |
---|
[554] | 240 | export StandAlone=false |
---|
| 241 | export listVarEnv=${listVarEnv} |
---|
| 242 | export Script_Post_Output=${Script_Post_Output} |
---|
| 243 | . ${libIGCM_POST}/libIGCM_debug/libIGCM_debug.ksh |
---|
[985] | 244 | . ${libIGCM_POST}/libIGCM_card/libIGCM_card.ksh |
---|
[554] | 245 | . ${libIGCM_POST}/libIGCM_sys/libIGCM_sys.ksh |
---|
| 246 | IGCM_sys_MkdirWork ${POST_DIR} |
---|
[1206] | 247 | IGCM_debug_Verif_Exit |
---|
[565] | 248 | IGCM_sys_QsubPost ${script} |
---|
[985] | 249 | IGCM_debug_Verif_Exit |
---|
[554] | 250 | EOF |
---|
[565] | 251 | # |
---|
| 252 | script=pack_restart |
---|
| 253 | # |
---|
| 254 | Script_Post_Output=${script}.${PeriodDateEnd} |
---|
| 255 | # |
---|
[1375] | 256 | IGCM_sys_RshPost <<-EOF |
---|
[786] | 257 | export DEBUG_debug=${DEBUG_debug} |
---|
[1070] | 258 | export BigBrother=${BigBrother} |
---|
[1290] | 259 | export postProcessingStopLevel=${postProcessingStopLevel} |
---|
[786] | 260 | export MODIPSL=${MODIPSL} |
---|
| 261 | export libIGCM_SX=${libIGCM} |
---|
| 262 | export libIGCM=${libIGCM_POST} |
---|
| 263 | export SUBMIT_DIR=${SUBMIT_DIR} |
---|
| 264 | export POST_DIR=${POST_DIR} |
---|
| 265 | export MASTER=${MASTER} |
---|
[1399] | 266 | export PeriodDateBegin=${PeriodDateBegin} |
---|
[786] | 267 | export DateBegin=${PackDateBegin} |
---|
| 268 | export DateEnd=${PeriodDateEnd} |
---|
| 269 | export PeriodPack=${config_Post_PackFrequency} |
---|
| 270 | export StandAlone=false |
---|
| 271 | export listVarEnv=${listVarEnv} |
---|
| 272 | export Script_Post_Output=${Script_Post_Output} |
---|
| 273 | . ${libIGCM_POST}/libIGCM_debug/libIGCM_debug.ksh |
---|
[985] | 274 | . ${libIGCM_POST}/libIGCM_card/libIGCM_card.ksh |
---|
[786] | 275 | . ${libIGCM_POST}/libIGCM_sys/libIGCM_sys.ksh |
---|
| 276 | IGCM_sys_MkdirWork ${POST_DIR} |
---|
[1206] | 277 | IGCM_debug_Verif_Exit |
---|
[786] | 278 | IGCM_sys_QsubPost ${script} |
---|
[985] | 279 | IGCM_debug_Verif_Exit |
---|
[565] | 280 | EOF |
---|
[583] | 281 | # |
---|
| 282 | script=pack_output |
---|
| 283 | # |
---|
| 284 | Script_Post_Output=${script}.${PeriodDateEnd} |
---|
| 285 | # |
---|
[1375] | 286 | IGCM_sys_RshPost <<-EOF |
---|
[786] | 287 | export DEBUG_debug=${DEBUG_debug} |
---|
[1070] | 288 | export BigBrother=${BigBrother} |
---|
[1290] | 289 | export postProcessingStopLevel=${postProcessingStopLevel} |
---|
[786] | 290 | export MODIPSL=${MODIPSL} |
---|
| 291 | export libIGCM_SX=${libIGCM} |
---|
| 292 | export libIGCM=${libIGCM_POST} |
---|
| 293 | export SUBMIT_DIR=${SUBMIT_DIR} |
---|
| 294 | export POST_DIR=${POST_DIR} |
---|
| 295 | export MASTER=${MASTER} |
---|
| 296 | export DateBegin=${PackDateBegin} |
---|
| 297 | export DateEnd=${PeriodDateEnd} |
---|
| 298 | export PeriodPack=${config_Post_PackFrequency} |
---|
| 299 | export StandAlone=false |
---|
| 300 | export listVarEnv=${listVarEnv} |
---|
| 301 | export Script_Post_Output=${Script_Post_Output} |
---|
| 302 | . ${libIGCM_POST}/libIGCM_debug/libIGCM_debug.ksh |
---|
[985] | 303 | . ${libIGCM_POST}/libIGCM_card/libIGCM_card.ksh |
---|
[786] | 304 | . ${libIGCM_POST}/libIGCM_sys/libIGCM_sys.ksh |
---|
| 305 | IGCM_sys_MkdirWork ${POST_DIR} |
---|
[1206] | 306 | IGCM_debug_Verif_Exit |
---|
[786] | 307 | IGCM_sys_QsubPost ${script} |
---|
[985] | 308 | IGCM_debug_Verif_Exit |
---|
[583] | 309 | EOF |
---|
[1375] | 310 | export DateBegin=${SavedDateBegin} |
---|
| 311 | export DateEnd=${SavedDateEnd} |
---|
[554] | 312 | fi |
---|
[590] | 313 | |
---|
| 314 | #============== REBUILD POST-PROCESSING =============# |
---|
[804] | 315 | if ( [ X${AsynchronousRebuild} = Xtrue ] && [ -f ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh ] ) ; then |
---|
[590] | 316 | # ----------------------------------------------------------------------------------- |
---|
| 317 | # Function IGCM_FlushRebuild define in rebuild.ksh has not been closed yet. Do it now |
---|
| 318 | # ----------------------------------------------------------------------------------- |
---|
[1043] | 319 | echo "IGCM_debug_PopStack \"IGCM_FlushRebuild\" " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh |
---|
| 320 | echo "} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh |
---|
| 321 | IGCM_sys_Mv REBUILD_${PeriodDateBegin} ${REBUILD_DIR} |
---|
[590] | 322 | fi |
---|
| 323 | # |
---|
| 324 | if [ ${RebuildFrequency} = true ] ; then |
---|
[1031] | 325 | IGCM_debug_Print 1 "REBUILD POST-PROCESSING FROM WORKDIR" |
---|
| 326 | echo |
---|
[927] | 327 | script=rebuild_fromWorkdir |
---|
[590] | 328 | # |
---|
| 329 | Script_Post_Output=${script}.${PeriodDateEnd} |
---|
| 330 | # |
---|
[1290] | 331 | listVarEnv="DEBUG_debug,BigBrother,postProcessingStopLevel,MODIPSL,libIGCM,libIGCM_SX,SUBMIT_DIR,REBUILD_DIR,POST_DIR,Script_Post_Output,MASTER,DateBegin,PeriodDateBegin,PeriodDateEnd,NbRebuildDir,StandAlone,RESOL_ATM,RESOL_OCE,RESOL_ICE,RESOL_MBG,RESOL_SRF,RESOL_SBG" |
---|
[590] | 332 | IGCM_sys_RshPost <<-EOF |
---|
[786] | 333 | export DEBUG_debug=${DEBUG_debug} |
---|
[1070] | 334 | export BigBrother=${BigBrother} |
---|
[1290] | 335 | export postProcessingStopLevel=${postProcessingStopLevel} |
---|
[786] | 336 | export MODIPSL=${MODIPSL} |
---|
| 337 | export libIGCM_SX=${libIGCM} |
---|
| 338 | export libIGCM=${libIGCM_POST} |
---|
| 339 | export SUBMIT_DIR=${SUBMIT_DIR} |
---|
| 340 | export REBUILD_DIR=${REBUILD_DIR} |
---|
| 341 | export POST_DIR=${POST_DIR} |
---|
| 342 | export MASTER=${MASTER} |
---|
| 343 | export DateBegin=${DateBegin} |
---|
| 344 | export PeriodDateBegin=${PeriodDateBegin} |
---|
| 345 | export PeriodDateEnd=${PeriodDateEnd} |
---|
| 346 | export NbRebuildDir=${NbRebuildDir} |
---|
| 347 | export StandAlone=false |
---|
| 348 | export RESOL_ATM=${RESOL_ATM} |
---|
| 349 | export RESOL_OCE=${RESOL_OCE} |
---|
| 350 | export RESOL_ICE=${RESOL_ICE} |
---|
| 351 | export RESOL_MBG=${RESOL_MBG} |
---|
| 352 | export RESOL_SRF=${RESOL_SRF} |
---|
| 353 | export RESOL_SBG=${RESOL_SBG} |
---|
| 354 | export listVarEnv=${listVarEnv} |
---|
| 355 | export Script_Post_Output=${Script_Post_Output} |
---|
| 356 | . ${libIGCM_POST}/libIGCM_debug/libIGCM_debug.ksh |
---|
[985] | 357 | . ${libIGCM_POST}/libIGCM_card/libIGCM_card.ksh |
---|
[786] | 358 | . ${libIGCM_POST}/libIGCM_sys/libIGCM_sys.ksh |
---|
| 359 | IGCM_sys_MkdirWork ${POST_DIR} |
---|
[1206] | 360 | IGCM_debug_Verif_Exit |
---|
[786] | 361 | IGCM_sys_QsubPost ${script} |
---|
[985] | 362 | IGCM_debug_Verif_Exit |
---|
[590] | 363 | EOF |
---|
| 364 | fi |
---|
[544] | 365 | IGCM_debug_PopStack "IGCM_post_Submit" |
---|
[2] | 366 | } |
---|
[380] | 367 | |
---|
| 368 | #=================================== |
---|
| 369 | function IGCM_post_CheckModuloFrequency |
---|
| 370 | { |
---|
[1057] | 371 | IGCM_debug_PushStack "IGCM_post_CheckModuloFrequency" $@ |
---|
[380] | 372 | |
---|
[544] | 373 | # Used by IGCM_config_Check |
---|
| 374 | # from 2 libIGCM compatible frequency (*Y, *M, *D, *y, *m, *d) |
---|
| 375 | # Issue an exit instruction IGCM_debug_Exit if there modulo is not zero |
---|
| 376 | # Input parameter are the name of the variable, not the frequency value itself |
---|
| 377 | # example |
---|
| 378 | # IGCM_post_ModuloFrequency config_Post_RebuildFrequency config_UserChoices_PeriodLength |
---|
[380] | 379 | |
---|
[544] | 380 | typeset MasterName SlaveName MasterFrequency SlaveFrequency PeriodMasterYear PeriodMasterMonth PeriodMasterDay PeriodSlaveYear PeriodSlaveMonth PeriodSlaveDay |
---|
[380] | 381 | |
---|
[544] | 382 | # Get the name of the variable |
---|
| 383 | MasterName=$1 |
---|
| 384 | SlaveName=$2 |
---|
| 385 | # Get the value the above name points to |
---|
| 386 | MasterFrequency=$( eval echo \${${1}} ) |
---|
| 387 | SlaveFrequency=$( eval echo \${${2}} ) |
---|
[380] | 388 | |
---|
[544] | 389 | IGCM_debug_Print 2 "IGCM_post_CheckModuloFrequency : Master=${MasterFrequency} Slave=${SlaveFrequency}" |
---|
[380] | 390 | |
---|
[544] | 391 | case ${MasterFrequency} in |
---|
| 392 | *y|*Y) |
---|
| 393 | PeriodMasterYear=$( echo ${MasterFrequency} | sed -e "s/[yY]//" ) |
---|
| 394 | case ${SlaveFrequency} in |
---|
| 395 | *Y|*y) |
---|
| 396 | PeriodSlaveYear=$( echo ${SlaveFrequency} | sed -e "s/[yY]//" ) |
---|
| 397 | if ( [ ${PeriodSlaveYear} -gt ${PeriodMasterYear} ] || \ |
---|
[786] | 398 | [ $(( ${PeriodMasterYear} % ${PeriodSlaveYear} )) -ne 0 ] ); then |
---|
| 399 | IGCM_debug_Print 1 "${SlaveName} frequency ${SlaveFrequency} not compatbile with" |
---|
| 400 | IGCM_debug_Print 1 "${MasterName} frequency : ${MasterFrequency}" |
---|
| 401 | IGCM_debug_Exit "Check your frequency" |
---|
[639] | 402 | else |
---|
| 403 | [ X${3} = XNbPeriodPerFrequency ] && NbPeriodPerFrequency=$(( ${PeriodMasterYear} / ${PeriodSlaveYear} )) |
---|
[544] | 404 | fi ;; |
---|
| 405 | *M|*m) |
---|
| 406 | PeriodSlaveMonth=$( echo ${SlaveFrequency} | sed -e "s/[mM]//" ) |
---|
| 407 | if ( [ ${PeriodSlaveMonth} -gt $(( ${PeriodMasterYear} * 12 )) ] || \ |
---|
[786] | 408 | [ $(( ( ${PeriodMasterYear} * 12 ) % ${PeriodSlaveMonth} )) -ne 0 ] ) ; then |
---|
| 409 | IGCM_debug_Print 1 "${SlaveName} frequency ${SlaveFrequency} not compatbile with" |
---|
| 410 | IGCM_debug_Print 1 "${MasterName} frequency : ${MasterFrequency}" |
---|
| 411 | IGCM_debug_Exit "Check your frequency" |
---|
[639] | 412 | else |
---|
| 413 | [ X${3} = XNbPeriodPerFrequency ] && NbPeriodPerFrequency=$(( ( 12 * ${PeriodMasterYear} ) / ${PeriodSlaveMonth} )) |
---|
[544] | 414 | fi ;; |
---|
| 415 | *D|*d) |
---|
| 416 | PeriodSlaveDay=$( echo ${SlaveFrequency} | sed -e "s/[dD]//" ) |
---|
| 417 | NbDays=$( IGCM_date_DaysInYear ${year} ) |
---|
| 418 | if [ ${config_UserChoices_CalendarType} = 360d ] || [ ${config_UserChoices_CalendarType} = noleap ] ; then |
---|
[786] | 419 | if ( [ ${PeriodSlaveDay} -gt $(( ${PeriodMasterYear} * ${NbDays} )) ] || \ |
---|
| 420 | [ $(( ( ${PeriodMasterYear} * ${NbDays} ) % ${PeriodSlaveDay} )) -ne 0 ] ; ) then |
---|
| 421 | IGCM_debug_Print 1 "${SlaveName} frequency ${SlaveFrequency} not compatbile with" |
---|
| 422 | IGCM_debug_Print 1 "${MasterName} frequency : ${MasterFrequency}" |
---|
| 423 | IGCM_debug_Exit "Check your frequency" |
---|
| 424 | fi |
---|
[544] | 425 | else |
---|
[786] | 426 | IGCM_debug_Print 1 "For ${MasterName} with leap calendar:" |
---|
| 427 | IGCM_debug_Print 1 "We have a daily ${SlaveName} frequency and ${MasterName}=${MasterFrequency}" |
---|
| 428 | IGCM_debug_Print 1 "No post-treatment. Case not properly handle at this moment by libIGCM. Sorry" |
---|
| 429 | IGCM_debug_Exit "Check your frequency ${MasterName} and choose a daily frequency for this one too." |
---|
[544] | 430 | fi ;; |
---|
| 431 | esac ;; |
---|
| 432 | *M|*m) |
---|
| 433 | PeriodMasterMonth=$( echo ${MasterFrequency} | sed -e "s/[mM]//" ) |
---|
[590] | 434 | case ${SlaveFrequency} in |
---|
[544] | 435 | *Y|*y) |
---|
| 436 | PeriodSlaveYear=$( echo ${SlaveFrequency} | sed -e "s/[yY]//" ) |
---|
| 437 | if ( [ ${PeriodMasterMonth} -gt $(( ${PeriodSlaveYear} * 12 )) ] || \ |
---|
[786] | 438 | [ $(( ${PeriodMasterMonth} % ( ${PeriodSlaveYear} * 12 ) )) -ne 0 ] ) ; then |
---|
| 439 | IGCM_debug_Print 1 "${SlaveName} frequency ${SlaveFrequency} not compatbile with" |
---|
| 440 | IGCM_debug_Print 1 "${MasterName} frequency : ${MasterFrequency}" |
---|
| 441 | IGCM_debug_Exit "Check your frequency" |
---|
[639] | 442 | else |
---|
| 443 | [ X${3} = XNbPeriodPerFrequency ] && NbPeriodPerFrequency=$(( ${PeriodMasterMonth} / ( 12 * ${PeriodSlaveYear} ) )) |
---|
[544] | 444 | fi ;; |
---|
| 445 | *M|*m) |
---|
| 446 | PeriodSlaveMonth=$( echo ${SlaveFrequency} | sed -e "s/[mM]//" ) |
---|
| 447 | if ( [ ${PeriodSlaveMonth} -gt ${PeriodMasterMonth} ] || \ |
---|
[1077] | 448 | [ $(( ${PeriodMasterMonth} % ${PeriodSlaveMonth} )) -ne 0 ] ) ; then |
---|
[786] | 449 | IGCM_debug_Print 1 "${SlaveName} frequency ${SlaveFrequency} not compatbile with" |
---|
| 450 | IGCM_debug_Print 1 "${MasterName} frequency : ${MasterFrequency}" |
---|
| 451 | IGCM_debug_Exit "Check your frequency" |
---|
[639] | 452 | else |
---|
| 453 | [ X${3} = XNbPeriodPerFrequency ] && NbPeriodPerFrequency=$(( ${PeriodMasterMonth} / ${PeriodSlaveMonth} )) |
---|
[544] | 454 | fi ;; |
---|
| 455 | *D|*d) |
---|
| 456 | IGCM_debug_Print 1 "${SlaveName} frequency ${SlaveFrequency} not compatbile with" |
---|
| 457 | IGCM_debug_Print 1 "${MasterName} frequency : ${MasterFrequency}" |
---|
| 458 | IGCM_debug_Exit "Check your frequency" ;; |
---|
| 459 | esac ;; |
---|
| 460 | *D|*d) |
---|
| 461 | PeriodMasterDay=$( echo ${MasterFrequency} | sed -e "s/[dD]//" ) |
---|
| 462 | case ${SlaveFrequency} in |
---|
| 463 | *Y|*y) |
---|
| 464 | IGCM_debug_Print 1 "${SlaveName} frequency ${SlaveFrequency} not compatbile with" |
---|
| 465 | IGCM_debug_Print 1 "${MasterName} frequency ${MasterFrequency}" |
---|
| 466 | IGCM_debug_Exit "Check your frequency" ;; |
---|
| 467 | *M|*m) |
---|
| 468 | IGCM_debug_Print 1 "${SlaveName} frequency ${SlaveFrequency} not compatbile with" |
---|
| 469 | IGCM_debug_Print 1 "${MasterName} frequency ${MasterFrequency}" |
---|
| 470 | IGCM_debug_Exit "Check your frequency" ;; |
---|
| 471 | *D|*d) |
---|
| 472 | PeriodSlaveDay=$( echo ${SlaveFrequency} | sed -e "s/[dD]//" ) |
---|
| 473 | if ( [ ${PeriodSlaveDay} -gt ${PeriodMasterDay} ] || \ |
---|
| 474 | [ $(( ${PeriodMasterDay} % ${PeriodSlaveDay} )) -ne 0 ] ) ; then |
---|
| 475 | IGCM_debug_Print 1 "${SlaveName} frequency ${SlaveFrequency} not compatbile with" |
---|
| 476 | IGCM_debug_Print 1 "${MasterName} frequency : ${MasterFrequency}" |
---|
[786] | 477 | IGCM_debug_Exit "Check your frequency" |
---|
[639] | 478 | else |
---|
| 479 | [ X${3} = XNbPeriodPerFrequency ] && NbPeriodPerFrequency=$(( ${PeriodMasterDay} / ${PeriodSlaveDay} )) |
---|
[544] | 480 | fi ;; |
---|
| 481 | esac ;; |
---|
[545] | 482 | NONE|none) |
---|
[544] | 483 | ;; |
---|
| 484 | *) |
---|
| 485 | IGCM_debug_Print 1 "KeyWord ${MasterFrequency} not allowed for ${MasterName} in config.card" |
---|
| 486 | IGCM_debug_Exit "Check your ${MasterName} in config.card" ;; |
---|
| 487 | esac |
---|
[380] | 488 | |
---|
[544] | 489 | IGCM_debug_PopStack "IGCM_post_CheckModuloFrequency" |
---|
[380] | 490 | } |
---|
| 491 | |
---|
| 492 | #=================================== |
---|
| 493 | function IGCM_post_ModuloRuntimeFrequency |
---|
| 494 | { |
---|
[1057] | 495 | IGCM_debug_PushStack "IGCM_post_ModuloRuntimeFrequency" $@ |
---|
[380] | 496 | |
---|
[544] | 497 | # Used by IGCM_post_Configure |
---|
[1077] | 498 | # - from libIGCM (config_UserChoices_PeriodLength frequency * CumulPeriod) and |
---|
[544] | 499 | # - post-processing compatible frequency (*Y, *M, *D, *y, *m, *d) |
---|
| 500 | # --> turn on post-processing submission when their modulo is zero |
---|
| 501 | # Input parameter are the name of the variable, not the frequency value itself |
---|
| 502 | # example |
---|
| 503 | # IGCM_post_ModuloRuntimeFrequency config_Post_SeasonalFrequency config_UserChoices_PeriodLength |
---|
[380] | 504 | |
---|
[544] | 505 | typeset MasterName SlaveName MasterFrequency SlaveFrequency PeriodMasterYear PeriodMasterMonth PeriodMasterDay PeriodSlaveYear PeriodSlaveMonth PeriodSlaveDay |
---|
[380] | 506 | |
---|
[544] | 507 | # Get the name of the variable |
---|
| 508 | MasterName=$1 |
---|
| 509 | SlaveName=$2 |
---|
| 510 | # Get the value the above name points to |
---|
| 511 | eval MasterFrequency=\${${1}} |
---|
| 512 | eval SlaveFrequency=\${${2}} |
---|
[380] | 513 | |
---|
[544] | 514 | echo |
---|
| 515 | IGCM_debug_Print 2 "IGCM_post_ModuloRuntimeFrequency : Master=${MasterFrequency} Slave=${SlaveFrequency} CumulPeriod=${CumulPeriod}" |
---|
[380] | 516 | |
---|
[544] | 517 | case ${MasterFrequency} in |
---|
| 518 | *y|*Y) |
---|
| 519 | PeriodMasterYear=$( echo ${MasterFrequency} | sed -e "s/[yY]//" ) |
---|
| 520 | case ${SlaveFrequency} in |
---|
| 521 | *Y|*y) |
---|
| 522 | PeriodSlaveYear=$( echo ${SlaveFrequency} | sed -e "s/[yY]//" ) |
---|
| 523 | if [ $(( ( ${CumulPeriod} * ${PeriodSlaveYear} - ${PeriodOffset} ) % ${PeriodMasterYear} )) -eq 0 ] ; then |
---|
[786] | 524 | if [ $(( ${CumulPeriod} * ${PeriodSlaveYear} - ${PeriodOffset} )) -ne 0 ] ; then |
---|
| 525 | eval ${post_freq}=true ; POST=true |
---|
| 526 | [ X${3} = XNbPeriodPerFrequency ] && NbPeriodPerFrequency=$(( ${PeriodMasterYear} / ${PeriodSlaveYear} )) |
---|
| 527 | fi |
---|
[544] | 528 | fi;; |
---|
| 529 | *M|*m) |
---|
| 530 | PeriodSlaveMonth=$( echo ${SlaveFrequency} | sed -e "s/[mM]//" ) |
---|
| 531 | if [ $(( ( ${CumulPeriod} * ${PeriodSlaveMonth} - ${PeriodOffset} * 12 ) % ( ${PeriodMasterYear} * 12 ) )) -eq 0 ] ; then |
---|
[786] | 532 | if [ $(( ${CumulPeriod} * ${PeriodSlaveMonth} - ${PeriodOffset} * 12 )) -ne 0 ] ; then |
---|
| 533 | eval ${post_freq}=true ; POST=true |
---|
| 534 | [ X${3} = XNbPeriodPerFrequency ] && NbPeriodPerFrequency=$(( ( 12 * ${PeriodMasterYear} ) / ${PeriodSlaveMonth} )) |
---|
| 535 | fi |
---|
[544] | 536 | fi;; |
---|
| 537 | *D|*d) |
---|
| 538 | PeriodSlaveDay=$( echo ${SlaveFrequency} | sed -e "s/[dD]//" ) |
---|
| 539 | NbDays=$( IGCM_date_DaysInYear ${year} ) |
---|
| 540 | if [ $(( ( ${CumulPeriod} - ( ${PeriodOffset} * ${NbDays} / ${PeriodSlaveDay} ) ) % ( ${NbDays} * ${PeriodMasterYear} / ${PeriodSlaveDay} ) )) -eq 0 ] ; then |
---|
[786] | 541 | if [ $(( ${CumulPeriod} - ( ${PeriodOffset} * ${NbDays} / ${PeriodSlaveDay} ) )) -ne 0 ] ; then |
---|
| 542 | eval ${post_freq}=true ; POST=true |
---|
| 543 | [ X${3} = XNbPeriodPerFrequency ] && NbPeriodPerFrequency=$(( ( ${NbDays} * ${PeriodMasterYear} ) / ${PeriodSlaveDay} )) |
---|
| 544 | fi |
---|
[544] | 545 | fi;; |
---|
| 546 | esac ;; |
---|
| 547 | *M|*m) |
---|
| 548 | PeriodMasterMonth=$( echo ${MasterFrequency} | sed -e "s/[mM]//" ) |
---|
| 549 | case ${SlaveFrequency} in |
---|
| 550 | *Y|*y) |
---|
| 551 | PeriodSlaveYear=$( echo ${SlaveFrequency} | sed -e "s/[yY]//" ) |
---|
| 552 | if [ $(( ( ${CumulPeriod} * ${PeriodSlaveYear} * 12 - ${PeriodOffset} ) % ( ${PeriodMasterMonth} ) )) -eq 0 ] ; then |
---|
[786] | 553 | if [ $(( ${CumulPeriod} * ${PeriodSlaveYear} * 12 - ${PeriodOffset} )) -ne 0 ] ; then |
---|
| 554 | eval ${post_freq}=true ; POST=true |
---|
| 555 | [ X${3} = XNbPeriodPerFrequency ] && NbPeriodPerFrequency=$(( ${PeriodMasterMonth} / ( 12 * ${PeriodSlaveYear} ) )) |
---|
| 556 | fi |
---|
[544] | 557 | fi;; |
---|
| 558 | *M|*m) |
---|
| 559 | PeriodSlaveMonth=$( echo ${SlaveFrequency} | sed -e "s/[mM]//" ) |
---|
| 560 | if [ $(( ( ${CumulPeriod} * ${PeriodSlaveMonth} - ${PeriodOffset} ) % ${PeriodMasterMonth} )) -eq 0 ] ; then |
---|
[1077] | 561 | if [ $(( ${CumulPeriod} * ${PeriodSlaveMonth} - ${PeriodOffset} )) -ne 0 ] ; then |
---|
[786] | 562 | eval ${post_freq}=true ; POST=true |
---|
| 563 | [ X${3} = XNbPeriodPerFrequency ] && NbPeriodPerFrequency=$(( ${PeriodMasterMonth} / ${PeriodSlaveMonth} )) |
---|
| 564 | fi |
---|
[544] | 565 | fi;; |
---|
| 566 | *D|*d) |
---|
| 567 | IGCM_debug_Print 1 "PeriodLength frequency ${SlaveFrequency} not compatbile with" |
---|
| 568 | IGCM_debug_Print 1 "${flag_post} frequency : ${MasterFrequency} " ;; |
---|
| 569 | esac ;; |
---|
| 570 | *D|*d) |
---|
| 571 | PeriodMasterDay=$( echo ${MasterFrequency} | sed -e "s/[dD]//" ) |
---|
| 572 | case ${SlaveFrequency} in |
---|
| 573 | *Y|*y) |
---|
| 574 | IGCM_debug_Print 1 "PeriodLength frequency ${SlaveFrequency} not compatbile with" |
---|
| 575 | IGCM_debug_Print 1 "${flag_post} frequency : ${MasterFrequency} " ;; |
---|
| 576 | *M|*m) |
---|
| 577 | IGCM_debug_Print 1 "PeriodLength frequency ${SlaveFrequency} not compatbile with" |
---|
| 578 | IGCM_debug_Print 1 "${flag_post} frequency : ${MasterFrequency} " ;; |
---|
| 579 | *D|*d) |
---|
| 580 | PeriodSlaveDay=$( echo ${SlaveFrequency} | sed -e "s/[dD]//" ) |
---|
| 581 | if [ $(( ( ${CumulPeriod} * ${PeriodSlaveDay} - ${PeriodOffset} ) % ${PeriodMasterDay} )) -eq 0 ] ; then |
---|
| 582 | if [ $(( ${CumulPeriod} * ${PeriodSlaveDay} - ${PeriodOffset} )) -ne 0 ] ; then |
---|
[786] | 583 | eval ${post_freq}=true ; POST=true |
---|
| 584 | [ X${3} = XNbPeriodPerFrequency ] && NbPeriodPerFrequency=$(( ${PeriodMasterDay} / ${PeriodSlaveDay} )) |
---|
| 585 | fi |
---|
[544] | 586 | fi;; |
---|
| 587 | esac ;; |
---|
| 588 | NONE|none) |
---|
| 589 | ;; |
---|
| 590 | *) |
---|
| 591 | IGCM_debug_Print 1 "KeyWord not allowed for ${post_freq} in config.card" |
---|
| 592 | ;; |
---|
| 593 | esac |
---|
[380] | 594 | |
---|
[544] | 595 | IGCM_debug_PopStack "IGCM_post_ModuloRuntimeFrequency" |
---|
[380] | 596 | } |
---|