Commit 19f29871 authored by Zhenguang Huang's avatar Zhenguang Huang
Browse files

Delete STARTTIME in the dictionary if it is a restart run.

parent 672a6a76
......@@ -10,7 +10,8 @@ from remap_magnetogram import FITS_RECOGNIZE
import download_ADAPT
# -----------------------------------------------------------------------------
def change_param_local(time, map, pfss, scheme=2, poynting_flux=-1.0, new_params={}, DoUseMarker=0):
def change_param_local(time, map, pfss, scheme=2, poynting_flux=-1.0, new_params={},
DoUseMarker=0,DoRestart=0):
params_pfss = ['CHANGEWEAKFIELD', 'BrFactor', 'BrMin']
......@@ -135,6 +136,10 @@ def change_param_local(time, map, pfss, scheme=2, poynting_flux=-1.0, new_params
else:
new_params['replace'] = {'STARTTIME':time_param}
if DoRestart:
if 'STARTTIME' in new_params['replace']:
new_params['replace'].pop('STARTTIME',None)
if poynting_flux > 0:
# set #POYNTINGFLUX
if 'replace' in new_params.keys():
......@@ -210,6 +215,11 @@ if __name__ == '__main__':
' Use if you want to change the values of the'
+ ' parameters.',
type=list)
ARG_PARSER.add_argument('--DoRestart',
help='(default: 0)' +
' Use if it is a restart run.',
type=int)
ARGS = ARG_PARSER.parse_args()
change_param_local(time=ARGS.time, map=ARGS.map, pfss=ARGS.pfss, poynting_flux=ARGS.poynting_flux, DoUseMarker=0)
change_param_local(time=ARGS.time, map=ARGS.map, pfss=ARGS.pfss,
poynting_flux=ARGS.poynting_flux, DoUseMarker=0, DoRestart=ARGS.DoRestart)
......@@ -216,7 +216,7 @@ if __name__ == '__main__':
MODEL = 'AWSoM'
PARAM = 'Default'
SCHEME= 2
DoRestart = False
DoRestart = 0
NewParam = {}
strRealizations = ''
......@@ -224,7 +224,7 @@ if __name__ == '__main__':
# check whether restartdir exists, if yes, set the params first.
for param in params[1:]:
if 'restartdir=' in param.lower():
DoRestart = True
DoRestart = 1
# remove /n with strip() and then RestartDir is the second element after split
RestartDir = param.strip().split('=')[1]
NewParam,MAP,PFSS,TIME,MODEL,PARAM,SCHEME,strRealizations = \
......@@ -315,7 +315,8 @@ if __name__ == '__main__':
# change the PARAM.in file
change_awsom_param.change_param_local(time=TIME, map=MAP, pfss=PFSS,
new_params=NewParam,scheme=SCHEME,
DoUseMarker=ARGS.DoUseMarker)
DoUseMarker=ARGS.DoUseMarker,
DoRestart=DoRestart)
# make run directories
strRun_dir = ('make rundir_realizations ' + strSimDirMake + ' '
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment