Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,933 changes: 1,933 additions & 0 deletions doc/solps/ELM_cycles.eps

Large diffs are not rendered by default.

Binary file added doc/solps/ELM_cycles.pdf
Binary file not shown.
28 changes: 28 additions & 0 deletions doc/solps/b2.transport.inputfile.ELMs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
&TRANSPORT
ndata(1, 1 , 1 )= 6 ,
tdata(1, 1 , 1 , 1 )= -4.00E-02 , tdata(2, 1 , 1 , 1 )= 1.30 , tdata(3, 1 , 1 , 1 )= 10.00 ,
tdata(1, 2 , 1 , 1 )= -1.50E-02 , tdata(2, 2 , 1 , 1 )= 1.30 , tdata(3, 2 , 1 , 1 )= 10.00 ,
tdata(1, 3 , 1 , 1 )= -1.40E-02 , tdata(2, 3 , 1 , 1 )= 0.05 , tdata(3, 3 , 1 , 1 )= 10.00 ,
tdata(1, 4 , 1 , 1 )= 5.00E-03 , tdata(2, 4 , 1 , 1 )= 0.05 , tdata(3, 4 , 1 , 1 )= 10.00 ,
tdata(1, 5 , 1 , 1 )= 5.50E-03 , tdata(2, 5 , 1 , 1 )= 1.30 , tdata(3, 5 , 1 , 1 )= 10.00 ,
tdata(1, 6 , 1 , 1 )= 2.50E-02 , tdata(2, 6 , 1 , 1 )= 1.30 , tdata(3, 6 , 1 , 1 )= 10.00 ,
ndata(1, 3 , 1 )= 6 ,
tdata(1, 1 , 3 , 1 )= -4.00E-02 , tdata(2, 1 , 3 , 1 )= 2.00 , tdata(3, 1 , 3 , 1 )= 10.00 ,
tdata(1, 2 , 3 , 1 )= -1.50E-02 , tdata(2, 2 , 3 , 1 )= 2.00 , tdata(3, 2 , 3 , 1 )= 10.00 ,
tdata(1, 3 , 3 , 1 )= -1.40E-02 , tdata(2, 3 , 3 , 1 )= 0.07 , tdata(3, 3 , 3 , 1 )= 10.00 ,
tdata(1, 4 , 3 , 1 )= 5.00E-03 , tdata(2, 4 , 3 , 1 )= 0.07 , tdata(3, 4 , 3 , 1 )= 10.00 ,
tdata(1, 5 , 3 , 1 )= 5.50E-03 , tdata(2, 5 , 3 , 1 )= 2.00 , tdata(3, 5 , 3 , 1 )= 10.00 ,
tdata(1, 6 , 3 , 1 )= 2.50E-02 , tdata(2, 6 , 3 , 1 )= 2.00 , tdata(3, 6 , 3 , 1 )= 10.00 ,
ndata(1, 4 , 1 )= 6 ,
tdata(1, 1 , 4 , 1 )= -4.00E-02 , tdata(2, 1 , 4 , 1 )= 2.00 , tdata(3, 1 , 4 , 1 )= 10.00 ,
tdata(1, 2 , 4 , 1 )= -1.50E-02 , tdata(2, 2 , 4 , 1 )= 2.00 , tdata(3, 2 , 4 , 1 )= 10.00 ,
tdata(1, 3 , 4 , 1 )= -1.40E-02 , tdata(2, 3 , 4 , 1 )= 0.07 , tdata(3, 3 , 4 , 1 )= 10.00 ,
tdata(1, 4 , 4 , 1 )= 5.00E-03 , tdata(2, 4 , 4 , 1 )= 0.07 , tdata(3, 4 , 4 , 1 )= 10.00 ,
tdata(1, 5 , 4 , 1 )= 5.50E-03 , tdata(2, 5 , 4 , 1 )= 2.00 , tdata(3, 5 , 4 , 1 )= 10.00 ,
tdata(1, 6 , 4 , 1 )= 2.50E-02 , tdata(2, 6 , 4 , 1 )= 2.00 , tdata(3, 6 , 4 , 1 )= 10.00 ,
ELM_TIME_PERIOD=0.001,
ELM_TIME_BEGIN=0.0002,
ELM_TIME_PLATEAU=0.0002,
ELM_TIME_RECOVERY=0.0006,
ELM_TIME_END=0.0006,
/
359 changes: 323 additions & 36 deletions doc/solps/solps.tex

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions runs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@ endif
-[ -s b2mn.exe.dir/b2time.nc ] && mv b2mn.exe.dir/b2time.nc . || echo > /dev/null
-[ -s b2mn.exe.dir/b2batch.nc ] && mv b2mn.exe.dir/b2batch.nc . || echo > /dev/null
-[ -s b2mn.exe.dir/b2wall.nc ] && mv b2mn.exe.dir/b2wall.nc . || echo > /dev/null
-[ -s b2mn.exe.dir/b2neo.nc ] && mv b2mn.exe.dir/b2neo.nc . || echo > /dev/null
-[ -s b2mn.exe.dir/b2movies.nc ] && mv b2mn.exe.dir/b2movies.nc . || echo > /dev/null
-[ -s b2mn.exe.dir/eirenemovies.nc ] && mv b2mn.exe.dir/eirenemovies.nc . || echo > /dev/null
-[ -s b2mn.exe.dir/b2tallies.nc ] && mv b2mn.exe.dir/b2tallies.nc . || echo > /dev/null
Expand Down Expand Up @@ -378,6 +379,7 @@ endif
-[ -s b2mn.exe.dir/b2time.nc ] && mv b2mn.exe.dir/b2time.nc . || echo > /dev/null
-[ -s b2mn.exe.dir/b2batch.nc ] && mv b2mn.exe.dir/b2batch.nc . || echo > /dev/null
-[ -s b2mn.exe.dir/b2wall.nc ] && mv b2mn.exe.dir/b2wall.nc . || echo > /dev/null
-[ -s b2mn.exe.dir/b2neo.nc ] && mv b2mn.exe.dir/b2neo.nc . || echo > /dev/null
-[ -s b2mn.exe.dir/b2movies.nc ] && mv b2mn.exe.dir/b2movies.nc . || echo > /dev/null
-[ -s b2mn.exe.dir/eirenemovies.nc ] && mv b2mn.exe.dir/eirenemovies.nc . || echo > /dev/null
-[ -s b2mn.exe.dir/b2tallies.nc ] && mv b2mn.exe.dir/b2tallies.nc . || echo > /dev/null
Expand Down
93 changes: 85 additions & 8 deletions scripts/2d
Original file line number Diff line number Diff line change
@@ -1,16 +1,24 @@
#! /bin/csh -f

