backwards compatible restart
@@ -82,6 +82,7 @@ def main(args=None, sharpy_input_dict=None):
if args.input_filename == '':
parser.error('input_filename is a required argument of SHARPy.')
settings = input_arg.read_settings(args)
+ missing_solvers = False
if args.restart is None:
# run preSHARPy
data = PreSharpy(settings)
@@ -91,7 +92,13 @@ def main(args=None, sharpy_input_dict=None):
try:
with open(args.restart, 'rb') as restart_file:
data = pickle.load(restart_file)
+ try:
solvers = pickle.load(restart_file)
+ except EOFError:
+ # For backwards compatibility
+ missing_solvers = True
+ solvers = dict()
+ cout.cout_wrap('Solvers not found in Pickle file. Using the settings in *.sharpy file.')
except FileNotFoundError:
raise FileNotFoundError('The file specified for the snapshot \
restart (-r) does not exist. Please check.')
@@ -117,8 +124,11 @@ def main(args=None, sharpy_input_dict=None):
# Loop for the solvers specified in *.sharpy['SHARPy']['flow']
for solver_name in settings['SHARPy']['flow']:
- if (args.restart is None) or (solver_name not in solvers.keys()):
+ if (args.restart is None) or (solver_name not in solvers.keys()) or (missing_solvers):
solvers[solver_name] = solver_interface.initialise_solver(solver_name)
+ if missing_solvers:
+ solvers[solver_name].initialise(data, restart=False)
+ else:
solvers[solver_name].initialise(data, restart=restart)
data = solvers[solver_name].run(solvers=solvers)
solvers[solver_name].teardown()
