Index: /issm/trunk-jpl/src/c/main/issm.js
===================================================================
--- /issm/trunk-jpl/src/c/main/issm.js	(revision 19787)
+++ /issm/trunk-jpl/src/c/main/issm.js	(revision 19787)
@@ -0,0 +1,20 @@
+function issm(binaryin){
+/*issm 
+	   usage: var output = issm(input);
+	      where: input is a typed array buffer created by marshall and output 
+		  is a binary buffer to be read by loadresultsfromcluster.
+*/
+
+	//input
+	var dbinary=new Float64Array(binaryin); var nb=dbinary.length * dbinary.BYTES_PER_ELEMENT;
+	var dbinaryPtr= Module._malloc(nb); var binHeap = new Uint8Array(Module.HEAPU8.buffer,dbinaryPtr,nb);
+	binHeap.set(new Uint8Array(dbinary.buffer)); var binary=binHeap.byteOffset;
+
+	//Declare TriMesh module: 
+	issm= Module.cwrap('main','number',['number','number']);
+	
+	//Call issm:
+	var output = issm(binary, 'null');
+	
+	return output;
+}
Index: /issm/trunk-jpl/src/m/array/arrayoperations.js
===================================================================
--- /issm/trunk-jpl/src/m/array/arrayoperations.js	(revision 19786)
+++ /issm/trunk-jpl/src/m/array/arrayoperations.js	(revision 19787)
@@ -141,4 +141,9 @@
 	for (i=0;i<array.length;i++)sqrtarray[i]=Math.sqrt(array[i]);
 	return sqrtarray;
+} //}}}
+function ArrayScale(array,alpha) { //{{{
+
+	for (i=0;i<array.length;i++)array[i]=array[i]*alpha;
+
 } //}}}
 function ArrayMag(array1,array2) { //{{{
Index: /issm/trunk-jpl/src/m/classes/autodiff.js
===================================================================
--- /issm/trunk-jpl/src/m/classes/autodiff.js	(revision 19786)
+++ /issm/trunk-jpl/src/m/classes/autodiff.js	(revision 19787)
@@ -31,4 +31,30 @@
 
 	}// }}}
+		this.checkconsistency = function(md,solution,analyses){ //{{{
+
+			//Early return 
+			if (!this.isautodiff) return; 
+
+			//Driver value:
+			checkfield(md,'fieldname','autodiff.driver','values',['fos_forward','fov_forward','fov_forward_all','fos_reverse','fov_reverse','fov_reverse_all']);
+			
+			//buffer values: 
+			checkfield(md,'fieldname','autodiff.obufsize','>=',16);
+			checkfield(md,'fieldname','autodiff.lbufsize','>=',16);
+			checkfield(md,'fieldname','autodiff.cbufsize','>=',16);
+			checkfield(md,'fieldname','autodiff.tbufsize','>=',16);
+			checkfield(md,'fieldname','autodiff.gcTriggerRatio','>=',0);
+			checkfield(md,'fieldname','autodiff.gcTriggerMaxSize','>=',65536);
+
+			//go through our dependents and independents and check consistency: 
+			for (var i=0;i<this.dependents.length;i++){
+				dep=this.dependents[i];
+				dep.checkconsistency(md,solution,analyses);
+			}
+			for (var i=0;i<this.independents.length;i++){
+				indep=this.independents[i];
+				indep.checkconsistency(md,i,solution,analyses,this.driver);
+			}
+		} // }}}
 	//properties 
 	// {{{
Index: /issm/trunk-jpl/src/m/classes/balancethickness.js
===================================================================
--- /issm/trunk-jpl/src/m/classes/balancethickness.js	(revision 19786)
+++ /issm/trunk-jpl/src/m/classes/balancethickness.js	(revision 19787)
@@ -20,4 +20,13 @@
 
 	}// }}}
+		this.checkconsistency = function(md,solution,analyses){ // {{{
+			//Early return
+			if (solution!=BalancethicknessSolutionEnum())return;
+
+			checkfield(md,'fieldname','balancethickness.spcthickness');
+			checkfield(md,'fieldname','balancethickness.thickening_rate','size',[md.mesh.numberofvertices ,1],'NaN',1);
+			checkfield(md,'fieldname','balancethickness.stabilization','size',[1, 1],'values',[0, 1, 2 ,3]);
+			//checkfield(md,'fieldname','balancethickness.omega','size',[md.mesh.numberofvertices ,1],'NaN',1,'>=',0);
+		} //}}}
 	//properties 
 	// {{{
Index: /issm/trunk-jpl/src/m/classes/calving.js
===================================================================
--- /issm/trunk-jpl/src/m/classes/calving.js	(revision 19786)
+++ /issm/trunk-jpl/src/m/classes/calving.js	(revision 19787)
@@ -21,4 +21,13 @@
 
 	}// }}}
+	this.checkconsistency = function(md,solution,analyses) { // {{{
+		//Early return
+		if (solution!=TransientSolutionEnum() | md.transient.iscalving==0) return;
+
+		checkfield(md,'fieldname','calving.spclevelset','timeseries',1);
+		checkfield(md,'fieldname','calving.stabilization','values',[0,1,2]);
+		checkfield(md,'fieldname','calving.calvingrate(1:md.mesh.numberofvertices,:)','>=',0,'timeseries',1,'NaN',1);
+		checkfield(md,'fieldname','calving.meltingrate(1:md.mesh.numberofvertices,:)','>=',0,'timeseries',1,'NaN',1);
+	} //}}}
 	//properties 
 	// {{{
Index: /issm/trunk-jpl/src/m/classes/clusters/generic.js
===================================================================
--- /issm/trunk-jpl/src/m/classes/clusters/generic.js	(revision 19786)
+++ /issm/trunk-jpl/src/m/classes/clusters/generic.js	(revision 19787)
@@ -36,4 +36,12 @@
 		console.log(sprintf('    shell: %s',this.shell));
 	}// }}}
+		this.checkconsistency = function (md,solution,analyses) { //{{{
+			if (cluster.np<1){
+				md.checkmessage('number of processors should be at least 1');
+			}
+			if (isNaN(cluster.np)){
+				md.checkmessage('number of processors should not be NaN!');
+			}
+		} //}}}
 	//properties 
 	// {{{
Index: /issm/trunk-jpl/src/m/classes/flaim.js
===================================================================
--- /issm/trunk-jpl/src/m/classes/flaim.js	(revision 19786)
+++ /issm/trunk-jpl/src/m/classes/flaim.js	(revision 19787)
@@ -37,4 +37,17 @@
 
 	}// }}}
