3 from optparse
import OptionParser
4 import subprocess
as sp
6 nmls
=('namelist.input','namelist.fire')
8 usage
='usage: %prog [options]'
11 o
.add_option('--nx',action
='store',type='int',dest
='nx')
12 o
.add_option('--ny',action
='store',type='int',dest
='ny')
13 o
.add_option('--dx',action
='store',type='float',dest
='dx')
14 o
.add_option('--dy',action
='store',type='float',dest
='dy')
16 o
.add_option('--windx',action
='store',type='float',dest
='windx')
17 o
.add_option('--windy',action
='store',type='float',dest
='windy')
18 o
.add_option('--slopex',action
='store',type='float',dest
='slopex')
19 o
.add_option('--slopey',action
='store',type='float',dest
='slopey')
21 o
.add_option('--runtime',action
='store',type='int',dest
='runseconds')
22 o
.add_option('--history',action
='store',type='int',dest
='historys')
23 o
.add_option('--timestep',action
='store',type='float',dest
='timestep')
25 for s
in ('ignros','ignx1','igny1','ignx2','igny2','ignr','ignt1','ignt2'):
26 o
.add_option('--'+s
,action
='store',type='float',dest
=s
)
28 fcats
=[ str(i
) for i
in xrange(1,14) ]
29 o
.add_option('--fuelcat',action
='store',choices
=fcats
,dest
='fuelcat')
31 o
.add_option('--debug',action
='store_true',dest
='debug')
33 o
.set_defaults(nx
=200,ny
=200,dx
=6,dy
=6,windx
=2,windy
=1,
34 slopex
=.5,slopey
=-.25,runseconds
=60*60,historys
=60,
35 timestep
=.25,ignros
=.1,ignx1
=500,ignx2
=500,
36 igny1
=500,igny2
=500,ignr
=10,ignt1
=2,ignt2
=2,
37 fuelcat
=3,debug
=False)
39 (opts
,args
)=o
.parse_args()
42 time
=opts
.pop('timestep')
43 opts
['times']=int(time
)
44 opts
['timen']=int( 1000*(time
-int(time
)) )
47 debug
=opts
.pop('debug')
53 opts
['fuelcat']=int(opts
['fuelcat'])
56 s
=open(n
+'.template','r').read()
57 open(n
,'w').write(s
% opts
)
59 p
=sp
.Popen('./init.exe')
62 p
=sp
.Popen('./fire.exe')