Index: /issm/trunk-jpl/src/m/solve/solve.js
===================================================================
--- /issm/trunk-jpl/src/m/solve/solve.js	(revision 22879)
+++ /issm/trunk-jpl/src/m/solve/solve.js	(revision 22880)
@@ -1,3 +1,3 @@
-function solve(md, solutionstring) { //{{{
+function solve(md, solutionstring) {//{{{
 /**
  * SOLVE - apply solution sequence for this model
@@ -45,29 +45,31 @@
 
 	//recover and process solve options
-	if ((solutionstring.toLowerCase() === 'sb') || (solutionstring.toLowerCase() === 'stressbalance')) {
+	let solutionStringLowerCase = solutionstring.toLowerCase();
+	
+	if ((solutionStringLowerCase === 'sb') || (solutionStringLowerCase === 'stressbalance')) {
 		solutionstring = 'StressbalanceSolution';
-	} else if ((solutionstring.toLowerCase() === 'mt') || (solutionstring.toLowerCase() === 'masstransport')) {
+	} else if ((solutionStringLowerCase === 'mt') || (solutionStringLowerCase === 'masstransport')) {
 		solutionstring = 'MasstransportSolution';	
-	} else if ((solutionstring.toLowerCase() === 'th') || (solutionstring.toLowerCase() === 'thermal')) {
+	} else if ((solutionStringLowerCase === 'th') || (solutionStringLowerCase === 'thermal')) {
 		solutionstring = 'ThermalSolution';
-	} else if ((solutionstring.toLowerCase() === 'st') || (solutionstring.toLowerCase() === 'steadystate')) {
+	} else if ((solutionStringLowerCase === 'st') || (solutionStringLowerCase === 'steadystate')) {
 		solutionstring = 'SteadystateSolution';
-	} else if ((solutionstring.toLowerCase() === 'tr') || (solutionstring.toLowerCase() === 'transient')) {
+	} else if ((solutionStringLowerCase === 'tr') || (solutionStringLowerCase === 'transient')) {
 		solutionstring = 'TransientSolution';
-	} else if ((solutionstring.toLowerCase() === 'mc') || (solutionstring.toLowerCase() === 'balancethickness')) {
+	} else if ((solutionStringLowerCase === 'mc') || (solutionStringLowerCase === 'balancethickness')) {
 		solutionstring = 'BalancethicknessSolution';
-	} else if ((solutionstring.toLowerCase() === 'bv') || (solutionstring.toLowerCase() === 'balancevelocity')) {
+	} else if ((solutionStringLowerCase === 'bv') || (solutionStringLowerCase === 'balancevelocity')) {
 		solutionstring = 'BalancevelocitySolution';
-	} else if ((solutionstring.toLowerCase() === 'bsl') || (solutionstring.toLowerCase() === 'bedslope')) {
+	} else if ((solutionStringLowerCase === 'bsl') || (solutionStringLowerCase === 'bedslope')) {
 		solutionstring = 'BedSlopeSolution';
-	} else if ((solutionstring.toLowerCase() === 'ssl') || (solutionstring.toLowerCase() === 'surfaceslope')) {
+	} else if ((solutionStringLowerCase === 'ssl') || (solutionStringLowerCase === 'surfaceslope')) {
 		solutionstring = 'SurfaceSlopeSolution';
-	} else if ((solutionstring.toLowerCase() === 'hy') || (solutionstring.toLowerCase() === 'hydrology')) {
+	} else if ((solutionStringLowerCase === 'hy') || (solutionStringLowerCase === 'hydrology')) {
 		solutionstring = 'HydrologySolution';
-	} else if ((solutionstring.toLowerCase() === 'da') || (solutionstring.toLowerCase() === 'damageevolution')) {
+	} else if ((solutionStringLowerCase === 'da') || (solutionStringLowerCase === 'damageevolution')) {
 		solutionstring = 'DamageEvolutionSolution';
-	} else if ((solutionstring.toLowerCase() === 'gia') || (solutionstring.toLowerCase() === 'gia')) {
+	} else if ((solutionStringLowerCase === 'gia') || (solutionStringLowerCase === 'gia')) {
 		solutionstring = 'GiaSolution';
-	} else if ((solutionstring.toLowerCase() === 'slr') || (solutionstring.toLowerCase() === 'sealevelrise')) {
+	} else if ((solutionStringLowerCase === 'slr') || (solutionStringLowerCase === 'sealevelrise')) {
 		solutionstring = 'SealevelriseSolution';
 	} else {
@@ -75,68 +77,64 @@
 	}
 	
-	//Process options
-	var args = Array.prototype.slice.call(arguments);
-	var options = new pairoptions(args.slice(2,args.length));
-	options.addfield('solutionstring',solutionstring);
-
-	//recover some fields
-	md.priv.solution=solutionstring;
-	cluster=md.cluster;
+	// Process options
+	let args 	= Array.prototype.slice.call(arguments);
+	let options = new pairoptions(args.slice(2, args.length));
+	options.addfield('solutionstring', solutionstring);
+
+	// recover some fields
+	md.priv.solution 	= solutionstring;
+	cluster 			= md.cluster;
 
 	//check model consistency
-	if (options.getfieldvalue('checkconsistency','yes') == 'yes'){
-		if (md.verbose.solution){
+	if (options.getfieldvalue('checkconsistency', 'yes') === 'yes') {
+		if (md.verbose.solution) {
 			console.log('checking model consistency');
 		}
+		
 		ismodelselfconsistent(md);
 	}
 
-	//If we are restarting, actually use the provided runtime name:
-	restart=options.getfieldvalue('restart','');
-
-	//First, build a runtime name that is unique
-	if (restart==1 ){
-		//Leave the runtimename as is
+	// If we are restarting, actually use the provided runtime name:
+	restart = options.getfieldvalue('restart', '');
+
+	// First, build a runtime name that is unique
+	if (restart === 1 ) {
+		// Leave the runtimename as is
+	} else {
+		if (!(restart === '')) {
+			md.priv.runtimename=restart;
+		} else if (options.getfieldvalue('runtimename',true)) {
+			let c = new Date().getTime();
+			md.priv.runtimename = sprintf('%s-%g', md.miscellaneous.name, c);
+		} else {
+			md.priv.runtimename = md.miscellaneous.name;
 		}
-	else{
-		if (!(restart == '')){
-			md.priv.runtimename=restart;
-		}
-		else if (options.getfieldvalue('runtimename',true)){
-			c=new Date().getTime();
-			md.priv.runtimename=sprintf('%s-%g',md.miscellaneous.name,c);
-		}
-		else{
-			md.priv.runtimename=md.miscellaneous.name;
-		}
-	}
-
-	//if running qmu analysis, some preprocessing of dakota files using models
-	//fields needs to be carried out. 
-	if (md.qmu.isdakota){
+	}
+
+	// If running qmu analysis, some preprocessing of dakota files using models fields needs to be carried out
+	if (md.qmu.isdakota) {
 		throw Error("solve error message: qmu runs not supported yet!");
 		//md.preqmu(options);
 	}
 
-
-	//Do we load results only?
-	if (options.getfieldvalue('loadonly',false)){
+	// Do we load results only?
+	if (options.getfieldvalue('loadonly', false)){
 		loadresultsfromcluster(md);
 		return;
 	}
 
-	//Marshall into a binary array (fid) all the fields of model.
-	var fid = marshall(md);                                          // bin file
+	// Marshall into a binary array (fid) all the fields of model
+	let fid = marshall(md); // bin file
 	
 	//deal with toolkits options: 
-	toolkitsstring= md.toolkits.ToolkitsFile(md.miscellaneous.name + '.toolkits'); // toolkits file
+	toolkitsstring = md.toolkits.ToolkitsFile(md.miscellaneous.name + '.toolkits'); // toolkits file
 
 
 	/*
 		Set success callback function
-	*/
-	//{{{
-	
-	// Default: do nothing if no success callback function requested
+		
+		Default: do nothing if no success callback function requested
+	*/
+	//{{{
 	function successCallbackDefault() {
 		solving = false;
@@ -149,8 +147,8 @@
 	/*
 		Set error callback function
-	*/
-	//{{{
-	
-	// Default: do nothing if no error callback function requested
+		
+		Default: do nothing if no error callback function requested
+	*/
+	//{{{ 
 	function errorCallbackDefault() {
 		solving = false;
@@ -163,8 +161,8 @@
 	/*
 		Set solve button ID
-	*/
-	//{{{
-	
-	// Default: update #solve-button element with progress updates
+		
+		Default: update #solve-button element with progress updates
+	*/
+	//{{{
 	let solveButtonId = options.getfieldvalue('solveButtonId', '#solve-button');
 	//}}}
@@ -184,23 +182,27 @@
 	/*
 		Set progress bar display boolean
-	*/
-	//{{{
-	// Default: no progress bar; NOTE: must have supplied a callout for progress bar to display
+		
+		Default: no progress bar
+		
+		NOTE: must have supplied a callout for progress bar to display
+	*/
+	//{{{
 	let withProgressBar = options.getfieldvalue('withProgressBar', false);
 	//}}}
 
 
-	if (cluster.classname() == 'local'){ //{{{
-
-		/*We are running locally on the machine, using the issm module:*/
+	if (cluster.classname() === 'local') {//{{{
+
+		// We are running locally on the machine, using the issm module
 		console.log('running issm locally');
 		
-		//Call issm:
-		var outputs = issm(fid, toolkitsstring, solutionstring, md.miscellaneous.name); 
-		
-		//Recover output arguments: 
-		var outputbuffer = outputs[0]; var outputbuffersize = outputs[1];
+		// Call issm
+		let outputs = issm(fid, toolkitsstring, solutionstring, md.miscellaneous.name); 
+		
+		// Recover output arguments:
+		let outputbuffer 		= outputs[0]; 
+		let outputbuffersize 	= outputs[1];
 			
-		//Load results: 
+		// Load results 
 		md = loadresultsfrombuffer(md, outputbuffer, outputbuffersize); 
 		
@@ -210,5 +212,5 @@
 		return md;
 	//}}}
-	} else { //{{{
+	} else {//{{{
 		// We are running somewhere else on a computational server. Send the buffer to that server and retrieve output.
 		console.log('running issm remotely');
@@ -229,6 +231,4 @@
 
 		return md;
-	//}}}
-	}
-//}}}
-}
+	}//}}}
+}//}}}
