plotgrids.py.html clawcode2html   
 Source file:   plotgrids.py
 Directory:   /home/rjl/www/pubs/cise08/cise08levequeV2
 Converted:   Wed Jul 2 2008 at 13:40:45
 This documentation file will not reflect any later changes in the source file.

#! /usr/bin/env python
#
# Python script to plot coarse grids of each type.
#

from clawtools import *
from clawplotting import *

    
#---------------------
def plotgrids(grids=[1,2,3]):
#---------------------
    
    # set data values:
    data = ClawData()
    data.tfinal = 0.01     # final time
    data.nout = 1          # only output at final time
    
    mxvals_polar = array([10])        # mx values on polar grid
    myvals_polar = array([75])      # my values on polar grid
    mxvals_other = array([30])       # mx values on other grids
    myvals_other = array([30])       # my values on other grids

    print "------------------------------------------------------------------"

    for igrid in grids:
        data.igrid = igrid
    
        if igrid==2:
            # for polar grid:
            mxvals = mxvals_polar
            myvals = myvals_polar
            data.xlower = 0.2
            data.xupper = 1.0
            data.ylower = 0
            data.yupper = 2*pi
            data.mthbc_ylower = 2
            data.mthbc_yupper = 2
        else:
            # for other grids:
            mxvals = mxvals_other
            myvals = myvals_other
            data.xlower = -1.0
            data.xlower = -1.0
            data.xupper = 1.0
            data.ylower = -1.0
            data.yupper = 1.0
            data.mthbc_ylower = 1
            data.mthbc_yupper = 1
    
        for itest in range(len(mxvals)):
            mx = mxvals[itest]
            my = myvals[itest]
            data.mx = mx
            data.my = my
            data.write('claw2ez.data')
            data.write('setprob.data')

            print "-------------------------------------------------------"
            print 'Running code with igrid = %i, mx = %g, my = %g ...' \
                                  % (igrid,mx,my)

            # run fortran code:
            runclaw()
        
            # plot grid lines only 
            data.plot_grid = [2]
            data.plot_contour = False
            data.write('setplot2.data')
            clawframe = read_clawframe(frame=0)
            plotframe2(clawframe=clawframe)
	    axis('off')
	    axis('equal')
	    title('Grid %i' %igrid,fontsize=40)
            pngfile = 'grid%g.png' % igrid
            savefig(pngfile)
            print "Figure is in ",pngfile


if __name__ == '__main__':
    import string
    # execute runtests with any command line arguments:
    cmd = 'plotgrids(%s)' % string.join(sys.argv[1:])
    exec(cmd)