+	this.checkconsistency = function(md,solution,analyses) { // {{{
+
+		//Early return
+		if (solution!=FlaimSolutionEnum()) return;
+
+		checkfield(md,'fieldname','flaim.tracks','file',1);
+		if (isNaN(md.flaim.criterion) | md.flaim.criterion.length==0){
+			checkfield(md,'fieldname','flaim.targets','file',1);
+		}
+		else{
+			checkfield(md,'fieldname','flaim.criterion','numel',[md.mesh.numberofvertices, md.mesh.numberofelements]);
+		}
+	} //}}}
 	//properties 
 	// {{{
Index: /issm/trunk-jpl/src/m/classes/gia.js
===================================================================
--- /issm/trunk-jpl/src/m/classes/gia.js	(revision 19786)
+++ /issm/trunk-jpl/src/m/classes/gia.js	(revision 19787)
@@ -20,4 +20,25 @@
 
 	}// }}}
+	this.checkconsistency = function(md,solution,analyses) { // {{{
+
+		if(!ArrayAnyEqual(ArrayIsMember(GiaAnalysisEnum(),analyses),1))return;
+
+		checkfield(md,'fieldname','gia.mantle_viscosity','NaN',1,'size',[md.mesh.numberofvertices,1],'>',0);
+		checkfield(md,'fieldname','gia.lithosphere_thickness','NaN',1,'size',[md.mesh.numberofvertices,1],'>',0);
+		checkfield(md,'fieldname','gia.cross_section_shape','numel',[1],'values',[1,2]);
+
+		//be sure that if we are running a masstransport ice flow model coupled with gia, that thickness forcings 
+		//are not provided into the future.
+		if (solution==TransientSolutionEnum() & md.transient.ismasstransport & md.transient.isgia){
+			//figure out if thickness is a transient forcing: 
+			if (md.geometry.thickness.length == (md.mesh.numberofvertices+1)){
+				//recover the furthest time "in time": 
+				t=md.geometry.thickness[0].length;
+				if(md.geometry.thickness[md.geometry.thickness.length-1][t-1]!=md.timestepping.start_time){
+					md.checkmessage('if ismasstransport is on, transient thickness forcing for the gia model should not be provided in the future. Synchronize your start_time to correspond to the most recent transient thickness forcing timestep');
+				}
+			}
+		}
+	} // }}}
 	//properties 
 	// {{{
Index: /issm/trunk-jpl/src/m/classes/groundingline.js
===================================================================
--- /issm/trunk-jpl/src/m/classes/groundingline.js	(revision 19786)
+++ /issm/trunk-jpl/src/m/classes/groundingline.js	(revision 19787)
@@ -17,4 +17,24 @@
 
 	}// }}}
+		this.checkconsistency = function(md,solution,analyses) {// {{{
+
+			checkfield(md,'fieldname','groundingline.migration','values',['None', 'AggressiveMigration', 'SoftMigration', 'SubelementMigration', 'SubelementMigration2', 'Contact', 'None', 'GroundingOnly']);
+
+			if (this.migration !='None'){
+				if (isNaN(md.geometry.bed)){
+					md.checkmessage('requesting grounding line migration, but bathymetry is absent!');
+				}
+				for (var i=0;i<md.mesh.numberofvertices;i++){
+					if(md.mask.groundedice_levelset[i]>0){
+						md.checkmessage('base not equal to bed on grounded ice!');
+						break;
+					}
+					if(md.geometry.bed[i] - md.geometry.base[i] > Math.pow(10,-9)){
+						md = checkmessage(md,'bed superior to base on floating ice!');
+						break;
+					}
+				}
+			}
+		} // }}}
 	//properties 
 	// {{{
Index: /issm/trunk-jpl/src/m/classes/hydrologyshreve.js
===================================================================
--- /issm/trunk-jpl/src/m/classes/hydrologyshreve.js	(revision 19786)
+++ /issm/trunk-jpl/src/m/classes/hydrologyshreve.js	(revision 19787)
@@ -23,4 +23,13 @@
 		return "hydrologyshreve";
 	}// }}}
+		this.checkconsistency = function(md,solution,analyses) { //{{{
+
+			//Early return
+			if(!ArrayAnyEqual(ArrayIsMember(HydrologyShreveAnalysisEnum(),analyses),1)) return;
+
+			checkfield(md,'fieldname','hydrology.spcwatercolumn','timeseries',1);
+			checkfield(md,'fieldname','hydrology.stabilization','>=',0);
+
+		} // }}}
 	//properties 
 	// {{{
Index: /issm/trunk-jpl/src/m/classes/inversion.js
===================================================================
--- /issm/trunk-jpl/src/m/classes/inversion.js	(revision 19786)
+++ /issm/trunk-jpl/src/m/classes/inversion.js	(revision 19787)
@@ -75,4 +75,42 @@
 
 	}// }}}
+		this.checkconsistency = function(md,solution,analyses) { //{{{
+
+			//Early return
+			if (!this.iscontrol) return;
+
+			num_controls=md.inversion.control_parameters.length;
+			num_costfunc=md.inversion.control_parameters[0].length;
+
+			checkfield(md,'fieldname','inversion.iscontrol','values',[0, 1]);
+			checkfield(md,'fieldname','inversion.incomplete_adjoint','values',[0 ,1]);
+			checkfield(md,'fieldname','inversion.control_parameters','cell',1,'values',supportedcontrols());
+			checkfield(md,'fieldname','inversion.nsteps','numel',1,'>=',0);
+			checkfield(md,'fieldname','inversion.maxiter_per_step','size',[md.inversion.nsteps, 1],'>=',0);
+			checkfield(md,'fieldname','inversion.step_threshold','size',[md.inversion.nsteps, 1]);
+			checkfield(md,'fieldname','inversion.cost_functions','size',[1, num_costfunc],'values',supportedcostfunctions());
+			checkfield(md,'fieldname','inversion.cost_functions_coefficients','size',[md.mesh.numberofvertices, num_costfunc],'>=',0);
+			checkfield(md,'fieldname','inversion.gradient_scaling','size',[md.inversion.nsteps, num_controls]);
+			checkfield(md,'fieldname','inversion.min_parameters','size',[md.mesh.numberofvertices , num_controls]);
+			checkfield(md,'fieldname','inversion.max_parameters','size',[md.mesh.numberofvertices ,num_controls]);
+
+			//Only SSA, HO and FS are supported right now
+			if (solution==StressbalanceSolutionEnum()){
+				if (!(md.flowequation.isSSA | md.flowequation.isHO | md.flowequation.isFS | md.flowequation.isL1L2)){
+					md.checkmessage('inversion can only be performed for SSA, HO or FS ice flow models');
+				}
+			}
+
+			if (solution==BalancethicknessSolutionEnum()){
+				checkfield(md,'fieldname','inversion.thickness_obs','size',[md.mesh.numberofvertices ,1],'NaN',1);
+			}
+			else if (solution==BalancethicknessSoftSolutionEnum()){
+				checkfield(md,'fieldname','inversion.thickness_obs','size',[md.mesh.numberofvertices, 1],'NaN',1);
+			}
+			else{
+				checkfield(md,'fieldname','inversion.vx_obs','size',[md.mesh.numberofvertices ,1],'NaN',1);
+				checkfield(md,'fieldname','inversion.vy_obs','size',[md.mesh.numberofvertices ,1],'NaN',1);
+			}
+		} // }}}
 	//properties 
 	// {{{
