- Timestamp:
- Nov 10, 2022, 4:18:58 PM (2 years ago)
- Location:
- BOL/Replay
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
BOL/Replay/replay_1D.sh
r4344 r4346 20 20 replay_clean.sh 21 21 replay_equip.sh $routine 22 # If wanting to equip other routines with nc outputs only 23 # replay_equip.sh -nconly -pre TOTO other_routine 22 24 cd - 23 25 -
BOL/Replay/replay_clean.sh
r4337 r4346 2 2 3 3 replay_comment="replay automatic include" 4 \rm -f dump_ param*.h dump_ini.hcall_param_replay.F90 dump_ini_module.F90 get_ini_module.F90 input tmp tmp24 \rm -f dump_replay*.h mcall_param_replay.F90 dump_ini_module.F90 get_ini_module.F90 input tmp tmp2 5 5 for file in `grep "$replay_comment" *F90 | cut -d: -f1` ; do 6 6 sed -i"" -e "/$replay_comment/d" $file -
BOL/Replay/replay_equip.sh
r4337 r4346 74 74 #============================================================================= 75 75 76 param=`basename $1 .F90` 76 #----------------------------------------------------------------------------- 77 # Reading rguments 78 #----------------------------------------------------------------------------- 79 nconly=false 80 if [ $# = 0 ] ; then $0 -h ; exit ; fi 81 while (($# > 0)) 82 do 83 case $1 in 84 -h|--help) cat <<........fin 85 $0 [-nconly] [-pre prefix] routine_name 86 The prefix will be put on each variable stored in the nc file 87 ........fin 88 exit ;; 89 -nconly) nconly=true ; shift ;; 90 -pre) prefix=$2 ; shift ; shift ;; 91 *) if (( $# > 1 )) ; then $0 -h ; exit ; fi ; param=`basename $1 .F90` ; shift 92 esac 93 done 94 if [ "$param" = "" ] ; then $0 -h ; exit ; fi 95 77 96 case $param in 78 97 thermcell_main|thermcell_plume_6A|thermcell_env|thermcell_height|thermcell_dry|\ … … 84 103 85 104 replay_comment="replay automatic include" 86 paraminc1=dump_param1.h 87 paraminc2=dump_param2.h 88 iniinc=dump_ini.h 105 paraminc1=dump_replay_${param}_head.h 106 paraminc2=dump_replay_${param}_nc_${prefix}.h 107 iniinc=dump_replay_ini.h 108 paramfile=`grep -i "subro.* ${param}[\ (]" *.F90 | sed -e 's/ //g' | grep "${param}(" | cut -d: -f1` 109 echo La parametrisation $param est contenue dans le fichier $paramfile 110 if [ `echo ${paramfile} | wc -w` != 1 ] ; then echo file $paramfile multiple ; $0 -h ; exit ; fi 111 89 112 90 113 #----------------------------------------------------------------------------- … … 118 141 echo '! dump_param_open >>> ' 119 142 } 143 120 144 121 145 #----------------------------------------------------------------------------- … … 133 157 \rm -f tmp tmp2 134 158 } 159 135 160 136 161 #----------------------------------------------------------------------------- … … 159 184 } 160 185 161 #----------------------------------------------------------------------------- 162 function get_param_file(){ 163 #----------------------------------------------------------------------------- 164 p=$1 165 grep -i "subro.* $p[\ (]" *.F90 | sed -e 's/ //g' | grep "$p(" | cut -d: -f1 166 } 186 187 167 188 168 189 #----------------------------------------------------------------------------- … … 181 202 182 203 #----------------------------------------------------------------------------- 204 function iotd_calls(){ 205 #----------------------------------------------------------------------------- 206 klev=$1 ; shift 207 pre=$1 ; shift 208 if (( $# >> 0 )) ; then 209 vars=$* 210 for var in $vars ; do 211 echo "call iotd_ecrit_seq('"$pre$var"',1,'"$pre$var in $param"',' ',"$var")" 212 done 213 fi 214 } 215 216 217 #----------------------------------------------------------------------------- 183 218 # On nettoye les inclusions précédente dans les fichiers .F90 184 219 #----------------------------------------------------------------------------- 185 220 186 for file in `grep "$replay_comment" *.F90 2> /dev/null | cut -d: -f1` ; do 187 sed -i"" -e "/$replay_comment/d" $file 188 done 189 line=`sed -n -e "/CALL wake_ini/=" physiq_mod.F90 | head -1` 190 sed -i"" -e "${line}s/$/\n CALL iophys_ini(pdtphys) ! $replay_comment ! $replay_comment/" physiq_mod.F90 191 192 #----------------------------------------------------------------------------- 193 # Modifying the parameterization routine 194 #----------------------------------------------------------------------------- 195 196 paramfile=`get_param_file $param` 197 echo La parametrisation $param est contenue dans le fichier $paramfile 198 if [ `echo ${paramfile} | wc -w` != 1 ] ; then echo file $paramfile multiple exit ; fi 199 extract_subroutine $param $paramfile 221 if [ $nconly = false ] ; then 222 for file in `grep "$replay_comment" *.F90 2> /dev/null | cut -d: -f1` ; do 223 sed -i"" -e "/$replay_comment/d" $file 224 done 225 line=`sed -n -e "/CALL wake_ini/=" physiq_mod.F90 | head -1` 226 sed -i"" -e "${line}s/$/\n CALL iophys_ini(pdtphys) ! $replay_comment ! $replay_comment/" physiq_mod.F90 227 fi 200 228 201 229 #----------------------------------------------------------------------------- … … 203 231 #----------------------------------------------------------------------------- 204 232 233 extract_subroutine $param $paramfile # -> input file 205 234 varin0=`grep inten.*.in input | sed -e 's/\!.*$//' | cut -d: -f3 | sed -e 's/,/ /g'` 206 235 varinout0=`grep inten.*.inout input | sed -e '/\!.*$/d' | cut -d: -f3 | sed -e 's/,/ /g'` … … 213 242 full) search_str='real' 214 243 esac 244 var_1D_inout=`grep -i "$search_str" input | grep intent.*inout | grep $klon | sed -e 's/!.*$//' -e /$klev/d | cut -d: -f3 | sed -e 's/,/ /g'` 245 var_2D_inout=`grep -i "$search_str" input | grep intent.*inout | grep $klon | grep $klev | cut -d: -f3 | sed -e 's/!.*$//' -e 's/,/ /g'` 215 246 var_1D_noarg=`grep -i "$search_str" input | sed -e /intent/d | grep $klon | sed -e 's/!.*$//' -e /$klev/d | cut -d: -f3 | sed -e 's/,/ /g'` 216 247 var_2D_noarg=`grep -i "$search_str" input | sed -e /intent/d | grep $klon | grep $klev | cut -d: -f3 | sed -e 's/!.*$//' -e 's/,/ /g'` … … 218 249 var_2D=`grep -i "$search_str" input | grep $klon | grep $klev | cut -d: -f3 | sed -e 's/!.*$//' -e 's/,/ /g'` 219 250 echo varin : $varin 220 echo var_1D_noarg : $var_1D_noarg 221 echo var_2D_noarg : $var_2D_noarg 222 echo var_1D : $var_1D 223 echo var_2D : $var_2D 251 echo var_1D_inout : $var_1D_inout ; echo 252 echo var_2D_inout : $var_2D_inout ; echo 253 echo var_1D_noarg : $var_1D_noarg ; echo 254 echo var_2D_noarg : $var_2D_noarg ; echo 255 echo var_1D : $var_1D ; echo 256 echo var_2D : $var_2D ; echo 224 257 225 258 #----------------------------------------------------------------------------- 226 259 # Ecriture de la routine d'appel a la parametrisation en mode replay 227 260 #----------------------------------------------------------------------------- 261 262 if [ $nconly = false ] ; then 228 263 229 264 cat > call_param_replay.F90 <<eod … … 268 303 eod 269 304 270 271 #----------------------------------------------------------------------------- 272 # Creation d'un .h d'ecriture de toutes les variables intent in & out 305 fi # nconly = false 306 307 #----------------------------------------------------------------------------- 308 # Creating file dump_${param}_head.h 273 309 #----------------------------------------------------------------------------- 274 310 275 311 \rm $paraminc1 312 if [ $nconly = false ] ; then 276 313 cat> $paraminc1 <<eod 277 314 logical, save :: first=.true. … … 286 323 write(81,rec=irec) $varin 287 324 eod 325 iotd_calls 1 in_${prefix} $var_1D_inout >> $paraminc1 326 iotd_calls $klev in_${prefix} $var_2D_inout >> $paraminc1 327 fi # nconly = false 328 288 329 for var in $var_1D_noarg $var_2D_noarg ; do echo $var=0. >> $paraminc1 ; done 289 330 include_line "include \"$paraminc1\"" $param $paramfile after_declarations 290 331 332 #----------------------------------------------------------------------------- 333 # Creating file dump_${param}_nc_${prefix}.h 334 #----------------------------------------------------------------------------- 335 291 336 \rm $paraminc2 292 for var in $var_1D ; do 293 echo "call iotd_ecrit_seq('"$var"',1,'"$var"',' ',"$var")" >> $paraminc2 294 done 295 for var in $var_2D ; do 296 echo "call iotd_ecrit_seq('"$var"',"$klev",'"$var"',' ',"$var")" >> $paraminc2 297 done 337 iotd_calls 1 "${prefix}" $var_1D >> $paraminc2 338 iotd_calls $klev "${prefix}" $var_2D >> $paraminc2 298 339 include_line "include \"$paraminc2\"" $param $paramfile before_return 299 340 … … 303 344 #----------------------------------------------------------------------------- 304 345 346 if [ $nconly = false ] ; then 305 347 varinmod=`grep -i 'intent.in' $inimod.F90 | sed -e 's/\!.*$//' | cut -d: -f3 | sed -e 's/,/ /g'` 306 348 varinmodv=`echo $varinmod | sed -e 's/ /,/g'` … … 311 353 eod 312 354 include_line "include \"$iniinc\"" $paramini $inimod.F90 before_return 355 fi # nconly = false 313 356 314 357 … … 316 359 # get_ini_module gere l'initialisation du module en mode replay 317 360 #----------------------------------------------------------------------------- 318 361 if [ $nconly = false ] ; then 319 362 cat > get_ini_module.F90 <<eod 320 363 subroutine get_ini_module … … 334 377 end 335 378 eod 379 fi # nconly = false 336 380 337 381 #-----------------------------------------------------------------------------
Note: See TracChangeset
for help on using the changeset viewer.