Index: /issm/trunk-jpl/src/m/classes/clusters/generic.m
===================================================================
--- /issm/trunk-jpl/src/m/classes/clusters/generic.m	(revision 20119)
+++ /issm/trunk-jpl/src/m/classes/clusters/generic.m	(revision 20120)
@@ -155,4 +155,55 @@
 		end
 		%}}}
+		function BuildQueueScriptMultipleModels(cluster,dirname,modelname,solution,dirnames,modelnames,nps) % {{{
+		
+			%some checks: 
+			if isempty(modelname), error('BuildQueueScriptMultipleModels error message: need a non empty model name!');end
+
+			%what is the executable being called? 
+			executable='issm_slr.exe';
+
+			if ispc(), error('BuildQueueScriptMultipleModels not support yet on windows machines');end;
+			
+			%write queuing script 
+			fid=fopen([modelname '.queue'],'w');
+			
+			fprintf(fid,'#!%s\n',cluster.shell);
+
+			%number of cpus: 
+			mpistring=sprintf('mpiexec -np %i ',cluster.np);
+
+			%executable: 
+			mpistring=[mpistring sprintf('%s/%s ',cluster.codepath,executable)];
+			
+			%solution name: 
+			mpistring=[mpistring sprintf('%s ',EnumToString(solution))];
+
+			%execution directory and model name: 
+			mpistring=[mpistring sprintf('%s/%s %s',cluster.executionpath,dirname,modelname)];
+
+			%inform main executable of how many icecaps, glaciers and earth models are being run: 
+			mpistring=[mpistring sprintf(' %i ',length(dirnames))];
+			
+			%icecaps, glaciers and earth location, names and number of processors associated:
+			for i=1:length(dirnames),
+			mpistring=[mpistring sprintf(' %s/%s %s %i ',cluster.executionpath,dirnames{i},modelnames{i},nps{i})];
+			end
+
+			%log files: 
+			if ~cluster.interactive,
+				mpistring=[mpistring sprintf('2> %s.errlog> %s.outlog',modelname,modelname)];
+			end
+
+			%write this long string to disk: 
+			fprintf(fid,mpistring);
+			fclose(fid);
+
+			%in interactive mode, create a run file, and errlog and outlog file
+			if cluster.interactive,
+				fid=fopen([modelname '.errlog'],'w'); fclose(fid);
+				fid=fopen([modelname '.outlog'],'w'); fclose(fid);
+			end
+		end
+		%}}}
 		function BuildKrigingQueueScript(cluster,modelname,solution,io_gather,isvalgrind,isgprof) % {{{
 
@@ -219,5 +270,5 @@
 			end
 		end %}}}