Index: /issm/trunk-jpl/src/m/classes/masstransport.js
===================================================================
--- /issm/trunk-jpl/src/m/classes/masstransport.js	(revision 19786)
+++ /issm/trunk-jpl/src/m/classes/masstransport.js	(revision 19787)
@@ -38,4 +38,17 @@
 
 	}// }}}
+		this.checkconsistency = function (md,solution,analyses){  // {{{
+
+			//Early return
+			if(!ArrayAnyEqual(ArrayIsMember(HydrologyShreveAnalysisEnum(),analyses),1) | (solution==TransientSolutionEnum() & md.transient.ismasstransport==0)) return; 
+
+			checkfield(md,'fieldname','masstransport.spcthickness','timeseries',1);
+			checkfield(md,'fieldname','masstransport.isfreesurface','values',[0 ,1]);
+			checkfield(md,'fieldname','masstransport.hydrostatic_adjustment','values',['Absolute', 'Incremental']);
+			checkfield(md,'fieldname','masstransport.stabilization','values',[0,1,2,3,4]);
+			checkfield(md,'fieldname','masstransport.min_thickness','>',0);
+			checkfield(md,'fieldname','masstransport.requested_outputs','stringrow',1);
+
+		} // }}}
 	//properties 
 	// {{{
Index: /issm/trunk-jpl/src/m/classes/miscellaneous.js
===================================================================
--- /issm/trunk-jpl/src/m/classes/miscellaneous.js	(revision 19786)
+++ /issm/trunk-jpl/src/m/classes/miscellaneous.js	(revision 19787)
@@ -17,4 +17,8 @@
 
 	}// }}}
+		this.checkconsistency= function(md,solution,analyses) {// {{{
+
+			checkfield(md,'fieldname','miscellaneous.name','empty',1);
+		}// }}}
 	//properties 
 	// {{{
Index: /issm/trunk-jpl/src/m/classes/outputdefinition.js
===================================================================
--- /issm/trunk-jpl/src/m/classes/outputdefinition.js	(revision 19786)
+++ /issm/trunk-jpl/src/m/classes/outputdefinition.js	(revision 19787)
@@ -15,4 +15,13 @@
 
 	}// }}}
+		this.checkconsistency = function(md,solution,analyses) { //{{{
+
+			checkfield(md,'fieldname','outputdefinition.definitions','cell',1);
+
+			for (var i=0;i<this.definitions.length;i++){
+				this.definitions[i].checkconsistency(md,solution,analyses);
+			}
+
+		} // }}}
 	//properties 
 	// {{{
Index: /issm/trunk-jpl/src/m/classes/private.js
===================================================================
--- /issm/trunk-jpl/src/m/classes/private.js	(revision 19786)
+++ /issm/trunk-jpl/src/m/classes/private.js	(revision 19787)
@@ -16,4 +16,7 @@
 		fielddisplay(this,'solution','type of solution launched');
 	}// }}}
+	this.checkconsistency = function(md,solution,analyses){ // {{{
+
+	}// % }}}
 	//properties 
 	// {{{
Index: /issm/trunk-jpl/src/m/classes/qmu.js
===================================================================
--- /issm/trunk-jpl/src/m/classes/qmu.js	(revision 19786)
+++ /issm/trunk-jpl/src/m/classes/qmu.js	(revision 19787)
@@ -90,4 +90,11 @@
 
 	}// }}}
+		this.checkconsistency = function(md,solution,analyses) { //{{{
+
+			///Early return
+			if (!md.qmu.isdakota) return;
+			else md.checkmessage('qmu runs not supported yet!');
+
+		} // }}}
 	//properties 
 	// {{{
Index: /issm/trunk-jpl/src/m/classes/rifts.js
===================================================================
--- /issm/trunk-jpl/src/m/classes/rifts.js	(revision 19786)
+++ /issm/trunk-jpl/src/m/classes/rifts.js	(revision 19787)
@@ -13,4 +13,33 @@
 		fielddisplay(this,'riftproperties','');
 	}// }}}
+		this.checkconsistency = function(md,solution,analyses) { //{{{
+			if (isNaN(this.riftstruct) | this.riftstruct.length==0){
+				numrifts=0;
+			}
+			else{
+				numrifts=this.riftstruct.length;
+			}
+			if (numrifts){
+				if (!(md.mesh.domaintype() == '2Dhorizontal')){
+					md.checkmessage('models with rifts are only supported in 2d for now!');
+				}
+				if (!IsArray(this.riftstruct)){
+					md.checkmessage('rifts.riftstruct should be a structure!');
+				}
+				for(var i=0;i<md.mesh.segmentmarkers.length;i++){
+					if (md.mesh.segmentmarkers[i]>=2){
+						//We have segments with rift markers, but no rift structure!
+						md.checkmessage(['model should be processed for rifts (run meshprocessrifts)!']);
+						break;
+					}
+				}
+				for (var i=0;i<numrifts;i++){
+					md = checkfield(md,'fieldname',sprintf('rifts.riftstruct[%i].fill',i),'values',[WaterEnum(), AirEnum(), IceEnum(), MelangeEnum()]);
+				}
+			}
+			else{
+				if (!isNaN(this.riftstruct)) md.checkmessage('riftstruct should be NaN since numrifts is 0!');
+			}
+		} //}}}
 	//properties 
 	// {{{
