Changeset 4591
- Timestamp:
- Jun 29, 2023, 8:20:49 AM (17 months ago)
- Location:
- BOL/Replay
- Files:
-
- 1 deleted
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
BOL/Replay/replay_clean.sh
r4378 r4591 4 4 replay_comment="replay automatic include" 5 5 if [ $# = 0 ] ; then 6 \rm -f dump_replay*.h dump_param.h dump_ini.h call_param_repla* get_ini_modul*input tmp tmp2 tmp3 tmp2_cpp6 \rm -f dump_replay*.h dump_param.h dump_ini.h input tmp tmp2 tmp3 tmp2_cpp 7 7 for file in `grep "$replay_comment" *F90 | cut -d: -f1` ; do 8 8 sed -i"" -e "/$replay_comment/d" $file 9 9 done 10 cat > call_param_replay.F90 <<...eod 11 subroutine call_param_replay(ngrid,nlay) 12 integer,intent(in) :: ngrid,nlay 13 stop 'In call_param_replay : You should run replay_equip.sh before runing replay[13]d' 14 return 15 end 16 ...eod 17 cat > call_ini_replay.F90 <<...eod 18 subroutine call_ini_replay 19 stop 'In call_ini_replay : You should run replay_equip.sh before runing replay[13]d' 20 return 21 end 22 ...eod 23 10 24 else 11 25 for file in $* ; do -
BOL/Replay/replay_equip.sh
r4378 r4591 54 54 # * call_param_replay : sous programme d'appelle en boucle à la param 55 55 # * dump_ini_module.F90 : écriture de l'interface "in" de param_ini 56 # * get_ini_module: lecture de l'interface "in" de param_ini56 # * call_ini_replay.F90 : lecture de l'interface "in" de param_ini 57 57 # dans ${param_ini}_mod.bin. 58 58 # Par ailleurs, un programme replay1d a été ajouté dans phylmd/dyn1d … … 114 114 thermcell_closure|thermcell_height|thermcell_dq|thermcell_flux2|thermcell_down| \ 115 115 thermcell_updown_dq) \ 116 paramini=thermcell_ini ; inimod= thermcell_ini_mod; klon=ngrid ; klev=nlay ;;117 wake|wake_popdyn_ 2) paramini=wake_ini ; inimod=wake_ini_mod; klon=klon ; klev=klev ;;116 paramini=thermcell_ini ; inimod=lmdz_thermcell_ini ; klon=ngrid ; klev=nlay ;; 117 wake|wake_popdyn_1|wake_popdyn_2) paramini=wake_ini ; inimod=lmdz_wake_ini ; klon=klon ; klev=klev ;; 118 118 *) echo Cas non prevu ; exit 119 119 esac … … 142 142 #----------------------------------------------------------------------------- 143 143 function dump_param_open(){ 144 #-----------------------------------------------------------------------------145 # Opening an direct access file with one record per time-step146 # Each record has the size and contains the arguments in and inout of the147 # routine148 #-----------------------------------------------------------------------------149 inout=$1 ; shift150 case $inout in151 out) fort=81 ;;152 in) fort=82153 esac154 echo '! <<< dump_param_open'155 for var in $* ; do echo 'rec_length_replay=rec_length_replay+kind('$var')*size(['$var'])' ; done156 cat <<eod157 open(${fort},file='dump_param_${inout}.bin',form='unformatted',access='direct',recl=rec_length_replay) ! $replay_comment158 eod159 echo '! dump_param_open >>> '144 #----------------------------------------------------------------------------- 145 # Opening an direct access file with one record per time-step 146 # Each record has the size and contains the arguments in and inout of the 147 # routine 148 #----------------------------------------------------------------------------- 149 inout=$1 ; shift 150 case $inout in 151 out) fort=81 ;; 152 in) fort=82 153 esac 154 echo '! <<< dump_param_open' 155 for var in $* ; do echo 'rec_length_replay=rec_length_replay+kind('$var')*size(['$var'])' ; done 156 cat <<....eod 157 open(${fort},file='dump_param_${inout}.bin',form='unformatted',access='direct',recl=rec_length_replay) ! $replay_comment 158 ....eod 159 echo '! dump_param_open >>> ' 160 160 } 161 161 … … 176 176 } 177 177 178 179 #----------------------------------------------------------------------------- 180 function echo_use_module(){ 181 #----------------------------------------------------------------------------- 182 # Regle tacite : l'instruction MODULE commence à la premiere colonne. 183 # Existe-t-i une facon de la faire tomber ? 184 # En enlevant tous les blanc dans le input sans doute ... 185 param_=$1 ; shift 186 paramfile_=$1 187 if [ ! -f $paramfile_ ] ; then echo plantage which_module ; exit 1 ; fi 188 module=`grep '^[mM][oO][dD][uU][lL][eE] .*[a-Z]' $paramfile_ | head -1 | awk ' { print $2 } '` 189 if [ "$module" != "" ] ; then 190 echo USE $module, ONLY : $param_ 191 fi 192 } 178 193 179 194 #----------------------------------------------------------------------------- … … 195 210 last_line_declaration2="`sed -n -e 's/\!.*$//' -e 's/^/ /' -e '/[\ ,]real[\ ,]/p' -e '/[\ ,]integer[\ ,]/p' -e '/[\ ,]logical[\ ,]/p' -e '/[\ ,]character[\ ,]/p' tmp2_cpp | tail -1 | sed -e 's/ / /g' -e 's/ /.*/g'`" 196 211 line_last_declaration=`cat tmp2 | tr '[A-Z]' '[a-z]' | sed -n -e "/$last_line_declaration2/="` 212 echo OK0 213 if [ "`grep -i 'end.*module' $paramfile_`" = "" ] ; then echo aka ; line_end_module=`wc -l $paramfile_ | awk ' { print $1 } '` ; else echo akb ; line_end_module=`sed -n -e '/[eE][nN][dD] .*[mM][oO][dD][uU][lL][eE]/=' $paramfile_` ; fi 214 echo OK1 215 echo $line_end_module 197 216 if [ "$line_last_declaration" = "" ] ; then echo line_last_declaration $line_last_declaration line $last_line_declaration2 ; exit ; fi 198 217 if (( $# > 0 )) ; then … … 201 220 -after_declarations) targeted_line=$line_last_declaration ;; 202 221 -before_return) targeted_line=$line_return ;; 222 -before_end_module) targeted_line=$line_end_module ;; 203 223 -before_line|-after_line) linestr=`echo $1 | sed -e "s/$wtype //"` ; targeted_line=`sed -n -e "/$linestr/=" tmp2` ;; 204 *) echo Cas non prevu 0 where=$where in incl ide_file224 *) echo Cas non prevu 0 where=$where in include_file 205 225 esac 206 226 case $wtype in 207 227 -after_declarations|-after_line) line0=$(( $line_subroutine - 1 )) ;; 208 228 -before_return|-before_line) line0=$(( $line_subroutine - 2 )) ;; 209 *) echo Cas non prevu 1 where=$where in inclide_file 229 -before_end_module) line0=-1 ;; 230 *) echo Cas non prevu 1 where=$where in include_file 210 231 esac 211 echo Including line $line0 in $paramfile_ the line : $line_to_be_included232 echo Including line $line0 + $targeted_line in $paramfile_ the line : $line_to_be_included 212 233 linebefore_include=$(( $line0 + $targeted_line )) 213 234 sed -i'' -e $linebefore_include"s/$/\n $line_to_be_included \! $replay_comment/" $paramfile_ … … 310 331 if [ $nconly = false ] ; then 311 332 312 cat > call_param_replay <<eod333 cat > call_param_replay.F90 <<eod 313 334 subroutine call_param_replay($klon,$klev) 314 335 USE IOIPSL, ONLY : getin 336 `echo_use_module $param $paramfile` 315 337 IMPLICIT NONE 316 338 integer :: ifin,irec,it,rec_length_replay=0,replay_irec0=1,replay_nt=1000 317 339 eod 318 grep 'intent.*::' input | sed -e 's/ //g' -e 's/,intent(.*[nt])//'>> call_param_replay 340 grep 'intent.*::' input | sed -e 's/ //g' -e 's/,intent(.*[nt])//'>> call_param_replay.F90 319 341 # duplicating declaration for inout variables 320 342 321 343 for var in $varinout0 ; do 322 sed -e 's/::/ :: /' -e 's/,/ , /g' -e 's/$/ /' input | grep 'intent.*inout.*::.* '$var' ' | sed -e 's/ //g' -e 's/,intent(.*[nt])//' | sed -e 's/::.*$/, allocatable, save :: '$var'_Replay0/' | sed -e 's/'$klon'/:/' -e 's/'$klev'/:/' >> call_param_replay 344 sed -e 's/::/ :: /' -e 's/,/ , /g' -e 's/$/ /' input | grep 'intent.*inout.*::.* '$var' ' | sed -e 's/ //g' -e 's/,intent(.*[nt])//' | sed -e 's/::.*$/, allocatable, save :: '$var'_Replay0/' | sed -e 's/'$klon'/:/' -e 's/'$klev'/:/' >> call_param_replay.F90 323 345 done 324 346 # Initalisation, shared with dump_param1.sh 325 dump_param_open "in" $varin0 >> call_param_replay 347 dump_param_open "in" $varin0 >> call_param_replay.F90 326 348 for var in $varinout0 ; do 327 sed -e 's/::/ :: /' -e 's/,/ , /g' -e 's/$/ /' input | grep 'intent.*inout.*::.* '$var' ' | sed -e 's/intent(.*t)//' -e 's/^.*(/allocate('$var'_Replay0(/' -e 's/).*$/))/' >> call_param_replay 349 sed -e 's/::/ :: /' -e 's/,/ , /g' -e 's/$/ /' input | grep 'intent.*inout.*::.* '$var' ' | sed -e 's/intent(.*t)//' -e 's/^.*(/allocate('$var'_Replay0(/' -e 's/).*$/))/' >> call_param_replay.F90 328 350 done 329 351 330 cat >> call_param_replay <<eod352 cat >> call_param_replay.F90 <<eod 331 353 call getin('replay_nt',replay_nt) 332 354 call getin('replay_irec0',replay_irec0) … … 342 364 eod 343 365 344 block_Replay0 "it == 1" _Replay0 "" $varinout0 >> call_param_replay 345 block_Replay0 "replay_irec0 < 0" "" _Replay0 $varinout0 >> call_param_replay 346 get_subroutine_arg $param $paramfile | sed -e 's/subroutine/ call/' >> call_param_replay 347 block_Replay0 "replay_irec0 < 0" _Replay0 "" $varinout0 >> call_param_replay 348 cat >> call_param_replay <<eod366 block_Replay0 "it == 1" _Replay0 "" $varinout0 >> call_param_replay.F90 367 block_Replay0 "replay_irec0 < 0" "" _Replay0 $varinout0 >> call_param_replay.F90 368 get_subroutine_arg $param $paramfile | sed -e 's/subroutine/ call/' >> call_param_replay.F90 369 block_Replay0 "replay_irec0 < 0" _Replay0 "" $varinout0 >> call_param_replay.F90 370 cat >> call_param_replay.F90 <<eod 349 371 enddo 350 372 return … … 410 432 411 433 #----------------------------------------------------------------------------- 412 # get_ini_modulegere l'initialisation du module en mode replay434 # call_ini_replay.F90 gere l'initialisation du module en mode replay 413 435 #----------------------------------------------------------------------------- 414 436 if [ $nconly = false -a $paramini != None ] ; then 415 cat > get_ini_module<<....eod............................................416 subroutine get_ini_module437 cat > call_ini_replay.F90 <<....eod............................................ 438 subroutine call_ini_replay 417 439 use $inimod 418 440 IMPLICIT NONE 419 441 ....eod............................................ 420 grep -i intent.in $inimod.F90 | tr '[A-Z]' '[a-z]' | sed -e 's/,.*intent.i.*)//' >> get_ini_module421 cat >> get_ini_module<<....eod...........................................442 grep -i intent.in $inimod.F90 | tr '[A-Z]' '[a-z]' | sed -e 's/,.*intent.i.*)//' >> call_ini_replay.F90 443 cat >> call_ini_replay.F90 <<....eod........................................... 422 444 open(90,file='$inimod.bin',form='unformatted') 423 445 read(90) $varinmodv … … 425 447 ....eod........................................... 426 448 #get_subroutine_arg $paramini $inimod.F90 ; exit 427 get_subroutine_arg $paramini $inimod.F90 | sed -e 's/subroutine/call/' >> get_ini_module428 cat >> get_ini_module<<....eod...........................................449 get_subroutine_arg $paramini $inimod.F90 | sed -e 's/subroutine/call/' >> call_ini_replay.F90 450 cat >> call_ini_replay.F90 <<....eod........................................... 429 451 return 430 452 end 431 453 ....eod........................................... 432 454 fi # nconly = false 433 434 #-----------------------------------------------------------------------------435 # Inclusion de l'ecriture de l'interface de l'initialisation436 #-----------------------------------------------------------------------------437 438 if [ $nconly = false ] ; then439 for file in get_ini_module call_param_replay ; do sed -i'' -e "s/$/ \!$replay_comment/" $file ; done440 cat get_ini_module >> $inimod.F90441 cat call_param_replay >> $paramfile442 fi443 444 #\rm -f tmp input
Note: See TracChangeset
for help on using the changeset viewer.