|
make_figs_for_paper.py.html |
clawcode2html
|
|
Source file: make_figs_for_paper.py
|
|
Directory: /Users/rjl/rjlsvn/papers/pathconwb10/code
|
|
Converted: Mon Jan 18 2010 at 10:11:18
|
|
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 setrun and setplot hardwired
# for example in paper.
from setrun_for_paper import setrun
from setplot_for_paper import setplot
dirnameroot = '_figs_for_paper'
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
#-------------
def runjobs():
#-------------
clawjob = controller.Controller()
clawjob.xdir = os.getcwd() # execute xclaw command from current dir.
print "-----------------------------------------------------------------"
rundata = setrun()
clawdata = rundata.clawdata
probdata = rundata.probdata
rundata.write() # creates *.data files
for mthsrc in [1,2,3,4]:
# directory for output of fort.*, *.png and *.html files:
outdir = dirnameroot + '.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
clawjob.runmake = True
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
plotdata.plotdir = outdir # plots will also go in this directory
#print 'Now plotting... check plotmsg.txt for errors'
#plotdata.msgfile = 'plotmsg.txt'
plotdata.setplot = setplot # defined below
# make all plots and html pages:
plotpages.plotclaw_driver(plotdata, verbose=False)
if __name__=='__main__':
runjobs()