#!/usr/bin/perl # set number of procs $nproc2=16; # number of procs on matrix or master $nproc1=0; # number of procs on vector2 $nproc=$nproc1+$nproc2; #remove any old plot*gif files #system("rm plot*gif"); #wait(); # create a list of file to plot system("ls -1 ABU*DAT > selem_file.list"); # create a template gnuplot file open(graph,"> graph.gnu"); print graph "set terminal postscript enha color landscape size 20,20 lw 3 font 14 \n"; print graph "set output 'graph.ps' \n"; print graph "set title 'ThisIsTheTitle' \n"; print graph "set myti 10 \n"; print graph "set mxti 10 \n"; print graph "set yra [-12:0.] \n"; print graph "set pointsize 1.0 \n"; print graph "set y2ti \n"; print graph "set yti nomi \n"; print graph "set key bottom \n"; #print graph "set xra [0.5977: 0.5987] \n"; print graph "set xra [0.57556: 0.5987] \n"; #print graph "set xra [0.:10.] \n"; print graph "set xlabel 'mass coordinate' \n"; print graph "set ylabel 'X (mass fraction) \n"; #print graph "set logs y \n"; # the plot columns are listed in the head of the ABUPP files # the first columns are: # 1 2 3 4 5 6 7 # j,xm(j),t9ppg(j),rhoppg(j),dppg(j),rppg(j),dppgLagr(j) # 8 - .... # the abundances. if iprintcsp in the code then species index # in printlist.output. 1st col + 7 #print graph "plot 'graph.DAT' u 2:(log10(\$5)) ax x1y2 tit 'D' wi linesp,\\"."\n"; print graph "plot 'graph.DAT' u 2:3 ax x1y2 tit 'T9' wi linesp,\\"."\n"; print graph "'graph.DAT' u 2:(log10(\$9)) tit 'H' wi linesp,\\"."\n"; print graph "'graph.DAT' u 2:(log10(\$12)) tit '^4He' wi linesp,\\"."\n"; print graph "'graph.DAT' u 2:(log10(\$18)) tit '^{12}C' wi linesp,\\\n"; print graph "'graph.DAT' u 2:(log10(\$19)) tit '^{13}C' wi linesp,\\\n"; print graph "'graph.DAT' u 2:(log10(\$22)) tit '^{14}C' wi linesp,\\\n"; print graph "'graph.DAT' u 2:(log10(\$20)) tit '^{13}N' wi linesp 7,\\"."\n"; print graph "'graph.DAT' u 2:(log10(\$21)) tit '^{14}N' wi poi 1,\\"."\n"; print graph "'graph.DAT' u 2:(log10(\$174)) tit '^{64}Ni' wi poi 4,\\"."\n"; print graph "'graph.DAT' u 2:(log10(\$199)) tit '^{70}Zn' wi poi 8,\\"."\n"; print graph "'graph.DAT' u 2:(log10(0.5*\$277+\$289+\$279+\$291)) tit 'Rb' wi poi 3,\\"."\n"; print graph "'graph.DAT' u 2:(log10(\$60+\$64+\$61+\$65+\$66+\$68)) tit 'S' wi poi 7,\\"."\n"; print graph "'graph.DAT' u 2:(log10(\$592)) tit '^{138}Ba' wi linespoi 3,\\"."\n"; print graph "'graph.DAT' u 2:(log10(\$274)) tit '^{82}Kr' wi poi 2 \n"; close(graph) ; open(selist,"selem_file.list"); $icount=0; # read filenames while () { # # read the header of the data file # chop($fileselem=$_); if (! -e "plot".substr($fileselem,5,12)."gif" ){ print Reading $fileselem."\n" ; open(sfile,$fileselem); $sline1 = ; @saline=split(/\s+/,$sline1); $time=$saline[2]; $temp9=$saline[4]; $modnum=$saline[6]; $totmass=$saline[8]; $procshell=$saline[11]; # $sline1 = ; # @saline=split(/\s+/,$sline1); # $densn=$saline[3]; print $time." ".$temp9." ".$modnum." ".$totmass."\n"; close(sfile); # # modify standard gnuplot plot file # open(graph,"graph.gnu"); open(graphtmp,"> graph".substr($fileselem,5,12)."gnu"); while () { if (/graph.DAT/){ s/graph.DAT/$fileselem/; print graphtmp $_ ; }elsif (/ThisIsTheTitle/){ $title="Cycle=".$modnum.", Mass=".$totmass.", Age=".$time.", T_{9,max}=".$temp9.", proc. shells=".$procshell; s/ThisIsTheTitle/$title/; print graphtmp $_ ; }elsif (/graph.ps/){ s/graph.ps/$fileselem.ps/; print graphtmp $_ ; }else{ print graphtmp $_ ; } } close(graph); close(graphtmp); if ($icount lt $nproc1){ system("ssh vector2 '(cd /ngpod1/nugrid/falk080606/mppn/RUN_D14_a/tmp;gnuplot graph".substr($fileselem,5,12)."gnu;convert -rotate 90 ".$fileselem.".ps plot".substr($fileselem,5,12)."gif )'&"); }else{ system("(gnuplot graph".substr($fileselem,5,12)."gnu;convert -rotate 90 ".$fileselem.".ps plot".substr($fileselem,5,12)."gif )&"); } if ($icount eq $nproc1){ #matrix has slower procs, and I want to give out new work only after a typical matrix slave has finished $filelock="plot".substr($fileselem,5,12)."gif"; } if (++$icount eq $nproc){ print "One set of slaves have work. icount = ".$icount." \n"; print "Is file ".$filelock." no there? \n"; while (! -e $filelock){ sleep 1; print "waited 1 sec\n"; } $icount=0; } }else{ print "plot".substr($fileselem,5,12)."gif already exists \n"; } }