Changeset 2610 for palm/trunk
- Timestamp:
- Nov 15, 2017 8:24:11 AM (7 years ago)
- Location:
- palm/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
palm/trunk/SCRIPTS/palmrun
r2605 r2610 27 27 # ----------------- 28 28 # $Id$ 29 # use of wildcards in file connection statements enabled 30 # 31 # 2605 2017-11-09 15:31:46Z raasch 29 32 # in case of remote jobs, input files with "job" or "jobopt" (new) attribute 30 33 # will not be sent with the job file any more, but copied into the 31 # SOURCES_FOR_RUN... folder on the remote host, before he job is submitted34 # SOURCES_FOR_RUN... folder on the remote host, before the job is submitted 32 35 # 33 36 # 2600 2017-11-01 14:11:20Z raasch … … 85 88 set +o noclobber # EXISTING FILES ARE ALLOWED TO BE OVERWRITTEN 86 89 87 typeset -i ibd=0 ibdt=0 iec=0 iic=0 iin=0 ioc=0 iout=0 90 typeset -i ibd=0 ibdt=0 iec=0 iic=0 iin=0 ioc=0 iout=0 nr_of_input_files=0 91 typeset -i nr_of_output_files=0 88 92 typeset -x -i memory=0 # HAS TO BE EXPORTED HERE, OTHERWISE AN UNKNOWN SIDE 89 93 # SIDE EFFECT MAY CAUSE DATA LOSS WHEN GETOPTS IS READING THE … … 556 560 # LOCALLY REQUIRED ON THAT MACHINE (I.E. s2b = loc), THE FILE CONNECTION 557 561 # IS NOT CHECKED AND STORED. 558 IFSALT="$IFS"; IFS="$IFS:" 562 IFSALT="$IFS"; IFS="$IFS:" # ADD ":" AS FIELD SEPARATOR 559 563 if [[ "$s2a" = in && ! ( $create_remote_batch_job = true && ( "$s2b" = loc || "$s2b" = locopt ) ) ]] 560 564 then … … 570 574 then 571 575 (( iin = iin + 1 )) 572 localin[$iin]=$s1; transin[$iin]=$s2b; actionin[$iin]=$s2c; 573 typein[$iin]=$s3; pathin[$iin]=$s4; endin[$iin]=$s5; 574 extin[$iin]=$s6 576 localin_pre[$iin]=$s1; transin_pre[$iin]=$s2b; actionin_pre[$iin]=$s2c; 577 pathin_pre[$iin]=$s4; endin_pre[$iin]=$s5; extin_pre[$iin]=$s6 575 578 576 579 # FILES WITH JOB-ATTRIBUTE ARE STORED IN THE SOURCES_FOR_RUN … … 578 581 if [[ $running_on_remote = true && ( "$s2b" = job || "$s2b" = jobopt ) ]] 579 582 then 580 pathin [$iin]=${fast_io_catalog}/${sources_for_run_catalog}583 pathin_pre[$iin]=${fast_io_catalog}/${sources_for_run_catalog} 581 584 fi 582 585 586 # CHECK FOR MULTIPLE FILES, SET A RESPECTIVE FLAG AND REMOVE 587 # THE WILDCARD FROM THE ENDING 588 if [[ "${s5: -1}" = "*" ]] 589 then 590 if [[ "$s2c" = "di" ]] 591 then 592 printf "\n +++ wildcards (*) not allowed with \"di\" file attribute." 593 printf "\n see file \"$fileconnection_file\", line" 594 printf "\n$line" 595 locat=iofiles_file; exit 596 fi 597 multin[$iin]=true 598 string=${endin_pre[$iin]} 599 endin_pre[$iin]="${string%?}" 600 else 601 multin[$iin]=false 602 fi 583 603 fi 584 604 elif [[ "$s2a" = out && ! ( $create_remote_batch_job = true && "$s2b" = loc ) ]] … … 595 615 then 596 616 (( iout = iout + 1 )) 597 localout[$iout]=$s1; actionout[$iout]=$s2c; typeout[$iout]=$s3; 598 pathout[$iout]=$s4; endout[$iout]=$s5; extout[$iout]=$s6 617 localout_pre[$iout]=$s1; actionout_pre[$iout]=$s2c; typeout_pre[$iout]=$s3; 618 pathout_pre[$iout]=$s4; endout_pre[$iout]=$s5; extout_pre[$iout]=$s6 619 620 # CHECK FOR MULTIPLE FILES, SET A RESPECTIVE FLAG AND REMOVE 621 # THE WILDCARD FROM THE LOCAL FILENAME 622 if [[ "${s1: -1}" = "*" ]] 623 then 624 if [[ "$s2c" = "di" ]] 625 then 626 printf "\n +++ wildcards (*) not allowed with \"di\" file attribute." 627 printf "\n see file \"$fileconnection_file\", line" 628 printf "\n$line" 629 locat=iofiles_file; exit 630 fi 631 multout[$iout]=true 632 string=${localout_pre[$iout]} 633 localout_pre[$iout]="${string%?}" 634 else 635 multout[$iout]=false 636 fi 599 637 fi 600 638 elif [[ "$s2a" != in && "$s2a" != out ]] … … 967 1005 # CHECK, IF INPUT-FILES EXIST, AND DETERMINE HIGHEST CYCLE NUMBER (IF CYCLES EXIST) 968 1006 (( i = 0 )) 1007 (( nr_of_input_files = 0 )) 969 1008 while (( i < iin )) 970 1009 do 971 1010 (( i = i + 1 )) 972 (( maxcycle = 0 ))973 1011 974 1012 # GENERATE PATH AND FULL FILE NAME (then-BRANCH: FIXED FULL NAME IS GIVEN, I.E. THE 975 1013 # FILE IDENTIFIER IS NOT PART OF THE FILENAME)) 976 if [[ "${actionin[$i]}" = di ]] 977 then 978 remotepathin[$i]=${pathin[$i]}/${endin[$i]} # EVALUATE REMOTE-PATH ON THE REMOTE 979 # HOST ONLY 980 eval filename=${pathin[$i]}/${endin[$i]} 1014 if [[ "${actionin_pre[$i]}" = di ]] 1015 then 1016 eval filename=${pathin_pre[$i]}/${endin_pre[$i]} 981 1017 else 982 remotepathin[$i]=${pathin[$i]}/${fname}${endin[$i]} # EVALUATE REMOTE-PATH ON THE REMOTE 983 # HOST ONLY 984 eval filename=${pathin[$i]}/${fname}${endin[$i]} 985 fi 986 eval pathname=${pathin[$i]} 1018 eval filename=${pathin_pre[$i]}/${fname}${endin_pre[$i]} 1019 fi 1020 987 1021 988 1022 # CHECK IF FILE EXISTS … … 991 1025 992 1026 # FILES WITH ATTRIBUTE locopt ARE OPTIONAL. NO ABORT, IF THEY DO NOT EXIST. 993 if [[ "${transin [$i]}" != "locopt" && "${transin[$i]}" != "jobopt" ]]1027 if [[ "${transin_pre[$i]}" != "locopt" && "${transin_pre[$i]}" != "jobopt" ]] 994 1028 then 995 1029 printf "\n\n +++ INPUT-file: " 996 if [[ "${extin [$i]}" = "" || "${extin[$i]}" = " " ]]1030 if [[ "${extin_pre[$i]}" = "" || "${extin_pre[$i]}" = " " ]] 997 1031 then 998 1032 printf "\n $filename" 999 1033 else 1000 printf "\n $filename.${extin [$i]}"1034 printf "\n $filename.${extin_pre[$i]}" 1001 1035 fi 1002 1036 printf "\n does not exist\n" 1003 1037 locat=input; exit 1004 1038 else 1005 transin[$i]="unavailable" 1039 (( nr_of_input_files = nr_of_input_files + 1 )) 1040 localin[$nr_of_input_files]="${localin_pre[$i]}" 1041 transin[$nr_of_input_files]="unavailable" 1042 actionin[$nr_of_input_files]="${actionin_pre[$i]}" 1043 pathin[$nr_of_input_files]="${pathin_pre[$i]}" 1044 endin[$nr_of_input_files]="${endin_pre[$i]}" 1045 extin[$nr_of_input_files]="${extin_pre[$i]}" 1006 1046 fi 1007 1047 1008 1048 else 1009 1049 1010 # DETERMINE THE FILE'S CYCLE NUMBER 1011 ls -1 -d $filename > filelist 2>/dev/null 1012 ls -1 -d $filename.* >> filelist 2>/dev/null 1013 while read line 1050 # FIRST CHECK FOR MULTIPLE NAMES WITH THE SAME BASENAME ($fname) AND 1051 # CREATE A LIST FOR THE DETECTED BASENAME ENDINGS 1052 if [[ "${multin[$i]}" = true ]] 1053 then 1054 # DETERMINE THE EXISTING EXTENSIONS FROM THE LIST OF FILES 1055 ls -1 -d ${filename} > filelist 2>/dev/null 1056 ls -1 -d ${filename}.* >> filelist 2>/dev/null 1057 ls -1 -d ${filename}_* >> filelist 2>/dev/null 1058 1059 endings="" 1060 while read line 1061 do 1062 # filename without path (i.e. after the last "/") 1063 basefilename=$(basename ${line}) 1064 1065 # check if there is an extension and remove it 1066 ext=${basefilename##*.} 1067 if [[ "$ext" = "${extin_pre[$i]}" ]] 1068 then 1069 basefilename=${basefilename%.*} 1070 fi 1071 1072 # check for an existing cycle number and remove it 1073 cycle=${basefilename##*.} 1074 if [[ $cycle =~ ^-?[0-9]+$ ]] 1075 then 1076 basefilename=${basefilename%.*} 1077 fi 1078 1079 # remove the fname from the beginning 1080 length_fname=${#fname} 1081 ending=${basefilename:${length_fname}} 1082 1083 # remove the ending given in the .iofiles from the beginning 1084 endingstring="${endin_pre[$i]}" 1085 length_ending=${#endingstring} 1086 ending=${ending:${length_ending}} 1087 1088 if [[ "$ending" = "" ]] 1089 then 1090 # standard ending as given in the .iofiles 1091 if [[ $(echo $endings | grep -c DEFAULT) = 0 ]] 1092 then 1093 endings="$endings DEFAULT" 1094 fi 1095 else 1096 # ending must start with "_", otherwise its a different file 1097 if [[ "${ending:0:1}" = "_" ]] 1098 then 1099 if [[ $(echo $endings | grep -c "$ending") = 0 ]] 1100 then 1101 endings="$endings $ending" 1102 fi 1103 fi 1104 fi 1105 1106 done <filelist 1107 1108 rm filelist 1109 1110 else 1111 1112 # SINGLE NAME 1113 endings=DEFAULT 1114 1115 fi 1116 1117 # FOR EACH BASENAME ENDING CREATE AN ENTRY IN THE FINAL INPUT FILE LIST 1118 for ending in $endings 1014 1119 do 1015 # filename without path (i.e. after the last "/") 1016 basefilename=$(basename ${line}) 1017 1018 # check if there is an extension 1019 extension=${basefilename##*.} 1020 if [[ "$extension" = "${extin[$i]}" ]] 1021 then 1022 basefilename=${basefilename%.*} 1023 fi 1024 1025 # check for an existing cycle number 1026 cycle=${basefilename##*.} 1027 if [[ $cycle =~ ^-?[0-9]+$ ]] 1028 then 1029 (( icycle = $cycle )) 1030 else 1031 (( icycle = 0 )) 1032 fi 1033 1034 if (( icycle > maxcycle )) 1035 then 1036 (( maxcycle = icycle )) 1037 1038 # FOR COMPATIBILITY REASONS WITH OLDER VERSIONS 1039 # CHECK IF CYCLE NUMBER CONTAINS LEADING ZEROS 1040 if [[ $(echo $cycle | cut -c1) = 0 ]] 1120 1121 # DEFAULT MEANS THAT THE ENDING GIVEN IN .iofiles SHALL BE USED 1122 if [[ $ending = DEFAULT ]] 1123 then 1124 ending="" 1125 fi 1126 1127 # NEW ENTRY (ENDING IS ALSO ADDED TO LOCAL FILENAME READ BY PALM!) 1128 (( nr_of_input_files = nr_of_input_files + 1 )) 1129 localin[$nr_of_input_files]="${localin_pre[$i]}"$ending 1130 transin[$nr_of_input_files]="${transin_pre[$i]}" 1131 actionin[$nr_of_input_files]="${actionin_pre[$i]}" 1132 pathin[$nr_of_input_files]="${pathin_pre[$i]}" 1133 endin[$nr_of_input_files]="${endin_pre[$i]}"$ending 1134 extin[$nr_of_input_files]="${extin_pre[$i]}" 1135 1136 1137 # GENERATE PATH AND FULL FILE NAME (then-BRANCH: FIXED FULL NAME IS GIVEN, I.E. THE 1138 # FILE IDENTIFIER IS NOT PART OF THE FILENAME)) 1139 if [[ "${actionin[$nr_of_input_files]}" = di ]] 1140 then 1141 eval filename=${pathin[$nr_of_input_files]}/${endin[$nr_of_input_files]} 1142 else 1143 eval filename=${pathin[$nr_of_input_files]}/${fname}${endin[$nr_of_input_files]} 1144 fi 1145 1146 # DETERMINE THE FILE'S CYCLE NUMBER 1147 (( maxcycle = 0 )) 1148 ls -1 -d $filename > filelist 2>/dev/null 1149 ls -1 -d $filename.* >> filelist 2>/dev/null 1150 while read line 1151 do 1152 # filename without path (i.e. after the last "/") 1153 basefilename=$(basename ${line}) 1154 1155 # check if there is an extension 1156 extension=${basefilename##*.} 1157 if [[ "$extension" = "${extin[$nr_of_input_files]}" ]] 1041 1158 then 1042 leading_zero=true 1159 basefilename=${basefilename%.*} 1160 fi 1161 1162 # check for an existing cycle number 1163 cycle=${basefilename##*.} 1164 if [[ $cycle =~ ^-?[0-9]+$ ]] 1165 then 1166 (( icycle = $cycle )) 1043 1167 else 1044 leading_zero=false1168 (( icycle = 0 )) 1045 1169 fi 1046 fi 1047 1048 done <filelist 1049 rm filelist 1050 1051 # MAKE CYCLE NUMBER THREE DIGITS WIDE 1052 if [[ $leading_zero = true ]] 1053 then 1054 cyclestring=`printf "%03d" $maxcycle` 1055 else 1056 cyclestring=$maxcycle 1057 fi 1058 1059 # APPEND CYCLE NUMBER TO FILENAME 1060 if (( maxcycle > 0 )) 1061 then 1062 if [[ "${extin[$i]}" != " " && "${extin[$i]}" != "" ]] 1063 then 1064 filename=${filename}.$cyclestring.${extin[$i]} 1170 1171 if (( icycle > maxcycle )) 1172 then 1173 (( maxcycle = icycle )) 1174 1175 # FOR COMPATIBILITY REASONS WITH OLDER VERSIONS 1176 # CHECK IF CYCLE NUMBER CONTAINS LEADING ZEROS 1177 if [[ $(echo $cycle | cut -c1) = 0 ]] 1178 then 1179 leading_zero=true 1180 else 1181 leading_zero=false 1182 fi 1183 fi 1184 1185 done <filelist 1186 rm filelist 1187 1188 # MAKE CYCLE NUMBER THREE DIGITS WIDE 1189 if [[ $leading_zero = true ]] 1190 then 1191 cyclestring=`printf "%03d" $maxcycle` 1065 1192 else 1066 filename=${filename}.$cyclestring 1067 fi 1068 else 1069 if [[ "${extin[$i]}" != " " && "${extin[$i]}" != "" ]] 1070 then 1071 filename=${filename}.${extin[$i]} 1072 fi 1073 fi 1074 1075 # STORE FILENAME WITHOUT PATH BUT WITH CYCLE NUMBER, 1076 # IS LATER USED FOR TRANSFERRING FILES WIHIN THE JOB (SEE END OF FILE) 1077 absnamein[$i]=$filename 1078 if (( maxcycle > 0 )) 1079 then 1080 if [[ "${actionin[$i]}" = di ]] 1081 then 1082 frelin[$i]=${endin[$i]}.$cyclestring 1193 cyclestring=$maxcycle 1194 fi 1195 1196 # APPEND CYCLE NUMBER TO FILENAME 1197 if (( maxcycle > 0 )) 1198 then 1199 if [[ "${extin[$nr_of_input_files]}" != " " && "${extin[$nr_of_input_files]}" != "" ]] 1200 then 1201 filename=${filename}.$cyclestring.${extin[$nr_of_input_files]} 1202 else 1203 filename=${filename}.$cyclestring 1204 fi 1083 1205 else 1084 frelin[$i]=${fname}${endin[$i]}.$cyclestring 1085 fi 1086 else 1087 if [[ "${actionin[$i]}" = di ]] 1088 then 1089 frelin[$i]=${endin[$i]} 1206 if [[ "${extin[$nr_of_input_files]}" != " " && "${extin[$nr_of_input_files]}" != "" ]] 1207 then 1208 filename=${filename}.${extin[$nr_of_input_files]} 1209 fi 1210 fi 1211 1212 # STORE FILENAME WITHOUT PATH BUT WITH CYCLE NUMBER, 1213 # IS LATER USED FOR TRANSFERRING FILES WIHIN THE JOB (SEE END OF FILE) 1214 absnamein[$nr_of_input_files]=$filename 1215 if (( maxcycle > 0 )) 1216 then 1217 if [[ "${actionin[$nr_of_input_files]}" = di ]] 1218 then 1219 frelin[$nr_of_input_files]=${endin[$nr_of_input_files]}.$cyclestring 1220 else 1221 frelin[$nr_of_input_files]=${fname}${endin[$nr_of_input_files]}.$cyclestring 1222 fi 1090 1223 else 1091 frelin[$i]=${fname}${endin[$i]} 1092 fi 1093 fi 1094 1095 fi 1224 if [[ "${actionin[$nr_of_input_files]}" = di ]] 1225 then 1226 frelin[$nr_of_input_files]=${endin[$nr_of_input_files]} 1227 else 1228 frelin[$nr_of_input_files]=${fname}${endin[$nr_of_input_files]} 1229 fi 1230 fi 1231 1232 done 1233 1234 fi 1235 1096 1236 done 1097 1237 1098 1238 1099 1239 # GENERATE FULL FILENAMES OF OUTPUT-FILES (WITHOUT $ OR ~), 1100 1240 # CHECK, IF OUTPUT-FILES EXIST, AND DETERMINE HIGHEST CYCLE NUMBER (IF CYCLES EXIST), 1101 1241 # OR, IN CASE THAT FILE DOES NOT EXIST, CHECK, IF IT CAN BE CREATED 1102 # THESE ACTIONS ARE NOT CARRIED OUT, IF FILES SHALL BE TRA SFERRED FROM THE REMOTE TO1242 # THESE ACTIONS ARE NOT CARRIED OUT, IF FILES SHALL BE TRANSFERRED FROM THE REMOTE TO 1103 1243 # THE LOCAL HOST (BECAUSE THEIR IS NO DIRECT ACCESS TO THE LOCAL DIRECTORIES FROM THE 1104 1244 # REMOTE HOST) … … 1107 1247 do 1108 1248 (( i = i + 1 )) 1109 if [[ ! ( $running_on_remote = true && ( "${actionout [$i]}" = tr || "${actionout[$i]}" = tra || "${actionout[$i]}" = trpe ) ) ]]1110 then 1111 if [[ "${actionout [$i]}" = tr ]]1112 then 1113 actionout [$i]=""1114 elif [[ "${actionout [$i]}" = trpe ]]1115 then 1116 actionout [$i]=pe1117 elif [[ "${actionout [$i]}" = tra ]]1118 then 1119 actionout [$i]=a1249 if [[ ! ( $running_on_remote = true && ( "${actionout_pre[$i]}" = tr || "${actionout_pre[$i]}" = tra || "${actionout_pre[$i]}" = trpe ) ) ]] 1250 then 1251 if [[ "${actionout_pre[$i]}" = tr ]] 1252 then 1253 actionout_pre[$i]="" 1254 elif [[ "${actionout_pre[$i]}" = trpe ]] 1255 then 1256 actionout_pre[$i]=pe 1257 elif [[ "${actionout_pre[$i]}" = tra ]] 1258 then 1259 actionout_pre[$i]=a 1120 1260 fi 1121 1261 (( maxcycle = 0 )) 1122 eval filename=${pathout [$i]}/${fname}${endout[$i]}1123 eval catalogname=${pathout [$i]}1262 eval filename=${pathout_pre[$i]}/${fname}${endout_pre[$i]} 1263 eval catalogname=${pathout_pre[$i]} 1124 1264 if ! ls $filename* 1>/dev/null 2>&1 1125 1265 then … … 1156 1296 fi 1157 1297 fi 2>/dev/null 1158 else 1159 1160 # DETERMINE THE CYCLE NUMBER 1161 ls -1 -d $filename > filelist 2>/dev/null 1162 ls -1 -d $filename.* >> filelist 2>/dev/null 1163 while read line 1164 do 1165 1166 # filename without path (i.e. after the last "/") 1167 basefilename=$(basename ${line}) 1168 1169 # check if there is an extension 1170 extension=${basefilename##*.} 1171 if [[ "$extension" = "${extout[$i]}" ]] 1172 then 1173 basefilename=${basefilename%.*} 1174 fi 1175 1176 # check for an existing cycle number 1177 cycle=${basefilename##*.} 1178 if [[ $cycle =~ ^-?[0-9]+$ ]] 1179 then 1180 (( icycle = $cycle + 1 )) 1181 else 1182 (( icycle = 1 )) 1183 fi 1184 1185 if (( icycle > maxcycle )) 1186 then 1187 (( maxcycle = icycle )) 1188 fi 1189 1190 done <filelist 1191 rm filelist 1192 fi 1193 1194 # APPEND CYCLE NUMBER TO FILENAME AND CHECK, IF FILE CAN BE CREATED 1195 # IN CASE OF FILE-APPEND, FILE MUST BE APPENDED TO THE ONE WITH HIGHEST CYCLE NUMBER 1196 if [[ "${actionout[$i]}" != a ]] 1197 then 1198 cyclestring=`printf "%03d" $maxcycle` 1199 if (( maxcycle > 0 )) 1200 then 1201 filename_tmp=${filename}.$cyclestring 1202 if cat /dev/null > $filename_tmp 1203 then 1204 rm $filename_tmp 1205 else 1206 printf "\n +++ OUTPUT-file:" 1207 printf "\n $filename_tmp" 1208 printf "\n cannot be created" 1209 locat=output ; exit 1210 fi 1211 fi 1212 else 1213 (( maxcycle = maxcycle - 1 )) 1214 fi 1215 1216 (( cycnum[$i] = maxcycle )) 1217 pathout[$i]=$filename 1298 1299 fi 1218 1300 1219 1301 fi … … 1499 1581 then 1500 1582 (( i = 0 )) 1501 while (( i < iin))1583 while (( i < nr_of_input_files )) 1502 1584 do 1503 1585 (( i = i + 1 )) … … 1678 1760 then 1679 1761 (( i = 0 )) 1680 while (( i < iin))1762 while (( i < nr_of_input_files )) 1681 1763 do 1682 1764 (( i = i + 1 )) … … 1721 1803 # LOOP OVER ALL ACTIVATED FILES (LISTED IN THE CONFIGURATION FILE) 1722 1804 (( i = 0 )) 1723 while (( i < iin))1805 while (( i < nr_of_input_files )) 1724 1806 do 1725 1807 (( i = i + 1 )) … … 1987 2069 1988 2070 1989 # PROVIDE DATA FOR 2071 # PROVIDE DATA FOR ATMOSPHERE OCEAN COUPLING 1990 2072 if [[ $run_coupled_model = false ]] 1991 2073 then … … 2066 2148 2067 2149 2150 # IN A FIRST PASS, ADD ADDITIONAL OUTPUT FILE CONNECTIONS IN CASE OF 2151 # WILDCARDS 2152 (( i = 0 )) 2153 (( nr_of_output_files = 0 )) 2154 2155 while (( i < iout )) 2156 do 2157 2158 (( i = i + 1 )) 2159 2160 # FIRST CHECK FOR MULTIPLE NAMES WITH THE SAME LOCAL NAME AND 2161 # CREATE A LIST FOR THE DETECTED ENDINGS 2162 if [[ "${multout[$i]}" = true ]] 2163 then 2164 # DETERMINE THE EXISTING EXTENSIONS FROM THE LIST OF FILES 2165 ls -1 -d ${localout_pre[$i]} > filelist 2>/dev/null 2166 ls -1 -d ${localout_pre[$i]}_* >> filelist 2>/dev/null 2167 2168 endings="DEFAULT" 2169 while read line 2170 do 2171 # remove the local name from the beginning 2172 localnamestring="${localout_pre[$i]}" 2173 length_localname=${#localnamestring} 2174 ending=${line:${length_localname}} 2175 2176 if [[ "$ending" != "" ]] 2177 then 2178 endings="$endings $ending" 2179 fi 2180 2181 done <filelist 2182 2183 rm filelist 2184 2185 else 2186 2187 # SINGLE NAME 2188 endings=DEFAULT 2189 2190 fi 2191 2192 # FOR EACH BASENAME ENDING CREATE AN ENTRY IN THE FINAL OUTPUT FILE LIST 2193 for ending in $endings 2194 do 2195 2196 # DEFAULT MEANS THAT THE ENDING GIVEN IN .iofiles SHALL BE USED 2197 if [[ $ending = DEFAULT ]] 2198 then 2199 ending="" 2200 fi 2201 2202 # NEW ENTRY (ENDING IS ALSO ADDED TO LOCAL FILENAME READ BY PALM!) 2203 (( nr_of_output_files = nr_of_output_files + 1 )) 2204 localout[$nr_of_output_files]="${localout_pre[$i]}"$ending 2205 transout[$nr_of_output_files]="${transout_pre[$i]}" 2206 actionout[$nr_of_output_files]="${actionout_pre[$i]}" 2207 pathout[$nr_of_output_files]="${pathout_pre[$i]}" 2208 endout[$nr_of_output_files]="${endout_pre[$i]}"$ending 2209 extout[$nr_of_output_files]="${extout_pre[$i]}" 2210 2211 done 2212 2213 done 2214 2215 2216 2217 2068 2218 # COPY LOCAL OUTPUT-FILES TO THEIR PERMANENT DESTINATIONS 2069 2219 (( i = 0 )) 2070 while (( i < iout))2220 while (( i < nr_of_output_files )) 2071 2221 do 2072 2222 (( i = i + 1 )) … … 2093 2243 fi 2094 2244 2095 # ADD CYCLE NUMBER TO FILENAME2096 2245 if [[ ! ( $running_on_remote = true && ( "${actionout[$i]}" = tr || "${actionout[$i]}" = tra || "${actionout[$i]}" = trpe ) ) ]] 2097 2246 then 2098 2247 2099 # IN APPEND MODE, FILES KEEP THEIR CURRENT CYCLE NUMBER 2248 eval filename=${pathout[$i]}/${fname}${endout[$i]} 2249 2250 # DETERMINE THE CYCLE NUMBER 2251 ls -1 -d $filename > filelist 2>/dev/null 2252 ls -1 -d $filename.* >> filelist 2>/dev/null 2253 while read line 2254 do 2255 2256 # filename without path (i.e. after the last "/") 2257 basefilename=$(basename ${line}) 2258 2259 # check if there is an extension 2260 extension=${basefilename##*.} 2261 if [[ "$extension" = "${extout[$i]}" ]] 2262 then 2263 basefilename=${basefilename%.*} 2264 fi 2265 2266 # check for an existing cycle number 2267 cycle=${basefilename##*.} 2268 if [[ $cycle =~ ^-?[0-9]+$ ]] 2269 then 2270 (( icycle = $cycle + 1 )) 2271 else 2272 (( icycle = 1 )) 2273 fi 2274 2275 if (( icycle > maxcycle )) 2276 then 2277 (( maxcycle = icycle )) 2278 fi 2279 2280 done <filelist 2281 rm filelist 2282 2283 2284 # SET THE CYCLE NUMBER 2285 # IN CASE OF FILE-APPEND, IT MUST BE THE HIGHEST EXISTING CYCLE NUMBER 2286 if [[ "${actionout[$i]}" = a ]] 2287 then 2288 (( maxcycle = maxcycle - 1 )) 2289 fi 2290 2291 (( cycnum[$i] = maxcycle )) 2292 pathout[$i]=$filename 2293 2294 2295 # ADD CYCLE NUMBER TO FILENAME 2296 # IN APPEND MODE, FILES KEEP THEIR CURRENT CYCLE NUMBER 2100 2297 if [[ "${actionout[$i]}" != "a" ]] 2101 2298 then … … 2393 2590 # MAY BE VERY HUGE) 2394 2591 (( i = 0 )) 2395 while (( i < iin))2592 while (( i < nr_of_input_files )) 2396 2593 do 2397 2594 (( i = i + 1 )) -
palm/trunk/SOURCE/lpm_advec.f90
r2606 r2610 25 25 ! ----------------- 26 26 ! $Id$ 27 ! bugfix in logarithmic interpolation of v-component (usws was used by mistake) 28 ! 29 ! 2606 2017-11-10 10:36:31Z schwenkel 27 30 ! Changed particle box locations: center of particle box now coincides 28 31 ! with scalar grid point of same index. … … 431 434 !-- large particle speed. 432 435 us_int = MAX( surf_def_h(0)%us(surf_start), 0.01_wp ) 433 vsws_int = surf_def_h(0)% usws(surf_start)436 vsws_int = surf_def_h(0)%vsws(surf_start) 434 437 ELSEIF ( surf_lsm_h%start_index(jlog,ilog) <= & 435 438 surf_lsm_h%end_index(jlog,ilog) ) THEN 436 439 surf_start = surf_lsm_h%start_index(jlog,ilog) 437 440 us_int = MAX( surf_lsm_h%us(surf_start), 0.01_wp ) 438 vsws_int = surf_lsm_h% usws(surf_start)441 vsws_int = surf_lsm_h%vsws(surf_start) 439 442 ELSEIF ( surf_usm_h%start_index(jlog,ilog) <= & 440 443 surf_usm_h%end_index(jlog,ilog) ) THEN 441 444 surf_start = surf_usm_h%start_index(jlog,ilog) 442 445 us_int = MAX( surf_usm_h%us(surf_start), 0.01_wp ) 443 vsws_int = surf_usm_h% usws(surf_start)446 vsws_int = surf_usm_h%vsws(surf_start) 444 447 ENDIF 445 448 !
Note: See TracChangeset
for help on using the changeset viewer.