Index: /issm/trunk-jpl/src/m/classes/settings.js
===================================================================
--- /issm/trunk-jpl/src/m/classes/settings.js	(revision 19786)
+++ /issm/trunk-jpl/src/m/classes/settings.js	(revision 19787)
@@ -33,4 +33,13 @@
 
 	}// }}}
+		this.checkconsistency = function(md,solution,analyses) { // {{{
+
+			checkfield(md,'fieldname','settings.results_on_nodes','numel',[1],'values',[0, 1]);
+			checkfield(md,'fieldname','settings.io_gather','numel',[1],'values',[0, 1]);
+			checkfield(md,'fieldname','settings.lowmem','numel',[1],'values',[0, 1]);
+			checkfield(md,'fieldname','settings.output_frequency','numel',[1],'>=',1);
+			checkfield(md,'fieldname','settings.recording_frequency','numel',[1],'>=',0);
+			checkfield(md,'fieldname','settings.waitonlock','numel',[1]);
+		} // }}}
 	//properties 
 	// {{{
Index: /issm/trunk-jpl/src/m/classes/steadystate.js
===================================================================
--- /issm/trunk-jpl/src/m/classes/steadystate.js	(revision 19786)
+++ /issm/trunk-jpl/src/m/classes/steadystate.js	(revision 19787)
@@ -28,4 +28,18 @@
 
 	}// }}}
+	this.checkconsistency = function(md,solution,analyses) {// {{{
+
+		//Early return
+		if (solution!=SteadystateSolutionEnum()) return;
+
+		if (md.timestepping.time_step!=0){
+			md.checkmessage('for a steadystate computation, timestepping.time_step must be zero.');
+		}
+		checkfield(md,'fieldname','steadystate.requested_outputs','stringrow',1);
+
+		if (isNaN(md.stressbalance.reltol)){
+			md.checkmessage('for a steadystate computation, stressbalance.reltol (relative convergence criterion) must be defined!');
+		}
+	} // }}}
 	//properties 
 	// {{{
Index: /issm/trunk-jpl/src/m/classes/stressbalance.js
===================================================================
--- /issm/trunk-jpl/src/m/classes/stressbalance.js	(revision 19786)
+++ /issm/trunk-jpl/src/m/classes/stressbalance.js	(revision 19787)
@@ -73,4 +73,64 @@
 
 	}// }}}
+		this.checkconsistency = function(md,solution,analyses) { //{{{
+
+			//Early return
+			if(ArrayAnyEqual(ArrayIsMember(StressbalanceAnalysisEnum(),analyses),0))return;
+
+			checkfield(md,'fieldname','stressbalance.spcvx','timeseries',1);
+			checkfield(md,'fieldname','stressbalance.spcvy','timeseries',1);
+			checkfield(md,'fieldname','stressbalance.spcvz','timeseries',1);
+			checkfield(md,'fieldname','stressbalance.restol','size',[1, 1],'>',0,'NaN',1);
+			checkfield(md,'fieldname','stressbalance.reltol','size',[1, 1]);
+			checkfield(md,'fieldname','stressbalance.abstol','size',[1, 1]);
+			checkfield(md,'fieldname','stressbalance.isnewton','numel',[1],'values',[0, 1, 2]);
+			checkfield(md,'fieldname','stressbalance.FSreconditioning','size',[1, 1],'NaN',1);
+			checkfield(md,'fieldname','stressbalance.viscosity_overshoot','size',[1, 1],'NaN',1);
+			checkfield(md,'fieldname','stressbalance.maxiter','size',[1, 1],'>=',1);
+			checkfield(md,'fieldname','stressbalance.referential','size',[md.mesh.numberofvertices, 6]);
+			checkfield(md,'fieldname','stressbalance.loadingforce','size',[md.mesh.numberofvertices, 3]);
+			checkfield(md,'fieldname','stressbalance.requested_outputs','stringrow',1);
+
+			//singular solution
+			if(!ArrayAnyNaN(md.stressbalance.spcvx) | !ArrayAnyNaN(md.stressbalance.spcvy) |  !ArrayAnyAboveStrict(md.mask.groundedice_levelset,0)){
+				md = checkmessage(md,'model is not well posed (singular). You need at least one node with fixed velocity!');
+				console.log(sprintf('\n !!! Warning: no spc applied, model might not be well posed if no basal friction is applied, check for solution crash\n'));
+			}
+			//CHECK THAT EACH LINES CONTAINS ONLY NAN VALUES OR NO NAN VALUES
+			for(var i=0;i<md.stressbalance.referential.length;i++){
+				var sum=0;
+				for(j=0;j<md.stressbalance.referential[0].length;j++)sum+=md.stressbalance.referential[i][j];
+				if (sum!=0 & sum!=6){
+					md = checkmessage(md,'Each line of stressbalance.referential should contain either only NaN values or no NaN values');
+					break;
+				}
+			}
+			//CHECK THAT THE TWO VECTORS PROVIDED ARE ORTHOGONAL
+			for(var i=0;i<md.stressbalance.referential.length;i++){
+				var sum=0;
+				for(j=0;j<md.stressbalance.referential[0].length;j++)sum+=md.stressbalance.referential[i][j];
+				if(sum==0){
+					var dot=0;
+					for(j=0;j<3;j++)dot+=md.stressbalance.referential[i][j]*md.stressbalance.referential[i][j+3];
+					dot=Math.abs(dot);
+					if(dot>Math.pow(10,-18)){
+						md.checkmessage('Vectors in stressbalance.referential (columns 1 to 3 and 4 to 6) must be orthogonal');
+						break;
+					}
+				}
+			}
+			//CHECK THAT NO rotation specified for FS Grounded ice at base
+			if (md.mesh.domaintype() == '3D' & md.flowequation.isFS){
+				for(var i=0;i<md.mask.groundedice_levelset.length;i++){
+					if(md.mask.groundedice_levelset[i]>0 & md.mesh.vertexonbase[i]){
+						if(!ArrayIsNan(md.stressbalance.referential[i])){
+							md.checkmessage('no referential should be specified for basal vertices of grounded ice');
+							break;
+						}
+					}
+				}
+				checkfield(md,'fieldname','stressbalance.FSreconditioning','>',0);
+			}
+		} // }}}
 	//properties 
 	// {{{
Index: /issm/trunk-jpl/src/m/classes/thermal.js
===================================================================
--- /issm/trunk-jpl/src/m/classes/thermal.js	(revision 19786)
+++ /issm/trunk-jpl/src/m/classes/thermal.js	(revision 19787)
@@ -49,4 +49,36 @@
 
 	}// }}}
