Index: /issm/trunk-jpl/src/m/model/WriteData.py
===================================================================
--- /issm/trunk-jpl/src/m/model/WriteData.py	(revision 12675)
+++ /issm/trunk-jpl/src/m/model/WriteData.py	(revision 12676)
@@ -1,2 +1,9 @@
+"""
+WRITEDATA - write model field in binary file
+ 
+    Usage:
+       WriteData(fid,*args)
+"""
+
 import numpy
 import math
@@ -5,11 +12,4 @@
 
 def WriteData(fid,*args):
-	"""
-	WRITEDATA - write model field in binary file
- 
-    Usage:
-       WriteData(fid,*args)
-	"""
-
 	#process options
 	options=pairoptions(args)
Index: /issm/trunk-jpl/src/m/model/process_solve_options.py
===================================================================
--- /issm/trunk-jpl/src/m/model/process_solve_options.py	(revision 12676)
+++ /issm/trunk-jpl/src/m/model/process_solve_options.py	(revision 12676)
@@ -0,0 +1,48 @@
+"""
+DEFAULT_SOLVE_OPTIONS - set up default options for solve phase
+ 
+    Usage:
+       options=process_solve_options(options)
+ 
+    See also: SOLVE
+"""
+
+import os
+
+def process_solve_options(options):
+
+	outoptions={}
+
+	#solution_type: check on this option, error out otherwise
+	solution_type=options.getfieldvalue('solution_type')
+	if solution_type in (DiagnosticSolutionEnum,PrognosticSolutionEnum,ThermalSolutionEnum,\
+			SteadystateSolutionEnum,TransientSolutionEnum,EnthalpySolutionEnum,\
+			BalancethicknessSolutionEnum,BedSlopeSolutionEnum,SurfaceSlopeSolutionEnum,HydrologySolutionEnum,FlaimSolutionEnum):
+		raise ValueError("process_solve_options error message: solution_type '%s' not supported yet!" % EnumToString(solution_type))
+	outoptions['solution_type']=solution_type
+
+	outoptions['upload']=options.getfieldvalue('upload','off')
+	outoptions['batch']=options.getfieldvalue('batch','no')
+	outoptions['loadonly']=options.getfieldvalue('loadonly',False)
+	outoptions['directory']=options.getfieldvalue('directory','')
+
+	#  process qmu arguments
+	outoptions['qmudir']=options.getfieldvalue('qmudir','qmu'+str(os.getpid()))
+	outoptions['qmufile']=options.getfieldvalue('qmufile','qmu')    # qmufile cannot be changed unless ????script.sh is also changed
+	outoptions['overwrite']=options.getfieldvalue('overwrite','n')
+	outoptions['keep']=options.getfieldvalue('keep','n')
+	outoptions['ivar']=options.getfieldvalue('ivar',1)
+	outoptions['iresp']=options.getfieldvalue('iresp',1)
+	outoptions['imethod']=options.getfieldvalue('imethod',1)
+	outoptions['iparams']=options.getfieldvalue('iparams',1)
+	outoptions['runmpi']=options.getfieldvalue('runmpi',False)
+
+	#  process flaim arguments
+	outoptions['fmdir']=options.getfieldvalue('fmdir','fm'+str(os.getpid()))
+	outoptions['overwrite']=options.getfieldvalue('overwrite','n')
+	outoptions['keep']=options.getfieldvalue('keep','y')
+	outoptions['latsgn']=options.getfieldvalue('latsgn',0)
+	outoptions['cmap']=options.getfieldvalue('cmap',None)
+
+	return outoptions
+
Index: /issm/trunk-jpl/src/m/model/waitonlock.py
===================================================================
--- /issm/trunk-jpl/src/m/model/waitonlock.py	(revision 12676)
+++ /issm/trunk-jpl/src/m/model/waitonlock.py	(revision 12676)
@@ -0,0 +1,65 @@
+"""
+WAITONLOCK - wait for a file
+ 
+    This routine will return when a file named 'filename' is written to disk.
+    If the time limit given in input is exceeded, return 0
+ 
+    Usage:
+       flag=waitonlock(md,executionpath)
+"""
+
+import os
+import socket
+import time
+from MatlabFuncs import *
+
+def waitonlock(md,executionpath,login,port):
+
+	#Get filename (lock file) and options
+	executionpath=md.cluster.executionpath
+	cluster=md.cluster.name
+	login=md.cluster.login
+	port=md.cluster.port
+	timelimit=md.settings.waitonlock
+	filename=os.path.join(executionpath,md.private.runtimename,md.miscellaneous.name+'.lock')
+
+	#waitonlock will work if the lock is on the same machine only: 
+	if not strcmpi(socket.gethostname().lower().split('.')[0],cluster):
+
+		print 'solution launched on remote cluster. log in to detect job completion.'
+		choice=raw_input('Is the job successfully completed? (y/n) ')
+		if not strcmp(choice,'y'): 
+			print 'Results not loaded... exiting' 
+			flag=0
+		else:
+			flag=1
+
+	#job is running on the same machine
+	else:
+
+		if 'interactive' in vars(md.cluster) and md.cluster.interactive:
+			#We are in interactive mode, no need to check for job completion
+			flag=1
+			return flag
+		#initialize time and file presence test flag
+		etime=0
+		ispresent=0
+		print "waiting for '%s' hold on... (Ctrl+C to exit)" % filename
+
+		#loop till file .lock exist or time is up
+		while ispresent==0 and etime<timelimit:
+			ispresent=os.path.exist(filename)
+			time.sleep(1)
+			etime+=1/60
+
+		#build output
+		if etime>timelimit:
+			print 'Time limit exceeded. Increase md.settings.waitonlock'
+			print 'The results must be loaded manually with md=loadresultsfromcluster(md).'
+			raise RuntimeError('waitonlock error message: time limit exceeded.')
+			flag=0
+		else:
+			flag=1
+
+	return flag
+
