[677] | 1 | #!/bin/ksh |
---|
| 2 | |
---|
| 3 | #************************************************************** |
---|
[1026] | 4 | # Author: Sebastien Denvil, Sonia Labetoulle, Nicolas Lebas, Sebastien Nguyen |
---|
[1001] | 5 | # Contact: Nicolas.Lebas__at__locean-ipsl.upmc.fr |
---|
[679] | 6 | # $Revision:: $ Revision of last commit |
---|
| 7 | # $Author:: $ Author of last commit |
---|
| 8 | # $Date:: $ Date of last commit |
---|
[677] | 9 | # IPSL (2012) |
---|
| 10 | # This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC |
---|
| 11 | # |
---|
[1026] | 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 | # |
---|
[677] | 22 | #************************************************************** |
---|
| 23 | |
---|
[1001] | 24 | # Read which ensemble type are active |
---|
| 25 | function IGCM_ensemble_Init |
---|
[677] | 26 | { |
---|
[1001] | 27 | IGCM_debug_PushStack "IGCM_ensemble_Init" |
---|
[677] | 28 | |
---|
[1007] | 29 | IGCM_card_DefineVariableFromOption ${F_CFG_ENS} Ens_PERTURB active |
---|
| 30 | IGCM_card_DefineVariableFromOption ${F_CFG_ENS} Ens_DATE active |
---|
| 31 | IGCM_card_DefineVariableFromOption ${F_CFG_ENS} Ens_PARAMETRIC active |
---|
| 32 | |
---|
[1026] | 33 | IGCM_debug_Print 1 "Ens_PERTURB ACTIVE = ${ensemble_Ens_PERTURB_active}" |
---|
| 34 | IGCM_debug_Print 1 "Ens_DATE ACTIVE = ${ensemble_Ens_DATE_active}" |
---|
[1001] | 35 | IGCM_debug_Print 1 "Ens_PARAMETRIC ACTIVE = ${ensemble_Ens_PARAMETRIC_active}" |
---|
| 36 | echo "" |
---|
[1007] | 37 | |
---|
[1147] | 38 | #==================================================== |
---|
| 39 | # Define ARCHIVE : Dedicated to large files |
---|
| 40 | # Define STORAGE : Dedicated to small/medium files |
---|
| 41 | # Define R_OUT : Output tree located on ARCHIVE |
---|
| 42 | # Define R_FIG : Output tree located on STORAGE hosting figures (monitoring and atlas, and/or small files) |
---|
| 43 | # Define R_BUF : USELESS and DEPRECATED output tree. |
---|
| 44 | IGCM_sys_defineArchives |
---|
| 45 | |
---|
[1001] | 46 | IGCM_debug_PopStack "IGCM_ensemble_Init" |
---|
| 47 | } |
---|
| 48 | |
---|
| 49 | # Set Alphanumerical variables ajust to member nb |
---|
| 50 | function IGCM_ensemble_SetAlpha |
---|
| 51 | { |
---|
| 52 | IGCM_debug_PushStack "IGCM_ensemble_SetAlpha" |
---|
[1007] | 53 | |
---|
[679] | 54 | set -A Alpha A B C D E F G H I J K L M N O P Q R S T U V W X Y Z |
---|
| 55 | set -A AlphaMonth a b c d e f g h i j k l |
---|
| 56 | |
---|
[1001] | 57 | IGCM_debug_PopStack "IGCM_ensemble_SetAlpha" |
---|
| 58 | } |
---|
| 59 | |
---|
| 60 | ############### Perturb ENSEMBLE ################# |
---|
| 61 | function IGCM_ensemble_CastInit |
---|
| 62 | { |
---|
| 63 | IGCM_debug_PushStack "IGCM_ensemble_CastInit" |
---|
| 64 | |
---|
[679] | 65 | IGCM_sys_Mkdir ${RUN_DIR} |
---|
| 66 | |
---|
| 67 | IGCM_sys_Cp ${SUBMIT_DIR}/config.card ${RUN_DIR} |
---|
| 68 | IGCM_sys_Cp ${SUBMIT_DIR}/ensemble.card ${RUN_DIR} |
---|
| 69 | IGCM_sys_Cp ${SUBMIT_DIR}/Job_* ${RUN_DIR} |
---|
| 70 | IGCM_sys_Cp ${SUBMIT_DIR}/run.card.init ${RUN_DIR} |
---|
[1001] | 71 | if [ -f ${SUBMIT_DIR}/Qsub.* ]; then |
---|
[1026] | 72 | IGCM_sys_Cp ${SUBMIT_DIR}/Qsub.* ${RUN_DIR} |
---|
[1001] | 73 | fi |
---|
[1007] | 74 | if [ -f ${SUBMIT_DIR}/Qclean.* ]; then |
---|
[1026] | 75 | IGCM_sys_Cp ${SUBMIT_DIR}/Qclean.* ${RUN_DIR} |
---|
[1007] | 76 | fi |
---|
| 77 | |
---|
[742] | 78 | # Useful? |
---|
| 79 | #if [ -f ${SUBMIT_DIR}/CreatedDir.txt ] ; then |
---|
| 80 | # IGCM_sys_Cp ${SUBMIT_DIR}/CreatedDir.txt ${RUN_DIR} |
---|
| 81 | #fi |
---|
| 82 | # Useful? |
---|
[1007] | 83 | #if [ -f ${SUBMIT_DIR}/Qsub.sh ] ; then |
---|
| 84 | # IGCM_sys_Cp ${SUBMIT_DIR}/Qsub.sh ${RUN_DIR} |
---|
[742] | 85 | #fi |
---|
[1026] | 86 | echo ${PWD} |
---|
| 87 | |
---|
| 88 | IGCM_card_DefineVariableFromOption ${F_CFG_ENS} Ens_PERTURB active |
---|
[1007] | 89 | IGCM_card_DefineVariableFromOption ${F_CFG_ENS} Ens_PERTURB NAME |
---|
| 90 | IGCM_card_DefineVariableFromOption ${F_CFG_ENS} Ens_PERTURB BEGIN_INIT |
---|
| 91 | IGCM_card_DefineVariableFromOption ${F_CFG_ENS} Ens_PERTURB END_INIT |
---|
| 92 | IGCM_card_DefineVariableFromOption ${F_CFG_ENS} Ens_PERTURB PERIODICITY |
---|
| 93 | IGCM_card_DefineArrayFromOption ${F_CFG_ENS} Ens_PERTURB NONPERIODIC |
---|
| 94 | IGCM_card_DefineVariableFromOption ${F_CFG_ENS} Ens_PERTURB LENGTH |
---|
| 95 | IGCM_card_DefineArrayFromOption ${F_CFG_ENS} Ens_PERTURB LENGTH_NONPERIODIC |
---|
| 96 | IGCM_card_DefineVariableFromOption ${F_CFG_ENS} Ens_PERTURB MEMBER |
---|
[1026] | 97 | IGCM_card_DefineArrayFromOption ${F_CFG_ENS} Ens_PERTURB MEMBER_LIST |
---|
| 98 | IGCM_card_DefineArrayFromOption ${F_CFG_ENS} Ens_PERTURB MEMBER_NAMESLIST |
---|
| 99 | IGCM_card_DefineVariableFromOption ${F_CFG_ENS} Ens_PERTURB MEMBER_INITFROM |
---|
| 100 | IGCM_card_DefineVariableFromOption ${F_CFG_ENS} Ens_PERTURB MEMBER_INITPATH |
---|
[1007] | 101 | IGCM_card_DefineArrayFromOption ${F_CFG_ENS} Ens_PERTURB PERTURB_BIN |
---|
| 102 | IGCM_card_DefineVariableFromOption ${F_CFG_ENS} Ens_PERTURB INITFROM |
---|
| 103 | IGCM_card_DefineVariableFromOption ${F_CFG_ENS} Ens_PERTURB INITPATH |
---|
[1001] | 104 | IGCM_card_DefineVariableFromOption config.card UserChoices JobName |
---|
[679] | 105 | IGCM_card_DefineVariableFromOption config.card UserChoices TagName |
---|
| 106 | IGCM_card_DefineVariableFromOption config.card UserChoices CalendarType |
---|
| 107 | IGCM_card_DefineArrayFromSection config.card ListOfComponents |
---|
| 108 | |
---|
[737] | 109 | echo |
---|
[1001] | 110 | IGCM_debug_Print 1 "[Ens_PERTURB]" |
---|
| 111 | IGCM_debug_Print 1 "ACTIVE = ${ensemble_Ens_PERTURB_active}" |
---|
[679] | 112 | IGCM_debug_Print 1 "NAME = ${ensemble_Ens_PERTURB_NAME}" |
---|
[1001] | 113 | IGCM_debug_Print 1 "BEGIN_INIT = ${ensemble_Ens_PERTURB_BEGIN_INIT}" |
---|
| 114 | IGCM_debug_Print 1 "END_INIT = ${ensemble_Ens_PERTURB_END_INIT}" |
---|
| 115 | IGCM_debug_Print 1 "PERIODICITY = ${ensemble_Ens_PERTURB_PERIODICITY}" |
---|
[679] | 116 | IGCM_debug_Print 1 "NONPERIODIC = ${ensemble_Ens_PERTURB_NONPERIODIC[*]}" |
---|
[1001] | 117 | IGCM_debug_Print 1 "LENGTH = ${ensemble_Ens_PERTURB_LENGTH}" |
---|
| 118 | IGCM_debug_Print 1 "LENGTH_NONPERIODIC = ${ensemble_Ens_PERTURB_LENGTH_NONPERIODIC[*]}" |
---|
[679] | 119 | IGCM_debug_Print 1 "MEMBER = ${ensemble_Ens_PERTURB_MEMBER}" |
---|
[1026] | 120 | IGCM_debug_Print 1 "MEMBER_LIST = ${ensemble_Ens_PERTURB_MEMBER_LIST[*]}" |
---|
| 121 | IGCM_debug_Print 1 "MEMBER_NAMESLIST = ${ensemble_Ens_PERTURB_MEMBER_NAMESLIST[*]}" |
---|
| 122 | IGCM_debug_Print 1 "MEMBER_INITFROM = ${ensemble_Ens_PERTURB_MEMBER_INITFROM}" |
---|
| 123 | IGCM_debug_Print 1 "MEMBER_INITPATH = ${ensemble_Ens_PERTURB_MEMBER_INITPATH}" |
---|
[679] | 124 | IGCM_debug_Print 1 "PERTURB_BIN = ${ensemble_Ens_PERTURB_PERTURB_BIN[*]}" |
---|
| 125 | IGCM_debug_Print 1 "INITFROM = ${ensemble_Ens_PERTURB_INITFROM}" |
---|
[680] | 126 | IGCM_debug_Print 1 "INITPATH = ${ensemble_Ens_PERTURB_INITPATH}" |
---|
[1001] | 127 | IGCM_debug_Print 1 "JobName = ${config_UserChoices_JobName}" |
---|
[679] | 128 | IGCM_debug_Print 1 "TagName = ${config_UserChoices_TagName}" |
---|
| 129 | IGCM_debug_Print 1 "CalendarType = ${config_UserChoices_CalendarType}" |
---|
| 130 | IGCM_debug_Print 1 "ListOfComponents = ${config_ListOfComponents[*]}" |
---|
[1007] | 131 | |
---|
[679] | 132 | PerturbExe=${ensemble_Ens_PERTURB_PERTURB_BIN[0]} |
---|
| 133 | |
---|
[1026] | 134 | case ${PerturbExe} in |
---|
| 135 | AddNoise) |
---|
| 136 | PerturbComp=${ensemble_Ens_PERTURB_PERTURB_BIN[1]} |
---|
| 137 | PerturbFile=${ensemble_Ens_PERTURB_PERTURB_BIN[2]} |
---|
| 138 | PerturbVar=${ensemble_Ens_PERTURB_PERTURB_BIN[3]} |
---|
| 139 | PerturbAmp=${ensemble_Ens_PERTURB_PERTURB_BIN[4]} |
---|
[1007] | 140 | |
---|
[1026] | 141 | IGCM_debug_Print 1 "PerturbExe = ${PerturbExe}" |
---|
| 142 | IGCM_debug_Print 1 "PerturbFile = ${PerturbFile}" |
---|
| 143 | IGCM_debug_Print 1 "PerturbComp = ${PerturbComp}" |
---|
| 144 | IGCM_debug_Print 1 "PerturbVar = ${PerturbVar}" |
---|
| 145 | IGCM_debug_Print 1 "PerturbAmp = ${PerturbAmp}" |
---|
| 146 | ;; |
---|
| 147 | AddPertu3DOCE) |
---|
| 148 | PerturbComp=${ensemble_Ens_PERTURB_PERTURB_BIN[1]} |
---|
| 149 | PerturbFile=${ensemble_Ens_PERTURB_PERTURB_BIN[2]} |
---|
| 150 | PerturbVar=${ensemble_Ens_PERTURB_PERTURB_BIN[3]} |
---|
| 151 | PerturbMask=${ensemble_Ens_PERTURB_PERTURB_BIN[4]} |
---|
| 152 | |
---|
| 153 | IGCM_card_DefineVariableFromOption ${F_CFG_ENS} Ens_PERTURB MASKPATH |
---|
| 154 | |
---|
| 155 | IGCM_debug_Print 1 "PerturbExe = ${PerturbExe}" |
---|
| 156 | IGCM_debug_Print 1 "PerturbFile = ${PerturbFile}" |
---|
| 157 | IGCM_debug_Print 1 "PerturbComp = ${PerturbComp}" |
---|
| 158 | IGCM_debug_Print 1 "PerturbVar = ${PerturbVar}" |
---|
| 159 | IGCM_debug_Print 1 "PerturbMask = ${PerturbMask}" |
---|
| 160 | IGCM_debug_Print 1 "MASK PATH = ${ensemble_Ens_PERTURB_MASKPATH}" |
---|
| 161 | ;; |
---|
| 162 | esac |
---|
| 163 | |
---|
[1001] | 164 | IGCM_ensemble_SetAlpha ${ensemble_Ens_PERTURB_MEMBER} |
---|
[1007] | 165 | |
---|
[680] | 166 | # A few checks Period case: |
---|
[679] | 167 | |
---|
[1001] | 168 | # ... Check PERIODICITY ... |
---|
| 169 | case ${ensemble_Ens_PERTURB_PERIODICITY} in |
---|
[1026] | 170 | NONE) |
---|
[737] | 171 | IGCM_debug_Print 1 "periodic start not active" |
---|
[736] | 172 | CastPeriodicStart=false |
---|
[679] | 173 | ;; |
---|
[680] | 174 | *[Yy]|*[Mm]) |
---|
[736] | 175 | CastPeriodicStart=true |
---|
[1001] | 176 | IGCM_debug_Print 1 "Periodic length : ${ensemble_Ens_PERTURB_PERIODICITY}" ;; |
---|
[679] | 177 | *) |
---|
[1001] | 178 | IGCM_debug_Exit "IGCM_ensemble_CastInit ${ensemble_Ens_PERTURB_PERIODICITY} : invalid PERIODICITY" |
---|
[680] | 179 | IGCM_debug_Exit "Choose a value in *Y or *M" |
---|
[679] | 180 | IGCM_debug_Verif_Exit ;; |
---|
| 181 | esac |
---|
[1026] | 182 | # ... Check LENGTH ... |
---|
[1001] | 183 | case ${ensemble_Ens_PERTURB_LENGTH} in |
---|
[680] | 184 | *[Yy]|*[Mm]) |
---|
[1001] | 185 | IGCM_debug_Print 1 "Periodic duration : ${ensemble_Ens_PERTURB_LENGTH}" ;; |
---|
[679] | 186 | *) |
---|
[1001] | 187 | IGCM_debug_Exit "IGCM_ensemble_CastInit ${ensemble_Ens_PERTURB_LENGTH} invalid LENGTH" |
---|
[680] | 188 | IGCM_debug_Exit "Choose a value in choose in *Y or *M" |
---|
[679] | 189 | IGCM_debug_Verif_Exit ;; |
---|
| 190 | esac |
---|
| 191 | |
---|
[736] | 192 | # A few checks for the Non-Periodic case: |
---|
[680] | 193 | DateNum=0 |
---|
[1026] | 194 | while [ ${DateNum} -lt ${#ensemble_Ens_PERTURB_NONPERIODIC[*]} ] ; do |
---|
[680] | 195 | |
---|
[1001] | 196 | # - Check LENGTH_NONPERIODIC |
---|
[1026] | 197 | case ${ensemble_Ens_PERTURB_LENGTH_NONPERIODIC[${DateNum}]} in |
---|
[735] | 198 | _0_) |
---|
[737] | 199 | IGCM_debug_Print 1 "non-periodic start not active" |
---|
[736] | 200 | CastNonPeriodicStart=false |
---|
[680] | 201 | ;; |
---|
| 202 | *[Yy]|*[Mm]) |
---|
[1026] | 203 | IGCM_debug_Print 1 "Non-periodic duration : ${ensemble_Ens_PERTURB_LENGTH_NONPERIODIC[${DateNum}]}" |
---|
[736] | 204 | CastNonPeriodicStart=true |
---|
[680] | 205 | ;; |
---|
| 206 | *) |
---|
[1026] | 207 | IGCM_debug_Exit "IGCM_ensemble_CastInit ${ensemble_Ens_PERTURB_LENGTH_NONPERIODIC[${DateNum}]} : invalid LENGTH" |
---|
[680] | 208 | IGCM_debug_Exit "choose in *Y or *M" |
---|
| 209 | IGCM_debug_Verif_Exit ;; |
---|
| 210 | esac |
---|
| 211 | (( DateNum = DateNum + 1 )) |
---|
| 212 | done |
---|
| 213 | |
---|
[1026] | 214 | # A few checks for the MEMBER_LIST case: |
---|
| 215 | case ${ensemble_Ens_PERTURB_MEMBER_LIST[0]} in |
---|
| 216 | _0_) |
---|
| 217 | IGCM_debug_Print 1 "list of perturbation maps not active" |
---|
| 218 | CastMemberList=false |
---|
| 219 | ;; |
---|
| 220 | *) |
---|
| 221 | if [ ${CastPeriodicStart} = "true" ] ; then |
---|
| 222 | IGCM_debug_Exit "list of perturbation maps for periodic start not implemented, will stop execution" |
---|
| 223 | IGCM_debug_Verif_Exit |
---|
| 224 | elif [ ${CastNonPeriodicStart} = "true" ] ; then |
---|
| 225 | IGCM_debug_Exit "list of perturbation maps for non periodic start not implemented, will stop execution" |
---|
| 226 | IGCM_debug_Verif_Exit |
---|
| 227 | fi |
---|
| 228 | |
---|
| 229 | # test that MEMBER_NAMESLIST and MEMBER_LIST have the same size |
---|
| 230 | |
---|
| 231 | if [ ${#ensemble_Ens_PERTURB_MEMBER_LIST[*]} -ne ${#ensemble_Ens_PERTURB_MEMBER_NAMESLIST[*]} ] ; then |
---|
| 232 | IGCM_debug_Exit "number of elements in MEMBER_LIST and MEMBER_NAMESLIST differ" |
---|
| 233 | IGCM_debug_Verif_Exit |
---|
| 234 | fi |
---|
| 235 | |
---|
| 236 | IGCM_debug_Print 1 "list of perturbation maps : ${ensemble_Ens_PERTURB_MEMBER_LIST[*]}" |
---|
| 237 | IGCM_debug_Print 1 "list of members names : ${ensemble_Ens_PERTURB_MEMBER_NAMESLIST[*]}" |
---|
| 238 | CastMemberList=true |
---|
| 239 | ;; |
---|
| 240 | esac |
---|
| 241 | |
---|
| 242 | # IGCM_debug_Exit "fin du test MEMBER_LIST" |
---|
| 243 | # IGCM_debug_Verif_Exit |
---|
| 244 | |
---|
[864] | 245 | # Need to know all the restart filename of the component we will apply the noise to |
---|
| 246 | IGCM_card_DefineArrayFromOption config.card ListOfComponents ${PerturbComp} |
---|
| 247 | eval compname=\${config_ListOfComponents_${PerturbComp}[0]} > /dev/null 2>&1 |
---|
| 248 | |
---|
| 249 | # Target the component's card we apply the noise to |
---|
| 250 | card=${SUBMIT_DIR}/COMP/${compname}.card |
---|
| 251 | |
---|
| 252 | # Read the restart file list. To be used later |
---|
| 253 | IGCM_card_DefineArrayFromOption ${card} RestartFiles List |
---|
| 254 | ListFilesName=${compname}_RestartFiles_List |
---|
| 255 | eval FileName0=\${${ListFilesName}[0]} > /dev/null 2>&1 |
---|
| 256 | eval NbFiles=\${#${ListFilesName}[@]} > /dev/null 2>&1 |
---|
| 257 | |
---|
| 258 | # Check |
---|
| 259 | IGCM_debug_Print 1 "Nb Restart Files = ${NbFiles}" |
---|
| 260 | |
---|
[680] | 261 | IGCM_debug_PopStack "IGCM_ensemble_CastInit" |
---|
| 262 | } |
---|
| 263 | |
---|
| 264 | function IGCM_ensemble_CastPeriodicStarts |
---|
| 265 | { |
---|
| 266 | IGCM_debug_PushStack "IGCM_ensemble_CastPeriodicStarts" |
---|
| 267 | |
---|
[736] | 268 | [ ${CastPeriodicStart} = false ] && return |
---|
| 269 | |
---|
[737] | 270 | echo |
---|
| 271 | IGCM_debug_Print 1 "Manage periodic starts" |
---|
| 272 | |
---|
[680] | 273 | #.. Manage periodic starts .. |
---|
| 274 | # ====================== |
---|
| 275 | |
---|
[679] | 276 | # ... Loop over DateBegin ... |
---|
[1001] | 277 | eval DateBegin=\${ensemble_Ens_PERTURB_BEGIN_INIT} |
---|
[679] | 278 | |
---|
[1001] | 279 | while [ ${DateBegin} -le ${ensemble_Ens_PERTURB_END_INIT} ] ; do |
---|
[679] | 280 | IGCM_date_GetYearMonth ${DateBegin} year month |
---|
| 281 | |
---|
[1001] | 282 | # - Determine number of day(s) in PERIODICITY |
---|
| 283 | PeriodLengthInDays=$( IGCM_date_DaysInCurrentPeriod ${DateBegin} ${ensemble_Ens_PERTURB_PERIODICITY} ) |
---|
[680] | 284 | |
---|
[1001] | 285 | # - Determine number of day(s) in LENGTH |
---|
| 286 | DureeLengthInDays=$(( $( IGCM_date_DaysInCurrentPeriod ${DateBegin} ${ensemble_Ens_PERTURB_LENGTH} ) - 1 )) |
---|
[679] | 287 | |
---|
| 288 | # - Determine DateEnd |
---|
| 289 | (( DateEnd = $( IGCM_date_AddDaysToGregorianDate ${DateBegin} ${DureeLengthInDays} ) )) |
---|
| 290 | |
---|
| 291 | # - Build directory name |
---|
[1001] | 292 | IGCM_ensemble_CastDirectoryName ${ensemble_Ens_PERTURB_NAME} ${ensemble_Ens_PERTURB_PERIODICITY} $year $month $StartDir |
---|
[679] | 293 | |
---|
| 294 | # - Determine RestartDate |
---|
| 295 | (( Offset = -1 )) |
---|
| 296 | (( RestartDate = $( IGCM_date_AddDaysToGregorianDate ${DateBegin} ${Offset} ) )) |
---|
| 297 | |
---|
| 298 | IGCM_debug_Print 2 "${DateBegin} => ${DateEnd} : ${StartDir}" |
---|
[888] | 299 | echo "${DateBegin} ${DateEnd} ${StartDir}" >> ${RUN_DIR}/CreatedDir.txt |
---|
[679] | 300 | |
---|
| 301 | # - Create directory for current DateBegin |
---|
| 302 | if [ ! -d ${StartDir} ] ; then |
---|
| 303 | IGCM_sys_Mkdir ${SUBMIT_DIR}/${StartDir} |
---|
| 304 | IGCM_sys_Cd ${SUBMIT_DIR}/${StartDir} |
---|
| 305 | ln -s ../../.resol . |
---|
| 306 | ln -s ../../.libmpi . |
---|
| 307 | IGCM_sys_Cd ${RUN_DIR} |
---|
| 308 | fi |
---|
| 309 | |
---|
[870] | 310 | # - Create directory to store modified restart files |
---|
[737] | 311 | RestartDir=${STORAGE}/IGCM_IN/${config_UserChoices_TagName}/${StartDir} |
---|
[680] | 312 | IGCM_sys_MkdirArchive ${RestartDir} |
---|
[679] | 313 | |
---|
| 314 | # - Loop over members |
---|
| 315 | i=0 |
---|
| 316 | while [ $i -lt ${ensemble_Ens_PERTURB_MEMBER} ] ; do |
---|
| 317 | MemberDir="${StartDir}${Alpha[$i]}" |
---|
[737] | 318 | echo |
---|
[679] | 319 | IGCM_debug_Print 3 "${MemberDir}" |
---|
| 320 | |
---|
| 321 | JobName="Job_${MemberDir}" |
---|
| 322 | |
---|
| 323 | # * Create directory if it doesn't exist and copy/link files |
---|
| 324 | if [ ! -d ${SUBMIT_DIR}/${StartDir}/${MemberDir} ] ; then |
---|
| 325 | IGCM_sys_Mkdir ${SUBMIT_DIR}/${StartDir}/${MemberDir} |
---|
| 326 | IGCM_sys_Cd ${SUBMIT_DIR}/${StartDir}/${MemberDir} |
---|
| 327 | ln -s ../../COMP |
---|
| 328 | ln -s ../../PARAM |
---|
| 329 | ln -s ../../POST |
---|
[1001] | 330 | ln -s ../../DRIVER |
---|
[679] | 331 | IGCM_sys_Cd ${RUN_DIR} |
---|
| 332 | IGCM_sys_Cp config.card run.card.init ${SUBMIT_DIR}/${StartDir}/${MemberDir} |
---|
[1001] | 333 | IGCM_sys_Cp Job_${config_UserChoices_JobName} ${SUBMIT_DIR}/${StartDir}/${MemberDir}/${JobName} |
---|
[679] | 334 | |
---|
[742] | 335 | # Dump command to be lauched |
---|
[1007] | 336 | echo "cd ${StartDir}/${MemberDir}/ ;" >> ${RUN_DIR}/Qsub.${StartDir}.sh |
---|
| 337 | echo "${SUBMIT} ${JobName} ; cd -" >> ${RUN_DIR}/Qsub.${StartDir}.sh |
---|
[1001] | 338 | |
---|
[1007] | 339 | echo "cd ${StartDir}/${MemberDir}/ ;" >> ${RUN_DIR}/Qclean.month.${StartDir}.sh |
---|
| 340 | echo "${libIGCM}/clean_month.job ; cd -" >> ${RUN_DIR}/Qclean.month.${StartDir}.sh |
---|
| 341 | |
---|
| 342 | echo "cd ${StartDir}/${MemberDir}/ ;" >> ${RUN_DIR}/Qclean.year.${StartDir}.sh |
---|
| 343 | echo "${libIGCM}/clean_year.job ; cd -" >> ${RUN_DIR}/Qclean.year.${StartDir}.sh |
---|
| 344 | |
---|
| 345 | # * Update files : config.card, Job_, COMP/comp.card |
---|
| 346 | IGCM_ensemble_CastFilesUpdate ${DateBegin} ${DateEnd} ${RestartDate} |
---|
| 347 | |
---|
| 348 | # * Apply noise on restart file |
---|
| 349 | IGCM_ensemble_CastPerturbFile |
---|
[679] | 350 | fi |
---|
[1007] | 351 | |
---|
[679] | 352 | (( i = i + 1 )) |
---|
| 353 | done |
---|
| 354 | |
---|
[742] | 355 | # Done. Save ${StartDir} submission text file |
---|
[1007] | 356 | IGCM_sys_Cp ${RUN_DIR}/Qsub.${StartDir}.sh ${SUBMIT_DIR} |
---|
| 357 | IGCM_sys_Cp ${RUN_DIR}/Qclean.month.${StartDir}.sh ${SUBMIT_DIR} |
---|
| 358 | IGCM_sys_Cp ${RUN_DIR}/Qclean.year.${StartDir}.sh ${SUBMIT_DIR} |
---|
[742] | 359 | |
---|
[679] | 360 | # - Next DateBegin |
---|
| 361 | echo "$DateBegin $PeriodLengthInDays" |
---|
[1001] | 362 | case ${ensemble_Ens_PERTURB_PERIODICITY} in |
---|
[680] | 363 | *[Yy]|*[Mm]) |
---|
[679] | 364 | (( DateBegin = $( IGCM_date_AddDaysToGregorianDate ${DateBegin} ${PeriodLengthInDays} ) )) |
---|
| 365 | ;; |
---|
| 366 | esac |
---|
| 367 | echo "New DateBegin = $DateBegin" |
---|
| 368 | echo "========================================================================" |
---|
| 369 | done |
---|
| 370 | IGCM_debug_PopStack "IGCM_ensemble_CastPeriodicStarts" |
---|
| 371 | } |
---|
| 372 | |
---|
| 373 | function IGCM_ensemble_CastNonPeriodicStarts |
---|
| 374 | { |
---|
| 375 | IGCM_debug_PushStack "IGCM_ensemble_CastNonPeriodicStarts" |
---|
| 376 | |
---|
| 377 | #.. Manage non periodic starts => Loop over DateBegin .. |
---|
| 378 | # ========================== |
---|
| 379 | |
---|
[736] | 380 | [ ${CastNonPeriodicStart} = false ] && return |
---|
| 381 | |
---|
[737] | 382 | echo |
---|
| 383 | IGCM_debug_Print 1 "Manage non periodic starts" |
---|
| 384 | |
---|
[679] | 385 | DateNum=0 |
---|
| 386 | # ... Loop over ensemble_Ens_PERTURB_NONPERIODIC ... |
---|
| 387 | echo ">${DateNum}<" |
---|
| 388 | echo ">${#ensemble_Ens_PERTURB_NONPERIODIC[*]}<" |
---|
[1026] | 389 | while [ ${DateNum} -lt ${#ensemble_Ens_PERTURB_NONPERIODIC[*]} ] ; do |
---|
| 390 | DateBegin=${ensemble_Ens_PERTURB_NONPERIODIC[${DateNum}]} |
---|
| 391 | Duree=${ensemble_Ens_PERTURB_LENGTH_NONPERIODIC[${DateNum}]} |
---|
[679] | 392 | echo ">${DateBegin}<" |
---|
| 393 | echo ">${Duree}<" |
---|
[680] | 394 | |
---|
[1001] | 395 | # - Determine number of day(s) in LENGTH_NONPERIODIC |
---|
[679] | 396 | IGCM_date_GetYearMonth ${DateBegin} year month |
---|
[680] | 397 | DureeLengthInDays=$(( $( IGCM_date_DaysInCurrentPeriod ${DateBegin} ${Duree} ) - 1 )) |
---|
[679] | 398 | |
---|
| 399 | # - Build directory name |
---|
| 400 | echo "========================================================================" |
---|
| 401 | echo "ensemble_Ens_PERTURB_NAME = ${ensemble_Ens_PERTURB_NAME}" |
---|
| 402 | IGCM_ensemble_CastDirectoryName ${ensemble_Ens_PERTURB_NAME} ${Duree} $year $month $StartDir |
---|
| 403 | |
---|
| 404 | # - Determine DateEnd |
---|
| 405 | (( DateEnd = $( IGCM_date_AddDaysToGregorianDate ${DateBegin} ${DureeLengthInDays} ) )) |
---|
| 406 | echo ">${DateEnd}<" |
---|
| 407 | echo "tout va bien 1" |
---|
| 408 | |
---|
| 409 | # - Determine RestartDate |
---|
| 410 | (( Offset = -1 )) |
---|
| 411 | (( RestartDate = $( IGCM_date_AddDaysToGregorianDate ${DateBegin} ${Offset} ) )) |
---|
| 412 | |
---|
| 413 | IGCM_debug_Print 2 "${DateBegin} => ${DateEnd} : ${StartDir}" |
---|
| 414 | |
---|
| 415 | # - Does $StartDir already exist ? |
---|
| 416 | #echo "tout va bien 2" ${StartDir} |
---|
| 417 | if [ ! -d ${SUBMIT_DIR}/${StartDir} ] ; then |
---|
| 418 | echo "create dir" |
---|
| 419 | IGCM_sys_Mkdir ${SUBMIT_DIR}/${StartDir} |
---|
| 420 | IGCM_sys_Cd ${SUBMIT_DIR}/${StartDir} |
---|
| 421 | ln -s ../../.resol . |
---|
| 422 | ln -s ../../.libmpi . |
---|
| 423 | IGCM_sys_Cd ${RUN_DIR} |
---|
[888] | 424 | echo "${DateBegin} ${DateEnd} ${StartDir}" >> ${RUN_DIR}/CreatedDir.txt |
---|
[679] | 425 | fi |
---|
[888] | 426 | PeriodDateEnd=$( grep -m1 ${StartDir} ${RUN_DIR}/CreatedDir.txt | cut -f2 -d\ ) |
---|
[679] | 427 | |
---|
| 428 | # - Create directory in which to store new restart files if it does'nt already exist |
---|
[737] | 429 | RestartDir=${STORAGE}/IGCM_IN/${config_UserChoices_TagName}/${StartDir} |
---|
[680] | 430 | IGCM_sys_MkdirArchive ${RestartDir} |
---|
[679] | 431 | |
---|
| 432 | # - Loop over members |
---|
| 433 | i=0 |
---|
| 434 | while [ $i -lt ${ensemble_Ens_PERTURB_MEMBER} ] ; do |
---|
| 435 | MemberDir="${StartDir}${Alpha[$i]}" |
---|
| 436 | IGCM_debug_Print 3 "${MemberDir}" |
---|
| 437 | |
---|
| 438 | JobName="Job_${MemberDir}" |
---|
| 439 | |
---|
| 440 | # * Create directory if it doesn't exist and copy files |
---|
| 441 | if [ ! -d ${SUBMIT_DIR}/${StartDir}/${MemberDir} ] ; then |
---|
| 442 | IGCM_sys_Mkdir ${SUBMIT_DIR}/${StartDir}/${MemberDir} |
---|
| 443 | #IGCM_sys_Cp -r COMP/ PARAM/ ${StartDir}/${MemberDir} |
---|
| 444 | IGCM_sys_Cd ${SUBMIT_DIR}/${StartDir}/${MemberDir} |
---|
| 445 | ln -s ../../COMP |
---|
| 446 | ln -s ../../PARAM |
---|
| 447 | ln -s ../../POST |
---|
[1001] | 448 | ln -s ../../DRIVER |
---|
[679] | 449 | IGCM_sys_Cd ${RUN_DIR} |
---|
| 450 | IGCM_sys_Cp config.card run.card.init ${SUBMIT_DIR}/${StartDir}/${MemberDir} |
---|
[1001] | 451 | IGCM_sys_Cp Job_${config_UserChoices_JobName} ${SUBMIT_DIR}/${StartDir}/${MemberDir}/Job_${MemberDir} |
---|
[679] | 452 | |
---|
[742] | 453 | # Dump command to be lauched |
---|
[1007] | 454 | echo "cd ${StartDir}/${MemberDir}/ ;" >> Qsub.${StartDir}.sh |
---|
| 455 | echo "${SUBMIT} ${JobName} ; cd -" >> Qsub.${StartDir}.sh |
---|
[679] | 456 | |
---|
[1007] | 457 | echo "cd ${StartDir}/${MemberDir}/ ;" >> ${RUN_DIR}/Qclean.month.${StartDir}.sh |
---|
| 458 | echo "${libIGCM}/clean_month.job ; cd -" >> ${RUN_DIR}/Qclean.month.${StartDir}.sh |
---|
| 459 | |
---|
| 460 | echo "cd ${StartDir}/${MemberDir}/ ;" >> ${RUN_DIR}/Qclean.year.${StartDir}.sh |
---|
| 461 | echo "${libIGCM}/clean_year.job ; cd -" >> ${RUN_DIR}/Qclean.year.${StartDir}.sh |
---|
| 462 | |
---|
| 463 | # * Update files : config.card, Job_, COMP/comp.card |
---|
| 464 | echo "${PeriodDateEnd} ? ${DateEnd}" |
---|
| 465 | if [ ${PeriodDateEnd} -gt ${DateEnd} ] ; then |
---|
[1026] | 466 | DateEnd=${PeriodDateEnd} |
---|
[1007] | 467 | fi |
---|
| 468 | IGCM_ensemble_CastFilesUpdate ${DateBegin} ${DateEnd} ${RestartDate} |
---|
| 469 | |
---|
| 470 | # * Apply noise on restart file |
---|
| 471 | IGCM_ensemble_CastPerturbFile |
---|
[679] | 472 | fi |
---|
[1007] | 473 | |
---|
[679] | 474 | (( i = i + 1 )) |
---|
| 475 | done |
---|
| 476 | |
---|
[742] | 477 | # Done. Save ${StartDir} submission text file |
---|
[1007] | 478 | IGCM_sys_Cp ${RUN_DIR}/Qsub.${StartDir}.sh ${SUBMIT_DIR} |
---|
| 479 | IGCM_sys_Cp ${RUN_DIR}/Qclean.month.${StartDir}.sh ${SUBMIT_DIR} |
---|
| 480 | IGCM_sys_Cp ${RUN_DIR}/Qclean.year.${StartDir}.sh ${SUBMIT_DIR} |
---|
[742] | 481 | |
---|
[679] | 482 | (( DateNum = DateNum + 1 )) |
---|
| 483 | done |
---|
| 484 | IGCM_debug_PopStack "IGCM_ensemble_CastNonPeriodicStarts" |
---|
| 485 | } |
---|
| 486 | |
---|
[1026] | 487 | function IGCM_ensemble_CastMemberList |
---|
| 488 | { |
---|
| 489 | IGCM_debug_PushStack "IGCM_ensemble_CastMemberList" |
---|
| 490 | |
---|
| 491 | if [ ${CastMemberList} = false ] ; then |
---|
| 492 | IGCM_debug_PopStack "IGCM_ensemble_CastMemberList" |
---|
| 493 | return |
---|
| 494 | fi |
---|
| 495 | |
---|
| 496 | echo |
---|
| 497 | IGCM_debug_Print 1 "Manage members list" |
---|
| 498 | |
---|
| 499 | #.. Manage members list .. |
---|
| 500 | # ====================== |
---|
| 501 | |
---|
| 502 | # DateBegin |
---|
| 503 | eval DateBegin=\${ensemble_Ens_PERTURB_BEGIN_INIT} |
---|
| 504 | |
---|
| 505 | IGCM_date_GetYearMonth ${DateBegin} year month |
---|
| 506 | |
---|
| 507 | # - Determine number of day(s) in LENGTH |
---|
| 508 | DureeLengthInDays=$(( $( IGCM_date_DaysInCurrentPeriod ${DateBegin} ${ensemble_Ens_PERTURB_LENGTH} ) - 1 )) |
---|
| 509 | |
---|
| 510 | # - Determine DateEnd |
---|
[1066] | 511 | DateEnd=$( IGCM_date_AddDaysToGregorianDate ${DateBegin} ${DureeLengthInDays} ) |
---|
[1026] | 512 | |
---|
| 513 | # bad hack enforce yearly for parent directory name |
---|
| 514 | # - Build directory name |
---|
| 515 | IGCM_ensemble_CastDirectoryName ${ensemble_Ens_PERTURB_NAME} 1Y $year $month $StartDir |
---|
| 516 | |
---|
| 517 | # - Determine RestartDate |
---|
| 518 | (( Offset = -1 )) |
---|
[1066] | 519 | RestartDate=$( IGCM_date_AddDaysToGregorianDate ${DateBegin} ${Offset} ) |
---|
[1026] | 520 | |
---|
| 521 | IGCM_debug_Print 2 "${DateBegin} => ${DateEnd} : ${StartDir}" |
---|
| 522 | echo "${DateBegin} ${DateEnd} ${StartDir}" >> ${RUN_DIR}/CreatedDir.txt |
---|
| 523 | |
---|
| 524 | # - Create directory for current DateBegin |
---|
| 525 | if [ ! -d ${StartDir} ] ; then |
---|
| 526 | IGCM_sys_Mkdir ${SUBMIT_DIR}/${StartDir} |
---|
| 527 | IGCM_sys_Cd ${SUBMIT_DIR}/${StartDir} |
---|
| 528 | ln -s ../../.resol . |
---|
| 529 | ln -s ../../.libmpi . |
---|
| 530 | IGCM_sys_Cd ${RUN_DIR} |
---|
| 531 | fi |
---|
| 532 | |
---|
| 533 | # - Create directory to store modified restart files |
---|
| 534 | RestartDir=${STORAGE}/IGCM_IN/${config_UserChoices_TagName}/${StartDir} |
---|
| 535 | IGCM_sys_MkdirArchive ${RestartDir} |
---|
| 536 | |
---|
| 537 | # - Loop over members |
---|
| 538 | i=0 |
---|
| 539 | nbmember=${#ensemble_Ens_PERTURB_MEMBER_LIST[*]} |
---|
| 540 | while [ $i -lt $nbmember ] ; do |
---|
| 541 | MemberDir=${ensemble_Ens_PERTURB_MEMBER_NAMESLIST[${i}]} |
---|
| 542 | MemberVec=${ensemble_Ens_PERTURB_MEMBER_LIST[${i}]} |
---|
| 543 | |
---|
| 544 | JobName="Job_${MemberDir}" |
---|
| 545 | echo |
---|
| 546 | IGCM_debug_Print 3 "${MemberDir}" |
---|
| 547 | |
---|
| 548 | # * Create directory if it doesn't exist and copy/link files |
---|
| 549 | if [ ! -d ${SUBMIT_DIR}/${StartDir}/${MemberDir} ] ; then |
---|
| 550 | IGCM_sys_Mkdir ${SUBMIT_DIR}/${StartDir}/${MemberDir} |
---|
| 551 | IGCM_sys_Cd ${SUBMIT_DIR}/${StartDir}/${MemberDir} |
---|
| 552 | ln -s ../../COMP |
---|
| 553 | ln -s ../../PARAM |
---|
| 554 | ln -s ../../POST |
---|
| 555 | ln -s ../../DRIVER |
---|
| 556 | IGCM_sys_Cd ${RUN_DIR} |
---|
| 557 | IGCM_sys_Cp config.card run.card.init ${SUBMIT_DIR}/${StartDir}/${MemberDir} |
---|
| 558 | IGCM_sys_Cp Job_${config_UserChoices_JobName} ${SUBMIT_DIR}/${StartDir}/${MemberDir}/${JobName} |
---|
| 559 | |
---|
| 560 | # Dump command to be lauched |
---|
| 561 | echo "cd ${StartDir}/${MemberDir}/ ;" >> ${RUN_DIR}/Qsub.${StartDir}.sh |
---|
| 562 | echo "${SUBMIT} ${JobName} ; cd -" >> ${RUN_DIR}/Qsub.${StartDir}.sh |
---|
| 563 | |
---|
| 564 | echo "cd ${StartDir}/${MemberDir}/ ;" >> ${RUN_DIR}/Qclean.month.${StartDir}.sh |
---|
| 565 | echo "${libIGCM}/clean_month.job ; cd -" >> ${RUN_DIR}/Qclean.month.${StartDir}.sh |
---|
| 566 | |
---|
| 567 | echo "cd ${StartDir}/${MemberDir}/ ;" >> ${RUN_DIR}/Qclean.year.${StartDir}.sh |
---|
| 568 | echo "${libIGCM}/clean_year.job ; cd -" >> ${RUN_DIR}/Qclean.year.${StartDir}.sh |
---|
| 569 | |
---|
| 570 | # * Update files : config.card, Job_, COMP/comp.card |
---|
| 571 | IGCM_ensemble_CastFilesUpdate ${DateBegin} ${DateEnd} ${RestartDate} |
---|
| 572 | |
---|
| 573 | # * Apply noise on restart file |
---|
| 574 | IGCM_ensemble_CastPerturbFile |
---|
| 575 | fi |
---|
| 576 | |
---|
| 577 | (( i = i + 1 )) |
---|
| 578 | done |
---|
| 579 | |
---|
| 580 | # Done. Save ${StartDir} submission text file |
---|
| 581 | IGCM_sys_Cp ${RUN_DIR}/Qsub.${StartDir}.sh ${SUBMIT_DIR} |
---|
| 582 | IGCM_sys_Cp ${RUN_DIR}/Qclean.month.${StartDir}.sh ${SUBMIT_DIR} |
---|
| 583 | IGCM_sys_Cp ${RUN_DIR}/Qclean.year.${StartDir}.sh ${SUBMIT_DIR} |
---|
| 584 | |
---|
| 585 | IGCM_debug_PopStack "IGCM_ensemble_CastMemberList" |
---|
| 586 | } |
---|
| 587 | |
---|
[679] | 588 | function IGCM_ensemble_CastFilesUpdate |
---|
| 589 | { |
---|
| 590 | IGCM_debug_PushStack "IGCM_ensemble_CastFilesUpdate" |
---|
| 591 | |
---|
[677] | 592 | # Debug Print : |
---|
| 593 | echo |
---|
[679] | 594 | IGCM_debug_Print 1 "IGCM_ensemble_CastFilesUpdate :" |
---|
[677] | 595 | |
---|
| 596 | HumanDateBegin=$( IGCM_date_ConvertFormatToHuman ${1} ) |
---|
| 597 | HumanDateEnd=$( IGCM_date_ConvertFormatToHuman ${2} ) |
---|
| 598 | HumanRestartDate=$( IGCM_date_ConvertFormatToHuman ${3} ) |
---|
| 599 | # ==> config.card |
---|
| 600 | IGCM_card_WriteOption ${SUBMIT_DIR}/${StartDir}/${MemberDir}/config.card Ensemble EnsembleRun 'y' |
---|
| 601 | IGCM_card_WriteOption ${SUBMIT_DIR}/${StartDir}/${MemberDir}/config.card Ensemble EnsembleName ${ensemble_Ens_PERTURB_NAME} |
---|
| 602 | IGCM_card_WriteOption ${SUBMIT_DIR}/${StartDir}/${MemberDir}/config.card Ensemble EnsembleDate ${StartDir} |
---|
| 603 | |
---|
| 604 | IGCM_card_WriteOption ${SUBMIT_DIR}/${StartDir}/${MemberDir}/config.card UserChoices JobName ${MemberDir} |
---|
| 605 | IGCM_card_WriteOption ${SUBMIT_DIR}/${StartDir}/${MemberDir}/config.card UserChoices DateBegin ${HumanDateBegin} |
---|
| 606 | IGCM_card_WriteOption ${SUBMIT_DIR}/${StartDir}/${MemberDir}/config.card UserChoices DateEnd ${HumanDateEnd} |
---|
| 607 | IGCM_card_WriteOption ${SUBMIT_DIR}/${StartDir}/${MemberDir}/config.card Restarts OverRule "n" |
---|
| 608 | |
---|
[742] | 609 | for comp in ${config_ListOfComponents[*]} ; do |
---|
| 610 | IGCM_card_WriteOption ${SUBMIT_DIR}/${StartDir}/${MemberDir}/config.card ${comp} Restart "y" |
---|
| 611 | IGCM_card_WriteOption ${SUBMIT_DIR}/${StartDir}/${MemberDir}/config.card ${comp} RestartDate ${HumanRestartDate} |
---|
| 612 | IGCM_card_WriteOption ${SUBMIT_DIR}/${StartDir}/${MemberDir}/config.card ${comp} RestartJobName ${ensemble_Ens_PERTURB_INITFROM} |
---|
| 613 | IGCM_card_WriteOption ${SUBMIT_DIR}/${StartDir}/${MemberDir}/config.card ${comp} RestartPath ${ensemble_Ens_PERTURB_INITPATH} |
---|
[677] | 614 | done |
---|
[742] | 615 | |
---|
[677] | 616 | # ==> Job |
---|
[1001] | 617 | sed -e "s/\(#.*\)${config_UserChoices_JobName}\( *#.*\)/\1${MemberDir} \2/" \ |
---|
| 618 | -e "s/\(#.*Script_Output_\)${config_UserChoices_JobName}\(\.*\)/\1${MemberDir}\2/" \ |
---|
[1026] | 619 | -e "s/^PeriodNb=.*/PeriodNb=60/" \ |
---|
[742] | 620 | ${SUBMIT_DIR}/${StartDir}/${MemberDir}/Job_${MemberDir} > Job_${MemberDir}.tmp |
---|
| 621 | IGCM_sys_Mv Job_${MemberDir}.tmp ${SUBMIT_DIR}/${StartDir}/${MemberDir}/Job_${MemberDir} |
---|
[738] | 622 | |
---|
[679] | 623 | IGCM_debug_PopStack "IGCM_ensemble_CastFilesUpdate" |
---|
[677] | 624 | } |
---|
| 625 | |
---|
[679] | 626 | function IGCM_ensemble_CastDirectoryName |
---|
[677] | 627 | { |
---|
[679] | 628 | IGCM_debug_PushStack "IGCM_ensemble_CastDirectoryName" |
---|
[677] | 629 | |
---|
| 630 | #.. Debug Print .. |
---|
| 631 | echo |
---|
[679] | 632 | IGCM_debug_Print 1 "IGCM_ensemble_CastDirectoryName :" |
---|
[677] | 633 | echo |
---|
| 634 | |
---|
| 635 | Name=$1 |
---|
| 636 | Duree=$2 |
---|
| 637 | year=$3 |
---|
| 638 | month=$4 |
---|
| 639 | |
---|
| 640 | # - Build directory name |
---|
| 641 | case ${Duree} in |
---|
[1026] | 642 | *Y|*y) |
---|
| 643 | siecle="$( echo $year | cut -c1-2 )" |
---|
| 644 | siecle=$( (( $siecle - 18 )) ) |
---|
| 645 | StartYear="${siecle}$( echo $year | cut -c3-4 )" |
---|
| 646 | StartDir="${Name}${StartYear}" |
---|
| 647 | ;; |
---|
| 648 | *M|*m) |
---|
| 649 | echo $month |
---|
| 650 | siecle="$( echo $year | cut -c1-2 )" |
---|
| 651 | siecle=$( (( $siecle - 18 )) ) |
---|
| 652 | StartYear="${siecle}$( echo $year | cut -c3-4 )" |
---|
| 653 | StartMonth="${AlphaMonth[ (( 10#${month} - 1 )) ]}" |
---|
| 654 | StartDir="${Name}${StartYear}${StartMonth}" |
---|
| 655 | ;; |
---|
[677] | 656 | esac |
---|
| 657 | |
---|
[679] | 658 | IGCM_debug_PopStack "IGCM_ensemble_CastDirectoryName" |
---|
[677] | 659 | } |
---|
| 660 | |
---|
[679] | 661 | function IGCM_ensemble_CastPerturbFile |
---|
[677] | 662 | { |
---|
[679] | 663 | IGCM_debug_PushStack "IGCM_ensemble_CastPerturbFile" |
---|
[677] | 664 | |
---|
[1026] | 665 | typeset i i_ j |
---|
| 666 | typeset -Z4 j4 |
---|
| 667 | typeset file_out file_out_ |
---|
[864] | 668 | |
---|
[677] | 669 | #.. Debug Print .. |
---|
| 670 | echo |
---|
[679] | 671 | IGCM_debug_Print 1 "IGCM_ensemble_CastPerturbFile :" |
---|
[677] | 672 | |
---|
| 673 | #.. FileIn ? => RestartDate .. |
---|
| 674 | DirIn="${ensemble_Ens_PERTURB_INITPATH}/${ensemble_Ens_PERTURB_INITFROM}/${PerturbComp}/Restart" |
---|
[738] | 675 | DirInTar="${ensemble_Ens_PERTURB_INITPATH}/${ensemble_Ens_PERTURB_INITFROM}/RESTART" |
---|
| 676 | FileIn="${ensemble_Ens_PERTURB_INITFROM}_${RestartDate}_${PerturbFile}" |
---|
[677] | 677 | DirOut="${RestartDir}/${MemberDir}/${PerturbComp}/Restart" |
---|
| 678 | |
---|
| 679 | # * Create member restart directory |
---|
| 680 | IGCM_sys_TestDirArchive ${DirOut} |
---|
| 681 | RET=$? |
---|
| 682 | if [ $RET -gt 0 ] ; then |
---|
| 683 | IGCM_sys_MkdirArchive ${DirOut} |
---|
| 684 | fi |
---|
| 685 | |
---|
[738] | 686 | FileOut="${MemberDir}_${RestartDate}_${PerturbFile}" |
---|
[864] | 687 | IGCM_debug_Print 1 "FileIn = ${DirIn}/${FileIn}" |
---|
[738] | 688 | IGCM_debug_Print 1 "FileOut = ${DirOut}/${FileOut}.nc" |
---|
| 689 | |
---|
| 690 | IGCM_sys_TestFileArchive ${DirOut}/${FileOut}.nc |
---|
[677] | 691 | RET=$? |
---|
| 692 | if [ $RET -gt 0 ] ; then |
---|
[737] | 693 | |
---|
[738] | 694 | # * Look for the restart file we apply the noise to |
---|
[737] | 695 | |
---|
[864] | 696 | # restart file list pertaining to the component we apply the noise to |
---|
| 697 | # but not being the precise restart file we will apply the noise to |
---|
| 698 | unset OtherFileInList |
---|
| 699 | # generic restart filename list (like flxat, sstoc, restart, ...) |
---|
| 700 | unset OtherGenericList |
---|
| 701 | |
---|
| 702 | if ( [ X${FileName0} != X${NULL_STR} ] && [ X${FileName0} != XNONE ] ) ; then |
---|
| 703 | (( i=0 )) |
---|
| 704 | until [ $i -ge ${NbFiles} ]; do |
---|
| 705 | |
---|
| 706 | (( i_ = i+1 )) |
---|
| 707 | eval file_out_=\${${ListFilesName}[$i_]} > /dev/null 2>&1 |
---|
| 708 | eval file_out=${file_out_} |
---|
| 709 | |
---|
| 710 | generic_restart_file_name_out=$( basename ${file_out} .nc ) |
---|
| 711 | |
---|
| 712 | if [ ! ${generic_restart_file_name_out} = ${PerturbFile} ] ; then |
---|
| 713 | set +A OtherFileInList ${OtherFileInList[*]} ${PerturbComp}_${ensemble_Ens_PERTURB_INITFROM}_${RestartDate}_${generic_restart_file_name_out}\*.nc |
---|
| 714 | set +A OtherGenericList ${OtherGenericList[*]} ${generic_restart_file_name_out} |
---|
| 715 | fi |
---|
| 716 | |
---|
| 717 | (( i=i+3 )) |
---|
| 718 | done |
---|
| 719 | fi |
---|
| 720 | # How many restart files other than the one we will apply the noise to |
---|
| 721 | NbOtherFiles=${#OtherGenericList[*]} |
---|
| 722 | |
---|
[738] | 723 | ########################## |
---|
| 724 | # TO BE A FUNCTION BEGIN # |
---|
| 725 | ########################## |
---|
[677] | 726 | |
---|
[738] | 727 | if [ $( IGCM_sys_TestFileBuffer ${DirIn}/${FileIn}*.nc ; echo $? ) = 0 ] ; then |
---|
| 728 | IGCM_debug_Print 3 "Buffered restart" |
---|
| 729 | Buffered=true |
---|
| 730 | Archived=false |
---|
| 731 | Tared=false |
---|
| 732 | nb_restart_file=$(IGCM_sys_CountFileBuffer ${DirIn}/${FileIn}_????.nc) |
---|
| 733 | elif [ $( IGCM_sys_TestFileArchive ${DirIn}/${FileIn}*.nc ; echo $? ) = 0 ] ; then |
---|
| 734 | IGCM_debug_Print 3 "Archived restart" |
---|
| 735 | Buffered=false |
---|
| 736 | Archived=true |
---|
| 737 | Tared=false |
---|
| 738 | nb_restart_file=$(IGCM_sys_CountFileArchive ${DirIn}/${FileIn}_????.nc) |
---|
| 739 | else |
---|
| 740 | IGCM_debug_Print 3 "Tared restart" |
---|
| 741 | Buffered=false |
---|
| 742 | Archived=false |
---|
| 743 | Tared=true |
---|
[864] | 744 | |
---|
[738] | 745 | # Look for the tar file we want if we did not found it already |
---|
[888] | 746 | for PotentialTarFile in $( find ${ensemble_Ens_PERTURB_INITPATH}/${ensemble_Ens_PERTURB_INITFROM}/RESTART -name "${ensemble_Ens_PERTURB_INITFROM}_*restart*.tar" -print ) ; do |
---|
| 747 | IsMatching=$( echo ${PotentialTarFile##*/} | sed "s:_restart::" | sed "s:^${ensemble_Ens_PERTURB_INITFROM}_::" | sed "s:\.tar$::" | gawk -F_ -v restartdate=${RestartDate} '{if (($1 <= restartdate) && ($2 >= restartdate)) {print $1"_"$2}}' ) |
---|
[864] | 748 | if [ ! X${IsMatching} = X ] ; then |
---|
| 749 | TarFileFound=${PotentialTarFile} |
---|
| 750 | break |
---|
| 751 | fi |
---|
| 752 | done |
---|
| 753 | |
---|
| 754 | # Extract relevant restart files |
---|
| 755 | IGCM_debug_Print 1 "tar xvf ${TarFileFound} ${PerturbComp}_${FileIn}*.nc ${OtherFileInList[*]}" |
---|
| 756 | tar xvf ${TarFileFound} ${PerturbComp}_${FileIn}*.nc ${OtherFileInList[*]} |
---|
[738] | 757 | nb_restart_file=$( IGCM_sys_CountFileBuffer ${PerturbComp}_${FileIn}_????.nc ) |
---|
| 758 | fi |
---|
| 759 | |
---|
[864] | 760 | # Move around and perturb restart files so as to be able to start hindcast/forecast simulation members |
---|
[738] | 761 | if [ ${nb_restart_file} -gt 1 ] ; then |
---|
| 762 | j=0 |
---|
[864] | 763 | until [ $j -ge ${nb_restart_file} ]; do |
---|
[738] | 764 | j4=${j} |
---|
| 765 | if [ X${Buffered} = Xtrue ] ; then |
---|
| 766 | IGCM_sys_GetBuffer ${DirIn}/${FileIn}_${j4}.nc ${RUN_DIR}/${FileOut}_${j4}.nc |
---|
[864] | 767 | |
---|
| 768 | cd ${DirOut} |
---|
| 769 | for generic in ${OtherGenericList[*]} ; do |
---|
| 770 | ln -s ${DirIn}/${ensemble_Ens_PERTURB_INITFROM}_${RestartDate}_${generic}.nc ${MemberDir}_${RestartDate}_${generic}_${j4}.nc |
---|
| 771 | done |
---|
| 772 | cd - |
---|
| 773 | |
---|
[738] | 774 | elif [ X${Archived} = Xtrue ] ; then |
---|
| 775 | IGCM_sys_Get ${DirIn}/${FileIn}_${j4}.nc ${RUN_DIR}/${FileOut}_${j4}.nc |
---|
[864] | 776 | |
---|
| 777 | for generic in ${OtherGenericList[*]} ; do |
---|
| 778 | IGCM_sys_RshArchive "cd ${DirOut} ; ln -s ${DirIn}/${ensemble_Ens_PERTURB_INITFROM}_${RestartDate}_${generic}.nc ${MemberDir}_${RestartDate}_${generic}_${j4}.nc" |
---|
| 779 | done |
---|
| 780 | |
---|
[738] | 781 | elif [ X${Tared} = Xtrue ] ; then |
---|
[1026] | 782 | IGCM_debug_Print 2 "IGCM_sys_Mv ${PerturbComp}_${FileIn}_${j4}.nc ${RUN_DIR}/${FileOut}_${j4}.nc" |
---|
[738] | 783 | IGCM_sys_Mv ${PerturbComp}_${FileIn}_${j4}.nc ${RUN_DIR}/${FileOut}_${j4}.nc |
---|
[864] | 784 | |
---|
| 785 | for generic in ${OtherGenericList[*]} ; do |
---|
| 786 | IGCM_sys_Mv ${PerturbComp}_${ensemble_Ens_PERTURB_INITFROM}_${RestartDate}_${generic}.nc ${DirOut}/${MemberDir}_${RestartDate}_${generic}_${j4}.nc |
---|
| 787 | done |
---|
| 788 | |
---|
[738] | 789 | fi |
---|
| 790 | (( j=j+1 )) |
---|
| 791 | done |
---|
| 792 | else |
---|
| 793 | if [ X${Buffered} = Xtrue ] ; then |
---|
| 794 | IGCM_sys_GetBuffer ${DirIn}/${FileIn}.nc ${RUN_DIR}/${FileOut}.nc |
---|
[864] | 795 | |
---|
| 796 | cd ${DirOut} |
---|
| 797 | for generic in ${OtherGenericList[*]} ; do |
---|
| 798 | ln -s ${DirIn}/${ensemble_Ens_PERTURB_INITFROM}_${RestartDate}_${generic}.nc ${MemberDir}_${RestartDate}_${generic}.nc |
---|
| 799 | done |
---|
| 800 | cd - |
---|
| 801 | |
---|
[738] | 802 | elif [ X${Archived} = Xtrue ] ; then |
---|
| 803 | IGCM_sys_Get ${DirIn}/${FileIn}.nc ${RUN_DIR}/${FileOut}.nc |
---|
[864] | 804 | |
---|
| 805 | for generic in ${OtherGenericList[*]} ; do |
---|
| 806 | IGCM_sys_RshArchive "cd ${DirOut} ; ln -s ${DirIn}/${ensemble_Ens_PERTURB_INITFROM}_${RestartDate}_${generic}.nc ${MemberDir}_${RestartDate}_${generic}.nc" |
---|
| 807 | done |
---|
| 808 | |
---|
[738] | 809 | elif [ X${Tared} = Xtrue ] ; then |
---|
[1026] | 810 | IGCM_debug_Print 2 "IGCM_sys_Mv ${PerturbComp}_${FileIn}.nc ${RUN_DIR}/${FileOut}.nc" |
---|
[738] | 811 | IGCM_sys_Mv ${PerturbComp}_${FileIn}.nc ${RUN_DIR}/${FileOut}.nc |
---|
[864] | 812 | |
---|
| 813 | for generic in ${OtherGenericList[*]} ; do |
---|
[1026] | 814 | IGCM_debug_Print 2 "IGCM_sys_Mv ${PerturbComp}_${ensemble_Ens_PERTURB_INITFROM}_${RestartDate}_${generic}.nc ${DirOut}/${MemberDir}_${RestartDate}_${generic}.nc" |
---|
[864] | 815 | IGCM_sys_Mv ${PerturbComp}_${ensemble_Ens_PERTURB_INITFROM}_${RestartDate}_${generic}.nc ${DirOut}/${MemberDir}_${RestartDate}_${generic}.nc |
---|
| 816 | done |
---|
| 817 | |
---|
[738] | 818 | fi |
---|
| 819 | fi |
---|
| 820 | |
---|
| 821 | ######################## |
---|
| 822 | # TO BE A FUNCTION END # |
---|
| 823 | ######################## |
---|
| 824 | |
---|
[1026] | 825 | # treat the perturbation on different components by looking at the executable name |
---|
[737] | 826 | |
---|
[1026] | 827 | case ${PerturbExe} in |
---|
| 828 | (AddNoise) |
---|
| 829 | IGCM_sys_Chmod 644 ${RUN_DIR}/${FileOut}.nc |
---|
| 830 | |
---|
| 831 | IGCM_debug_Print 1 "${PerturbExe} ${RUN_DIR}/${FileOut}.nc ${PerturbVar} ${PerturbAmp}" |
---|
| 832 | echo |
---|
| 833 | |
---|
| 834 | ${PerturbExe} ${RUN_DIR}/${FileOut}.nc ${PerturbVar} ${PerturbAmp} > /dev/null 2>&1 |
---|
| 835 | if [ $? -ne 0 ] ; then |
---|
| 836 | IGCM_debug_Exit "Abend $( basename ${PerturbExe} )" |
---|
| 837 | IGCM_debug_Verif_Exit |
---|
| 838 | fi |
---|
| 839 | IGCM_sys_Put_Out ${RUN_DIR}/${FileOut}.nc ${DirOut}/ 644 |
---|
| 840 | ;; |
---|
| 841 | (AddPertu3DOCE) |
---|
| 842 | # where to find the pattern we apply to the restart |
---|
| 843 | PatternFile=${ensemble_Ens_PERTURB_MEMBER_INITPATH}/${ensemble_Ens_PERTURB_MEMBER_INITFROM}/${MemberVec}.nc |
---|
| 844 | |
---|
| 845 | # where to find the land mask for the grid |
---|
| 846 | MaskFile=${ensemble_Ens_PERTURB_MASKPATH}/${PerturbMask} |
---|
| 847 | |
---|
| 848 | # if there is multiple restart files rebuild restart file |
---|
| 849 | if [ ${nb_restart_file} -gt 1 ] ; then |
---|
| 850 | IGCM_debug_Print 1 "rebuild files ${FileOut}_????.nc" |
---|
| 851 | IGCM_sys_rebuild ${RUN_DIR}/${FileOut}.nc ${RUN_DIR}/${FileOut}_????.nc |
---|
| 852 | fi |
---|
| 853 | |
---|
| 854 | # there is now a single restart file |
---|
| 855 | IGCM_sys_Chmod 644 ${RUN_DIR}/${FileOut}.nc |
---|
| 856 | |
---|
| 857 | IGCM_debug_Print 1 "${PerturbExe} ${RUN_DIR}/${FileOut}.nc ${PerturbVar} ${PatternFile} ${MaskFile}" |
---|
| 858 | echo |
---|
| 859 | |
---|
| 860 | # add pattern to restart file on variable PerturbVar |
---|
| 861 | ${PerturbExe} ${RUN_DIR}/${FileOut}.nc ${PerturbVar} ${PatternFile} ${MaskFile} > /dev/null 2>&1 |
---|
| 862 | if [ $? -ne 0 ] ; then |
---|
| 863 | IGCM_debug_Exit "Abend $( basename ${PerturbExe} )" |
---|
| 864 | IGCM_debug_Verif_Exit |
---|
| 865 | fi |
---|
| 866 | IGCM_sys_Put_Out ${RUN_DIR}/${FileOut}.nc ${DirOut}/ 644 |
---|
| 867 | ;; |
---|
| 868 | esac |
---|
| 869 | |
---|
[677] | 870 | fi |
---|
| 871 | |
---|
| 872 | #.. Update config.card.. |
---|
| 873 | IGCM_card_WriteOption ${SUBMIT_DIR}/${StartDir}/${MemberDir}/config.card ${PerturbComp} Restart "y" |
---|
| 874 | IGCM_card_WriteOption ${SUBMIT_DIR}/${StartDir}/${MemberDir}/config.card ${PerturbComp} RestartDate ${HumanRestartDate} |
---|
| 875 | IGCM_card_WriteOption ${SUBMIT_DIR}/${StartDir}/${MemberDir}/config.card ${PerturbComp} RestartJobName ${MemberDir} |
---|
| 876 | IGCM_card_WriteOption ${SUBMIT_DIR}/${StartDir}/${MemberDir}/config.card ${PerturbComp} RestartPath ${RestartDir}/ |
---|
[1001] | 877 | IGCM_card_WriteOption ${SUBMIT_DIR}/${StartDir}/${MemberDir}/config.card Ensemble EnsembleType "Ens_PERTURB" |
---|
[1007] | 878 | |
---|
[679] | 879 | IGCM_debug_PopStack "IGCM_ensemble_CastPerturbFile" |
---|
[677] | 880 | } |
---|
[1001] | 881 | |
---|
| 882 | ############### Date ENSEMBLE ################# |
---|
| 883 | function IGCM_ensemble_DateInit |
---|
| 884 | { |
---|
| 885 | IGCM_debug_PushStack "IGCM_ensemble_DateInit" |
---|
| 886 | |
---|
| 887 | IGCM_sys_Mkdir ${RUN_DIR} |
---|
| 888 | |
---|
| 889 | IGCM_sys_Cp ${SUBMIT_DIR}/config.card ${RUN_DIR} |
---|
| 890 | IGCM_sys_Cp ${SUBMIT_DIR}/ensemble.card ${RUN_DIR} |
---|
| 891 | IGCM_sys_Cp ${SUBMIT_DIR}/Job_* ${RUN_DIR} |
---|
| 892 | IGCM_sys_Cp ${SUBMIT_DIR}/run.card.init ${RUN_DIR} |
---|
| 893 | if [ -f ${SUBMIT_DIR}/Qsub.* ]; then |
---|
[1026] | 894 | IGCM_sys_Cp ${SUBMIT_DIR}/Qsub.* ${RUN_DIR} |
---|
[1001] | 895 | fi |
---|
[1007] | 896 | if [ -f ${SUBMIT_DIR}/Qclean.* ]; then |
---|
[1026] | 897 | IGCM_sys_Cp ${SUBMIT_DIR}/Qclean.* ${RUN_DIR} |
---|
[1007] | 898 | fi |
---|
| 899 | |
---|
| 900 | IGCM_card_DefineVariableFromOption ${F_CFG_ENS} Ens_DATE active |
---|
| 901 | IGCM_card_DefineVariableFromOption ${F_CFG_ENS} Ens_DATE NAME |
---|
| 902 | IGCM_card_DefineVariableFromOption ${F_CFG_ENS} Ens_DATE BEGIN_INIT |
---|
| 903 | IGCM_card_DefineVariableFromOption ${F_CFG_ENS} Ens_DATE BEGIN_RESTART |
---|
| 904 | IGCM_card_DefineVariableFromOption ${F_CFG_ENS} Ens_DATE END_INIT |
---|
| 905 | IGCM_card_DefineVariableFromOption ${F_CFG_ENS} Ens_DATE PERIODICITY |
---|
| 906 | IGCM_card_DefineArrayFromOption ${F_CFG_ENS} Ens_DATE NONPERIODIC |
---|
| 907 | IGCM_card_DefineArrayFromOption ${F_CFG_ENS} Ens_DATE RESTART_NONPERIODIC |
---|
| 908 | IGCM_card_DefineVariableFromOption ${F_CFG_ENS} Ens_DATE LENGTH |
---|
| 909 | IGCM_card_DefineArrayFromOption ${F_CFG_ENS} Ens_DATE LENGTH_NONPERIODIC |
---|
| 910 | IGCM_card_DefineVariableFromOption ${F_CFG_ENS} Ens_DATE INITFROM |
---|
| 911 | IGCM_card_DefineVariableFromOption ${F_CFG_ENS} Ens_DATE INITFROM_NONPERIODIC |
---|
| 912 | IGCM_card_DefineVariableFromOption ${F_CFG_ENS} Ens_DATE INITPATH |
---|
[1001] | 913 | IGCM_card_DefineVariableFromOption config.card UserChoices JobName |
---|
| 914 | IGCM_card_DefineVariableFromOption config.card UserChoices TagName |
---|
| 915 | IGCM_card_DefineVariableFromOption config.card UserChoices CalendarType |
---|
| 916 | IGCM_card_DefineArrayFromSection config.card ListOfComponents |
---|
| 917 | |
---|
| 918 | echo |
---|
| 919 | IGCM_debug_Print 1 "[Ens_DATE]" |
---|
[1007] | 920 | IGCM_debug_Print 1 "ACTIVE = ${ensemble_Ens_DATE_active}" |
---|
| 921 | IGCM_debug_Print 1 "NAME = ${ensemble_Ens_DATE_NAME}" |
---|
| 922 | IGCM_debug_Print 1 "BEGIN_INIT = ${ensemble_Ens_DATE_BEGIN_INIT}" |
---|
| 923 | IGCM_debug_Print 1 "END_INIT = ${ensemble_Ens_DATE_END_INIT}" |
---|
| 924 | IGCM_debug_Print 1 "PERIODICITY = ${ensemble_Ens_DATE_PERIODICITY}" |
---|
| 925 | IGCM_debug_Print 1 "BEGIN_RESTART = ${ensemble_Ens_DATE_BEGIN_RESTART}" |
---|
| 926 | IGCM_debug_Print 1 "NONPERIODIC = ${ensemble_Ens_DATE_NONPERIODIC[*]}" |
---|
| 927 | IGCM_debug_Print 1 "RESTART_NONPERIODIC = ${ensemble_Ens_DATE_RESTART_NONPERIODIC[*]}" |
---|
| 928 | IGCM_debug_Print 1 "LENGTH = ${ensemble_Ens_DATE_LENGTH}" |
---|
| 929 | IGCM_debug_Print 1 "LENGTH_NONPERIODIC = ${ensemble_Ens_DATE_LENGTH_NONPERIODIC[*]}" |
---|
| 930 | IGCM_debug_Print 1 "INITFROM = ${ensemble_Ens_DATE_INITFROM}" |
---|
| 931 | IGCM_debug_Print 1 "INITFROM_NONPERIODIC = ${ensemble_Ens_DATE_INITFROM_NONPERIODIC[*]}" |
---|
| 932 | IGCM_debug_Print 1 "INITPATH = ${ensemble_Ens_DATE_INITPATH}" |
---|
| 933 | IGCM_debug_Print 1 "JobName = ${config_UserChoices_JobName}" |
---|
| 934 | IGCM_debug_Print 1 "TagName = ${config_UserChoices_TagName}" |
---|
| 935 | IGCM_debug_Print 1 "CalendarType = ${config_UserChoices_CalendarType}" |
---|
| 936 | IGCM_debug_Print 1 "ListOfComponents = ${config_ListOfComponents[*]}" |
---|
[1001] | 937 | echo "" |
---|
[1007] | 938 | |
---|
[1001] | 939 | ensemble_Ens_DATE_MEMBER=1 # actually use only 1 member |
---|
| 940 | IGCM_ensemble_SetAlpha ${ensemble_Ens_DATE_MEMBER} |
---|
[1007] | 941 | |
---|
[1001] | 942 | IGCM_debug_Print 1 "Check args..." |
---|
| 943 | DatePeriodicStart=false |
---|
| 944 | DateNonPeriodicStart=false |
---|
[1007] | 945 | |
---|
[1001] | 946 | # ... Check LENGTH ... |
---|
| 947 | case ${ensemble_Ens_DATE_LENGTH} in |
---|
| 948 | *[Yy]|*[Mm]) |
---|
| 949 | IGCM_debug_Print 1 "Default simulation duration : ${ensemble_Ens_DATE_LENGTH}" ;; |
---|
| 950 | *) |
---|
| 951 | IGCM_debug_Exit "IGCM_ensemble_DateInit ${ensemble_Ens_DATE_LENGTH} invalid LENGTH" |
---|
| 952 | IGCM_debug_Exit "Choose a value in choose in *Y or *M" |
---|
| 953 | IGCM_debug_Verif_Exit ;; |
---|
| 954 | esac |
---|
| 955 | |
---|
| 956 | # *************************************** |
---|
| 957 | # A few checks Period case: |
---|
| 958 | # *************************************** |
---|
| 959 | # if all Periodic params are not filled: desactivate Periodic mode |
---|
| 960 | totalPeriodArgs=4 |
---|
| 961 | periodFillArgs=0 |
---|
[1007] | 962 | |
---|
[1001] | 963 | if [[ X${ensemble_Ens_DATE_BEGIN_RESTART} != "X" ]]; then |
---|
[1026] | 964 | (( periodFillArgs = periodFillArgs + 1 )) |
---|
[1001] | 965 | fi |
---|
[1007] | 966 | |
---|
[1001] | 967 | if [[ X${ensemble_Ens_DATE_BEGIN_INIT} != "X" ]]; then |
---|
[1026] | 968 | (( periodFillArgs = periodFillArgs + 1 )) |
---|
[1001] | 969 | fi |
---|
| 970 | |
---|
| 971 | if [[ X${ensemble_Ens_DATE_END_INIT} != "X" ]]; then |
---|
[1026] | 972 | (( periodFillArgs = periodFillArgs + 1 )) |
---|
[1001] | 973 | fi |
---|
| 974 | |
---|
| 975 | if [[ X${ensemble_Ens_DATE_PERIODICITY} != "X" ]]; then |
---|
[1026] | 976 | (( periodFillArgs = periodFillArgs + 1 )) |
---|
[1007] | 977 | |
---|
[1026] | 978 | # ... Check PERIODICITY ... |
---|
| 979 | case ${ensemble_Ens_DATE_PERIODICITY} in |
---|
| 980 | *[Yy]|*[Mm]) |
---|
| 981 | IGCM_debug_Print 1 "Periodic length : ${ensemble_Ens_DATE_PERIODICITY}" ;; |
---|
| 982 | *) |
---|
| 983 | IGCM_debug_Exit "IGCM_ensemble_DateInit ${ensemble_Ens_DATE_PERIODICITY} : invalid PERIODICITY" |
---|
| 984 | IGCM_debug_Exit "Choose a value in *Y or *M" |
---|
| 985 | IGCM_debug_Verif_Exit ;; |
---|
| 986 | esac |
---|
[1001] | 987 | fi # if periodicity |
---|
[1007] | 988 | |
---|
[1001] | 989 | if [[ ${periodFillArgs} = ${totalPeriodArgs} ]]; then |
---|
[1026] | 990 | DatePeriodicStart=true |
---|
[1001] | 991 | else |
---|
[1026] | 992 | if [[ ${periodFillArgs} = 0 ]]; then |
---|
| 993 | IGCM_debug_Print 1 "Periodic start NOT ACTIVE" |
---|
| 994 | DatePeriodicStart=false |
---|
| 995 | else |
---|
| 996 | IGCM_debug_Exit "IGCM_ensemble_DateInit missing arguments for Periodic mode!" |
---|
| 997 | IGCM_debug_Exit "Get only ${periodFillArgs} on ${totalPeriodArgs} args. Check ${F_CFG_ENS} file." |
---|
| 998 | IGCM_debug_Verif_Exit |
---|
| 999 | fi |
---|
[1001] | 1000 | fi |
---|
[1007] | 1001 | |
---|
[1001] | 1002 | # *************************************** |
---|
| 1003 | # A few checks for the Non-Periodic case: |
---|
| 1004 | # *************************************** |
---|
| 1005 | if [[ ${#ensemble_Ens_DATE_NONPERIODIC[*]} != ${#ensemble_Ens_DATE_RESTART_NONPERIODIC[*]} ]] ; then |
---|
[1026] | 1006 | IGCM_debug_Exit "IGCM_ensemble_DateInit: NONPERIODIC and RESTART_NONPERIODIC lists have different sizes" |
---|
| 1007 | IGCM_debug_Verif_Exit |
---|
[1001] | 1008 | fi |
---|
[1007] | 1009 | |
---|
[1001] | 1010 | if [[ ${#ensemble_Ens_DATE_NONPERIODIC[*]} > 0 ]] && [[ ${ensemble_Ens_DATE_NONPERIODIC[*]} != _0_ ]]; then |
---|
[1026] | 1011 | DateNonPeriodicStart=true |
---|
[1007] | 1012 | |
---|
[1026] | 1013 | # Use LENGTH if no NONPERIODIC_LENGTH given |
---|
| 1014 | if [[ ${#ensemble_Ens_DATE_LENGTH_NONPERIODIC[*]} < ${#ensemble_Ens_DATE_NONPERIODIC[*]} ]] ; then |
---|
| 1015 | IGCM_debug_Print 1 "WARNING: LENGTH_NONPERIODIC is not fill (or not correctly). Use LENGTH value '${ensemble_Ens_DATE_LENGTH}' for all NONPERIODIC runs" |
---|
| 1016 | DateNum=0 |
---|
| 1017 | while [ ${DateNum} -lt ${#ensemble_Ens_DATE_NONPERIODIC[*]} ] ; do |
---|
| 1018 | ensemble_Ens_DATE_LENGTH_NONPERIODIC[${DateNum}]=${ensemble_Ens_DATE_LENGTH} |
---|
| 1019 | (( DateNum = DateNum + 1 )) |
---|
| 1020 | done |
---|
| 1021 | fi |
---|
[1007] | 1022 | |
---|
[1026] | 1023 | # Use INITFROM if no NONPERIODIC_INITFROM given |
---|
| 1024 | if [ ${#ensemble_Ens_DATE_INITFROM_NONPERIODIC[*]} -lt ${#ensemble_Ens_DATE_NONPERIODIC[*]} ] ; then |
---|
| 1025 | IGCM_debug_Print 1 "WARNING: INITFROM_NONPERIODIC is not fill (or not correctly). Use INITFROM value '${ensemble_Ens_DATE_INITFROM}' for all NONPERIODIC runs" |
---|
| 1026 | DateNum=0 |
---|
| 1027 | while [ ${DateNum} -lt ${#ensemble_Ens_DATE_NONPERIODIC[*]} ] ; do |
---|
| 1028 | ensemble_Ens_DATE_INITFROM_NONPERIODIC[${DateNum}]=${ensemble_Ens_DATE_INITFROM} |
---|
| 1029 | (( DateNum = DateNum + 1 )) |
---|
| 1030 | done |
---|
| 1031 | fi |
---|
[1001] | 1032 | else |
---|
[1026] | 1033 | IGCM_debug_Print 1 "Non-Periodic start NOT ACTIVE" |
---|
| 1034 | DateNonPeriodicStart=false |
---|
[1001] | 1035 | fi |
---|
[1007] | 1036 | |
---|
[1001] | 1037 | if [[ ${DateNonPeriodicStart} = true ]]; then |
---|
[1026] | 1038 | DateNum=0 |
---|
| 1039 | while [ ${DateNum} -lt ${#ensemble_Ens_DATE_NONPERIODIC[*]} ] ; do |
---|
| 1040 | # - Check LENGTH_NONPERIODIC |
---|
| 1041 | case ${ensemble_Ens_DATE_LENGTH_NONPERIODIC[${DateNum}]} in |
---|
| 1042 | *[Yy]|*[Mm]) |
---|
| 1043 | IGCM_debug_Print 1 "Non-periodic duration ${DateNum}: ${ensemble_Ens_DATE_LENGTH_NONPERIODIC[${DateNum}]}" |
---|
| 1044 | ;; |
---|
| 1045 | *) |
---|
| 1046 | IGCM_debug_Exit "IGCM_ensemble_DateInit ${ensemble_Ens_DATE_LENGTH_NONPERIODIC[${DateNum}]} : invalid NON PERIODIC LENGTH" |
---|
| 1047 | IGCM_debug_Exit "choose in *Y or *M" |
---|
| 1048 | IGCM_debug_Verif_Exit ;; |
---|
| 1049 | esac |
---|
[1001] | 1050 | |
---|
[1026] | 1051 | # - Check RESTART_NONPERIODIC |
---|
| 1052 | case ${ensemble_Ens_DATE_RESTART_NONPERIODIC[${DateNum}]} in |
---|
| 1053 | _0_) |
---|
| 1054 | IGCM_debug_Exit "IGCM_ensemble_DateInit ${ensemble_Ens_DATE_RESTART_NONPERIODIC[${DateNum}]} : invalid NON PERIODIC RESTART" |
---|
| 1055 | IGCM_debug_Verif_Exit ;; |
---|
| 1056 | esac |
---|
[1007] | 1057 | |
---|
[1026] | 1058 | (( DateNum = DateNum + 1 )) |
---|
| 1059 | done |
---|
[1001] | 1060 | fi # DateNonPeriodicStart = true |
---|
[1007] | 1061 | |
---|
[1001] | 1062 | IGCM_debug_PopStack "IGCM_ensemble_DateInit" |
---|
| 1063 | } |
---|
| 1064 | |
---|
| 1065 | function IGCM_ensemble_DatePeriodicStarts |
---|
| 1066 | { |
---|
| 1067 | IGCM_debug_PushStack "IGCM_ensemble_DatePeriodicStarts" |
---|
| 1068 | |
---|
| 1069 | [ ${DatePeriodicStart} = false ] && return |
---|
| 1070 | |
---|
| 1071 | echo |
---|
| 1072 | IGCM_debug_Print 1 ">>> MANAGE PERIODIC STARTS <<<" |
---|
| 1073 | |
---|
| 1074 | #.. Manage periodic starts .. |
---|
| 1075 | # ====================== |
---|
| 1076 | |
---|
| 1077 | # - Build directory name |
---|
| 1078 | StartDir="${ensemble_Ens_DATE_NAME}" |
---|
[1007] | 1079 | |
---|
[1001] | 1080 | # - Create directory for current DateBegin |
---|
| 1081 | if [ ! -d ${StartDir} ] ; then |
---|
[1026] | 1082 | IGCM_sys_Mkdir ${SUBMIT_DIR}/${StartDir} |
---|
| 1083 | IGCM_sys_Cd ${SUBMIT_DIR}/${StartDir} |
---|
| 1084 | ln -s ../../.resol . |
---|
| 1085 | ln -s ../../.libmpi . |
---|
| 1086 | IGCM_sys_Cd ${RUN_DIR} |
---|
[1001] | 1087 | fi |
---|
[1007] | 1088 | |
---|
[1001] | 1089 | # ... Loop over DateBegin ... |
---|
| 1090 | eval DateBegin=\${ensemble_Ens_DATE_BEGIN_INIT} |
---|
| 1091 | eval RestartDate=\${ensemble_Ens_DATE_BEGIN_RESTART} |
---|
| 1092 | |
---|
[1007] | 1093 | DateNum=0 |
---|
[1001] | 1094 | while [ ${DateBegin} -le ${ensemble_Ens_DATE_END_INIT} ] ; do |
---|
| 1095 | IGCM_date_GetYearMonth ${DateBegin} year month |
---|
[1007] | 1096 | |
---|
[1001] | 1097 | echo "========================================================================" |
---|
| 1098 | echo "New DateBegin = $DateBegin" |
---|
[1007] | 1099 | |
---|
[1001] | 1100 | # - Determine number of day(s) in PERIODICITY |
---|
| 1101 | PeriodLengthInDays=$( IGCM_date_DaysInCurrentPeriod ${DateBegin} ${ensemble_Ens_DATE_PERIODICITY} ) |
---|
[1007] | 1102 | |
---|
[1001] | 1103 | # - Determine number of day(s) in LENGTH |
---|
| 1104 | DureeLengthInDays=$(( $( IGCM_date_DaysInCurrentPeriod ${DateBegin} ${ensemble_Ens_DATE_LENGTH} ) - 1 )) |
---|
| 1105 | |
---|
| 1106 | # - Determine DateEnd |
---|
| 1107 | (( DateEnd = $( IGCM_date_AddDaysToGregorianDate ${DateBegin} ${DureeLengthInDays} ) )) |
---|
[1007] | 1108 | |
---|
[1001] | 1109 | IGCM_debug_Print 2 "${DateBegin} => ${DateEnd} : ${StartDir}" |
---|
| 1110 | echo "${DateBegin} ${DateEnd} ${StartDir}" >> ${RUN_DIR}/CreatedDir.txt |
---|
[1007] | 1111 | |
---|
[1001] | 1112 | # - Loop over members (default =1 no member) |
---|
| 1113 | i=0 |
---|
| 1114 | while [ $i -lt ${ensemble_Ens_DATE_MEMBER} ] ; do |
---|
[1007] | 1115 | MemberDir="${ensemble_Ens_DATE_NAME}${DateNum}${Alpha[$i]}_per" |
---|
[1001] | 1116 | echo |
---|
| 1117 | IGCM_debug_Print 3 "${MemberDir}" |
---|
[1007] | 1118 | |
---|
[1001] | 1119 | JobName="Job_${MemberDir}" |
---|
| 1120 | |
---|
| 1121 | # * Create directory if it doesn't exist and copy/link files |
---|
| 1122 | if [ ! -d ${SUBMIT_DIR}/${StartDir}/${MemberDir} ] ; then |
---|
| 1123 | IGCM_sys_Mkdir ${SUBMIT_DIR}/${StartDir}/${MemberDir} |
---|
| 1124 | IGCM_sys_Cd ${SUBMIT_DIR}/${StartDir}/${MemberDir} |
---|
| 1125 | ln -s ../../COMP |
---|
| 1126 | ln -s ../../PARAM |
---|
| 1127 | ln -s ../../POST |
---|
| 1128 | ln -s ../../DRIVER |
---|
| 1129 | IGCM_sys_Cd ${RUN_DIR} |
---|
| 1130 | IGCM_sys_Cp config.card run.card.init ${SUBMIT_DIR}/${StartDir}/${MemberDir} |
---|
| 1131 | IGCM_sys_Cp Job_${config_UserChoices_JobName} ${SUBMIT_DIR}/${StartDir}/${MemberDir}/${JobName} |
---|
[1007] | 1132 | |
---|
[1001] | 1133 | # Dump command to be lauched |
---|
[1007] | 1134 | echo "cd ${StartDir}/${MemberDir}/ ;" >> ${RUN_DIR}/Qsub.${StartDir}.sh |
---|
| 1135 | echo "${SUBMIT} ${JobName} ; cd -" >> ${RUN_DIR}/Qsub.${StartDir}.sh |
---|
| 1136 | |
---|
| 1137 | echo "cd ${StartDir}/${MemberDir}/ ;" >> ${RUN_DIR}/Qclean.month.${StartDir}.sh |
---|
| 1138 | echo "${libIGCM}/clean_month.job ; cd -" >> ${RUN_DIR}/Qclean.month.${StartDir}.sh |
---|
| 1139 | |
---|
| 1140 | echo "cd ${StartDir}/${MemberDir}/ ;" >> ${RUN_DIR}/Qclean.year.${StartDir}.sh |
---|
| 1141 | echo "${libIGCM}/clean_year.job ; cd -" >> ${RUN_DIR}/Qclean.year.${StartDir}.sh |
---|
| 1142 | |
---|
| 1143 | # * Update files : config.card, Job_, COMP/comp.card |
---|
| 1144 | IGCM_ensemble_DateFilesUpdate ${DateBegin} ${DateEnd} ${RestartDate} |
---|
[1001] | 1145 | fi |
---|
[1007] | 1146 | |
---|
[1001] | 1147 | (( i = i + 1 )) |
---|
| 1148 | done |
---|
| 1149 | |
---|
| 1150 | # - Next DateBegin & RestartDate |
---|
| 1151 | echo "$DateBegin $PeriodLengthInDays" |
---|
| 1152 | case ${ensemble_Ens_DATE_PERIODICITY} in |
---|
| 1153 | *[Yy]|*[Mm]) |
---|
| 1154 | (( DateBegin = $( IGCM_date_AddDaysToGregorianDate ${DateBegin} ${PeriodLengthInDays} ) )) |
---|
| 1155 | (( RestartDate = $( IGCM_date_AddDaysToGregorianDate ${RestartDate} ${PeriodLengthInDays} ) )) |
---|
| 1156 | ;; |
---|
| 1157 | esac |
---|
| 1158 | |
---|
[1007] | 1159 | (( DateNum = DateNum + 1 )) # increment number of restart date |
---|
[1001] | 1160 | done |
---|
| 1161 | |
---|
| 1162 | # Done. Save ${StartDir} submission text file |
---|
[1007] | 1163 | IGCM_sys_Cp ${RUN_DIR}/Qsub.${StartDir}.sh ${SUBMIT_DIR} |
---|
| 1164 | IGCM_sys_Cp ${RUN_DIR}/Qclean.month.${StartDir}.sh ${SUBMIT_DIR} |
---|
| 1165 | IGCM_sys_Cp ${RUN_DIR}/Qclean.year.${StartDir}.sh ${SUBMIT_DIR} |
---|
| 1166 | |
---|
[1001] | 1167 | IGCM_debug_PopStack "IGCM_ensemble_DatePeriodicStarts" |
---|
| 1168 | } |
---|
| 1169 | |
---|
| 1170 | function IGCM_ensemble_DateNonPeriodicStarts |
---|
| 1171 | { |
---|
| 1172 | IGCM_debug_PushStack "IGCM_ensemble_DateNonPeriodicStarts" |
---|
| 1173 | |
---|
| 1174 | #.. Manage non periodic starts => Loop over DateBegin .. |
---|
| 1175 | # ========================== |
---|
| 1176 | |
---|
| 1177 | [ ${DateNonPeriodicStart} = false ] && return |
---|
| 1178 | |
---|
| 1179 | echo |
---|
| 1180 | IGCM_debug_Print 1 ">>> MANAGE NON PERIODIC STARTS <<<" |
---|
| 1181 | |
---|
| 1182 | # - Build directory name |
---|
| 1183 | echo "" |
---|
| 1184 | echo "========================================================================" |
---|
| 1185 | echo "ensemble_Ens_DATE_NAME = ${ensemble_Ens_DATE_NAME}" |
---|
| 1186 | StartDir="${ensemble_Ens_DATE_NAME}" |
---|
| 1187 | |
---|
| 1188 | # - Does $StartDir already exist ? |
---|
| 1189 | if [ ! -d ${SUBMIT_DIR}/${StartDir} ] ; then |
---|
[1026] | 1190 | IGCM_sys_Mkdir ${SUBMIT_DIR}/${StartDir} |
---|
| 1191 | IGCM_sys_Cd ${SUBMIT_DIR}/${StartDir} |
---|
| 1192 | ln -s ../../.resol . |
---|
| 1193 | ln -s ../../.libmpi . |
---|
| 1194 | IGCM_sys_Cd ${RUN_DIR} |
---|
[1001] | 1195 | fi |
---|
[1007] | 1196 | |
---|
[1001] | 1197 | DateNum=0 |
---|
| 1198 | # ... Loop over ensemble_Ens_DATE_NONPERIODIC ... |
---|
[1026] | 1199 | while [ ${DateNum} -lt ${#ensemble_Ens_DATE_NONPERIODIC[*]} ] ; do |
---|
| 1200 | DateBegin=${ensemble_Ens_DATE_NONPERIODIC[${DateNum}]} |
---|
| 1201 | Duree=${ensemble_Ens_DATE_LENGTH_NONPERIODIC[${DateNum}]} |
---|
| 1202 | RestartDate=${ensemble_Ens_DATE_RESTART_NONPERIODIC[${DateNum}]} |
---|
| 1203 | InitFrom=${ensemble_Ens_DATE_INITFROM_NONPERIODIC[${DateNum}]} |
---|
[1007] | 1204 | |
---|
[1001] | 1205 | # - Determine number of day(s) in LENGTH_NONPERIODIC |
---|
| 1206 | IGCM_date_GetYearMonth ${DateBegin} year month |
---|
| 1207 | DureeLengthInDays=$(( $( IGCM_date_DaysInCurrentPeriod ${DateBegin} ${Duree} ) - 1 )) |
---|
| 1208 | |
---|
| 1209 | # - Determine DateEnd |
---|
| 1210 | (( DateEnd = $( IGCM_date_AddDaysToGregorianDate ${DateBegin} ${DureeLengthInDays} ) )) |
---|
[1007] | 1211 | |
---|
[1001] | 1212 | IGCM_debug_Print 2 "${DateBegin} => ${DateEnd} : ${StartDir}" |
---|
[1007] | 1213 | echo "${DateBegin} ${DateEnd} ${StartDir}" >> ${RUN_DIR}/CreatedDir.txt |
---|
| 1214 | |
---|
[1001] | 1215 | PeriodDateEnd=$( grep -m1 ${StartDir} ${RUN_DIR}/CreatedDir.txt | cut -f2 -d\ ) |
---|
[1007] | 1216 | |
---|
[1001] | 1217 | # - Loop over members |
---|
| 1218 | i=0 |
---|
| 1219 | while [ $i -lt ${ensemble_Ens_DATE_MEMBER} ] ; do |
---|
[1007] | 1220 | MemberDir="${ensemble_Ens_DATE_NAME}${DateNum}${Alpha[$i]}" |
---|
[1001] | 1221 | IGCM_debug_Print 3 "${MemberDir}" |
---|
[1007] | 1222 | |
---|
[1001] | 1223 | JobName="Job_${MemberDir}" |
---|
| 1224 | |
---|
| 1225 | # * Create directory if it doesn't exist and copy files |
---|
| 1226 | if [ ! -d ${SUBMIT_DIR}/${StartDir}/${MemberDir} ] ; then |
---|
| 1227 | IGCM_sys_Mkdir ${SUBMIT_DIR}/${StartDir}/${MemberDir} |
---|
| 1228 | IGCM_sys_Cd ${SUBMIT_DIR}/${StartDir}/${MemberDir} |
---|
| 1229 | ln -s ../../COMP |
---|
| 1230 | ln -s ../../PARAM |
---|
| 1231 | ln -s ../../POST |
---|
| 1232 | ln -s ../../DRIVER |
---|
| 1233 | IGCM_sys_Cd ${RUN_DIR} |
---|
| 1234 | IGCM_sys_Cp config.card run.card.init ${SUBMIT_DIR}/${StartDir}/${MemberDir} |
---|
| 1235 | IGCM_sys_Cp Job_${config_UserChoices_JobName} ${SUBMIT_DIR}/${StartDir}/${MemberDir}/Job_${MemberDir} |
---|
| 1236 | |
---|
| 1237 | # Dump command to be lauched |
---|
[1007] | 1238 | echo "cd ${StartDir}/${MemberDir}/ ;" >> ${RUN_DIR}/Qsub.${StartDir}.sh |
---|
| 1239 | echo "${SUBMIT} ${JobName} ; cd -" >> ${RUN_DIR}/Qsub.${StartDir}.sh |
---|
[1001] | 1240 | |
---|
[1007] | 1241 | echo "cd ${StartDir}/${MemberDir}/ ;" >> ${RUN_DIR}/Qclean.month.${StartDir}.sh |
---|
| 1242 | echo "${libIGCM}/clean_month.job ; cd -" >> ${RUN_DIR}/Qclean.month.${StartDir}.sh |
---|
| 1243 | |
---|
| 1244 | echo "cd ${StartDir}/${MemberDir}/ ;" >> ${RUN_DIR}/Qclean.year.${StartDir}.sh |
---|
| 1245 | echo "${libIGCM}/clean_year.job ; cd -" >> ${RUN_DIR}/Qclean.year.${StartDir}.sh |
---|
| 1246 | |
---|
| 1247 | # * Update files : config.card, Job_, COMP/comp.card |
---|
| 1248 | IGCM_ensemble_DateFilesUpdate ${DateBegin} ${DateEnd} ${RestartDate} ${InitFrom} |
---|
[1001] | 1249 | fi |
---|
[1007] | 1250 | |
---|
[1001] | 1251 | (( i = i + 1 )) |
---|
| 1252 | done |
---|
| 1253 | |
---|
| 1254 | # Done. Save ${StartDir} submission text file |
---|
[1007] | 1255 | IGCM_sys_Cp ${RUN_DIR}/Qsub.${StartDir}.sh ${SUBMIT_DIR} |
---|
| 1256 | IGCM_sys_Cp ${RUN_DIR}/Qclean.month.${StartDir}.sh ${SUBMIT_DIR} |
---|
| 1257 | IGCM_sys_Cp ${RUN_DIR}/Qclean.year.${StartDir}.sh ${SUBMIT_DIR} |
---|
[1001] | 1258 | |
---|
| 1259 | (( DateNum = DateNum + 1 )) |
---|
| 1260 | done |
---|
| 1261 | |
---|
| 1262 | # Done. Save ${StartDir} submission text file |
---|
[1007] | 1263 | IGCM_sys_Cp ${RUN_DIR}/Qsub.${StartDir}.sh ${SUBMIT_DIR} |
---|
| 1264 | IGCM_sys_Cp ${RUN_DIR}/Qclean.month.${StartDir}.sh ${SUBMIT_DIR} |
---|
| 1265 | IGCM_sys_Cp ${RUN_DIR}/Qclean.year.${StartDir}.sh ${SUBMIT_DIR} |
---|
| 1266 | |
---|
[1001] | 1267 | IGCM_debug_PopStack "IGCM_ensemble_DateNonPeriodicStarts" |
---|
| 1268 | } |
---|
| 1269 | |
---|
| 1270 | function IGCM_ensemble_DateFilesUpdate |
---|
| 1271 | { |
---|
| 1272 | IGCM_debug_PushStack "IGCM_ensemble_DateFilesUpdate" |
---|
| 1273 | |
---|
| 1274 | # Debug Print : |
---|
| 1275 | echo |
---|
| 1276 | IGCM_debug_Print 1 "IGCM_ensemble_DateFilesUpdate :" |
---|
| 1277 | |
---|
| 1278 | HumanDateBegin=$( IGCM_date_ConvertFormatToHuman ${1} ) |
---|
| 1279 | HumanDateEnd=$( IGCM_date_ConvertFormatToHuman ${2} ) |
---|
| 1280 | HumanRestartDate=$( IGCM_date_ConvertFormatToHuman ${3} ) |
---|
[1007] | 1281 | if [[ X${4} != "X" ]]; then |
---|
[1026] | 1282 | initFrom=${4} # non periodic config (INITFROM could be different between members) |
---|
[1007] | 1283 | else |
---|
[1026] | 1284 | initFrom=${ensemble_Ens_DATE_INITFROM} # periodic (same INITFROM value) |
---|
[1007] | 1285 | fi |
---|
| 1286 | |
---|
[1001] | 1287 | # ==> config.card |
---|
| 1288 | # [ENSEMBLE] |
---|
| 1289 | IGCM_card_WriteOption ${SUBMIT_DIR}/${StartDir}/${MemberDir}/config.card Ensemble EnsembleRun 'y' |
---|
| 1290 | IGCM_card_WriteOption ${SUBMIT_DIR}/${StartDir}/${MemberDir}/config.card Ensemble EnsembleName ${ensemble_Ens_DATE_NAME} |
---|
| 1291 | IGCM_card_WriteOption ${SUBMIT_DIR}/${StartDir}/${MemberDir}/config.card Ensemble EnsembleDate ${HumanDateBegin} |
---|
| 1292 | IGCM_card_WriteOption ${SUBMIT_DIR}/${StartDir}/${MemberDir}/config.card Ensemble EnsembleType "Ens_DATE" |
---|
[1007] | 1293 | |
---|
[1001] | 1294 | # [UserChoices] |
---|
| 1295 | IGCM_card_WriteOption ${SUBMIT_DIR}/${StartDir}/${MemberDir}/config.card UserChoices JobName ${MemberDir} |
---|
| 1296 | IGCM_card_WriteOption ${SUBMIT_DIR}/${StartDir}/${MemberDir}/config.card UserChoices DateBegin ${HumanDateBegin} |
---|
| 1297 | IGCM_card_WriteOption ${SUBMIT_DIR}/${StartDir}/${MemberDir}/config.card UserChoices DateEnd ${HumanDateEnd} |
---|
[1007] | 1298 | |
---|
[1001] | 1299 | # [Restarts] |
---|
| 1300 | IGCM_card_WriteOption ${SUBMIT_DIR}/${StartDir}/${MemberDir}/config.card Restarts OverRule "y" |
---|
| 1301 | IGCM_card_WriteOption ${SUBMIT_DIR}/${StartDir}/${MemberDir}/config.card Restarts RestartDate ${HumanRestartDate} |
---|
[1007] | 1302 | IGCM_card_WriteOption ${SUBMIT_DIR}/${StartDir}/${MemberDir}/config.card Restarts RestartJobName ${initFrom} |
---|
[1001] | 1303 | IGCM_card_WriteOption ${SUBMIT_DIR}/${StartDir}/${MemberDir}/config.card Restarts RestartPath ${ensemble_Ens_DATE_INITPATH} |
---|
| 1304 | |
---|
| 1305 | # [ATM/OCE/...] |
---|
| 1306 | for comp in ${config_ListOfComponents[*]} ; do |
---|
| 1307 | IGCM_card_WriteOption ${SUBMIT_DIR}/${StartDir}/${MemberDir}/config.card ${comp} Restart "n" |
---|
| 1308 | done |
---|
[1007] | 1309 | unset initFrom |
---|
| 1310 | |
---|
[1001] | 1311 | # ==> Job |
---|
| 1312 | sed -e "s/\(#.*\)${config_UserChoices_JobName}\( *#.*\)/\1${MemberDir} \2/" \ |
---|
| 1313 | -e "s/\(#.*Script_Output_\)${config_UserChoices_JobName}\(\.*\)/\1${MemberDir}\2/" \ |
---|
[1026] | 1314 | -e "s/^PeriodNb=.*/PeriodNb=60/" \ |
---|
[1001] | 1315 | ${SUBMIT_DIR}/${StartDir}/${MemberDir}/Job_${MemberDir} > Job_${MemberDir}.tmp |
---|
| 1316 | IGCM_sys_Mv Job_${MemberDir}.tmp ${SUBMIT_DIR}/${StartDir}/${MemberDir}/Job_${MemberDir} |
---|
| 1317 | |
---|
| 1318 | IGCM_debug_PopStack "IGCM_ensemble_DateFilesUpdate" |
---|
| 1319 | } |
---|
| 1320 | |
---|
| 1321 | ############### Parametric ENSEMBLE ################# |
---|