+	this.checkconsistency = function(md,solution,analyses){ // {{{
+
+		//Early return
+		if(!ArrayAnyEqual(ArrayIsMember(ThermalAnalysisEnum(),analyses),1) & !ArrayAnyEqual(ArrayIsMember(EnthalpyAnalysisEnum(),analyses),1)  | (solution == TransientSolutionEnum() & md.transient.isthermal==0)) return;
+
+		checkfield(md,'fieldname','thermal.stabilization','numel',[1],'values',[0 ,1, 2]);
+		checkfield(md,'fieldname','thermal.spctemperature','timeseries',1);
+		if(ArrayAnyEqual(ArrayIsMember(EnthalpyAnalysisEnum(),analyses),1) & md.thermal.isenthalpy & md.mesh.dimension() == 3){
+			
+			for(var i=0;i<md.mesh.numberofvertices;i++){
+				for(var j=0;j<md.thermal.spctemperature[0].length;j++){
+					if (!isNaN(md.thermal.spctemperature[i][j])){
+						var rep=md.geometry.surface[i]-md.mesh.z[i];
+						if (md.thermal.spctemperature[i][j] <= md.materials.melting-md.materials.beta*md.materials.rho_ice*md.constants.g*rep+Math.pow(10,-5)){
+
+							md.checkmessage('spctemperature should be less or equal than the adjusted melting point');
+							break;
+						}
+					}
+				}
+			}
+			checkfield(md,'fieldname','thermal.isenthalpy','numel',[1],'values',[0, 1]);
+			checkfield(md,'fieldname','thermal.isdynamicbasalspc','numel', [1],'values',[0, 1]);
+			if(md.thermal.isenthalpy){
+				if (isNan(md.stressbalance.reltol)){
+					md.checkmessage('for a steadystate computation, thermal.reltol (relative convergence criterion) must be defined!');
+				}
+			}
+			checkfield(md,'fieldname','thermal.reltol','>',0.,'message','reltol must be larger than zero');
+		}
+		checkfield(md,'fieldname','thermal.requested_outputs','stringrow',1);
+	} // }}} 
 	//properties 
 	// {{{
Index: /issm/trunk-jpl/src/m/classes/toolkits.js
===================================================================
--- /issm/trunk-jpl/src/m/classes/toolkits.js	(revision 19786)
+++ /issm/trunk-jpl/src/m/classes/toolkits.js	(revision 19787)
@@ -30,5 +30,5 @@
 		}
 	}// }}}
-	this.disp= function(){// {{{
+	this.disp = function(){// {{{
 		console.log(sprintf('List of toolkits options per analysis:\n'));
 		for(var prop in this){
@@ -38,4 +38,13 @@
 		}
 	}// }}}
+	this.checkconsistency = function (md,solution,analyses) { // {{{
+		for(var prop in this){
+			if(typeof this[prop] == 'object'){
+				if (this[prop] == ''){
+					md.checkmessage(sprintf("md.toolkits.%s is empty",prop));
+				}
+			}
+		}
+	} // }}}
 	//properties 
 	// {{{
Index: /issm/trunk-jpl/src/m/classes/transient.js
===================================================================
--- /issm/trunk-jpl/src/m/classes/transient.js	(revision 19786)
+++ /issm/trunk-jpl/src/m/classes/transient.js	(revision 19787)
@@ -42,4 +42,21 @@
 
 	}// }}}
+		this.checkconsistency = function(md,solution,analyses) { // {{{
+
+			//Early return
+			if (solution!=TransientSolutionEnum()) return;
+
+			checkfield(md,'fieldname','transient.issmb','numel',[1],'values',[0 ,1]);
+			checkfield(md,'fieldname','transient.ismasstransport','numel',[1],'values',[0 ,1]);
+			checkfield(md,'fieldname','transient.isstressbalance','numel',[1],'values',[0 ,1]);
+			checkfield(md,'fieldname','transient.isthermal','numel',[1],'values',[0 ,1]);
+			checkfield(md,'fieldname','transient.isgroundingline','numel',[1],'values',[0, 1]);
+			checkfield(md,'fieldname','transient.isgia','numel',[1],'values',[0, 1]);
+			checkfield(md,'fieldname','transient.isdamageevolution','numel',[1],'values',[0, 1]);
+			checkfield(md,'fieldname','transient.islevelset','numel',[1],'values',[0, 1]);
+			checkfield(md,'fieldname','transient.iscalving','numel',[1],'values',[0, 1]);
+			checkfield(md,'fieldname','transient.ishydrology','numel',[1],'values',[0 ,1]);
+			checkfield(md,'fieldname','transient.requested_outputs','stringrow',1);
+		} // }}}
 	//properties 
 	// {{{
Index: /issm/trunk-jpl/src/m/classes/verbose.js
===================================================================
--- /issm/trunk-jpl/src/m/classes/verbose.js	(revision 19786)
+++ /issm/trunk-jpl/src/m/classes/verbose.js	(revision 19787)
@@ -40,4 +40,7 @@
 		//ENDDISP
 	}// }}}
+		this.checkconsistency = function(md,solution,analyses){ // {{{
+
+		} // }}}
 	//properties 
 	// {{{
Index: /issm/trunk-jpl/src/m/consistency/ismodelselfconsistent.js
===================================================================
--- /issm/trunk-jpl/src/m/consistency/ismodelselfconsistent.js	(revision 19786)
+++ /issm/trunk-jpl/src/m/consistency/ismodelselfconsistent.js	(revision 19787)
@@ -24,5 +24,4 @@
 			continue;
 		}
-		console.log(field);
 
 		//Check consistency of the class