-		function LaunchQueueJob(cluster,modelname,dirname,filelist,restart)% {{{
+		function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch)% {{{
 
 			if ~ispc,
@@ -235,6 +286,11 @@
 					launchcommand=['source ' cluster.etcpath '/environment.' shellext ' && cd ' cluster.executionpath ' && cd ' dirname ' && source ' modelname '.queue '];
 				else
+					if ~batch,
 					launchcommand=['source ' cluster.etcpath '/environment.' shellext ' && cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ...
 						' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz  && source  ' modelname '.queue '];
+					else
+					launchcommand=['source ' cluster.etcpath '/environment.' shellext ' && cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ...
+						' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz '];
+					end
 				end
 				issmssh(cluster.name,cluster.login,cluster.port,launchcommand);
Index: /issm/trunk-jpl/src/m/classes/clusters/generic.py
===================================================================
--- /issm/trunk-jpl/src/m/classes/clusters/generic.py	(revision 20119)
+++ /issm/trunk-jpl/src/m/classes/clusters/generic.py	(revision 20120)
@@ -183,5 +183,5 @@
 
 	# }}}
-	def LaunchQueueJob(self,modelname,dirname,filelist,restart):    # {{{
+	def LaunchQueueJob(self,modelname,dirname,filelist,restart,batch):    # {{{
 
 		print 'launching solution sequence on remote cluster'
@@ -189,6 +189,11 @@
 			launchcommand='cd %s && cd %s chmod 777 %s.queue && ./%s.queue' % (self.executionpath,dirname,modelname,modelname)
 		else:
-			launchcommand='cd %s && rm -rf ./%s && mkdir %s && cd %s && mv ../%s.tar.gz ./ && tar -zxf %s.tar.gz  && chmod 777 %s.queue && ./%s.queue' % \
+			if batch:
+				launchcommand='cd %s && rm -rf ./%s && mkdir %s && cd %s && mv ../%s.tar.gz ./ && tar -zxf %s.tar.gz  && chmod 777 %s.queue && ./%s.queue' % \
 				(self.executionpath,dirname,dirname,dirname,dirname,dirname,modelname,modelname)
+			else:
+				launchcommand='cd %s && rm -rf ./%s && mkdir %s && cd %s && mv ../%s.tar.gz ./ && tar -zxf %s.tar.gz' % \
+				(self.executionpath,dirname,dirname,dirname,dirname,dirname)
+
 		issmssh(self.name,self.login,self.port,launchcommand)
 	# }}}
Index: /issm/trunk-jpl/src/m/classes/clusters/pfe.m
===================================================================
--- /issm/trunk-jpl/src/m/classes/clusters/pfe.m	(revision 20119)
+++ /issm/trunk-jpl/src/m/classes/clusters/pfe.m	(revision 20120)
@@ -308,5 +308,5 @@
 		 end
 		 %}}}
-		 function LaunchQueueJob(cluster,modelname,dirname,filelist,restart)% {{{
+		 function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch)% {{{
 
 			 %lauch command, to be executed via ssh
Index: /issm/trunk-jpl/src/m/classes/clusters/pfe.py
===================================================================
--- /issm/trunk-jpl/src/m/classes/clusters/pfe.py	(revision 20119)
+++ /issm/trunk-jpl/src/m/classes/clusters/pfe.py	(revision 20120)
@@ -180,5 +180,5 @@
 
 		# }}}
-	def LaunchQueueJob(self,modelname,dirname,filelist,restart):
+	def LaunchQueueJob(self,modelname,dirname,filelist,restart,batch):
 			# {{{
 
Index: /issm/trunk-jpl/src/m/solve/solve.m
===================================================================
--- /issm/trunk-jpl/src/m/solve/solve.m	(revision 20119)
+++ /issm/trunk-jpl/src/m/solve/solve.m	(revision 20120)
@@ -36,4 +36,5 @@
 md.private.solution=solutionenum;
 cluster=md.cluster;
+if strcmpi(getfieldvalue(options,'batch','no'),'yes') batch=1; else batch=0; end
 
 %check model consistency
@@ -99,13 +100,4 @@
 BuildQueueScript(cluster,md.private.runtimename,md.miscellaneous.name,md.private.solution,md.settings.io_gather,md.debug.valgrind,md.debug.gprof,md.qmu.isdakota); % queue file
 
-%Stop here if batch mode
-if strcmpi(getfieldvalue(options,'batch','no'),'yes')
-	if md.verbose.solution,
-		disp('batch mode requested: not launching job interactively');
-		disp('launch solution sequence on remote cluster by hand');
-	end
-	return;
-end
-
 %Upload all required files
 modelname = md.miscellaneous.name;
@@ -126,6 +118,14 @@
 
 %launch queue job: 
-LaunchQueueJob(cluster,md.miscellaneous.name,md.private.runtimename,filelist,restart);
+LaunchQueueJob(cluster,md.miscellaneous.name,md.private.runtimename,filelist,restart,batch);
 
+%return if batch: 
+if batch,
+	if md.verbose.solution,
+		disp('batch mode requested: not launching job interactively');
+		disp('launch solution sequence on remote cluster by hand');
+	end
+	return;
+end
 %wait on lock
 if isnan(md.settings.waitonlock),
Index: /issm/trunk-jpl/src/m/solve/solve.py
===================================================================
--- /issm/trunk-jpl/src/m/solve/solve.py	(revision 20119)
+++ /issm/trunk-jpl/src/m/solve/solve.py	(revision 20120)
@@ -47,5 +47,9 @@
 	#recover some fields
 	md.private.solution=solutionenum
-	cluster=md.cluster
+	cluster=md.cluster 
+	if m.strcmpi(options.getfieldvalue('batch','no'),'yes'):
+		batch=1
+	else:
+		batch=0;
 
 	#check model consistency
@@ -113,5 +117,5 @@
 	
 	#Launch job
-	cluster.LaunchQueueJob(md.miscellaneous.name,md.private.runtimename,filelist,restart)
+	cluster.LaunchQueueJob(md.miscellaneous.name,md.private.runtimename,filelist,restart,batch)
 
 	#wait on lock
