added templates for gnuplot and bash scripts
This commit is contained in:
parent
0ccc459cd0
commit
c8bb0e8cbf
99
scripts/beta-alpha.sh
Executable file
99
scripts/beta-alpha.sh
Executable file
@ -0,0 +1,99 @@
|
||||
#!/bin/bash
|
||||
|
||||
# set input/working/output folders
|
||||
in=/Users/lorenzo/Desktop/files5s
|
||||
work=/Users/lorenzo/Desktop/tmp2
|
||||
out=/Users/lorenzo/Desktop/out
|
||||
|
||||
# launching mirrors
|
||||
mirror=( "USM" "LSM" )
|
||||
r0=( 699.871 705.392 )
|
||||
z0=( 441.441 417.821 )
|
||||
|
||||
# steering range
|
||||
amin=25
|
||||
amax=70
|
||||
bmin=10
|
||||
bmax=30
|
||||
|
||||
# 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_10520.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+1 )); do
|
||||
#loop on alpha
|
||||
for (( alpha=$amin; alpha<=$amax ; alpha=alpha+1 )); 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/-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 "# 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.data
Normal file
28
scripts/gray0.data
Normal file
@ -0,0 +1,28 @@
|
||||
-alfa- -beta- : alfac, betac poloidal and toroidal launching angles
|
||||
170 : f (GHz)
|
||||
1 : P0 (MW) injected power
|
||||
1 16 1 : nray ktx,rhomx
|
||||
-x0- 0. -z0- : x00 y00 z00 (cm) mirror position (y00=0 !)
|
||||
2.1 2.1 162 162 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.001 : 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
|
106
scripts/icd-cnt.gnu
Normal file
106
scripts/icd-cnt.gnu
Normal file
@ -0,0 +1,106 @@
|
||||
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='../EL_data/'
|
||||
id1='sc9MA'
|
||||
id2='bot12co'
|
||||
fn='f7.'.id1.'_'.id2.'.txt'
|
||||
lab1=id1
|
||||
lab2=id2
|
||||
|
||||
xi=10; xa=45
|
||||
yi=-40; ya=40
|
||||
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=60
|
||||
di=10
|
||||
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 (abs($2)):3:($5>=0.95?$10: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 |}I_{cd}{/Symbol |} (kA/MW)" offset 0,0
|
||||
set clabel
|
||||
set cntrparam levels incremental -i0,di/5.,i0
|
||||
splot dir.fn u (abs($2)):3:($5>=0.95 && abs($4)>1 ?abs($4):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 (abs($2)):3:($5>=0.95 && abs($4)>1 ?abs($4):1/0) w l lt 1 lc palette lw 2
|
||||
#set cntrparam levels incremental -i0,2*di,i0
|
||||
#splot dir.fn u (abs($2)):3:($5>=0.95 && abs($4)>1 ?abs($4):1/0) w l lt 1 lc palette lw 3
|
||||
|
||||
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, @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 (abs($2)):3:($5>=0.95 && abs($4)>1 ?$10:1/0) w l lt 1 lc rgb 'black' lw 1
|
||||
unset label 1
|
||||
unset label 2
|
||||
|
||||
unset multiplot
|
||||
|
30
scripts/icd-rho.gnu
Executable file
30
scripts/icd-rho.gnu
Executable file
@ -0,0 +1,30 @@
|
||||
set term aqua enhanced font "Helvetica, 20"
|
||||
id1='sc15MA'
|
||||
id2='mid12co'
|
||||
#dir=id.'/'
|
||||
dir='../EL_data/'
|
||||
fn='f7.'.id1.'_'.id2.'.txt'
|
||||
set title id1."- mid row co"
|
||||
|
||||
al=0
|
||||
|
||||
set xrange[0:1]
|
||||
set yrange[*:*]
|
||||
set ytics 10
|
||||
set xlabel "{/Symbol r}"
|
||||
set ylabel "I_{cd} (kA/MW)"
|
||||
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
|
||||
|
||||
|
||||
plot dir.fn u 10:($8>0 && $5>=0.95 && (abs($4))>1 ? (abs($4)):1/0) w l ls 1, dir.fn u 10:($8<0 && $5>=0.95 && (abs($4))>1? (abs($4)):1/0) w l ls 2,\
|
||||
dir.fn u 10:($3==al && $5>=0.95 ? (abs($4)):1/0) w p pt 7 lc rgb "black"
|
||||
|
||||
set term postscript eps enhanced font "Helvetica, 20"
|
||||
set termoption dash
|
||||
set output id1.'-'.id2."_icdrho.eps"
|
||||
replot
|
||||
reset
|
94
scripts/t-alpha.sh
Executable file
94
scripts/t-alpha.sh
Executable file
@ -0,0 +1,94 @@
|
||||
#!/bin/bash
|
||||
|
||||
# set input/working/output folders
|
||||
in=/Users/lorenzo/Desktop/files5s
|
||||
work=/Users/lorenzo/Desktop/tmp
|
||||
out=/Users/lorenzo/Desktop/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
|
||||
#loop on beta
|
||||
for beta in 18 20 22; do
|
||||
# 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 alpha
|
||||
for (( alpha=$amin; alpha<=$amax ; alpha=alpha+2 )); do
|
||||
#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
|
||||
# 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/-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
|
||||
rm ${base}.eqdsk ${base}.prf fort.*
|
||||
done
|
||||
echo " " >> $f7file
|
||||
done
|
||||
done
|
||||
done
|
||||
|
||||
#EOF
|
Loading…
Reference in New Issue
Block a user