Index: /issm/trunk-jpl/src/m/io/fileptr.js
===================================================================
--- /issm/trunk-jpl/src/m/io/fileptr.js	(revision 19787)
+++ /issm/trunk-jpl/src/m/io/fileptr.js	(revision 19787)
@@ -0,0 +1,80 @@
+//FILEPTR class definition
+////
+//// Usage: 
+//// var fid = new fileptr(); 
+//
+//
+
+function fileptr() {
+	//properties
+	this.increment=NaN;
+	this.buffer =NaN;
+	this.view =NaN;
+	this.ptr =NaN;
+	this.options = new pairoptions(Array.prototype.slice.call(arguments));
+	
+	//methods
+		this.disp = function () { //{{{
+			console.log(sprintf("   fileptr:")); 
+
+			console.log(sprintf("       buffer: ArrayBuffer{ byteLength: %i }\n",this.buffer.byteLength));
+			console.log(sprintf("       ptr: %i\n",this.ptr));
+			console.log(sprintf("       increment: %i\n",this.increment));
+
+		} //}}}
+		this.setdefaultparameters = function (options) { //{{{
+
+			this.increment=options.getfieldvalue('increment',8000); //8000 bytes,  1000 doubles.
+			this.buffer=new ArrayBuffer(this.increment);
+			this.ptr=0;
+			this.view=new DataView(this.buffer);
+
+		} //}}}
+		this.fwrite = function (value,format) { //{{{
+
+			if(this.ptr==this.buffer.byteLength){
+				//need to resize the buffer: 
+				var  newbuffer = new ArrayBuffer(this.buffer.byteLength+this.increment);
+				newbuffer.set(this.buffer);
+				this.buffer=newbuffer;
+			}
+			
+			if(format == 'int'){
+				this.view.setUint32(this.ptr,value,true); this.ptr+=4;
+			}
+			else if(format == 'char'){
+				for(var i=0;i<value.length;i++){
+					this.view.setUint8(this.ptr,value.charCodeAt(i),true); 
+					this.ptr+=1;
+				}
+			}
+			else if(format == 'double'){
+				if (!IsArray(value)){
+					this.view.setFloat64(this.ptr,value,true);
+					this.ptr+=8;
+				}
+				else{
+					if (!IsArray(value[0])){
+						for(var i=0;i<value.length;i++){
+							this.view.setFloat64(this.ptr,value[i],true);
+							this.ptr+=8;
+						}
+					}
+					else{
+						for(var i=0;i<value.length;i++){
+							for(var j=0;j<value[0].length;j++){
+								this.view.setFloat64(this.ptr,value[i][j],true);
+								this.ptr+=8;
+							}
+						}
+					}
+				}
+			}
+			else throw Error('fileptr.fwrite error message: wrong type of format');
+		} //}}}
+		this.rawbuffer = function () { //{{{
+			return this.buffer;
+		} //}}}
+	//set defaults
+	this.setdefaultparameters(this.options);
+}
Index: /issm/trunk-jpl/src/m/solve/WriteData.js
===================================================================
--- /issm/trunk-jpl/src/m/solve/WriteData.js	(revision 19787)
+++ /issm/trunk-jpl/src/m/solve/WriteData.js	(revision 19787)
@@ -0,0 +1,303 @@
+function WriteData(fid){
+//WRITEDATA - write model field into binary buffer 
+//
+//   Usage:
+//      WriteData(fid,varargin);
+
+	//process options
+	var args = Array.prototype.slice.call(arguments);
+	var options = new pairoptions(args.slice(1,args.length));
+
+	//Get data properties
+	if (options.exist('object')){
+		//This is a object field, construct enum and data
+		obj       = options.getfieldvalue('object');
+		fieldname = options.getfieldvalue('fieldname');
+		classname = options.getfieldvalue('class',obj.classname());
+		if (options.exist('enum')){
+			enumm = options.getfieldvalue('enum');
+		}
+		else{
+			enumm = BuildEnum(classname  + '_' + fieldname);
+		}
+		data  = obj[fieldname];
+	}
+	else{
+		//No processing required
+		data = options.getfieldvalue('data');
+		enumm = options.getfieldvalue('enum');
+	}
+
+	format  = options.getfieldvalue('format');
+	mattype = options.getfieldvalue('mattype',0);    //only required for matrices
+	timeserieslength = options.getfieldvalue('timeserieslength',-1);
+
+	//Scale data if necesarry
+	if (options.exist('scale')){
+		scale = options.getfieldvalue('scale');
+		if (data.length==timeserieslength){
+			if (IsArray(data[0])){
+				for(var i=0;i<data.length-1;i++){
+					for(var j=0;j<data[0].length;j++){
+						data[i][j]=scale*data[i][j];
+					}
+				}
+			}
+			else{
+				for(var i=0;i<data.length-1;i++){
+					data[i]=scale*data[i];
+				}
+			}
+		}
+		else{
+			ArrayScale(data,scale);
+		}
+	}
+
+	if(data.length == timeserieslength){
+		var yts=365.0*24.0*3600.0;
+		if (IsArray(data[0])){
+			for(var j=0;j<data[0].length;j++)data[timeserieslength-1][j]=data[timeserieslength-1][j]*yts;
+		}
+		else data[timeserieslength-1]=data[timeserieslength-1]*yts;
+	}
+
+	//Step 1: write the enum to identify this record uniquely
+	fid.fwrite(enumm,'int'); 
+
+	//Step 2: write the data itself.
+	if (format == 'Boolean'){// {{{
+		if(IsArray(data)) throw  Error(sprintf("field '%s' cannot be marshalled as it has more than one element!",EnumToString(enumm)));
+
+		//first write length of record
+		fid.fwrite(4+4,'int');  //1 bool (disguised as an int)+code
+
+		//write data code: 
+		fid.fwrite(FormatToCode(format),'int'); 
+
+		//now write integer
+		fid.fwrite(data,'int');  //send an int, not easy to send a bool
+	} // }}}
+	else if (format == 'Integer'){ // {{{
+		if(IsArray(data)) throw  Error(sprintf("field '%s' cannot be marshalled as it has more than one element!",EnumToString(enumm)));
+
+		//first write length of record
+		fid.fwrite(4+4,'int');  //1 integer + code
+
+		//write data code: 
+		fid.fwrite(FormatToCode(format),'int'); 
+
+		//now write integer
+		fid.fwrite(data,'int'); 
+	} // }}}
+	else if (format == 'Double'){ // {{{
+		if(IsArray(data)) throw  Error(sprintf("field '%s' cannot be marshalled as it has more than one element!",EnumToString(enumm)));
+
+		//first write length of record
+		fid.fwrite(8+4,'int');  //1 double+code
+
+		//write data code: 
+		fid.fwrite(FormatToCode(format),'int'); 
+
+		//now write double
+		fid.fwrite(data,'double'); 
+	} // }}}
+	else if (format == 'String'){ // {{{
+		//first write length of record
+		fid.fwrite(data.length+4+4,'int');  //string + string size + code
+
+		//write data code: 
+		fid.fwrite(FormatToCode(format),'int'); 
+
+		//now write string
+		fid.fwrite(data.length,'int'); 
+		fid.fwrite(data,'char'); 
+	} // }}}
+	else if (format == 'BooleanMat'){ // {{{
+
+		//Get size
+		var s=[data.length,1];
+		if(IsArray(data[0]))s[1]=data[0].length;
+
+		//if matrix = NaN, then do not write anything
+		if (s[0]==1 & s[1]==1 & isNan(data)){
+			s[0]=0; s[1]=0;
+		}
+		if (s[0]==1 & s[1]==1 & isNan(data[0])){
+			s[0]=0; s[1]=0;
+		}
+
+		//first write length of record
+		fid.fwrite(4+4+8*s[0]*s[1]+4+4,'int');  //2 integers (32 bits) + the double matrix + code + matrix type
+
+		//write data code and matrix type: 
+		fid.fwrite(FormatToCode(format),'int'); 
+		fid.fwrite(mattype,'int');
+
+		//now write matrix
+		fid.fwrite(s[0],'int'); 
+		fid.fwrite(s[1],'int'); 
+		if (s[0]*s[1]) fid.fwrite(MatrixToList(data),'double'); //get to the "c" convention, hence the transpose
+	} // }}}
+	else if (format == 'IntMat'){ // {{{
+
+		//Get size
+		var s=[data.length,1];
+		if(IsArray(data[0]))s[1]=data[0].length;
+
+		//if matrix = NaN, then do not write anything
+		if (s[0]==1 & s[1]==1 & isNan(data)){
+			s[0]=0; s[1]=0;
+		}
+		if (s[0]==1 & s[1]==1 & isNan(data[0])){
+			s[0]=0; s[1]=0;
+		}
+
+		//first write length of record
+		fid.fwrite(4+4+8*s[0]*s[1]+4+4,'int');  //2 integers (32 bits) + the double matrix + code + matrix type
+
+		//write data code and matrix type: 
+		fid.fwrite(FormatToCode(format),'int'); 
+		fid.fwrite(mattype,'int');
+
+		//now write matrix
+		fid.fwrite(s[0],'int'); 
+		fid.fwrite(s[1],'int'); 
+		if (s[0]*s[1]) fid.fwrite(MatrixToList(data),'double'); //get to the "c" convention, hence the transpose
+
+	} // }}}
+	else if (format == 'DoubleMat'){ // {{{
+
+		//Get size
+		var s=[data.length,1];
+		if(IsArray(data[0]))s[1]=data[0].length;
+
+		//if matrix = NaN, then do not write anything
+		if (s[0]==1 & s[1]==1 & isNan(data)){
+			s[0]=0; s[1]=0;
+		}
+		if (s[0]==1 & s[1]==1 & isNan(data[0])){
+			s[0]=0; s[1]=0;
+		}
+
+		//first write length of record
+		var recordlength=4+4+8*s[0]*s[1]+4+4; //2 integers (32 bits) + the double matrix + code + matrix type
+		if (recordlength>Math.pow(2,31)) throw Error(sprintf("field '%s' cannot be marshalled because it is larger than 2^31 bytes!",EnumToString(enumm)));
+		fid.fwrite(recordlength,'int');
+
+		//write data code and matrix type: 
+		fid.fwrite(FormatToCode(format),'int'); 
+		fid.fwrite(mattype,'int');
+
+		//now write matrix
+		fid.fwrite(s[0],'int'); 
+		fid.fwrite(s[1],'int'); 
+		if (s[0]*s[1]) fid.fwrite(MatrixToList(data),'double'); //get to the "c" convention, hence the transpose
+	} // }}}
+	else if (format == 'MatArray'){ // {{{
+
+		numrecords=data.length;
+
+		//first get length of record
+		recordlength=4+4; //number of records + code
+		for (var i=0;i<numrecords;i++){
+			matrix=data[i];
+			var s=[matrix.length,1];
+			if(IsArray(matrix[0]))s[1]=matrix[0].length;
+
+			recordlength=recordlength+4*2+ //row and col of matrix
+				s[0]*s[1]*8; //matrix of doubles
+		}
+
+		//write length of record
+		fid.fwrite(recordlength,'int'); 
+
+		//write data code: 
+		fid.fwrite(FormatToCode(format),'int'); 
+
+		//write data, first number of records
+		fid.fwrite(numrecords,'int'); 
+
+		//write each matrix: 
+		for (var i=0;i<numrecords;i++){
+			matrix=data[i];
+			var s=[matrix.length,1];
+			if(IsArray(matrix[0]))s[1]=matrix[0].length;
+
+			fid.fwrite(s[0],'int'); 
+			fid.fwrite(s[1],'int'); 
+			fid.fwrite(MatrixToList(matrix),'double');
+		}
+	} // }}}
+	else if (format == 'StringArray'){ // {{{
+
+		//first get length of string array: 
+		num=data.length;
+		if ((typeof data[0] == 'numeric') & num==1 & isNaN(data[0])){
+			num = 0;
+		}
+
+		//now get length of record: 
+		recordlength=4+4; //for length of array + code
+		for (var i=0;i<num;i++){
+			string=data[i];
+			recordlength=recordlength+4+string.length; //for each string
+		}
+
+		//write length of record
+		fid.fwrite(recordlength,'int'); 
+
+		//write data code: 
+		fid.fwrite(FormatToCode(format),'int'); 
+
+		//now write length of string array
+		fid.fwrite(num,'int'); 
+
+		//now write the strings
+		for (var i=0;i<num;i++){
+			string=data[i];
+			fid.fwrite(string.length,'int'); 
+			fid.fwrite(string,'char'); 
+		}
+	} // }}}
+	else { 
+		throw Error(sprintf("WriteData error message: data type: %s not supported yet! ('%s')",
+					format.toString(),EnumToString(enumm)));
+	}
+}
+
+function BuildEnum(string){ // {{{
+	//BUILDENUM - build enum out of string
+	//
+	//   Usage:
+	//      enumm=BuildEnum(string)
+
+	while( string.indexOf('_') !=-1){
+		index=string.indexOf('_');
+		string=string.slice(0,index)+string[index+1].toUpperCase() + string.slice(index+2);
+	}
+
+	//take first letter of string and make it uppercase: 
+	string = string.charAt(0).toUpperCase() + this.slice(1);
+
+	//Get Enum
+	enumm=StringToEnum(string); 
+
+	return enumm;
+} // }}}
+function FormatToCode(format){ // {{{
+	//This routine takes the format string, and hardcodes it into an integer, which 
+	//is passed along the record, in order to identify the nature of the dataset being 
+	//sent.
+	if  (format == 'Boolean') code=1;
+	else if (format == 'Integer') code=2;
+	else if (format == 'Double') code=3;
+	else if (format == 'String') code=4;
+	else if (format == 'BooleanMat') code=5;
+	else if (format == 'IntMat') code=6;
+	else if (format == 'DoubleMat') code=7;
+	else if (format == 'MatArray') code=8;
+	else if (format == 'StringArray') code=9;
+	else throw Error('FormatToCode error message: data type not supported yet!');
+	return code;
+}// }}}
Index: /issm/trunk-jpl/src/m/solve/marshall.js
===================================================================
--- /issm/trunk-jpl/src/m/solve/marshall.js	(revision 19787)
+++ /issm/trunk-jpl/src/m/solve/marshall.js	(revision 19787)
@@ -0,0 +1,40 @@
+function marshall(md){
+//MARSHALL - outputs a typed array buffer to be send to the issm module.
+//
+//   The routine creates a compatible binary stream from @model md
+//   This binary stream will be used for single cpu runs using the issm module.
+//
+//   Usage:
+//      fid=marshall(md)
+
+	if (md.verbose.solution){
+		console.log('marshalling file ' + md.miscellaneous.name + '.bin');
+	}
+
+	//open file for binary writing
+	fid=new fileptr();
+
+	//First, write MaximumNumberOfEnum to make sure that the Enums are synchronized
+	WriteData(fid,'enum',MaximumNumberOfDefinitionsEnum(),'data',true,'format','Boolean');
+
+	//Go through all model fields: check that it is a class and call checkconsistency
+	for (field in md){
+
+		//Some properties do not need to be marshalled
+		if (field == 'results' | field =='radaroverlay' | field == 'toolkits' | field =='cluster' | field == 'flaim' | field == 'private') continue;
+		
+		//Check that current field is a class
+		if(typeof md[field] == 'function'){
+			continue;
+		}
+		console.log(field);
+
+		//Marshall current object
+		md[field].marshall(md,fid);
+	}
+
+	//Last, write MaximumNumberOfEnum+1 to make sure that the binary file is not corrupt
+	WriteData(fid,'enum',MaximumNumberOfDefinitionsEnum()+1,'data',true,'format','Boolean');
+
+	return fid;
+}
Index: /issm/trunk-jpl/src/wrappers/javascript/Makefile.am
===================================================================
--- /issm/trunk-jpl/src/wrappers/javascript/Makefile.am	(revision 19786)
+++ /issm/trunk-jpl/src/wrappers/javascript/Makefile.am	(revision 19787)
@@ -83,7 +83,8 @@
 					 ../IssmConfig/IssmConfig.cpp\
 					 ../EnumToString/EnumToString.cpp\