if ("X$1" == "X-lx") then
set lx="l"
shift
else
set lx=""
endif

if ("X$1" == "X-ly") then
set ly="l"
shift
else
set ly=""
endif

if ( $#argv < 2 ) then
echo "Error: You must provide at least two arguments (2nd, 3rd, etc. arguments will be plotted vs. the 1st one)."
exit 1
endif

set x=$1
shift
set source=b2mn.exe.dir/b2time.nc
Expand All @@ -36,23 +44,92 @@ endif

cp /dev/null ${tmpdir}gnuplot.data.tmp
if ($no_nc2text == 1) then
ncdump $source -f f -v $x | \
awk 'BEGIN {ORS="";} /data:/{found1=1;next;} /$x/{if (found1==1) {if (found2==1) print $1; else {print $3;found2=1;}}} END {print "\n";}' | \
sed 's/,/ /g' | sed 's/;//g' >> ${tmpdir}gnuplot.data.tmp
if ("$x" =~ *[0-9]) then
# Multi-species quantities, called as $x = $name$is (e.g. $x = 'nasepm1')
echo "Error: Plotting multi-species arrays from b2time.nc not yet implemented for $no_nc2text == 1."
exit 1
else
# Time, called as $x = 'timesa', or single species quantities, called as $x = $name (e.g. $x = 'nesepm')
ncdump $source -f f -v $x | \
awk 'BEGIN {ORS="";} /data:/{found1=1;next;} /$x/{if (found1==1) {if (found2==1) print $1; else {print $3;found2=1;}}} END {print "\n";}' | \
sed 's/,/ /g' | sed 's/;//g' >> ${tmpdir}gnuplot.data.tmp
endif
else
if ("$x" =~ *[0-9]) then
# Multi-species quantities, called as $x = $name$is (e.g. $x = 'nasepm1')
set is = `echo "$x" | sed -E 's/.*[^0-9]([0-9]+)$/\1/'`
set name = `echo "$x" | sed -E 's/([0-9]+)$//'`
@ is_plus_1 = $is + 1
echo `nc2text -n 9999999 $source "$name(:,$is_plus_1)"` >> ${tmpdir}gnuplot.data.tmp
else
# Time, called as $x = 'timesa', or single species quantities, called as $x = $name (e.g. $x = 'nesepm')
echo `nc2text -n 9999999 $source $x` >> ${tmpdir}gnuplot.data.tmp
endif
endif

set solps_fluids=`climb_and_look_for SOLPS_FLUIDS`
if (-s $solps_fluids) then
setenv SOLPS_FLUIDS `cat $solps_fluids`
else
echo `nc2text -n 9999999 $source $x` >> ${tmpdir}gnuplot.data.tmp
setenv SOLPS_FLUIDS "`get_solps_fluids`"
endif
set species_names = ( $SOLPS_FLUIDS )
set neutral_species_names = ()
foreach name ($species_names)
set last_char = `echo "$name" | awk '{print substr($0,length($0),1)}'`
set second_last_char = `echo "$name" | awk '{print substr($0,length($0)-1,1)}'`
if ("$last_char" == "0" && "$second_last_char" !~ [0-9]) then
set neutral_species_names = ($neutral_species_names $name)
endif
end

start:
if ($no_nc2text == 1) then
ncdump $source -f f -v $1 | awk -v string="$1" 'BEGIN {ORS="";} /data:/{found1=1;next;} $0 ~ string {if (found1==1) {if (found2==1) print $1; else {print $3;found2=1;}}} END {print "\n";}' | \
sed 's/,/ /g' | sed 's/;//g' >> ${tmpdir}gnuplot.data.tmp
if ("$1" =~ *[0-9]) then
# Multi-species quantities, called as $1 = $name$is (e.g. $1 = 'nasepm1')
echo "Error: Plotting multi-species arrays from b2time.nc not yet implemented for $no_nc2text == 1."
exit 1
else
# Time, called as $1 = 'timesa', or single species quantities, called as $1 = $name (e.g. $1 = 'nesepm')
ncdump $source -f f -v $1 | awk -v string="$1" 'BEGIN {ORS="";} /data:/{found1=1;next;} $0 ~ string {if (found1==1) {if (found2==1) print $1; else {print $3;found2=1;}}} END {print "\n";}' | \
sed 's/,/ /g' | sed 's/;//g' >> ${tmpdir}gnuplot.data.tmp
endif
else
echo `nc2text -n 9999999 $source $1` >> ${tmpdir}gnuplot.data.tmp
if ("$1" =~ *[0-9]) then
# Multi-species quantities, called as $1 = $name$is (e.g. $1 = 'nasepm1')
set is = `echo "$1" | sed -E 's/.*[^0-9]([0-9]+)$/\1/'`
set name = `echo "$1" | sed -E 's/([0-9]+)$//'`
@ is_plus_1 = $is + 1
echo `nc2text -n 9999999 $source "$name(:,$is_plus_1)"` >> ${tmpdir}gnuplot.data.tmp
else
# Time, called as $1 = 'timesa', or single species quantities, called as $1 = $name (e.g. $1 = 'nesepm')
echo `nc2text -n 9999999 $source $1` >> ${tmpdir}gnuplot.data.tmp
endif
endif
shift
if ("X$1X" != "XX") goto start

awk.transpose < ${tmpdir}gnuplot.data.tmp | awk 'NR==1{saveNF=NF}NF==saveNF{print $0}' | plot ${lx}x${ly}yplot$nargs $args $x '' $PWD
# Find species names, in case of multi-species array
set args_plot=""
set field_names = ( $args )
foreach i ($field_names)
if ("$i" =~ *[0-9]) then
# Multi-species quantities, called as $i = $name$is (e.g. $i = 'nasepm1')
set is = `echo "$i" | sed -E 's/.*[^0-9]([0-9]+)$/\1/'`
set name = `echo "$i" | sed -E 's/([0-9]+)$//'`
@ is_plus_1 = $is + 1
if ("$name" =~ dab* || "$name" =~ dmb* || "$name" =~ tab* || "$name" =~ tmb*) then
setenv species_name $neutral_species_names[$is_plus_1]
else
setenv species_name $species_names[$is_plus_1]
endif
set args_plot="$args_plot $name($species_name)"
else
set args_plot="$args_plot $i"
endif
end

awk.transpose < ${tmpdir}gnuplot.data.tmp | awk 'NR==1{saveNF=NF}NF==saveNF{print $0}' | plot ${lx}x${ly}yplot$nargs $args_plot $x '' $PWD
rm ${tmpdir}gnuplot.data.tmp

if ($netcdf4 == 1) then
Expand Down
121 changes: 118 additions & 3 deletions scripts/2d_plots
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,31 @@ else
endif
setenv GNUPLOT_BATCH yes
setenv GNUPLOT_POSTSCRIPT_OPTIONS 'color solid noenhanced'
setenv PRINT_PLOT b2time2d.ps
setenv PRINT_PLOT b2time2d_time_traces.ps
rm -f ${tmpdir}GNUPLOT_COUNT ${tmpdir}gnuplot.cmd
echo 0 > ${tmpdir}GNUPLOT_COUNT

set source=b2mn.exe.dir/b2time.nc
if (! -s $source) set source=b2time.nc
set ns = `ncdump -h $source | grep -w "ns =" | sed -E 's/.*= *([0-9]+) *;.*/\1/'`

set solps_fluids=`climb_and_look_for SOLPS_FLUIDS`
if (-s $solps_fluids) then
setenv SOLPS_FLUIDS `cat $solps_fluids`
else
setenv SOLPS_FLUIDS "`get_solps_fluids`"
endif
set species_names = ( $SOLPS_FLUIDS )
set neutral_species_index = -1

set nreg=`climb_and_look_for NREG`
set nnreg=`pipe_run.log | grep -a ^nnreg | head -1`
if (-s $nreg) then
setenv NREG `cat $nreg`
echo Set NREG to $NREG "(based on $nreg)"
#echo Set NREG to $NREG "(based on $nreg)"
else
set NREG=$nnreg[2]
echo Set NREG to $NREG "(based on log file)"
#echo Set NREG to $NREG "(based on log file)"
endif
if (! $?NREG) set NREG = 4
if ("X$nnreg" != "X") then
Expand All @@ -29,8 +42,110 @@ if ("X$nnreg" != "X") then
endif

2dt nesepm
set na_dens=""
set neutral_species_index = -1
foreach is (`seq 1 $ns`)
@ is_minus_1 = $is - 1
setenv species_name $species_names[$is]
set last_char = `echo "$species_name" | awk '{print substr($0,length($0),1)}'`
set second_last_char = `echo "$species_name" | awk '{print substr($0,length($0)-1,1)}'`
if ("$last_char" == "0" && "$second_last_char" !~ [0-9]) then
# neutral species: call dabsepm if run with Eirene, nasepm if standalone run
if (`ncdump -h $source | grep -w dabsepm | wc -l` > 0) then
# dabsepm fields exist --> coupled run --> call dabsepm
@ neutral_species_index = $neutral_species_index + 1
set na_dens="$na_dens dabsepm$neutral_species_index "
else
# dabsepm fields do not exist --> standalone run --> call nasepm
set na_dens="$na_dens nasepm$is_minus_1 "
endif
else
# ion species: always call nasepm
set na_dens="$na_dens nasepm$is_minus_1 "
endif
end
set counts = (`groups_species`)
set na_dens_list = (`echo $na_dens`)
set offset = 1
foreach c ($counts)
@ end = $offset + $c - 1
set group = ""
foreach i (`seq $offset $end`)
set group = "$group $na_dens_list[$i]"
end
2dt $group
@ offset = $end + 1
end
2dt tesepm tisepm
2dt nesepi nemxip nesepa nemxap
set na_dens=""
set neutral_species_index = -1
foreach is (`seq 1 $ns`)
@ is_minus_1 = $is - 1
setenv species_name $species_names[$is]
set last_char = `echo "$species_name" | awk '{print substr($0,length($0),1)}'`
set second_last_char = `echo "$species_name" | awk '{print substr($0,length($0)-1,1)}'`
if ("$last_char" == "0" && "$second_last_char" !~ [0-9]) then
# neutral species: call dabsepi if run with Eirene, nasepi if standalone run
if (`ncdump -h $source | grep -w dabsepm | wc -l` > 0) then
# dabsepi fields exist --> coupled run --> call dabsepi
@ neutral_species_index = $neutral_species_index + 1
set na_dens="$na_dens dabsepi$neutral_species_index "
else
# dabsepi fields do not exist --> standalone run --> call nasepi
set na_dens="$na_dens nasepi$is_minus_1 "
endif
else
# ion species: always call nasepi
set na_dens="$na_dens nasepi$is_minus_1 "
endif
end
set counts = (`groups_species`)
set na_dens_list = (`echo $na_dens`)
set offset = 1
foreach c ($counts)
@ end = $offset + $c - 1
set group = ""
foreach i (`seq $offset $end`)
set group = "$group $na_dens_list[$i]"
end
2dt $group
@ offset = $end + 1
end
set na_dens=""
set neutral_species_index = -1
foreach is (`seq 1 $ns`)
@ is_minus_1 = $is - 1
setenv species_name $species_names[$is]
set last_char = `echo "$species_name" | awk '{print substr($0,length($0),1)}'`
set second_last_char = `echo "$species_name" | awk '{print substr($0,length($0)-1,1)}'`
if ("$last_char" == "0" && "$second_last_char" !~ [0-9]) then
# neutral species: call dabsepa if run with Eirene, nasepa if standalone run
if (`ncdump -h $source | grep -w dabsepm | wc -l` > 0) then
# dabsepa fields exist --> coupled run --> call dabsepa
@ neutral_species_index = $neutral_species_index + 1
set na_dens="$na_dens dabsepa$neutral_species_index "
else
# dabsepa fields do not exist --> standalone run --> call nasepa
set na_dens="$na_dens nasepa$is_minus_1 "
endif
else
# ion species: always call nasepa
set na_dens="$na_dens nasepa$is_minus_1 "
endif
end
set counts = (`groups_species`)
set na_dens_list = (`echo $na_dens`)
set offset = 1
foreach c ($counts)
@ end = $offset + $c - 1
set group = ""
foreach i (`seq $offset $end`)
set group = "$group $na_dens_list[$i]"
end
2dt $group
@ offset = $end + 1
end
2dt tesepi temxip tesepa temxap
2dt tisepi timxip tisepa timxap
2dt fnixip fnixap
Expand Down
Loading