Commit 162c3a60 by Jigyasa Watwani

moving

parent 8ab2655e
Showing with 0 additions and 47 deletions
import datetime
import json
import os
import argparse
from fixed_boundaries import FixedBoundaries
from viz_fixed_boundaries import visualize
parser = argparse.ArgumentParser()
parser.add_argument('-j','--jsonfile', help='json file', default='fixed_boundaries.json')
parser.add_argument('-t','--time', help='time to extend', type=float, default=50)
parser.add_argument('-o','--outputdir', help='output directory', type=str, default='')
args = parser.parse_args()
assert os.path.isfile(args.jsonfile), '%s file not found' % args.jsonfile
with open(args.jsonfile) as jsonFile:
params = json.load(jsonFile)
u0, rho0, c0 = None, None, None
if args.jsonfile=='fixed_boundaries.json':
print('Fresh run')
extend = False
DIR = args.outputdir
timestamp = datetime.datetime.now().strftime("%d%m%y-%H%M%S")
# current timestamp is the jobID
params['timestamp'] = timestamp
else:
print('Extending %s' % params['timestamp'])
extend = True
DIR = os.path.dirname(args.jsonfile)
oldMaxTime = params['maxtime']
params['maxtime'] = args.time
# solve
fb = FixedBoundaries(params)
fb.solve(extend=extend, DIR=DIR)
if extend:
params['maxtime'] = oldMaxTime + params['maxtime']
with open(os.path.join(DIR,
params['timestamp'] + '_fixed_boundaries.json'), "w") as fp:
json.dump(params, fp, indent=4)
visualize(params, DIR, interactive=False)
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment