#!/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 \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 [-6.5:1.] \n"; print graph "set pointsize 0.3 \n"; print graph "set xra [0.:25.0] \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:(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(\$21)) tit '^{14}N' wi linesp"."\n"; #print graph "'graph.DAT' u 2:(log10(\$17)) tit '^{19}F' wi linesp,\\\n"; #print graph "'graph.DAT' u 2:(log10(\$20)) tit '^{22}Ne' wi linesp,\\\n"; #print graph "'graph.DAT' u 2:(log10(\$23)) tit '^{25}Mg' wi linesp \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" ){ 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 $fileselem.": t, T9, cycle, M_tot: ".$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"; } }