-					 ../StringToEnum/StringToEnum.cpp
+					 ../StringToEnum/StringToEnum.cpp\
+					 ../../c/main/issm.cpp
 
-IssmModule_CXXFLAGS= -fPIC -D_DO_NOT_LOAD_GLOBALS_ --memory-init-file 0 $(AM_CXXFLAGS) $(CXXFLAGS) $(CXXOPTFLAGS) $(COPTFLAGS) -s EXPORTED_FUNCTIONS="['_TriMeshModule','_NodeConnectivityModule','_ElementConnectivityModule','_InterpFromMeshToMesh2dModule','_IssmConfigModule','_EnumToStringModule','_StringToEnumModule']"  -s DISABLE_EXCEPTION_CATCHING=0 -s ALLOW_MEMORY_GROWTH=1
+IssmModule_CXXFLAGS= -fPIC -D_DO_NOT_LOAD_GLOBALS_ --memory-init-file 0 $(AM_CXXFLAGS) $(CXXFLAGS) $(CXXOPTFLAGS) $(COPTFLAGS) -s EXPORTED_FUNCTIONS="['_TriMeshModule','_NodeConnectivityModule','_ElementConnectivityModule','_InterpFromMeshToMesh2dModule','_IssmConfigModule','_EnumToStringModule','_StringToEnumModule','_main']"  -s DISABLE_EXCEPTION_CATCHING=0 -s ALLOW_MEMORY_GROWTH=1
 IssmModule_LDADD = ${deps} $(TRIANGLELIB) 
 #}}}
