script updated to read tables provided by AM

This commit is contained in:
Lorenzo Figini 2012-10-11 08:40:11 +00:00
parent b4d877f6a3
commit 82834fa63b

View File

@ -1,9 +1,9 @@
#!/bin/bash #!/bin/bash
# set input/working/output folders # set input/working/output folders
in=/Users/lorenzo/Desktop/scenario_001 in=/Users/lorenzo/ITER/UL-Grant-161/QO-design/scenario1_scan_gamma
work=/Users/lorenzo/Desktop/scenario_001/tmp work=/Users/lorenzo/ITER/UL-Grant-161/QO-design/scenario1_scan_gamma/tmp
out=/Users/lorenzo/Desktop/scenario_001/out out=/Users/lorenzo/ITER/UL-Grant-161/QO-design/scenario1_scan_gamma/out
# check if working folder exists, otherwise create it # check if working folder exists, otherwise create it
if [[ ! -e $work ]]; then if [[ ! -e $work ]]; then
@ -31,7 +31,8 @@ else
fi fi
fi fi
listfile=$in/alpha-beta-vs-gamma.txt listfile=$in/v0_22.txt
listbase=`basename ${listfile} .txt`
# count number of lines in input file # count number of lines in input file
nlines=`wc -l $listfile | awk '{print $1}'` nlines=`wc -l $listfile | awk '{print $1}'`
@ -45,7 +46,7 @@ cp $eqfile ${base}.eqdsk
cp $in/${base}.prf ${base}.prf cp $in/${base}.prf ${base}.prf
# set output file names # set output file names
id=${base}_8beams_gammascan id=t${t}_scan_${listbase}_1ray
f7file=$out/f7_${id}.txt f7file=$out/f7_${id}.txt
f48file=$out/f48_${id}.txt f48file=$out/f48_${id}.txt
rm -f $out/log_${id}.txt rm -f $out/log_${id}.txt
@ -61,7 +62,10 @@ appendheader=0
#loop on lines of launching conditions table #loop on lines of launching conditions table
for (( iline=1; iline<=$nlines+1; iline++ )); do for (( iline=1; iline<=$nlines+1; iline++ )); do
# search full, non-commented lines # search full, non-commented lines
awkcommand='NR=='$iline' && NF>=6 {print $1, $2, $3, $4, $5, $6}' # table from MIRRORS
# awkcommand='NR=='$iline' && NF>=6 {print $1, $2, $3, $4, $5, $6}'
# table from AM
awkcommand='NR=='$iline' && NF>=6 {print $1, -$2, sqrt($5^2+$6^2), $7, $3, $4}'
line=`sed 's/#.*$//' $listfile | awk "$awkcommand"` line=`sed 's/#.*$//' $listfile | awk "$awkcommand"`
if (( `echo $line | wc -w`>0 )); then if (( `echo $line | wc -w`>0 )); then
# if valid line extract values # if valid line extract values