Back to home page

MITgcm

 
 

    


File indexing completed on 2018-03-02 18:45:44 UTC

view on githubraw file Latest commit add29e06 on 2018-01-31 20:35:05 UTC
ef264d3837 Mart*0001 #!/bin/bash 
                0002 # GMT script to plot the development of the residual and the 
                0003 # number of Krylov steps per Newton step
                0004 #
                0005 
                0006 \rm -rf .gmtdefault*
                0007 gmtset HEADER_FONT_SIZE 24p
                0008 gmtset GRID_PEN_PRIMARY thinnest,-
                0009 
                0010 ps=res.ps
                0011 prj=-JX14/12l
                0012 xticks=100g500a500
                0013 #ticks="-B${xticks}:newton iteration:/1g5a5:residual:WSne"
                0014 ticks="-B${xticks}/1g5a5:residual:WSne"
                0015 xoff=-X4c
                0016 yoff=-Y14c
                0017 
                0018 infile=STDOUT.0000
                0019 infile=$1
                0020 tmpfile1=res.tmp
                0021 tmpfile2=iter.tmp
                0022 grep JFNK: $infile | grep initial | \
                0023     awk '{printf("%i %e\n", $(NF-2), $NF)}' > ${tmpfile1}
                0024 # get min/max as y-axis limits
                0025 R=`minmax -I1.e-16 ${tmpfile1}`
                0026 RR=`echo $R | awk -F/ '{printf("%e/%e",$3,$4)}'`
                0027 #R=-R0/2400/1.e-16/10
                0028 R=-R0/2400/$RR
                0029 psbasemap ${xoff} ${yoff} $R $prj -G255 "${ticks}" -P -K > $ps
                0030 psxy ${tmpfile1} -R -J -W1p,blue -O -K >> $ps
                0031 psxy ${tmpfile1} -R -J -Sx0.075i -O -K >> $ps
                0032 # add number of FGMRES iterations
                0033 grep JFNK: $infile | grep 'Nb. of FGMRES' | \
                0034     awk '{printf("%i %i\n",$12,$NF)}' > ${tmpfile2}
                0035 yoff=-Y-10c
                0036 prj=-JX14/7
                0037 ticks="-B${xticks}:newton iteration:/1g5a5:FGMRES iterations:WSne"
                0038 ticks="-B${xticks}:newton iteration:/a10f5g10:FGMRES iterations:WSne"
                0039 # get x-range
                0040 R1=`echo $R | awk -F/ '{printf("%s/%s/",$1,$2)}'`
                0041 R=${R1}0/50
                0042 #R2=`minmax -C ${tmpfile2} | awk '{printf("%i/%i",$3,$4)}'`
                0043 #R=$R1$R2
                0044 psbasemap -Y-8c $R $prj -G255 "${ticks}" -O -K >> $ps
                0045 psxy ${tmpfile2} -R -J -W1p,blue -O -K >> $ps
                0046 psxy ${tmpfile2} -R -J -Sx0.075i -O -K >> $ps
                0047 #
                0048 echo "" | psxy -R -J -O  >> $ps
                0049 
                0050 # if available show plot
                0051 have_gv=`which gv`
                0052 if [[ x$have_gv != x ]]; then
                0053  gv $ps
                0054 fi
                0055 # generate png-file
                0056 ps2raster -A -Tg ${ps}
                0057 
                0058 # clean up
                0059 \rm -f ${tmpfile1} ${tmpfile2} ${ps}
                0060 
                0061 
                0062