added new scripts

This commit is contained in:
Daniela Farina 2012-09-26 09:11:27 +00:00
parent 5cfc903c98
commit 8348f52783
6 changed files with 463 additions and 0 deletions

97
scripts/alpha-t.sh Executable file
View File

@ -0,0 +1,97 @@
#!/bin/bash
# set input/working/output folders
in=/Users/daniela/Desktop/scenario_001/files5s
work=/Users/daniela/Desktop/scenario_001/tmp
out=/Users/daniela/Desktop/scenario_001/out
# launching mirrors
mirror=( "USM" "LSM" )
r0=( 699.871 705.392 )
z0=( 441.441 417.821 )
# poloidal steering range
amin=20
amax=70
# check if working folder exists, otherwise create it
if [[ ! -e $work ]]; then
mkdir $work
else
if [[ ! -d $work ]]; then
echo $work is not a folder.
exit 1
fi
fi
# move to working folder
cd $work
if [[ $? != 0 ]]; then
echo Cannot move to $work
exit 1
fi
# check if output folder exists, otherwise create it
if [[ ! -e $out ]]; then
mkdir $out
else
if [[ ! -d $out ]]; then
echo $out is not a folder.
exit 1
fi
fi
#loop on USM/LSM mirrors
for i in 0 1; do
#i=0
#loop on beta
for beta in 18 20 22; do
#beta=18
# set output file names
id="${mirror[i]}_${beta}"
f7file=$out/f7_${id}.txt
rm -f $out/log_${id}.txt
# add header in output file
echo "# =============================" > $f7file
echo "# `date`" >> $f7file
echo "# ${mirror[i]}: R0=${r0[i]} z0=${z0[i]}" >> $f7file
echo "# beta=$beta" >> $f7file
echo "# =============================" >> $f7file
appendheader=0
#loop on time
for eqfile in $in/*.eqdsk; do
# look for time value in equil file
base=`basename $eqfile .eqdsk`
tstr=`echo $base | 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
#loop on alpha
for (( alpha=$amin; alpha<=$amax ; alpha=alpha+2 )); do
# replace dummy values in template for gray.data
#alpha=50
sed "s/-alfa-/$alpha/g; \
s/-beta-/$beta/g; \
s/-x0-/${r0[i]}/g; \
s/-z0-/${z0[i]}/g; \
s/-equil-/$base/g; \
s/-prf-/$base/g" $in/gray0.data > gray.data
# run gray
gray >> $out/log_${id}.txt
if (( $appendheader==0 )); then
# append parameters to header if first run of the loop
cat headers.txt >> $f7file
echo "#t alpha`head -n 1 fort.7 | sed 's/#//'`" >> $f7file
appendheader=1
fi
# add time and alpha values in first two columns
awk 'NR>1 {print '$t','$alpha',$0}' fort.7 >> $f7file
# remove files from working folder
done
rm ${base}.eqdsk ${base}.prf fort.*
echo " " >> $f7file
done
done
done
#EOF

105
scripts/beta-alpha_beam.sh Executable file
View File

@ -0,0 +1,105 @@
#!/bin/bash
# set input/working/output folders
in=/Users/daniela/Desktop/scenario_001/files5s
work=/Users/daniela/Desktop/scenario_001/tmpab_beam
out=/Users/daniela/Desktop/scenario_001/outab_beam_550
# launching mirrors
mirror=( "USM" "LSM" )
r0=( 699.871 705.392 )
z0=( 441.441 417.821 )
w0=( 2.9 2.1)
d0=( 213.4 162.0)
# steering range
amin=20
amax=70
da=1
bmin=15
bmax=25
db=1
# check if working folder exists, otherwise create it
if [[ ! -e $work ]]; then
mkdir $work
else
if [[ ! -d $work ]]; then
echo $work is not a folder.
exit 1
fi
fi
# move to working folder
cd $work
if [[ $? != 0 ]]; then
echo Cannot move to $work
exit 1
fi
# check if output folder exists, otherwise create it
if [[ ! -e $out ]]; then
mkdir $out
else
if [[ ! -d $out ]]; then
echo $out is not a folder.
exit 1
fi
fi
eqfile=$in/F4E_Equil_10550.eqdsk
# look for time value in equil file
base=`basename $eqfile .eqdsk`
tstr=`echo $base | 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
#loop on USM/LSM mirrors
for i in 0 1; do
# set output file names
id="${mirror[i]}_t$t"
f7file=$out/f7_${id}.txt
rm -f $out/log_${id}.txt
# add header in output file
echo "# =============================" > $f7file
echo "# `date`" >> $f7file
echo "# ${mirror[i]}: R0=${r0[i]} z0=${z0[i]}" >> $f7file
echo "# time=$t" >> $f7file
echo "# =============================" >> $f7file
appendheader=0
#loop on beta
for (( beta=$bmin; beta<=$bmax ; beta=beta+db )); do
#loop on alpha
for (( alpha=$amin; alpha<=$amax ; alpha=alpha+da )); do
# replace dummy values in template for gray.data
sed "s/-alfa-/$alpha/g; \
s/-beta-/$beta/g; \
s/-x0-/${r0[i]}/g; \
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
# run gray
gray >> $out/log_${id}.txt
if (( $appendheader==0 )); then
# append parameters to header if first run of the loop
cat headers.txt >> $f7file
echo "#beta alpha`head -n 1 fort.7 | sed 's/#//'`" >> $f7file
appendheader=1
fi
# add time and alpha values in first two columns
awk 'NR>1 {print '$beta','$alpha',$0}' fort.7 >> $f7file
done
#end of alpha loop
echo " " >> $f7file
done
#end of beta loop
done
#end of mirrors loop
# remove files from working folder
rm ${base}.eqdsk ${base}.prf fort.*
#EOF

28
scripts/gray0_beam.data Normal file
View File

@ -0,0 +1,28 @@
-alfa- -beta- : alfac, betac poloidal and toroidal launching angles
170 : f (GHz)
1 : P0 (MW) injected power
9 12 1 : nray ktx,rhomx
-x0- 0. -z0- : x00 y00 z00 (cm) mirror position (y00=0 !)
-w0- -w0- -d0- -d0- 0. : w0xt w0yt pw0xt pw0yt awr (cm) [pw0>0 towards plasma]
0 : ibeam=0 uses data above, >0 read from file beam data (1,2,3)
mpusm : filename.txt for beam data max(character*16)
2 0 : iequil= 0 vacuum, 1 analytical equilibrium, 2 EQDSK;indXpoint
1 : iprof= 0/1 analytical/numerical dens & temp profiles
2 5 : iwarm= 0-3 ECRH&CD computation, ilarm order of larmor expans
11 : ieccd 0/1 NO/YES ECCD calculation
1 2001 : ipec=0/1 profiles in dpsi/drhop; nnd=no. intervals +1 (=< 501)
.2 8000 100 5 0 : dst (cm), nsteps < = 8000, istprj,istpl,ist (0,1,2 integration in s,ct,Sr)
1 1 4.04 : igrad (0 rtr - 1 gauss beam), ipass=1/2 passes in plasma, R_wall(m)
1 0 0 : IOX = 1 : O-MODE IOX = 2 : X-MODE, psi_pol_ant chi_pol_ant
-equil- : filename EQDSK : filename.eqdsk max(character 16)
0 0.005 : ipsinorm =0/1 [psi normalized (1) or not (0) in EQDSK], sspl spline coeff psi
1 1 1 1 : factb, iscal=0/1/2 nustar=const/ngreenw=const/no_scal, factT factn scal.
-prf- : filename profiles : filename.prf max(character*16)
1.015 : psi plasma boundary
-1 -1 11 : signum B_phi I_phi +1=counterclockwise , -1=clockwise from above, icocos (0 old case, 11 iter)
8 4 4 : dens190 aln1,aln2 (10^19 m-3)
15 0 2 4 : te0,dte0,alt1,alt2 (keV)
2 : Zeff
620 0 180 : rr0 zr0 a (cm)
5.3 : b0 (T)
1 3 2 : q0,qa alq

65
scripts/icdr-al.gnu Normal file
View File

@ -0,0 +1,65 @@
set term aqua enhanced font "Helvetica, 20" dashed dl 2
time=" 120 170 520 550"
rhov32="6.95131e-01 6.69571e-01 6.35710e-01 6.92845e-01"
rhov2="7.92257e-01 7.76055e-01 7.59258e-01 8.00650e-01"
#time="100 120 170 220 270 320 370 420 470 520 550"
#rho32="7.09791e-01 6.95131e-01 6.69571e-01 6.54412e-01 6.46003e-01 6.40910e-01 6.37534e-01 6.36223e-01 6.35863e-01 6.35710e-01 6.92845e-01"
#rho2="8.06517e-01 7.92257e-01 7.76055e-01 7.68374e-01 7.64201e-01 7.61830e-01 7.60326e-01 7.59522e-01 7.59319e-01 7.59258e-01 8.00650e-01"
ic=1
tt=word(time,ic)
rho32=word(rhov32,ic)
rho2=word(rhov2,ic)
id1='USM'
id2=tt
dir='/Users/daniela/Desktop/scenario_001/outab_beam_'.id2.'/'
fn='f7_'.id1.'_t'.id2.'.txt'
set title "Scenario 1 - ".id1." t = ".id2.' s'
ymin=0
ymax=30
betamin=15
betamax=25
alphamax=65
betalabel=20
set xrange[0:1]
set yrange[ymin:ymax]
set cbrange[betamin:betamax]
set ytics 5
set xlabel "{/Symbol r}"
set ylabel "-I_{cd} (kA/MW)"
set cblabel "{/Symbol b} (^o)"
unset key
set style line 1 lt 1 lc rgb "red" lw 1
set style line 2 lt 2 lc rgb "red" lw 1
set style line 3 lt 1 lc rgb "blue" lw 1
set style line 4 lt 2 lc rgb "blue" lw 1
set style line 5 lt 2 lc rgb "black" lw 1
set palette defined (0 'black', 1 'red', 2 'orange', 3 'yellow', 4 'web-green', 5 'cyan', 6 'blue', 7 'violet') negative
set arrow 1 from rho32,graph 0 to rho32,graph 1 nohead ls 5
set arrow 2 from rho2,graph 0 to rho2,graph 1 nohead ls 5
set label 1 "q=3/2" right at rho32,graph 0.9 offset -0.5,0
set label 2 "q=2" left at rho2,graph 0.9 offset 0.5,0
plot for[i=ic:ic] dir.fn u 8:($4>=0.95 &&$2<=alphamax ? (-$3):1/0):1 w l lc palette, \
dir.fn u 8:($4>=0.95 && $2<=alphamax && int($2)%5==0 ? (-$3):1/0):1 w p pt 7 ps 0.5 lc rgb "black", \
dir.fn u 8:($4>=0.95 && $2<=alphamax && int($2)%5==0 && $1==betalabel ? (-$3):1/0):2 w labels offset 0,-0.5 font "Helvetica, 16"
set term postscript eps color enhanced font "Helvetica, 20"
set termoption dash
set output id1.'-'.id2."_icdrho.eps"
replot
reset

103
scripts/jcd-cnt.gnu Normal file
View File

@ -0,0 +1,103 @@
reset
set style increment default
set term aqua 1 size 600,750 font "Helvetica, 20" enhanced
set macro
set view map
set size noratio
unset key
unset surface
unset hidden
set contour base
set isosamples 200,200
dir='/Users/daniela/Desktop/scenario_001/outab_beam_170/'
id1='LSM'
id2='170'
fn='f7_'.id1.'_t'.id2.'.txt'
lab1=id1
lab2='t='.id2.'s'
xi=15; xa=25
yi=20; ya=65
xl = xi + 0.1*(xa - xi); xh = xa - 0.1*(xa-xi);
yl = yi + 0.1*(ya - yi); yh = ya - 0.1*(ya-yi);
xtoy = (xa-xi) / (ya-yi)
x0 = xi - (xa-xi); y0 = yi - (ya-yi)
eps = 0.05
g(x,y)=(((x > xl && x < xh && y > yl && y < yh) ? (x0 = x, y0 = y) : 1), 1/0)
f(x,y) = ((x-x0)*(x-x0)+(y-y0)*(y-y0)*xtoy*xtoy > eps ? y : 1/0)
lab(x,y) = ( (x == x0 && y == y0) ? stringcolumn(3) : "")
ZERO = "x0 = xi - (xa-xi), y0 = yi - (ya-yi), b = b+1"
SEARCH = "filecontour index b using 1:(g($1,$2))"
PLOT = "filecontour index b using 1:(f($1,$2)) w l lt 1 lc rgb 'black' lw 2"
LABEL = "filecontour index b using 1:2:(lab($1,$2)) with labels font 'Helvetica, 16'"
i0=30
di=2
imax=i0
set xrange [xi:xa]
set yrange [yi:ya] reverse
set zrange [0:imax]
set cbrange [0:imax]
#set palette defined (0 'black', 1 'red', 2 'orange', 3 'yellow', 4 'web-green', 5 'cyan', 6 'blue', 7 'violet') negative
set cntrparam levels incremental 0,0.2,1.0
filecontour = "contours.dat"
set table filecontour
splot dir.fn u 1:2:($4>=0.95 ?$8:1/0)
unset table
set lmargin at screen 0.15
set rmargin at screen 0.76
set bmargin at screen 0.12
set tmargin at screen 0.90
set multiplot
unset border
set xtics offset 0,0.3
#set xlabel "{/Symbol b} (º)" offset 0,0.8
set xlabel "{/Symbol b} (º)" offset 0,0.8
set ytics offset 0,0
set ylabel "{/Symbol a} (º)" offset 0,0
set colorbox user origin 0.80,0.12 size 0.05,0.78 vertical
set cbtics di offset 0,0
set mcbtics 2
set cblabel "{/Symbol |}J_{cd}{/Symbol |} (kA/m^2/MW)" offset 0,0
set clabel
set cntrparam levels incremental -i0,di/5.,i0
splot dir.fn u 1:2:($4>=0.95? abs(1000*$5):1/0) w l lt 1 lc palette lw 1
unset xtics; unset mxtics; unset xlabel
unset ytics; unset mytics; unset ylabel
unset colorbox
set cntrparam levels incremental -i0,di,i0
set border
splot dir.fn u 1:2:($4>=0.95? abs(1000*$5):1/0) w l lt 1 lc palette lw 2
filecontour = "contours.dat"
b = 0
plot \
@SEARCH, @PLOT, @LABEL, @ZERO, \
@SEARCH, @PLOT, @LABEL, @ZERO, \
@SEARCH, @PLOT, @LABEL, @ZERO, \
@SEARCH, @PLOT, @LABEL, @ZERO, \
@SEARCH, @PLOT, @LABEL, @ZERO, \
@SEARCH, @PLOT, @LABEL, @ZERO, \
@SEARCH, @PLOT, @LABEL, @ZERO, \
@SEARCH, @PLOT, @LABEL, @ZERO, \
@SEARCH, @PLOT, @LABEL, @ZERO, \
@SEARCH, @PLOT, @LABEL
set cntrparam levels discrete 0.05,0.1,0.15,0.25,0.3,0.35,0.45,0.5,0.55,0.65,0.7,0.75,0.85,0.9,0.95
unset clabel
set border
set label 1 lab1 left at screen 0.15,0.94
set label 2 lab2 right at screen 0.76,0.94
splot dir.fn u 1:2:($4>=0.95 ?$8:1/0) w l lt 1 lc rgb 'black' lw 1
unset label 1
unset label 2
unset multiplot

65
scripts/jcdr-al.gnu Normal file
View File

@ -0,0 +1,65 @@
set term aqua enhanced font "Helvetica, 20" dashed dl 2
time=" 120 170 520 550"
rhov32="6.95131e-01 6.69571e-01 6.35710e-01 6.92845e-01"
rhov2="7.92257e-01 7.76055e-01 7.59258e-01 8.00650e-01"
#time="100 120 170 220 270 320 370 420 470 520 550"
#rho32="7.09791e-01 6.95131e-01 6.69571e-01 6.54412e-01 6.46003e-01 6.40910e-01 6.37534e-01 6.36223e-01 6.35863e-01 6.35710e-01 6.92845e-01"
#rho2="8.06517e-01 7.92257e-01 7.76055e-01 7.68374e-01 7.64201e-01 7.61830e-01 7.60326e-01 7.59522e-01 7.59319e-01 7.59258e-01 8.00650e-01"
ic=1
tt=word(time,ic)
rho32=word(rhov32,ic)
rho2=word(rhov2,ic)
id1='LSM'
id2=tt
dir='/Users/daniela/Desktop/scenario_001/outab_beam_'.id2.'/'
fn='f7_'.id1.'_t'.id2.'.txt'
set title "Scenario 1 - ".id1." t = ".id2.' s'
ymin=0
ymax=30
betamin=15
betamax=25
alphamax=65
betalabel=25
set xrange[0:1]
set yrange[ymin:ymax]
set cbrange[betamin:betamax]
set ytics 5
set xlabel "{/Symbol r}"
set ylabel "-J_{cd} (kA/m^2/MW)"
set cblabel "{/Symbol b} (^o)"
unset key
set style line 1 lt 1 lc rgb "red" lw 1
set style line 2 lt 2 lc rgb "red" lw 1
set style line 3 lt 1 lc rgb "blue" lw 1
set style line 4 lt 2 lc rgb "blue" lw 1
set style line 5 lt 2 lc rgb "black" lw 1
set palette defined (0 'black', 1 'red', 2 'orange', 3 'yellow', 4 'web-green', 5 'cyan', 6 'blue', 7 'violet') negative
set arrow 1 from rho32,graph 0 to rho32,graph 1 nohead ls 5
set arrow 2 from rho2,graph 0 to rho2,graph 1 nohead ls 5
set label 1 "q=3/2" right at rho32,graph 0.9 offset -0.5,0
set label 2 "q=2" left at rho2,graph 0.9 offset 0.5,0
plot for[i=ic:ic] dir.fn u 8:($4>=0.95 &&$2<=alphamax ? (-1000*$5):1/0):1 w l lc palette, \
dir.fn u 8:($4>=0.95 && $2<=alphamax && int($2)%5==0 ? (-1000*$5):1/0):1 w p pt 7 ps 0.5 lc rgb "black", \
dir.fn u 8:($4>=0.95 && $2<=alphamax && int($2)%5==0 && $1==betalabel ? (-1000*$5):1/0):2 w labels offset 0,-0.6 font "Helvetica, 16"
set term postscript eps color enhanced font "Helvetica, 20"
set termoption dash
set output id1.'-'.id2."_jcdrho.eps"
replot
reset