run_tests.py.html clawcode2html   
 Source file:   run_tests.py
 Directory:   /Users/rjl/rjlsvn/papers/pathconwb10/code
 Converted:   Mon Jan 18 2010 at 10:24:29
 This documentation file will not reflect any later changes in the source file.

 

#
# Python script to run xclaw with several different parameter choices.
# This script uses the current version of setrun.py and setplot.py from this
# directory.
#

import os, shutil

# importing these modules requires $CLAW/python in PYTHONPATH:
from pyclaw import data, controller
from pyclaw.plotters import plotpages
from pyclaw.plotters.data import ClawPlotData


from setplot import setplot
from setrun import setrun

rundata = setrun()
clawdata = rundata.clawdata
probdata = rundata.probdata
rundata.write()  # creates *.data files

#-------------
def runjobs():
#-------------
    clawjob = controller.Controller()
    clawjob.xdir = os.getcwd()    # execute xclaw command from current dir.
    
    print "-----------------------------------------------------------------"

    for mthsrc in [1,2,3,4]:
        # directory for output of fort.*, *.png and *.html files:
        outdir = '_output.mthsrc%s' % mthsrc
        if not os.path.isdir(outdir):
            os.mkdir(outdir)

        run_fortran = True   # set to false if computations already done.
        if run_fortran:

            # make local copies of data files to modify for each run:
            os.chdir(outdir)
            probdata.mthsrc = mthsrc
            rundata.write()
            os.chdir('..')

            # run fortran code:
            clawjob.rundir = outdir      # use data files from outdir
            clawjob.outdir = outdir      # write fort files to outdir
            returncode = clawjob.runxclaw()
            if returncode != 0:
                print '*** returncode = ', returncode, '   aborting'
                return
            print 'Done executing with mthsrc = %i' % mthsrc
            print 'Output is in ', outdir


        # create plots:

        plotdata = ClawPlotData()
        plotdata.outdir = outdir

        plotdir = '_plots.mthsrc%s' % mthsrc
        plotdata.plotdir = plotdir       # plots will also go here

        #print 'Now plotting... check plotmsg.txt for errors'
        #plotdata.msgfile = 'plotmsg.txt'
        plotdata.setplot = setplot      # in setplot.py

        # make all plots and html pages:
        plotpages.plotclaw_driver(plotdata, verbose=False)


if __name__=='__main__':
    runjobs()