Index: /issm/trunk-jpl/test/NightlyRun/test101.html
===================================================================
--- /issm/trunk-jpl/test/NightlyRun/test101.html	(revision 19786)
+++ /issm/trunk-jpl/test/NightlyRun/test101.html	(revision 19787)
@@ -69,5 +69,8 @@
 <script type="text/javascript" src="../../src/m/enum/EnumDefinitions.js"></script>
 <script type="text/javascript" src="../../src/m/solvers/issmgslsolver.js"></script>
+<script type="text/javascript" src="../../src/m/io/fileptr.js"></script>
 <script type="text/javascript" src="../../src/m/solve/solve.js"></script>
+<script type="text/javascript" src="../../src/m/solve/marshall.js"></script>
+<script type="text/javascript" src="../../src/m/solve/WriteData.js"></script>
 <script type="text/javascript" src="../../src/wrappers/TriMesh/TriMesh.js"></script>
 <script type="text/javascript" src="../../src/wrappers/EnumToString/EnumToString.js"></script>
@@ -78,4 +81,5 @@
 <script type="text/javascript" src="../../src/wrappers/InterpFromMeshToMesh2d/InterpFromMeshToMesh2d.js"></script>
 <script type="text/javascript" src="../../build-js/src/wrappers/javascript/IssmModule.js"></script>
+<script type="text/javascript" src="../../src/c/main/issm.js"></script>
 <script type="text/javascript" src="../../externalpackages/javascript/src/sprintf.js"></script>
 <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
@@ -91,10 +95,10 @@
 	setmask(md,'all','');
 	parameterize(md);
-	
-	//setflowequation(md,'SSA','all');
-	//md=solve(md,StressbalanceSolutionEnum());
+	setflowequation(md,'SSA','all');
+	md=solve(md,StressbalanceSolutionEnum());
 
-	plotmodel(md,'data',md.initialization.vel,'colorbar','on', 'data',md.initialization.vx,
-	'data',md.initialization.temperature, 'data',md.basalforcings.floatingice_melting_rate,'data','mesh');
+	/*plotmodel(md,'data',md.initialization.vel,'colorbar','on','data',md.initialization.vx,
+	  'data',md.initialization.temperature, 'data',md.basalforcings.floatingice_melting_rate,'data','mesh');
+	//var output=issm([5,1,1]);*/
 
 
