updated script for beta-alpha loop

This commit is contained in:
Daniela Farina 2014-02-25 17:05:31 +00:00
parent 3b5e756a28
commit 95a119ba35

View File

@ -1,11 +1,14 @@
#!/bin/bash
# set input/working/output folders
in=/Users/lorenzo/ITER/UL-Grant-161/performance-analysis/case006/in
work=/Users/lorenzo/Desktop/tmp/sc6
out=/Users/lorenzo/Public/case006-mappe-ab-beam
in=/Users/daniela/Desktop/runs2014/case008/case008_data
work=/Users/daniela/Desktop/runs2014/case008/sc8work
out=/Users/daniela/Desktop/runs2014/case008/case008-mappe-ab-beam
scen='006'
scen='008'
uideq='267QBX'
uidprf='265AZT'
tt='10'
# launching mirrors
mirror=( "USM" "LSM" )
@ -48,14 +51,18 @@ else
fi
fi
eqfile=$in/F4E_Equil_10550.eqdsk
tplus=`echo "${tt}+10000" | bc`
eqfile=$in/F4E_Equil_${tplus}_case${scen}_${uideq}.eqdsk
prfile=$in/F4E_Equil_${tplus}_case${scen}_${uidprf}.prf
echo $eqfile $prfile
# look for time value in equil file
base=`basename $eqfile .eqdsk`
tstr=`echo $base | grep "[[:digit:]]\{5\}" -o`
baseq=`basename $eqfile .eqdsk`
basep=`basename $prfile .prf`
tstr=`echo $baseq | grep "[[:digit:]]\{5\}" -o`
t=`echo "$tstr-10000" | bc`
# copy input files in working folder
cp $eqfile ${base}.eqdsk
cp $in/${base}.prf ${base}.prf
cp $eqfile ${baseq}.eqdsk
cp $prfile ${basep}.prf
#loop on USM/LSM mirrors
for i in 0 1; do
@ -68,7 +75,7 @@ for i in 0 1; do
echo "# =============================" > $f7file
echo "# `date`" >> $f7file
echo "# ${mirror[i]}: R0=${r0[i]} z0=${z0[i]}" >> $f7file
echo "# time=$t" >> $f7file
echo "# Case ${scen} time=$t" >> $f7file
echo "# =============================" >> $f7file
cp $f7file $f48file
appendheader=0
@ -83,8 +90,8 @@ for i in 0 1; do
s/-z0-/${z0[i]}/g; \
s/-w0-/${w0[i]}/g; \
s/-d0-/${d0[i]}/g; \
s/-equil-/$base/g; \
s/-prf-/$base/g" $in/gray0_beam.data > gray.data
s/-equil-/$baseq/g; \
s/-prf-/$basep/g" $in/gray0_beam.data > gray.data
# run gray
gray >> $out/log_${id}.txt
if (( $appendheader==0 )); then
@ -93,22 +100,26 @@ for i in 0 1; do
cat headers.txt >> $f48file
echo "#beta alpha`head -n 1 fort.7 | sed 's/#//'`" >> $f7file
echo "#beta alpha`head -n 1 fort.48 | sed 's/#//'`" >> $f48file
echo "#beta alpha`head -n 1 fort.9 | sed 's/#//'`" > test9.txt
appendheader=1
fi
# add time and alpha values in first two columns
awk 'NR>1 {print '$beta','$alpha',$0}' fort.7 >> $f7file
awk 'NR>1 {print '$beta','$alpha',$0}' fort.48 >> $f48file
awk 'NR>1 {if (NF>1) print '$beta','$alpha',$0; else print $0}' fort.9 >> test9.txt
echo "" >> $f48file
echo "" >> test9.txt
done
#end of alpha loop
echo " " >> $f7file
echo "" >> $f48file
echo "" >> test9.txt
done
#end of beta loop
done
#end of mirrors loop
# remove files from working folder
rm ${base}.eqdsk ${base}.prf fort.*
rm ${baseq}.eqdsk ${basep}.prf fort.*
#EOF