Changeset 1026 for trunk/libIGCM/libIGCM_ensemble/libIGCM_ensemble.ksh
- Timestamp:
- 07/24/14 16:45:56 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libIGCM/libIGCM_ensemble/libIGCM_ensemble.ksh
r1007 r1026 2 2 3 3 #************************************************************** 4 # Author: Sebastien Denvil, Sonia Labetoulle, Nicolas Lebas 4 # Author: Sebastien Denvil, Sonia Labetoulle, Nicolas Lebas, Sebastien Nguyen 5 5 # Contact: Nicolas.Lebas__at__locean-ipsl.upmc.fr 6 6 # $Revision:: $ Revision of last commit … … 10 10 # This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC 11 11 # 12 # >>> Date ensemble <<< 13 # Author: Nicolas Lebas (adapted from Sonia Labetoulle) 14 # Contact: Nicolas.Lebas__at__locean-ipsl.upmc.fr 15 # IPSL (2014) 16 # 17 # >>> Add 3D perturbation maps to oceanic restart <<< 18 # Author: Sebastien Nguyen 19 # Contact: Sebastien.Nguyen__at__locean-ipsl.upmc.fr 20 # IPSL (2014) 21 # 12 22 #************************************************************** 13 23 … … 21 31 IGCM_card_DefineVariableFromOption ${F_CFG_ENS} Ens_PARAMETRIC active 22 32 23 IGCM_debug_Print 1 "Ens_PERTURB ACTIVE 24 IGCM_debug_Print 1 "Ens_DATE ACTIVE = ${ensemble_Ens_DATE_active}"33 IGCM_debug_Print 1 "Ens_PERTURB ACTIVE = ${ensemble_Ens_PERTURB_active}" 34 IGCM_debug_Print 1 "Ens_DATE ACTIVE = ${ensemble_Ens_DATE_active}" 25 35 IGCM_debug_Print 1 "Ens_PARAMETRIC ACTIVE = ${ensemble_Ens_PARAMETRIC_active}" 26 36 echo "" … … 52 62 IGCM_sys_Cp ${SUBMIT_DIR}/run.card.init ${RUN_DIR} 53 63 if [ -f ${SUBMIT_DIR}/Qsub.* ]; then 54 64 IGCM_sys_Cp ${SUBMIT_DIR}/Qsub.* ${RUN_DIR} 55 65 fi 56 66 if [ -f ${SUBMIT_DIR}/Qclean.* ]; then 57 67 IGCM_sys_Cp ${SUBMIT_DIR}/Qclean.* ${RUN_DIR} 58 68 fi 59 69 … … 66 76 # IGCM_sys_Cp ${SUBMIT_DIR}/Qsub.sh ${RUN_DIR} 67 77 #fi 78 echo ${PWD} 79 80 IGCM_card_DefineVariableFromOption ${F_CFG_ENS} Ens_PERTURB active 68 81 IGCM_card_DefineVariableFromOption ${F_CFG_ENS} Ens_PERTURB NAME 69 82 IGCM_card_DefineVariableFromOption ${F_CFG_ENS} Ens_PERTURB BEGIN_INIT … … 74 87 IGCM_card_DefineArrayFromOption ${F_CFG_ENS} Ens_PERTURB LENGTH_NONPERIODIC 75 88 IGCM_card_DefineVariableFromOption ${F_CFG_ENS} Ens_PERTURB MEMBER 89 IGCM_card_DefineArrayFromOption ${F_CFG_ENS} Ens_PERTURB MEMBER_LIST 90 IGCM_card_DefineArrayFromOption ${F_CFG_ENS} Ens_PERTURB MEMBER_NAMESLIST 91 IGCM_card_DefineVariableFromOption ${F_CFG_ENS} Ens_PERTURB MEMBER_INITFROM 92 IGCM_card_DefineVariableFromOption ${F_CFG_ENS} Ens_PERTURB MEMBER_INITPATH 76 93 IGCM_card_DefineArrayFromOption ${F_CFG_ENS} Ens_PERTURB PERTURB_BIN 77 94 IGCM_card_DefineVariableFromOption ${F_CFG_ENS} Ens_PERTURB INITFROM … … 93 110 IGCM_debug_Print 1 "LENGTH_NONPERIODIC = ${ensemble_Ens_PERTURB_LENGTH_NONPERIODIC[*]}" 94 111 IGCM_debug_Print 1 "MEMBER = ${ensemble_Ens_PERTURB_MEMBER}" 112 IGCM_debug_Print 1 "MEMBER_LIST = ${ensemble_Ens_PERTURB_MEMBER_LIST[*]}" 113 IGCM_debug_Print 1 "MEMBER_NAMESLIST = ${ensemble_Ens_PERTURB_MEMBER_NAMESLIST[*]}" 114 IGCM_debug_Print 1 "MEMBER_INITFROM = ${ensemble_Ens_PERTURB_MEMBER_INITFROM}" 115 IGCM_debug_Print 1 "MEMBER_INITPATH = ${ensemble_Ens_PERTURB_MEMBER_INITPATH}" 95 116 IGCM_debug_Print 1 "PERTURB_BIN = ${ensemble_Ens_PERTURB_PERTURB_BIN[*]}" 96 117 IGCM_debug_Print 1 "INITFROM = ${ensemble_Ens_PERTURB_INITFROM}" … … 102 123 103 124 PerturbExe=${ensemble_Ens_PERTURB_PERTURB_BIN[0]} 104 PerturbComp=${ensemble_Ens_PERTURB_PERTURB_BIN[1]} 105 PerturbFile=${ensemble_Ens_PERTURB_PERTURB_BIN[2]} 106 PerturbVar=${ensemble_Ens_PERTURB_PERTURB_BIN[3]} 107 PerturbAmp=${ensemble_Ens_PERTURB_PERTURB_BIN[4]} 108 109 IGCM_debug_Print 1 "PerturbExe = ${PerturbExe}" 110 IGCM_debug_Print 1 "PerturbFile = ${PerturbFile}" 111 IGCM_debug_Print 1 "PerturbComp = ${PerturbComp}" 112 IGCM_debug_Print 1 "PerturbVar = ${PerturbVar}" 113 IGCM_debug_Print 1 "PerturbAmp = ${PerturbAmp}" 125 126 case ${PerturbExe} in 127 AddNoise) 128 PerturbComp=${ensemble_Ens_PERTURB_PERTURB_BIN[1]} 129 PerturbFile=${ensemble_Ens_PERTURB_PERTURB_BIN[2]} 130 PerturbVar=${ensemble_Ens_PERTURB_PERTURB_BIN[3]} 131 PerturbAmp=${ensemble_Ens_PERTURB_PERTURB_BIN[4]} 132 133 IGCM_debug_Print 1 "PerturbExe = ${PerturbExe}" 134 IGCM_debug_Print 1 "PerturbFile = ${PerturbFile}" 135 IGCM_debug_Print 1 "PerturbComp = ${PerturbComp}" 136 IGCM_debug_Print 1 "PerturbVar = ${PerturbVar}" 137 IGCM_debug_Print 1 "PerturbAmp = ${PerturbAmp}" 138 ;; 139 AddPertu3DOCE) 140 PerturbComp=${ensemble_Ens_PERTURB_PERTURB_BIN[1]} 141 PerturbFile=${ensemble_Ens_PERTURB_PERTURB_BIN[2]} 142 PerturbVar=${ensemble_Ens_PERTURB_PERTURB_BIN[3]} 143 PerturbMask=${ensemble_Ens_PERTURB_PERTURB_BIN[4]} 144 145 IGCM_card_DefineVariableFromOption ${F_CFG_ENS} Ens_PERTURB MASKPATH 146 147 IGCM_debug_Print 1 "PerturbExe = ${PerturbExe}" 148 IGCM_debug_Print 1 "PerturbFile = ${PerturbFile}" 149 IGCM_debug_Print 1 "PerturbComp = ${PerturbComp}" 150 IGCM_debug_Print 1 "PerturbVar = ${PerturbVar}" 151 IGCM_debug_Print 1 "PerturbMask = ${PerturbMask}" 152 IGCM_debug_Print 1 "MASK PATH = ${ensemble_Ens_PERTURB_MASKPATH}" 153 ;; 154 esac 114 155 115 156 IGCM_ensemble_SetAlpha ${ensemble_Ens_PERTURB_MEMBER} … … 119 160 # ... Check PERIODICITY ... 120 161 case ${ensemble_Ens_PERTURB_PERIODICITY} in 121 _0_)162 NONE) 122 163 IGCM_debug_Print 1 "periodic start not active" 123 164 CastPeriodicStart=false … … 131 172 IGCM_debug_Verif_Exit ;; 132 173 esac 133 # ... Check LENGTH ...174 # ... Check LENGTH ... 134 175 case ${ensemble_Ens_PERTURB_LENGTH} in 135 176 *[Yy]|*[Mm]) … … 143 184 # A few checks for the Non-Periodic case: 144 185 DateNum=0 145 while [ $ DateNum-lt ${#ensemble_Ens_PERTURB_NONPERIODIC[*]} ] ; do186 while [ ${DateNum} -lt ${#ensemble_Ens_PERTURB_NONPERIODIC[*]} ] ; do 146 187 147 188 # - Check LENGTH_NONPERIODIC 148 case ${ensemble_Ens_PERTURB_LENGTH_NONPERIODIC[$ DateNum]} in189 case ${ensemble_Ens_PERTURB_LENGTH_NONPERIODIC[${DateNum}]} in 149 190 _0_) 150 191 IGCM_debug_Print 1 "non-periodic start not active" … … 152 193 ;; 153 194 *[Yy]|*[Mm]) 154 IGCM_debug_Print 1 "Non-periodic duration : ${ensemble_Ens_PERTURB_LENGTH_NONPERIODIC[$ DateNum]}"195 IGCM_debug_Print 1 "Non-periodic duration : ${ensemble_Ens_PERTURB_LENGTH_NONPERIODIC[${DateNum}]}" 155 196 CastNonPeriodicStart=true 156 197 ;; 157 198 *) 158 IGCM_debug_Exit "IGCM_ensemble_CastInit ${ensemble_Ens_PERTURB_LENGTH_NONPERIODIC[$ DateNum]} : invalid LENGTH"199 IGCM_debug_Exit "IGCM_ensemble_CastInit ${ensemble_Ens_PERTURB_LENGTH_NONPERIODIC[${DateNum}]} : invalid LENGTH" 159 200 IGCM_debug_Exit "choose in *Y or *M" 160 201 IGCM_debug_Verif_Exit ;; … … 162 203 (( DateNum = DateNum + 1 )) 163 204 done 205 206 # A few checks for the MEMBER_LIST case: 207 case ${ensemble_Ens_PERTURB_MEMBER_LIST[0]} in 208 _0_) 209 IGCM_debug_Print 1 "list of perturbation maps not active" 210 CastMemberList=false 211 ;; 212 *) 213 if [ ${CastPeriodicStart} = "true" ] ; then 214 IGCM_debug_Exit "list of perturbation maps for periodic start not implemented, will stop execution" 215 IGCM_debug_Verif_Exit 216 elif [ ${CastNonPeriodicStart} = "true" ] ; then 217 IGCM_debug_Exit "list of perturbation maps for non periodic start not implemented, will stop execution" 218 IGCM_debug_Verif_Exit 219 fi 220 221 # test that MEMBER_NAMESLIST and MEMBER_LIST have the same size 222 223 if [ ${#ensemble_Ens_PERTURB_MEMBER_LIST[*]} -ne ${#ensemble_Ens_PERTURB_MEMBER_NAMESLIST[*]} ] ; then 224 IGCM_debug_Exit "number of elements in MEMBER_LIST and MEMBER_NAMESLIST differ" 225 IGCM_debug_Verif_Exit 226 fi 227 228 IGCM_debug_Print 1 "list of perturbation maps : ${ensemble_Ens_PERTURB_MEMBER_LIST[*]}" 229 IGCM_debug_Print 1 "list of members names : ${ensemble_Ens_PERTURB_MEMBER_NAMESLIST[*]}" 230 CastMemberList=true 231 ;; 232 esac 233 234 # IGCM_debug_Exit "fin du test MEMBER_LIST" 235 # IGCM_debug_Verif_Exit 164 236 165 237 # Need to know all the restart filename of the component we will apply the noise to … … 307 379 echo ">${DateNum}<" 308 380 echo ">${#ensemble_Ens_PERTURB_NONPERIODIC[*]}<" 309 while [ $ DateNum-lt ${#ensemble_Ens_PERTURB_NONPERIODIC[*]} ] ; do310 DateBegin=${ensemble_Ens_PERTURB_NONPERIODIC[$ DateNum]}311 Duree=${ensemble_Ens_PERTURB_LENGTH_NONPERIODIC[$ DateNum]}381 while [ ${DateNum} -lt ${#ensemble_Ens_PERTURB_NONPERIODIC[*]} ] ; do 382 DateBegin=${ensemble_Ens_PERTURB_NONPERIODIC[${DateNum}]} 383 Duree=${ensemble_Ens_PERTURB_LENGTH_NONPERIODIC[${DateNum}]} 312 384 echo ">${DateBegin}<" 313 385 echo ">${Duree}<" … … 384 456 echo "${PeriodDateEnd} ? ${DateEnd}" 385 457 if [ ${PeriodDateEnd} -gt ${DateEnd} ] ; then 386 458 DateEnd=${PeriodDateEnd} 387 459 fi 388 460 IGCM_ensemble_CastFilesUpdate ${DateBegin} ${DateEnd} ${RestartDate} … … 403 475 done 404 476 IGCM_debug_PopStack "IGCM_ensemble_CastNonPeriodicStarts" 477 } 478 479 function IGCM_ensemble_CastMemberList 480 { 481 IGCM_debug_PushStack "IGCM_ensemble_CastMemberList" 482 483 if [ ${CastMemberList} = false ] ; then 484 IGCM_debug_PopStack "IGCM_ensemble_CastMemberList" 485 return 486 fi 487 488 echo 489 IGCM_debug_Print 1 "Manage members list" 490 491 #.. Manage members list .. 492 # ====================== 493 494 # DateBegin 495 eval DateBegin=\${ensemble_Ens_PERTURB_BEGIN_INIT} 496 497 IGCM_date_GetYearMonth ${DateBegin} year month 498 499 # - Determine number of day(s) in LENGTH 500 DureeLengthInDays=$(( $( IGCM_date_DaysInCurrentPeriod ${DateBegin} ${ensemble_Ens_PERTURB_LENGTH} ) - 1 )) 501 502 # - Determine DateEnd 503 DateEnd = $( IGCM_date_AddDaysToGregorianDate ${DateBegin} ${DureeLengthInDays} ) 504 505 # bad hack enforce yearly for parent directory name 506 # - Build directory name 507 IGCM_ensemble_CastDirectoryName ${ensemble_Ens_PERTURB_NAME} 1Y $year $month $StartDir 508 509 # - Determine RestartDate 510 (( Offset = -1 )) 511 RestartDate = $( IGCM_date_AddDaysToGregorianDate ${DateBegin} ${Offset} ) 512 513 IGCM_debug_Print 2 "${DateBegin} => ${DateEnd} : ${StartDir}" 514 echo "${DateBegin} ${DateEnd} ${StartDir}" >> ${RUN_DIR}/CreatedDir.txt 515 516 # - Create directory for current DateBegin 517 if [ ! -d ${StartDir} ] ; then 518 IGCM_sys_Mkdir ${SUBMIT_DIR}/${StartDir} 519 IGCM_sys_Cd ${SUBMIT_DIR}/${StartDir} 520 ln -s ../../.resol . 521 ln -s ../../.libmpi . 522 IGCM_sys_Cd ${RUN_DIR} 523 fi 524 525 # - Create directory to store modified restart files 526 RestartDir=${STORAGE}/IGCM_IN/${config_UserChoices_TagName}/${StartDir} 527 IGCM_sys_MkdirArchive ${RestartDir} 528 529 # - Loop over members 530 i=0 531 nbmember=${#ensemble_Ens_PERTURB_MEMBER_LIST[*]} 532 while [ $i -lt $nbmember ] ; do 533 MemberDir=${ensemble_Ens_PERTURB_MEMBER_NAMESLIST[${i}]} 534 MemberVec=${ensemble_Ens_PERTURB_MEMBER_LIST[${i}]} 535 536 JobName="Job_${MemberDir}" 537 echo 538 IGCM_debug_Print 3 "${MemberDir}" 539 540 # * Create directory if it doesn't exist and copy/link files 541 if [ ! -d ${SUBMIT_DIR}/${StartDir}/${MemberDir} ] ; then 542 IGCM_sys_Mkdir ${SUBMIT_DIR}/${StartDir}/${MemberDir} 543 IGCM_sys_Cd ${SUBMIT_DIR}/${StartDir}/${MemberDir} 544 ln -s ../../COMP 545 ln -s ../../PARAM 546 ln -s ../../POST 547 ln -s ../../DRIVER 548 IGCM_sys_Cd ${RUN_DIR} 549 IGCM_sys_Cp config.card run.card.init ${SUBMIT_DIR}/${StartDir}/${MemberDir} 550 IGCM_sys_Cp Job_${config_UserChoices_JobName} ${SUBMIT_DIR}/${StartDir}/${MemberDir}/${JobName} 551 552 # Dump command to be lauched 553 echo "cd ${StartDir}/${MemberDir}/ ;" >> ${RUN_DIR}/Qsub.${StartDir}.sh 554 echo "${SUBMIT} ${JobName} ; cd -" >> ${RUN_DIR}/Qsub.${StartDir}.sh 555 556 echo "cd ${StartDir}/${MemberDir}/ ;" >> ${RUN_DIR}/Qclean.month.${StartDir}.sh 557 echo "${libIGCM}/clean_month.job ; cd -" >> ${RUN_DIR}/Qclean.month.${StartDir}.sh 558 559 echo "cd ${StartDir}/${MemberDir}/ ;" >> ${RUN_DIR}/Qclean.year.${StartDir}.sh 560 echo "${libIGCM}/clean_year.job ; cd -" >> ${RUN_DIR}/Qclean.year.${StartDir}.sh 561 562 # * Update files : config.card, Job_, COMP/comp.card 563 IGCM_ensemble_CastFilesUpdate ${DateBegin} ${DateEnd} ${RestartDate} 564 565 # * Apply noise on restart file 566 IGCM_ensemble_CastPerturbFile 567 fi 568 569 (( i = i + 1 )) 570 done 571 572 # Done. Save ${StartDir} submission text file 573 IGCM_sys_Cp ${RUN_DIR}/Qsub.${StartDir}.sh ${SUBMIT_DIR} 574 IGCM_sys_Cp ${RUN_DIR}/Qclean.month.${StartDir}.sh ${SUBMIT_DIR} 575 IGCM_sys_Cp ${RUN_DIR}/Qclean.year.${StartDir}.sh ${SUBMIT_DIR} 576 577 IGCM_debug_PopStack "IGCM_ensemble_CastMemberList" 405 578 } 406 579 … … 436 609 sed -e "s/\(#.*\)${config_UserChoices_JobName}\( *#.*\)/\1${MemberDir} \2/" \ 437 610 -e "s/\(#.*Script_Output_\)${config_UserChoices_JobName}\(\.*\)/\1${MemberDir}\2/" \ 438 -e "s/^PeriodNb=.*/PeriodNb=60/" \611 -e "s/^PeriodNb=.*/PeriodNb=60/" \ 439 612 ${SUBMIT_DIR}/${StartDir}/${MemberDir}/Job_${MemberDir} > Job_${MemberDir}.tmp 440 613 IGCM_sys_Mv Job_${MemberDir}.tmp ${SUBMIT_DIR}/${StartDir}/${MemberDir}/Job_${MemberDir} … … 459 632 # - Build directory name 460 633 case ${Duree} in 461 462 463 464 465 466 467 468 469 470 471 472 473 474 634 *Y|*y) 635 siecle="$( echo $year | cut -c1-2 )" 636 siecle=$( (( $siecle - 18 )) ) 637 StartYear="${siecle}$( echo $year | cut -c3-4 )" 638 StartDir="${Name}${StartYear}" 639 ;; 640 *M|*m) 641 echo $month 642 siecle="$( echo $year | cut -c1-2 )" 643 siecle=$( (( $siecle - 18 )) ) 644 StartYear="${siecle}$( echo $year | cut -c3-4 )" 645 StartMonth="${AlphaMonth[ (( 10#${month} - 1 )) ]}" 646 StartDir="${Name}${StartYear}${StartMonth}" 647 ;; 475 648 esac 476 649 … … 482 655 IGCM_debug_PushStack "IGCM_ensemble_CastPerturbFile" 483 656 484 typeset i i_ j j4 file_out file_out_ 657 typeset i i_ j 658 typeset -Z4 j4 659 typeset file_out file_out_ 485 660 486 661 #.. Debug Print .. … … 597 772 598 773 elif [ X${Tared} = Xtrue ] ; then 774 IGCM_debug_Print 2 "IGCM_sys_Mv ${PerturbComp}_${FileIn}_${j4}.nc ${RUN_DIR}/${FileOut}_${j4}.nc" 599 775 IGCM_sys_Mv ${PerturbComp}_${FileIn}_${j4}.nc ${RUN_DIR}/${FileOut}_${j4}.nc 600 776 … … 624 800 625 801 elif [ X${Tared} = Xtrue ] ; then 802 IGCM_debug_Print 2 "IGCM_sys_Mv ${PerturbComp}_${FileIn}.nc ${RUN_DIR}/${FileOut}.nc" 626 803 IGCM_sys_Mv ${PerturbComp}_${FileIn}.nc ${RUN_DIR}/${FileOut}.nc 627 804 628 805 for generic in ${OtherGenericList[*]} ; do 806 IGCM_debug_Print 2 "IGCM_sys_Mv ${PerturbComp}_${ensemble_Ens_PERTURB_INITFROM}_${RestartDate}_${generic}.nc ${DirOut}/${MemberDir}_${RestartDate}_${generic}.nc" 629 807 IGCM_sys_Mv ${PerturbComp}_${ensemble_Ens_PERTURB_INITFROM}_${RestartDate}_${generic}.nc ${DirOut}/${MemberDir}_${RestartDate}_${generic}.nc 630 808 done … … 637 815 ######################## 638 816 639 IGCM_sys_Chmod 644 ${RUN_DIR}/${FileOut}.nc 640 IGCM_debug_Print 1 "${PerturbExe} ${RUN_DIR}/${FileOut}.nc ${PerturbVar} ${PerturbAmp}" 641 echo 642 ${PerturbExe} ${RUN_DIR}/${FileOut}.nc ${PerturbVar} ${PerturbAmp} > /dev/null 2>&1 643 644 if [ $? -ne 0 ] ; then 645 IGCM_debug_Exit "Abend $( basename ${PerturbExe} )" 646 IGCM_debug_Verif_Exit 647 fi 648 IGCM_sys_Put_Out ${RUN_DIR}/${FileOut}.nc ${DirOut}/ 644 817 # treat the perturbation on different components by looking at the executable name 818 819 case ${PerturbExe} in 820 (AddNoise) 821 IGCM_sys_Chmod 644 ${RUN_DIR}/${FileOut}.nc 822 823 IGCM_debug_Print 1 "${PerturbExe} ${RUN_DIR}/${FileOut}.nc ${PerturbVar} ${PerturbAmp}" 824 echo 825 826 ${PerturbExe} ${RUN_DIR}/${FileOut}.nc ${PerturbVar} ${PerturbAmp} > /dev/null 2>&1 827 if [ $? -ne 0 ] ; then 828 IGCM_debug_Exit "Abend $( basename ${PerturbExe} )" 829 IGCM_debug_Verif_Exit 830 fi 831 IGCM_sys_Put_Out ${RUN_DIR}/${FileOut}.nc ${DirOut}/ 644 832 ;; 833 (AddPertu3DOCE) 834 # where to find the pattern we apply to the restart 835 PatternFile=${ensemble_Ens_PERTURB_MEMBER_INITPATH}/${ensemble_Ens_PERTURB_MEMBER_INITFROM}/${MemberVec}.nc 836 837 # where to find the land mask for the grid 838 MaskFile=${ensemble_Ens_PERTURB_MASKPATH}/${PerturbMask} 839 840 # if there is multiple restart files rebuild restart file 841 if [ ${nb_restart_file} -gt 1 ] ; then 842 IGCM_debug_Print 1 "rebuild files ${FileOut}_????.nc" 843 IGCM_sys_rebuild ${RUN_DIR}/${FileOut}.nc ${RUN_DIR}/${FileOut}_????.nc 844 fi 845 846 # there is now a single restart file 847 IGCM_sys_Chmod 644 ${RUN_DIR}/${FileOut}.nc 848 849 IGCM_debug_Print 1 "${PerturbExe} ${RUN_DIR}/${FileOut}.nc ${PerturbVar} ${PatternFile} ${MaskFile}" 850 echo 851 852 # add pattern to restart file on variable PerturbVar 853 ${PerturbExe} ${RUN_DIR}/${FileOut}.nc ${PerturbVar} ${PatternFile} ${MaskFile} > /dev/null 2>&1 854 if [ $? -ne 0 ] ; then 855 IGCM_debug_Exit "Abend $( basename ${PerturbExe} )" 856 IGCM_debug_Verif_Exit 857 fi 858 IGCM_sys_Put_Out ${RUN_DIR}/${FileOut}.nc ${DirOut}/ 644 859 ;; 860 esac 861 649 862 fi 650 863 … … 671 884 IGCM_sys_Cp ${SUBMIT_DIR}/run.card.init ${RUN_DIR} 672 885 if [ -f ${SUBMIT_DIR}/Qsub.* ]; then 673 886 IGCM_sys_Cp ${SUBMIT_DIR}/Qsub.* ${RUN_DIR} 674 887 fi 675 888 if [ -f ${SUBMIT_DIR}/Qclean.* ]; then 676 889 IGCM_sys_Cp ${SUBMIT_DIR}/Qclean.* ${RUN_DIR} 677 890 fi 678 891 … … 741 954 742 955 if [[ X${ensemble_Ens_DATE_BEGIN_RESTART} != "X" ]]; then 743 956 (( periodFillArgs = periodFillArgs + 1 )) 744 957 fi 745 958 746 959 if [[ X${ensemble_Ens_DATE_BEGIN_INIT} != "X" ]]; then 747 960 (( periodFillArgs = periodFillArgs + 1 )) 748 961 fi 749 962 750 963 if [[ X${ensemble_Ens_DATE_END_INIT} != "X" ]]; then 751 964 (( periodFillArgs = periodFillArgs + 1 )) 752 965 fi 753 966 754 967 if [[ X${ensemble_Ens_DATE_PERIODICITY} != "X" ]]; then 755 756 757 758 759 760 761 762 763 764 765 968 (( periodFillArgs = periodFillArgs + 1 )) 969 970 # ... Check PERIODICITY ... 971 case ${ensemble_Ens_DATE_PERIODICITY} in 972 *[Yy]|*[Mm]) 973 IGCM_debug_Print 1 "Periodic length : ${ensemble_Ens_DATE_PERIODICITY}" ;; 974 *) 975 IGCM_debug_Exit "IGCM_ensemble_DateInit ${ensemble_Ens_DATE_PERIODICITY} : invalid PERIODICITY" 976 IGCM_debug_Exit "Choose a value in *Y or *M" 977 IGCM_debug_Verif_Exit ;; 978 esac 766 979 fi # if periodicity 767 980 768 981 if [[ ${periodFillArgs} = ${totalPeriodArgs} ]]; then 769 982 DatePeriodicStart=true 770 983 else 771 772 773 774 775 776 777 778 984 if [[ ${periodFillArgs} = 0 ]]; then 985 IGCM_debug_Print 1 "Periodic start NOT ACTIVE" 986 DatePeriodicStart=false 987 else 988 IGCM_debug_Exit "IGCM_ensemble_DateInit missing arguments for Periodic mode!" 989 IGCM_debug_Exit "Get only ${periodFillArgs} on ${totalPeriodArgs} args. Check ${F_CFG_ENS} file." 990 IGCM_debug_Verif_Exit 991 fi 779 992 fi 780 993 … … 783 996 # *************************************** 784 997 if [[ ${#ensemble_Ens_DATE_NONPERIODIC[*]} != ${#ensemble_Ens_DATE_RESTART_NONPERIODIC[*]} ]] ; then 785 786 998 IGCM_debug_Exit "IGCM_ensemble_DateInit: NONPERIODIC and RESTART_NONPERIODIC lists have different sizes" 999 IGCM_debug_Verif_Exit 787 1000 fi 788 1001 789 1002 if [[ ${#ensemble_Ens_DATE_NONPERIODIC[*]} > 0 ]] && [[ ${ensemble_Ens_DATE_NONPERIODIC[*]} != _0_ ]]; then 790 791 792 793 794 795 796 while [ $DateNum-lt ${#ensemble_Ens_DATE_NONPERIODIC[*]} ] ; do797 ensemble_Ens_DATE_LENGTH_NONPERIODIC[DateNum]=${ensemble_Ens_DATE_LENGTH}798 799 800 801 802 803 if [[ ${#ensemble_Ens_DATE_INITFROM_NONPERIODIC[*]} < ${#ensemble_Ens_DATE_NONPERIODIC[*]} ]] ; then804 805 806 while [ $DateNum-lt ${#ensemble_Ens_DATE_NONPERIODIC[*]} ] ; do807 ensemble_Ens_DATE_INITFROM_NONPERIODIC[DateNum]=${ensemble_Ens_DATE_INITFROM}808 809 810 1003 DateNonPeriodicStart=true 1004 1005 # Use LENGTH if no NONPERIODIC_LENGTH given 1006 if [[ ${#ensemble_Ens_DATE_LENGTH_NONPERIODIC[*]} < ${#ensemble_Ens_DATE_NONPERIODIC[*]} ]] ; then 1007 IGCM_debug_Print 1 "WARNING: LENGTH_NONPERIODIC is not fill (or not correctly). Use LENGTH value '${ensemble_Ens_DATE_LENGTH}' for all NONPERIODIC runs" 1008 DateNum=0 1009 while [ ${DateNum} -lt ${#ensemble_Ens_DATE_NONPERIODIC[*]} ] ; do 1010 ensemble_Ens_DATE_LENGTH_NONPERIODIC[${DateNum}]=${ensemble_Ens_DATE_LENGTH} 1011 (( DateNum = DateNum + 1 )) 1012 done 1013 fi 1014 1015 # Use INITFROM if no NONPERIODIC_INITFROM given 1016 if [ ${#ensemble_Ens_DATE_INITFROM_NONPERIODIC[*]} -lt ${#ensemble_Ens_DATE_NONPERIODIC[*]} ] ; then 1017 IGCM_debug_Print 1 "WARNING: INITFROM_NONPERIODIC is not fill (or not correctly). Use INITFROM value '${ensemble_Ens_DATE_INITFROM}' for all NONPERIODIC runs" 1018 DateNum=0 1019 while [ ${DateNum} -lt ${#ensemble_Ens_DATE_NONPERIODIC[*]} ] ; do 1020 ensemble_Ens_DATE_INITFROM_NONPERIODIC[${DateNum}]=${ensemble_Ens_DATE_INITFROM} 1021 (( DateNum = DateNum + 1 )) 1022 done 1023 fi 811 1024 else 812 813 1025 IGCM_debug_Print 1 "Non-Periodic start NOT ACTIVE" 1026 DateNonPeriodicStart=false 814 1027 fi 815 1028 816 1029 if [[ ${DateNonPeriodicStart} = true ]]; then 817 818 while [ $DateNum-lt ${#ensemble_Ens_DATE_NONPERIODIC[*]} ] ; do819 820 case ${ensemble_Ens_DATE_LENGTH_NONPERIODIC[$DateNum]} in821 822 IGCM_debug_Print 1 "Non-periodic duration $DateNum: ${ensemble_Ens_DATE_LENGTH_NONPERIODIC[$DateNum]}"823 824 825 IGCM_debug_Exit "IGCM_ensemble_DateInit ${ensemble_Ens_DATE_LENGTH_NONPERIODIC[$DateNum]} : invalid NON PERIODIC LENGTH"826 827 828 829 830 831 case ${ensemble_Ens_DATE_RESTART_NONPERIODIC[$DateNum]} in832 833 IGCM_debug_Exit "IGCM_ensemble_DateInit ${ensemble_Ens_DATE_RESTART_NONPERIODIC[$DateNum]} : invalid NON PERIODIC RESTART"834 835 836 837 838 1030 DateNum=0 1031 while [ ${DateNum} -lt ${#ensemble_Ens_DATE_NONPERIODIC[*]} ] ; do 1032 # - Check LENGTH_NONPERIODIC 1033 case ${ensemble_Ens_DATE_LENGTH_NONPERIODIC[${DateNum}]} in 1034 *[Yy]|*[Mm]) 1035 IGCM_debug_Print 1 "Non-periodic duration ${DateNum}: ${ensemble_Ens_DATE_LENGTH_NONPERIODIC[${DateNum}]}" 1036 ;; 1037 *) 1038 IGCM_debug_Exit "IGCM_ensemble_DateInit ${ensemble_Ens_DATE_LENGTH_NONPERIODIC[${DateNum}]} : invalid NON PERIODIC LENGTH" 1039 IGCM_debug_Exit "choose in *Y or *M" 1040 IGCM_debug_Verif_Exit ;; 1041 esac 1042 1043 # - Check RESTART_NONPERIODIC 1044 case ${ensemble_Ens_DATE_RESTART_NONPERIODIC[${DateNum}]} in 1045 _0_) 1046 IGCM_debug_Exit "IGCM_ensemble_DateInit ${ensemble_Ens_DATE_RESTART_NONPERIODIC[${DateNum}]} : invalid NON PERIODIC RESTART" 1047 IGCM_debug_Verif_Exit ;; 1048 esac 1049 1050 (( DateNum = DateNum + 1 )) 1051 done 839 1052 fi # DateNonPeriodicStart = true 840 1053 … … 859 1072 # - Create directory for current DateBegin 860 1073 if [ ! -d ${StartDir} ] ; then 861 862 863 864 865 1074 IGCM_sys_Mkdir ${SUBMIT_DIR}/${StartDir} 1075 IGCM_sys_Cd ${SUBMIT_DIR}/${StartDir} 1076 ln -s ../../.resol . 1077 ln -s ../../.libmpi . 1078 IGCM_sys_Cd ${RUN_DIR} 866 1079 fi 867 1080 … … 967 1180 # - Does $StartDir already exist ? 968 1181 if [ ! -d ${SUBMIT_DIR}/${StartDir} ] ; then 969 970 971 972 973 1182 IGCM_sys_Mkdir ${SUBMIT_DIR}/${StartDir} 1183 IGCM_sys_Cd ${SUBMIT_DIR}/${StartDir} 1184 ln -s ../../.resol . 1185 ln -s ../../.libmpi . 1186 IGCM_sys_Cd ${RUN_DIR} 974 1187 fi 975 1188 976 1189 DateNum=0 977 1190 # ... Loop over ensemble_Ens_DATE_NONPERIODIC ... 978 while [ $ DateNum-lt ${#ensemble_Ens_DATE_NONPERIODIC[*]} ] ; do979 DateBegin=${ensemble_Ens_DATE_NONPERIODIC[$ DateNum]}980 Duree=${ensemble_Ens_DATE_LENGTH_NONPERIODIC[$ DateNum]}981 RestartDate=${ensemble_Ens_DATE_RESTART_NONPERIODIC[$ DateNum]}982 InitFrom=${ensemble_Ens_DATE_INITFROM_NONPERIODIC[$ DateNum]}1191 while [ ${DateNum} -lt ${#ensemble_Ens_DATE_NONPERIODIC[*]} ] ; do 1192 DateBegin=${ensemble_Ens_DATE_NONPERIODIC[${DateNum}]} 1193 Duree=${ensemble_Ens_DATE_LENGTH_NONPERIODIC[${DateNum}]} 1194 RestartDate=${ensemble_Ens_DATE_RESTART_NONPERIODIC[${DateNum}]} 1195 InitFrom=${ensemble_Ens_DATE_INITFROM_NONPERIODIC[${DateNum}]} 983 1196 984 1197 # - Determine number of day(s) in LENGTH_NONPERIODIC … … 1059 1272 HumanRestartDate=$( IGCM_date_ConvertFormatToHuman ${3} ) 1060 1273 if [[ X${4} != "X" ]]; then 1061 1274 initFrom=${4} # non periodic config (INITFROM could be different between members) 1062 1275 else 1063 1276 initFrom=${ensemble_Ens_DATE_INITFROM} # periodic (same INITFROM value) 1064 1277 fi 1065 1278 … … 1091 1304 sed -e "s/\(#.*\)${config_UserChoices_JobName}\( *#.*\)/\1${MemberDir} \2/" \ 1092 1305 -e "s/\(#.*Script_Output_\)${config_UserChoices_JobName}\(\.*\)/\1${MemberDir}\2/" \ 1093 -e "s/^PeriodNb=.*/PeriodNb=60/" \1306 -e "s/^PeriodNb=.*/PeriodNb=60/" \ 1094 1307 ${SUBMIT_DIR}/${StartDir}/${MemberDir}/Job_${MemberDir} > Job_${MemberDir}.tmp 1095 1308 IGCM_sys_Mv Job_${MemberDir}.tmp ${SUBMIT_DIR}/${StartDir}/${MemberDir}/Job_${MemberDir}
Note: See TracChangeset
for help on using the changeset viewer.